Entering edit mode
9 months ago
salman_96 ▴ 70
I have multiple bam files that I used to generate vcf file for variant calling. I used the command below
bcftools mpileup -O v -f $REF bam/*.bam > genotypes.vcf
Instead of getting one file each sample, I am getting one big file that contains information on all samples.
Is there any way to either split them into samples or re-run the command to get one file per sample?
use a loop or better, a workflow manager.
'bcftools call' should also be invoked after mpileup.
Yes, I did write only the first command that generates genotype vcf files. Unfortunately, there are multiple files and I cannot find any way to loop through
what have you tried ?
I tried a one liner to avoid large genotype file. I get no results'
and there is no error message ? the vcf are all empty ? no header ?
Yes no error message. Just the command returns ">"
No vcf files generated
because a for loop should end with
Yes, The following command did work when used done but it is generating same named file for every sample. So at the end the process resulted in only one file which was the last one in the samples because of loop.
The bam files are named somehow like this
CL03_T1STARpairedAligned.sortedByCoord.out.bam CL05_T1STARpairedAligned.sortedByCoord.out.bam CL05_T1_2DSTARpairedAligned.sortedByCoord.out.bam CL09T1_2DSTARpairedAligned.sortedByCoord.out.bam
This is my script
The error I run into is Failed to open file "CL48T3STARpairedAligned.sortedByCoord.out" : No such file or directory No I know that the file name should end with .bam but here I get CL48T3STARpairedAligned.sortedByCoord.out instead of CL48T3STARpairedAligned.sortedByCoord.out.bam.
I would appreciate if you would add any suggestion. I do believe there is some problem with the base name.