Thanks very much, Goutham Atla! I have changed the "ID=" to "ID=chr" perfectly using awk that you posted.
However, SortVcf does not work in this case because the order of "chr" in header lines and data lines are BOTH inconsistent with the order of reference.dict. According to the dictionary it says that SortVcf sorts the records in VCF files according to the order of the contigs in the header/sequence dictionary and then by coordinate. in my case, the "chr" order in the header of VCF is not the same as reference. unless the "chr" order of header is the same as reference, it will sort the data lines in the way i need.
in the example of "SortVcf"
java -jar picard.jar SortVcf \
I=vcf_1.vcf \
I=vcf_2.vcf \
O=sorted.vcf
there is no reference file called "reference.dict". it does not work in my case.
I tried another script called vcfsorter.pl.
perl vcfsorter.pl genome.dict new.vcf > Newdbsnp.vcf 2> STDERR &
you can see "genome.dict" is used as a reference to sort the chr order of both header lines and data lines.
Unfortunately, my supercomputer shows
+ Killed perl vcfsorter.pl genome.dict new.vcf > Newdbsnp.vcf 2> STDERR
not sure why, but seems like this script has used a lot of computer resources even my account has 70GB of vmem quota that i can use to run program
any idead?
It would be safer to just use the reference genome which was used for the mapping of the reads.
If the vcf file is not so big I would do it manually with a text editor. If a text editor doesn't work I would try with "sed"
But you have to do it 23 times and maybe there are some problems with characters like "=" or "<"
Not only the header needs modification. Every variant would need modification.