I’ve been struggling with how to use functions within the GenomicFeatures package from Bioconductor to map from cDNA sequence (and subsequences of the cDNA) to genomic space.
Specifically, I’m generating short oligonucleotide sequences (e.g., 20-mers) against an mRNA/cDNA sequence (e.g., the mRNA might have length of 3339 bases with coordinates 1..3339, and an example oligo would have coordinates 105..124).
I'm constructing a GRanges object from the cDNA coordinates:
oligo.rng <- GRanges(ucsc_id, IRanges(105, width = 20))
Where 'ucsc_id' is a string of the UCSC transcript ID (e.g., uc022bfa.2) from which the cDNA sequence was retrieved and the oligo designed against.
GRanges object with 1 range and 0 metadata columns:
seqnames ranges strand
<Rle> <IRanges> <Rle>
uc022bfa.2 C9orf72 [105, 124] *
Subsequently, I'm constructing a GRanges object for the genomic region of interest, called 'genes':
GRanges object with 1 range and 1 metadata column:
seqnames ranges strand | gene_id
<Rle> <IRanges> <Rle> | <character>
uc022bfa.2 chr9 [27546545, 27573866] - | 203228
Then using GenomicFeatures::mapFromTranscripts to find the genomic coordinates for the oligo:
gr.oligos <- mapFromTranscripts(oligo.rng, genes)
This is not changing the oligo GRange to the genomic range; just giving me 105..124 as the genomic range, which is the starting cDNA range and clearly incorrect.
I'm sure I'm making some bush-league errors here in my thinking; any help would be greatly appreciated.
Working through this a little more; I'm beginning to see that an important first step for me in mapping my oligos is to map the coordinates of the oligos to exon space, first by grabbing the exon coords of the transcript using GenomicFeatures::exonsBy