Entering edit mode
Hi,
I am trying to get the last 300 bases of each transcript in genomic ranges. However, when I resize with genomic ranges, it resizes each exon to 300 bases rather than resizing the sum of the exons to be 300 bases.
transcripts <- exonsBy(gencode, by = 'tx', use.names = T)
transcripts_neg <- transcripts[strand(transcripts) == '-']
transcripts_neg <- transcripts_neg[elementNROWS(transcripts_neg) > 0]
transcripts_pos <- transcripts[strand(transcripts) == '+']
transcripts_pos <- transcripts_pos[elementNROWS(transcripts_pos) > 0]
transcripts_neg
transcripts_neg_resized <- resize(transcripts_neg, 300, fix = 'start')
transcripts_pos
transcripts_pos_resized <- resize(transcripts_pos, 300, fix = 'end')
export(transcripts_neg_resized, '~/Desktop/transcripts_neg.bed')
Not sure the last step (
pintersect
) will work. Probably better to address the out-of-limit ranges upfront:H.
Agreed that is cleaner.
Could also use restrict for fixing the bounds: