Hi,
I'm having some problems creating empty tracks from ENSEMBL data. If the region of interest is empty on the ENSEMBL database then an empty track can be created. The problem I'm having is when features are present in the region but I want to select and display a feature which isn't (so produce an empty track). This returns the error:
Error in .fillWithDefaults(range, defaults[missing], args[missing], len = nrow(range)) : The mandatory argument 'NA' is missing with no default
I have included some examples below which hopefully help show the problem I'm having. The blank table produced when a selection of a non existent element is made looks identical to the table produced when no data is returned from ENSEMBL.
Is there a way to create an empty track in this case?
No data from ENSEMBL
There is no issue to visualise, even if a selection is made from list of particular features an empty plot can still be created.
Code:
gen <- 'hg38' chr <- 1 start <- 1 end <- 1000
featureDisplay <- “Promoter” biomTrack <- NULL martfunc <- NULL biomTrackDislay <- NULL genTrunk <- gsub("\\..*","",gen) martfunc <- useMart("regulation", dataset = "hsapiens_regulatory_feature") biomTrack <- getBM(c("chromosome_name", "chromosome_start","chromosome_end", "feature_type_name"),filters = c("chromosome_name","start","end"), values = list(chrEnsembl, start, end), mart = martfunc) biomTrackDislay <- biomTrack if( !("all" %in% featureDisplay) ) { biomTrackDislay <- biomTrack[which(biomTrack$feature_type_name %in% featureDisplay),] } data_trackfunc <- AnnotationTrack(genome = genTrunk,chromosome=chrEnsembl, strand ="*",start=biomTrackDislay[,2],end=biomTrackDislay[,3], feature=biomTrackDislay[,4],group=biomTrackDislay[,1], id=biomTrackDislay[,1], name = " Regulatory Features ENSEMBL",stacking="dense", col.line = "black", col = NULL, collapse= FALSE) print(biomTrackDislay) data_trackfunc
Result:
[1] chromosome_name chromosome_start chromosome_end feature_type_name
<0 rows> (or 0-length row.names)
AnnotationTrack ' Regulatory Features ENSEMBL' | genome: hg38 | active chromosome: 1 | annotation features: 0
Data from ENSEMBL without selection
Range increased so features are present with in the region but no selection of features is made, this also creates a plot without any problems.
Code:
gen <- 'hg38' chr <- 1 start <- 1 end <- 10000
featureDisplay <- “all” biomTrack <- NULL martfunc <- NULL biomTrackDislay <- NULL genTrunk <- gsub("\\..*","",gen) martfunc <- useMart("regulation", dataset = "hsapiens_regulatory_feature") biomTrack <- getBM(c("chromosome_name", "chromosome_start","chromosome_end", "feature_type_name"),filters = c("chromosome_name","start","end"), values = list(chrEnsembl, start, end), mart = martfunc) biomTrackDislay <- biomTrack if( !("all" %in% featureDisplay) ) { biomTrackDislay <- biomTrack[which(biomTrack$feature_type_name %in% featureDisplay),] } data_trackfunc <- AnnotationTrack(genome = genTrunk,chromosome=chrEnsembl, strand ="*",start=biomTrackDislay[,2],end=biomTrackDislay[,3], feature=biomTrackDislay[,4],group=biomTrackDislay[,1], id=biomTrackDislay[,1], name = " Regulatory Features ENSEMBL",stacking="dense", col.line = "black", col = NULL, collapse= FALSE) print(biomTrackDislay) data_trackfunc
Result:
chromosome_name chromosome_start chromosome_end feature_type_name
1 1 9882 10951 TF binding site
AnnotationTrack ' Regulatory Features ENSEMBL' | genome: hg38 | active chromosome: 1 | annotation features: 1
Data from ENSEMBL with selection
This is where the issue occurs, the same rage is used as in the previous example. if a selection is made for 'Promoter' (or any non existent element) when other other features (but not Promoter) have been returned this error occurs:
Code:
gen <- 'hg38' chr <- 1 start <- 1 end <- 10000
featureDisplay <- “Promoter” biomTrack <- NULL martfunc <- NULL biomTrackDislay <- NULL genTrunk <- gsub("\\..*","",gen) martfunc <- useMart("regulation", dataset = "hsapiens_regulatory_feature") biomTrack <- getBM(c("chromosome_name", "chromosome_start","chromosome_end", "feature_type_name"),filters = c("chromosome_name","start","end"), values = list(chrEnsembl, start, end), mart = martfunc) biomTrackDislay <- biomTrack if( !("all" %in% featureDisplay) ) { biomTrackDislay <- biomTrack[which(biomTrack$feature_type_name %in% featureDisplay),] } data_trackfunc <- AnnotationTrack(genome = genTrunk,chromosome=chrEnsembl, strand ="*",start=biomTrackDislay[,2],end=biomTrackDislay[,3], feature=biomTrackDislay[,4],group=biomTrackDislay[,1], id=biomTrackDislay[,1], name = " Regulatory Features ENSEMBL",stacking="dense", col.line = "black", col = NULL, collapse= FALSE) print(biomTrackDislay) data_trackfunc
Result:
Error in .fillWithDefaults(range, defaults[missing], args[missing], len = nrow(range)) : The mandatory argument 'NA' is missing with no default
Session info
R version 3.2.1 (2015-06-18) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 7 x64 (build 7601) Service Pack 1 locale: [1] LC_COLLATE=English_United Kingdom.1252 LC_CTYPE=English_United Kingdom.1252 [3] LC_MONETARY=English_United Kingdom.1252 LC_NUMERIC=C [5] LC_TIME=English_United Kingdom.1252 attached base packages: [1] grid parallel stats4 stats graphics grDevices utils datasets methods base other attached packages: [1] rtracklayer_1.28.9 XVector_0.8.0 coMET_1.0.1 psych_1.5.6 biomaRt_2.24.0 [6] Gviz_1.12.1 GenomicRanges_1.20.5 GenomeInfoDb_1.4.2 IRanges_2.2.7 BiocInstaller_1.18.4 [11] S4Vectors_0.6.3 BiocGenerics_0.14.0 loaded via a namespace (and not attached): [1] Rcpp_0.12.0 biovizBase_1.16.0 lattice_0.20-33 Rsamtools_1.20.4 [5] Biostrings_2.36.3 digest_0.6.8 plyr_1.8.3 futile.options_1.0.0 [9] acepack_1.3-3.3 RSQLite_1.0.0 ggplot2_1.0.1 zlibbioc_1.14.0 [13] GenomicFeatures_1.20.3 rpart_4.1-10 hash_2.2.6 ggbio_1.16.1 [17] proto_0.3-10 splines_3.2.1 BiocParallel_1.2.20 stringr_1.0.0 [21] foreign_0.8-66 RCurl_1.95-4.7 munsell_0.4.2 mnormt_1.5-3 [25] tcltk_3.2.1 nnet_7.3-10 gridExtra_2.0.0 colortools_0.1.5 [29] Hmisc_3.16-0 matrixStats_0.14.2 gWidgets_0.0-54 XML_3.98-1.3 [33] reshape_0.8.5 GenomicAlignments_1.4.1 MASS_7.3-43 bitops_1.0-6 [37] RBGL_1.44.0 GGally_0.5.0 gtable_0.1.2 DBI_0.3.1 [41] magrittr_1.5 gWidgetstcltk_0.0-55 scales_0.2.5 graph_1.46.0 [45] stringi_0.5-5 pbapply_1.1-1 trackViewer_1.4.0 reshape2_1.4.1 [49] latticeExtra_0.6-26 futile.logger_1.4.1 Formula_1.2-1 lambda.r_1.1.7 [53] RColorBrewer_1.1-2 tools_3.2.1 dichromat_2.0-0 OrganismDbi_1.10.0 [57] BSgenome_1.36.3 Biobase_2.28.0 survival_2.38-3 AnnotationDbi_1.30.1 [61] colorspace_1.2-6 cluster_2.0.3 VariantAnnotation_1.14.11
Thank you very much for your help,
Tom