I want to pass samples from several different species through this command:
bcftools mpileup -Ob -o <study.bcf> -f <ref.fa> <sample1.bam> <sample2.bam> <sample3.bam>
How can I do that with a loop, considering that each species may have 3-5 different individuals? The files look like this, with the species first and individual second:
107_2.bam 107_7.bam 1322_7.bam 1589_3.bam 1777_8.bam 1782_3.bam 2172_5.bam 716_11.bam 716_7.bam M82_3.bam
107_4.bam 1322_10.bam 1322_9.bam 1589_5.bam 1777_9.bam 1782_5.bam 2172_7.bam 716_5.bam 716_9.bam M82_4.bam
107_6.bam 1322_1.bam 1589_2.bam 1777_4.bam 1782_2.bam 2172_3.bam 2172_9.bam 716_6.bam M82_11.bam M82_8.bam
Thank you for your time.
At a guess since I've no idea what a
bamfile is, nor aspeciesas it relates to your files, norbcftools, this might be what you're trying to do:The above assumes your file names don't contain newlines and that a "species" can't contain underscores, as in your provided example.