Hi,
I have a two dataframes,one containing the genomic co-ordinates of enhancers (column names :#chr,start,end ) and the other containing the SNV position (column names : chr,position).My objective is to obtain those enhancers that are mutated,resultant dataframe should have the following columns : #chr,start,end,no of mutations.How do I achieve this using gRanges?Also please suggest other R packages if any,with which I can achieve this.
I did in the following way:
grEnhancer<-GRanges(seqnames=enhancer_data$chr,
ranges=IRanges(enhancer_data$start,end=enhancer_data$end))
grSNV<-GRanges(seqnames = snvData$X.CHROM,
ranges = IRanges(snvData$POS,end=snvData$POS))
grSNVhits=intersect(grEnhancer,grSNV)
However this gives me the list of mutations that occur in the provided enhancers.
Please help.
Regards,
Addy
Thanks a lot. countOverlaps did the job :)