Thanks a lot for your reply. How do I add"chr" to each chromosome number using awk? All my hg19 chromosome numbers are of the form "chr1" etc
Extract strand information from ENSEMBL
I have a set of variants in the following format
BRAF_7_140453150_A/T
BRAF_7_140453145_A/T
BRAF_7_140453145_A/C
BRAF_7_140453136_A/T
BRAF_7_140481417_C/A
I want to extract flanking bases for each of this mutation. How do I get the strand information form the above data? I need to create a bed file with the format Chromosome start end strand.
• 1,469 views
•
link
1 answer
Hello,
I see no reason, why you need the strand information. If I'm correct these list of variants contains all information to create a valid bed file. Assuming that the format is <gene>_<chromosome>_<pos>_<REF>/<ALT> one can use awk:
$ awk -v FS="_" -v OFS="\t" '{print $2, $3-1, $3, $0}' variants.txt > output.bed
If you want to expand the region for e.g. 50bp to the left and right, do this:
$ awk -v FS="_" -v OFS="\t" '{print $2, $3-51, $3+50, $0}' variants.txt > output.bed
fin swimmer
• 1 views
•
link
Log in to answer this question.