wrangling-genomics icon indicating copy to clipboard operation
wrangling-genomics copied to clipboard

I have a problem with executing variant call

Open otienolwanga opened this issue 5 years ago • 7 comments

bcftools mpileup -0 b -o $raw_bcf -f $genome $sorted_bam

code breaks each time I run the above command. It says Unrecognized command. What could I be doing wrong?

Also, each time I run a variant call for multiple samples (38 samples), on the first sample is processed up to where the pipe breaks.

Below is my script for the variant calling:

set -e

cd  /data10/working_groups/balint_group/charlesotieno/project1/results

genome=/data10/genomes/hg38/index/hg38.fa

mkdir -p sam bam bcf vcf


for fq in /data10/working_groups/balint_group/charlesotieno/project1/data/untrimmed_fastq/*.fastq
do
echo “Working with file $fq”

base=$(basename $fq)
echo “base name is $base”

fq=/data10/working_groups/balint_group/charlesotieno/project1/data/untrimmed_fastq/${base}
sam=/data10/working_groups/balint_group/charlesotieno/project1/results/sam/${base}.aligned.sam
bam=/data10/working_groups/balint_group/charlesotieno/project1/results/bam/${base}.aligned.bam
sorted_bam=/data10/working_groups/balint_group/charlesotieno/project1/results/bam/${base}.aligned.sorte$
raw_bcf=/data10/working_groups/balint_group/charlesotieno/project1/results/bcf//${base}_raw.bcf
variants=/data10/working_groups/balint_group/charlesotieno/project1/results/bcf/${base}_variants.vcf
final_variants=/data10/working_groups/balint_group/charlesotieno/project1/results/vcf/${base}_final_var$

bwa mem $genome $fq > $sam
samtools view -S -b $sam > $bam
samtools sort -o $sorted_bam $bam
samtools index $sorted_bam
bcftools mpileup -0 b -o $raw_bcf -f $genome $sorted_bam
bcftools call - - ploidy 1 -m -v -o $variants $raw_bcf
vcfutils.pl varFilter $variants > final_variants

done

PLEASE HELP!!!

otienolwanga avatar Sep 14 '19 10:09 otienolwanga

bcftools mpileup -0 b -o $raw_bcf -f $genome $sorted_bam This command is not working.It gives the output Unrecognized command. Are there alternatives to this command?

otienolwanga avatar Sep 14 '19 12:09 otienolwanga

Hi @otienolwanga ! I'm really sorry to hear that. Could you provide me with some additional information so that I can figure out what the problem might be?

  1. Are you using an Carpentries AMI instance or have you setup the tools in your own machine / environment?
  2. If the second (i.e. your own env), which version of bcftools have you installed? As you can see in the setup page, all commands have been tested using the respective versions (BCFtools version 1.8 in this case).
  3. Is there any additional info to the Unrecognized command message? For example, if you run the command bcftools --version what is the produced output?

fpsom avatar Sep 14 '19 12:09 fpsom

Hello @fpsom! I am using the University Server not the Carpentries AMI instance. The bcftools is installed but I am not quite sure which version it is; I can't figure out the version from the server as bcftools --version won't work. Apparently, all the tools in carpentries AMI instance are installed in our server as well. As to the third question, the loop runs until bcftools mpileup -0 b -o $raw_bcf -f $genome $sorted_bam then Unrecognized command and that's the end of it; no additional information. It just stops. The rest of the samples don't even get processed.

otienolwanga avatar Sep 14 '19 13:09 otienolwanga

Hi @otienolwanga, thanks for the details.

To me, it seems that bcftools is not installed (or at least, incorrectly installed) - hence the Unrecognized command error, and why the loop fails at that particular point. My suggestion would be to re-install the software (if you have the admin rights), or ask the IT team to assist in this. The easiest solution (that I usually go for) is to go through conda - this option also let's you install the specific version. Alternatively, you can look through the installation instructions of the main bcftools website.

fpsom avatar Sep 14 '19 13:09 fpsom

Thank you @fpsom for your help. I will contact the server admin to reinstall it since I do not have the rights. I will update you on the progress.

Kind regards

otienolwanga avatar Sep 14 '19 13:09 otienolwanga

I'm jumping in on this late, but could the problem be the typo in the first option listed: -0 b? This should actually be the capital letter O, not zero. So it should read -O b instead.

jrkirk61 avatar Feb 07 '20 21:02 jrkirk61

Hi All,

I just tested the respective commands, and when typing

bcftools mpileup -0 b -o $raw_bcf -f $genome $sorted_bam

I get the same error.

When changing this to

bcftools mpileup -O b -o $raw_bcf -f $genome $sorted_bam

it works for me.

Could you confirm that this was the problem @otienolwanga?

Thank you, Lara

larahurban avatar Jan 13 '21 22:01 larahurban