This is a test version of Biostars. For the public version, visit https://www.biostars.org.
BCFTools - empty output

Hi,

I need to convert vcf to fasta and after make multifasta file. However I am stuck in getting empty output files with this script

I would like to ask for a help

#!bin/bash
for file in $inpath/*.filtered ;
do
        echo $file
        bname=$(basename $file)
        echo "base name is $bname"
        bfile=$outpath1/$bname".gz"
        outfile=$outpath/$bname".fasta"
        bgzip -c $file > $bfile
        bcftools index $bfile
        samtools faidx $reference | bcftools consensus -s $bfile -o $outfile
done
sequence

Why is there a pipe in the faidx line?

this is usage example for BCFTools

Examples: # Get the consensus for one region. The fasta header lines are then expected # in the form ">chr:from-to". samtools faidx ref.fa 8:11870-11890 | bcftools consensus in.vcf.gz > out.fa

Yes but this is not what you are doing. You don’t provide a range to faidx.

Thank you! But how can I know in which range should I index reference?

What kind of file is $bfile? a compressed vcf? Doesn't bcf consensus need to be told what the fasta reference is?

bfile is a compressed vcf. I wrote syntax like samtools faidx $reference NC_045512.2:1-29903 but still nothing

0 answers

No answers yet.

Log in to answer this question.