Entering edit mode
10.1 years ago
Lee Katz
★
3.2k
When I do bcftools merge
, the headers do not retain the filenames. How can I specify filenames?
This is my command
bcftools merge vcf/unfiltered/*.vcf.gz -O z > msa/pooled.vcf.gz
However this is the relevant part of my header, despite the filenames I gave it. Is it just up to me to parse the mergeCommand line? Or is there a way to use bcftools query
to get the right headers after the fact?
##bcftools_mergeVersion=0.2.0-rc7-47-g02a1fb3+htslib-0.2.0-rc7-36-g6e2ebc4
##bcftools_mergeCommand=merge -O z vcf/unfiltered/lambda_virus.fasta.wgsim.fastq.gz-lambda_virus.vcf.gz vcf/unfiltered/lambda_virus.fasta.wgsim.fastq.gz-reference.vcf.gz vcf/unfiltered/sample1.fastq.gz-lambda_virus.vcf.gz vcf/unfiltered/sample1.fastq.gz-reference.vcf.gz vcf/unfiltered/sample2.fastq.gz-lambda_virus.vcf.gz vcf/unfiltered/sample2.fastq.gz-reference.vcf.gz vcf/unfiltered/sample3.fastq.gz-lambda_virus.vcf.gz vcf/unfiltered/sample3.fastq.gz-reference.vcf.gz vcf/unfiltered/sample4.fastq.gz-lambda_virus.vcf.gz vcf/unfiltered/sample4.fastq.gz-reference.vcf.gz
#CHROM POS ID REF ALT QUAL FILTER INFO FORMAT Sample1 2:Sample1 3:Sample1 4:Sample1 5:Sample1 6:Sample1 7:Sample1 8:Sample1 9:Sample1 10:Sample1
How do you do that? Just change the header from
to
?
Or is there a Vcf.pm method? Or bcftools/vcftools method?
I can't figure out your sed magic but it essentially works, thanks! This is my full system call.
Read the sed command so:
From the file
in.vcf
In lines that begin with "#CHROM" (
/^#CHROM
)substitute "Sample1" with "lambda_virus.fasta" (
/s/Sample1/lambda_virus.fasta
)and write the output to "out.vcf" (
>out.vcf
)Put together,
my command:
I get :
You may need to use the
-E
option. Plus, if you have/
characters in your expressions, don't use/
as the sed-separator. Use something like|
instead: