Thank you for the help!! It worked :). I can understand the command easily.
• 0 views
•
link
I want to replace the CHROM column with chr followed by chromosome number 1 [chr1].
After using the command, the contents in the line of a VCF file should look like this
CHROM POS ID REF ALT QUAL FILTER INFO FORMAT 801
chr1 711 . T C 40 PASS DP=15 GT:GQ:DP 1|1:40:15
Has been asked before, e.g. VCF files: Change Chromosome Notation
Untested:
awk '$1 ~ /^#/ {OFS="\t"; print $0;next} {$1="chr"$1; print $0}' < in.vcf
Thank you for the help!! It worked :). I can understand the command easily.
Log in to answer this question.
You can do it in R like this If you remove the headers
In Rstudio:
There's probs a few different ways - sorry if this isn't helpful
Thanks for the suggestion! I want to use the linux command for multiple files.
Please do not paste screenshots of plain text content, it is counterproductive. You can copy paste the content directly here (using the code formatting option shown below), or use a GitHub Gist if the content volume exceeds allowed length here.