[BioC] Elementwise appending of List elements?

Hervé Pagès hpages at fhcrc.org
Wed Jun 18 20:51:57 CEST 2014


Hi Ryan,

On 06/18/2014 11:33 AM, Ryan C. Thompson wrote:
> Hi all,
>
> I have 2 CharacterList objects (let's call them A and B) of equal
> length, and I want to append the each element of List A to the
> corresponding one in List B and get the resulting CharacterList. I can
> do this with mendoapply(c, A, B), but this is quite slow. Is there a
> function to do this quickly?

Code adapted from "junctions" method for GAlignmentPairs objects:

   library(GenomicAlignments)

   pcombine <- function(x, y)
   {
     stopifnot(length(x) == length(y))
     xy <- c(x, y)
     collate_subscript <-
       S4Vectors:::make_XYZxyz_to_XxYyZz_subscript(length(x))
     tmp <- xy[collate_subscript]
     GenomicAlignments:::shrinkByHalf(tmp)
   }

I'll add something like this to S4Vectors.

Cheers,
H.

>
> -Ryan
>
> _______________________________________________
> 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

-- 
Hervé Pagès

Program in Computational Biology
Division of Public Health Sciences
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N, M1-B514
P.O. Box 19024
Seattle, WA 98109-1024

E-mail: hpages at fhcrc.org
Phone:  (206) 667-5791
Fax:    (206) 667-1319



More information about the Bioconductor mailing list