Finding distance between end of all ORFs in utr and start of first cds exon in transcript coordinates
1
0
Entering edit mode
@hauken_heyken-13992
Last seen 20 months ago
Bergen

This is a speedup question like my last, my data is too big to do what I would normally do, I'm doing several TB of data.

So my question is how to match two GRangeslist by name and calculate distance between each match( that is, they are from the same transcript)

, where the first list contains several ORFs per transcript while cds only have unique rows, namely the first exon.

I have already made these lists, so a solution would be:

#uorfs: list of ORFs in utr

#cdsFirstExon: list of all first exons that have uorfs, so it only contains transcripts that have uorfs.

merged = merge( uorfs, cdsFirstExon, by.x = names(uorfs), by.y = names(cdsFirstExon)

distances = merged$uorf.end - merged$cdsFirstExon.start # distances now contains what I want

 

But the merging step is too slow with big data, is there a vectorized way ?

granges distance • 947 views
ADD COMMENT
1
Entering edit mode
@michael-lawrence-3846
Last seen 2.6 years ago
United States

Well merge() is vectorized but it's a more general case than you require, and so is slower than something simpler. I think you can sort the first exons, flatten them to a GRanges, flatten the ORFs and expand the first exons accordingly. It may be easier and faster in the long run to keep the data as GRanges.

cdsFirstExon_gr <- unlist(cdsFirstExon[names(uorfs)])
uorfs_gr <- unlist(uorfs)
cdsFirstExon_long <- rep(cdsFirstExon_gr, lengths(uorfs))
distance(uorfs_gr, cdsFirstExon_long)

 


 

ADD COMMENT

Login before adding your answer.

Traffic: 1097 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6