This is a test version of Biostars. For the public version, visit https://www.biostars.org.
changing of chromosome notation in CHROM columns of vcf file

hi I have a vcf file in which "CHROM column " has chromosomes number as "chr01|ref000123, chr02|ref000456......chr22|ref000965, scaffold_23|ref00657 like this way and i want this like chr01,ch02,,,,,,,chr22,scaffold_23..as so anyone has idea how can i change this. please reply me if anyone know this. Thank you,

next-gen snp

try this:

$ awk '!/#/ {gsub("\\|.*","",$1)}1' test.vcf

or

$ sed  -e '/#/! s/|.*\t/\t/' test.vcf

btw, it always helps to post some example data to work on.

hi, cpad0112, Thank you very much for your reply and script. it works for my data :) I appreciate you very much. Thank you once again.

warning: this script doesn't change the ##contig= lines in the header.

Thank you Pierre for this info and do you know how can i make change for ##contig= lines in the header also?

NP. Next time, please post some example data to work on, when you have a question on data.

Thank you cpad0112 for your script and from next time i will sure post my example data.

Hello aarvaBioinfo!

Questions similar to yours can already be found at:

We have closed your question to allow us to keep similar content in the same thread.

If you disagree with this please tell us why in a reply below. We'll be happy to talk about it.

Cheers!

0 answers

No answers yet.

Log in to answer this question.