I have a dataframe that looks like this:
chr alleles position
2 [A/T] 123456
3 [C/T] 5678910
8 [A/G] 8765435334
I'd like to load each row into variables such as:
library('BSgenome.Hsapiens.UCSC.hg19')
chr <- 'chr2'
alleles <- '[T/C]'
position <- 123456
offset <- 60
and then use them iteratively in:
seq <- paste(getSeq(Hsapiens,chr,position-offset,position-1),
+ alleles,
+ getSeq(Hsapiens,chr,position+1,position+offset),
+ sep='')
and finally have the output as another dataframe containing:
chr allele position seq
2 [A/T] 123456 "ACTTGGAGATTTGGAGGAAGCTCCAGAGAGAGAGAGGCTTCCCAGCGTGGACTTGAAAGA[A/T]GAAACCAGCATAGATAGCACCGTGAATGGTGAGTTGGAATTCCTGGTTTCACTTTTGTTA"
I have read this thread, but appreciate a solution that doesnt require indices!