[BioC] Error in GenomicRanges trying to append two GRangesLists

Martin Morgan mtmorgan at fhcrc.org
Sat Sep 11 20:08:07 CEST 2010


Hi Elizabeth --

This does seem to be a bug in IRanges; a reproducible example is just

  example(GRangesList)
  c(grl, grl)

A work around is to remove and reapply the 'names', e.g.,

cc <- function(...)
{
    args <- list(...)
    names <- unlist(lapply(args, names))
    result <- do.call(c, args)
    names(result) <- names
    result
}

This appears not to be a problem in the development version, e.g.,

> sessionInfo()
R version 2.12.0 Under development (unstable) (2010-09-05 r52874)
Platform: x86_64-unknown-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C             
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8   
 [5] LC_MONETARY=C              LC_MESSAGES=en_US.UTF-8  
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                
 [9] LC_ADDRESS=C               LC_TELEPHONE=C           
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C      

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base    

other attached packages:
[1] GenomicRanges_1.1.25 IRanges_1.7.32     

loaded via a namespace (and not attached):
[1] tools_2.12.0

Martin

On 09/10/2010 12:43 PM, Elizabeth Purdom wrote:
>  Hello,
> I am trying to append together two GRangesLists. I thought that either
> c() or append would allow me to do this, but I'm getting an error. My
> two GRangesLists have the same metadata column names. With both, I'm
> getting some kind of error about rownames that I don't understand and
> I just don't have any ideas about trying to track this down. My system
> information is below (R 2.11.1, GenomicRanges_1.0.9).
> Thanks for any help,
> Elizabeth
>
> #my two GRangesList
> > disjointElementsCds
> GRangesList of length 44
> $100132288
> GRanges with 6 ranges and 1 elementMetadata value
>         seqnames           ranges strand | disjEx_id
> <Rle> <IRanges> <Rle> | <integer>
> [1] chr21_random [103280, 104416]      * |         1
> [2] chr21_random [104417, 104518]      * |         2
> [3] chr21_random [105133, 105363]      * |         3
> [4] chr21_random [162407, 162463]      * |         4
> [5] chr21_random [162464, 162465]      * |         5
> [6] chr21_random [164601, 164670]      * |         6
>
> ...
> <43 more elements>
>
>
> seqlengths
>           chr1   chr1_random         chr10  chr10_random         chr11
> ...   chr9_random          chrM          chrX   chrX_random          chrY
>      247249719       1663265     135374737        113275     134452384
> ...       1146434         16571     154913754       1719168      57772954
>
> > disjointElementsNonCds
> GRangesList of length 7
> $152687
> GRanges with 6 ranges and 1 elementMetadata value
>     seqnames           ranges strand | disjEx_id
> <Rle> <IRanges> <Rle> | <integer>
> [1]     chr4 [ 43227,  43385]      * |         1
> [2]     chr4 [ 49323,  49449]      * |         2
> [3]     chr4 [ 49951,  50046]      * |         3
> [4]     chr4 [ 57732,  58380]      * |         4
> [5]     chr4 [184870, 185000]      * |         5
> [6]     chr4 [185421, 186092]      * |         6
>
> $26751
> GRanges with 8 ranges and 1 elementMetadata value
>     seqnames           ranges strand | disjEx_id
> <Rle> <IRanges> <Rle> | <integer>
> [1]     chr2 [208155, 209001]      * |         1
> [2]     chr2 [214864, 214920]      * |         2
> [3]     chr2 [219966, 220044]      * |         3
> [4]     chr2 [221023, 221191]      * |         4
> [5]     chr2 [223101, 223229]      * |         5
> [6]     chr2 [224160, 224272]      * |         6
> [7]     chr2 [237538, 237602]      * |         7
> [8]     chr2 [239731, 239852]      * |         8
>
> $403340
> GRanges with 1 range and 1 elementMetadata value
>         seqnames           ranges strand | disjEx_id
> <Rle> <IRanges> <Rle> | <integer>
> [1] chr17_random [116623, 119732]      * |         1
>
> ...
> <4 more elements>
>
>
> seqlengths
>           chr1   chr1_random         chr10  chr10_random         chr11
> ...   chr9_random          chrM          chrX   chrX_random          chrY
>      247249719       1663265     135374737        113275     134452384
> ...       1146434         16571     154913754       1719168      57772954
>
> #my attempt to join them together
> >
> disjointElements<-append(disjointElementsCds,values=disjointElementsNonCds)
>
> Error in `rownames<-`(`*tmp*`, value = c("100132288", "10752",
> "10771",  :
>   invalid rownames length
> > disjointElements<-c(disjointElementsCds,values=disjointElementsNonCds)
> Error in `rownames<-`(`*tmp*`, value = c("100132288", "10752",
> "10771",  :
>   invalid rownames length
> > traceback()
> 9: stop("invalid rownames length")
> 8: `rownames<-`(`*tmp*`, value = c("100132288", "10752", "10771",
>    "114821", "123887", "133957", "140850", "153478", "23192", "245938",
>    "255403", "283768", "283897", "3081", "3166", "335", "347688",
>    "3662", "375690", "375791", "3803", "3810", "389257", "404785",
>    "440073", "440153", "441308", "51078", "55344", "56900", "56940",
>    "5987", "642273", "643836", "6942", "7179", "727800", "81623",
>    "83482", "83755", "8694", "9097", "92259", "9501", "152687",
>    "26751", "403340", "644128", "645520", "64946", "653635"))
> 7: `rownames<-`(`*tmp*`, value = c("100132288", "10752", "10771",
>    "114821", "123887", "133957", "140850", "153478", "23192", "245938",
>    "255403", "283768", "283897", "3081", "3166", "335", "347688",
>    "3662", "375690", "375791", "3803", "3810", "389257", "404785",
>    "440073", "440153", "441308", "51078", "55344", "56900", "56940",
>    "5987", "642273", "643836", "6942", "7179", "727800", "81623",
>    "83482", "83755", "8694", "9097", "92259", "9501", "152687",
>    "26751", "403340", "644128", "645520", "64946", "653635"))
> 6: .local(x, ...)
> 5: elementMetadata(x)
> 4: elementMetadata(x)
> 3: .c.Sequence(x, ...)
> 2: c(disjointElementsCds, values = disjointElementsNonCds)
> 1: c(disjointElementsCds, values = disjointElementsNonCds)
>
> > sessionInfo()
> R version 2.11.1 (2010-05-31)
> x86_64-apple-darwin9.8.0
>
> locale:
> [1] en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
>
> other attached packages:
> [1] graph_1.26.0           projectManager_1.0    
> XML_3.1-1              GenomicFeatures_1.0.10 GenomicRanges_1.0.9   
> IRanges_1.6.16
>
> loaded via a namespace (and not attached):
> [1] Biobase_2.8.0     biomaRt_2.4.0     Biostrings_2.16.9
> BSgenome_1.16.5   DBI_0.2-5         RCurl_1.4-2      
> RSQLite_0.9-2     rtracklayer_1.8.1
> [9] tools_2.11.1
>
> _______________________________________________
> Bioconductor mailing list
> Bioconductor at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/bioconductor
> Search the archives:
> http://news.gmane.org/gmane.science.biology.informatics.conductor



More information about the Bioconductor mailing list