I downloaded the Rnor gff3 from http://mirrors.vbi.vt.edu/mirrors/ft...orvegicus/GFF/ . I can import into R and get it as a GRanges list with:
I read in a bam file with readBamGappedAlignments and I now want to use countOverlaps, or summarizeOverlaps from GenomicRanges to count the reads aligning to every exon. However, the Rat gff3 Granges list has nucleotide IDs (eg NC_005100.3) as the seqnames, instead of the Chr number. I therefore don't get any overlaps, even though there is a chromosome column in the metadata. How do I get this overlap to work?
If I could convert gff3 to a dataframe or a GRanges directly, I know how to do it from there. Thanks for your help.
Code:
gff <- import.gff("rat.gff3", asRangedData=FALSE) subgene_index <- which(elementMetadata(gff)[,"type"] == "exon") gffsub <- gff[subgene_index,] ids <- gsub("Parent=|\\..*", "", elementMetadata(gffsub)$gene) gffsub <- split(gffsub, ids)
If I could convert gff3 to a dataframe or a GRanges directly, I know how to do it from there. Thanks for your help.