[BioC] Help on sapply() with GRanges
James W. MacDonald
jmacdon at uw.edu
Tue Nov 26 19:22:58 CET 2013
Hi Prashanatha,
On Tuesday, November 26, 2013 1:00:13 PM, Prashantha Hebbar wrote:
> Hello friends,
>
> I am trying to get genome cordinate information for list of genes using sapply function. I find an error saying "
> Error in c(values, x) : all arguments in '...' must be CompressedList objects
>
> "
>
> Following is the code I am using.
>
> library(VariantAnnotation)
> library(TxDb.Hsapiens.UCSC.hg19.knownGene)
> txdb = TxDb.Hsapiens.UCSC.hg19.knownGene
> txg = transcriptsBy(txdb,by="gene")
z <- txg[genes]
zr <- reduce(z)
unlist(zr)
GRanges with 3 ranges and 0 metadata columns:
seqnames ranges strand
<Rle> <IRanges> <Rle>
47 chr17 [40023179, 40075272] -
4067 chr8 [56792386, 56925006] +
2017 chr11 [70244612, 70282690] +
---
seqlengths:
chr1 chr2 ... chrUn_gl000249
249250621 243199373 ... 38502
Is that what you are trying to do?
Best,
Jim
> allGeneRange <- GRanges()
> genes<-c("47","4067","2017")
> gRangeFun <- function(i){
> geneRange <- reduce(txg[i])
> allGeneRange<-append(allGeneRange, geneRange)
> return(allGeneRange)
> }
> x<-sapply(genes, gRangeFun )
> print(x)
>
> I wanted to have coordination of all genes in one GRange object to process it further. when I print x following error appears. Can somebody tell me what is going wrong with sapply() usage?
>
> Here is sessionInfo()
>
>> sessionInfo() R version 2.15.2 (2012-10-26)
> Platform: i686-pc-linux-gnu (32-bit) locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=C LC_COLLATE=C [5] LC_MONETARY=C LC_MESSAGES=C LC_PAPER=C LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=C LC_IDENTIFICATION=C attached base packages:
> [1] stats graphics grDevices utils datasets methods base other attached packages: [1] VariantAnnotation_1.4.12 Rsamtools_1.10.2 [3] Biostrings_2.26.3 TxDb.Hsapiens.UCSC.hg19.knownGene_2.8.0 [5] GenomicFeatures_1.10.2 AnnotationDbi_1.20.7 [7] Biobase_2.18.0 GenomicRanges_1.10.7 [9] IRanges_1.16.6 BiocGenerics_0.4.0 loaded via a namespace (and not attached): [1] BSgenome_1.26.1 DBI_0.2-7 RCurl_1.95-4.1 RSQLite_0.11.4 [5] XML_3.98-1.1 biomaRt_2.14.0 bitops_1.0-5 parallel_2.15.2 [9] rtracklayer_1.18.2 stats4_2.15.2 tools_2.15.2 zlibbioc_1.4.0
>
> Regards,
> Prashantha
> [[alternative HTML version deleted]]
>
>
>
> _______________________________________________
> Bioconductor mailing list
> Bioconductor at r-project.org
> https://stat.ethz.ch/mailman/listinfo/bioconductor
> Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor
--
James W. MacDonald, M.S.
Biostatistician
University of Washington
Environmental and Occupational Health Sciences
4225 Roosevelt Way NE, # 100
Seattle WA 98105-6099
More information about the Bioconductor
mailing list