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:
grSNV<-GRanges(seqnames = snvData$X.CHROM,
ranges = IRanges(snvData$POS,end=snvData$POS))
However this gives me the list of mutations that occur in the provided enhancers.