lapply(gr, FUN) should work, but it will be slow, because it constructs a
new GRanges each time. This could in theory be optimized at some low level,
but it's generally best to avoid this type of iteration. Maybe you could
share your specific problem and we could help with this.

Michael


On Thu, Jun 19, 2014 at 1:40 AM, Francesco Lescai <lescai@biomed.au.dk>
wrote:

> Hi guys,
> I’ve seen this issue addressed previously, but I couldn’t understand if
> it’s been implemented in some ways.
>
> I’d like to go through a GRanges object by row - or interval - (let’s say
> variants, or genes) and perform a function (ex. to annotate with additional
> metadata).
> I can do that with
>
> for (i in 1:length(variants)){
>   #do something with variants[i,] data
> }
>
> but it’s quite slow.
> as someone else asked in the past, something like
> apply(variants, 1, myFunction) or
> lapply(variants, myFunction)
> would be great.
> is there something like grapply? :)
>
> Any advice?
>
> thanks,
> Francesco
>
>
>         [[alternative HTML version deleted]]
>
>
> _______________________________________________
> Bioconductor mailing list
> Bioconductor@r-project.org
> https://stat.ethz.ch/mailman/listinfo/bioconductor
> Search the archives:
> http://news.gmane.org/gmane.science.biology.informatics.conductor
>

	[[alternative HTML version deleted]]

