Search
Question: VariantAnnotation mapToTranscripts: best implementation
0
gravatar for kristina_holton
8 months ago by
kristina_holton0 wrote:

Hi,

I'm looking for input on what the best way to implement the VariantAnnotation mapToTranscripts function would be, over a 48k rows data frame (data2). I just need a vector of the CDS position.  I have access to an HPC, R 3.3.1 or R 3.2.5 with high memory allocations. Here's the code I'm working with.  Thanks! -Kris

head(data2[,c(1,2)], n=10)
 V1        V2
 1: chr9  76068032
 2: chr9  76068032
 3: chr9  92500968
 4: chr9  92500968
 5: chr9 120833319
 6: chr9 120833319
 7: chr9  92514974
 8: chr9  92514974
 9: chr9 134727395
10: chr9 134727395
library(VariantAnnotation)
library(TxDb.Hsapiens.UCSC.hg38.knownGene)
txdb<-TxDb.Hsapiens.UCSC.hg38.knownGene
cds <- cdsBy(txdb, "tx", use.names=TRUE)
get.cds.start<-function(i) {
 chrom<-data2[i]$V1
 pos<-data2[i]$V2
 roi<-GRanges(chrom, IRanges(pos, width=1))
 mapped<-mapToTranscripts(roi, cds)
 cds.pos<-start(mapped)[1]
 if (is.null(cds.pos)){
 break
 }
 return(cds.pos)
 }
cds.start<-sapply(1:length(data2), get.cds.start)
ADD COMMENTlink written 8 months ago by kristina_holton0
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.2.0
Traffic: 308 users visited in the last hour