Home > Net >  Keep getting error: [E::fai_build3_core] Failed to open the file --regions for a script I have been
Keep getting error: [E::fai_build3_core] Failed to open the file --regions for a script I have been

Time:02-27

I have been using the below script however, I keep getting an error on the output. Any ideas why?

#!/bin/bash

set - eu

bam_input=$3

geome=/storage1/DISK1/TCGA_scripts/ref_genome/GRCh38.ref.fa
export genome




function bam_chromosomes {
        samtools idxstats $bam_input | cut -f 1 | grep -v '*'
}

export -f bam_chromosomes




function parallel_call {
    bcftools mpileup \
        --fasta-ref ${genome} \
        --regions $2 \
        --output-type u \
        $1 | \
    bcftools call --multiallelic-caller \
                  --variants-only \
                  --output-type u - > ${1/.bam/}.$2.bcf
}

export -f parallel_call


chrom_set=`bam_chromosomes test.bam`
parallel --verbose -j 90% parallel_call sample_A.bam ::: ${chrom_set}

The above script is the first step in parallelizing the process mpileup which should calculate variants within a .bam file. The following error keeps ocuring:

parallel_call sample_A.bam 'Usage:'
parallel_call sample_A.bam samtools
parallel_call sample_A.bam idxstats
parallel_call sample_A.bam '[options]'
Note: none of --samples-file, --ploidy or --ploidy-file given, assuming all sites are     diploid
[E::fai_build3_core] Failed to open the file --regions
Failed to open -: unknown file type
parallel_call sample_A.bam '<in.bam>'
Note: none of --samples-file, --ploidy or --ploidy-file given, assuming all sites are   diploid
[E::fai_build3_core] Failed to open the file --regions
Failed to open -: unknown file type
Note: none of --samples-file, --ploidy or --ploidy-file given, assuming all sites are   diploid
[E::fai_build3_core] Failed to open the file --regions
Failed to open -: unknown file type
parallel_call sample_A.bam --input-fmt-option
parallel_call sample_A.bam 'OPT[=VAL]'
Note: none of --samples-file, --ploidy or --ploidy-file given, assuming all sites are  diploid
[E::fai_build3_core] Failed to open the file --regions
Failed to open -: unknown file type
parallel_call sample_A.bam Specify
parallel_call sample_A.bam a
Note: none of --samples-file, --ploidy or --ploidy-file given, assuming all sites are diploid
[E::fai_build3_core] Failed to open the file --regions

In theory the above script should create a number of files with the variable substitution ${1/.bam/}.$2.bcf which avoids filename collision. It's difficult for me to upload any of the files as they are very large and my internet speed is very slow. Thanks for any help.

CodePudding user response:

Suggesting to replace line:

 geome=/storage1/DISK1/TCGA_scripts/ref_genome/GRCh38.ref.fa

With line:

 genome=/storage1/DISK1/TCGA_scripts/ref_genome/GRCh38.ref.fa
  • Related