tkrahn / extract23

Extract a simulated 23andMe (V3) style file from a Whole Genome BAM file
GNU General Public License v3.0
28 stars 5 forks source link

"samtools: Could not read file "-f": No such file or directory" error #3

Closed napobo3 closed 7 years ago

napobo3 commented 7 years ago

The same problem as in the issue #1 When I am running the command step-by-step on the command line everything works fine. When I run the script I am getting :


$ ./extract23.sh -b 1.bam -r hs37d5.fasta -t 23andMe_V3_GRCh37_ref.tab.gz 
Starting mpileup... Please be patient!
samtools: Could not read file "-f": No such file or directory
tbx_index_build failed: 23andMe_raw.vcf.gz
Mpileup completed. Starting SNP calling...
Note: none of --samples-file, --ploidy or --ploidy-file given, assuming all sites are diploid
Failed to open 23andMe_raw.vcf.gz: unknown file type
tbx_index_build failed: 23andMe_called.vcf.gz
SNP calling completed. Starting annotation...
[E::hts_open_format] fail to open file '-c'
./extract23.sh: line 77: 41041 Segmentation fault      (core dumped) bcftools annotate -O z -a ${REF_23ANDME} -c CHROM,POS,ID 23andMe_called.vcf.gz > 23andMe_annotated.vcf.gz
tbx_index_build failed: 23andMe_annotated.vcf.gz
Annotation completed. Starting extraction from VCF ...
Failed to open 23andMe_annotated.vcf.gz: unknown file type
Extraction from VCF completed. Sorting by chromosome and position ...
23andMe_V3_hg19.txt was created. We don't zip it meantime ...
napobo3 commented 7 years ago

The problem is : the script is running the command :

samtools mpileup -C 50 -v -l -f hs37d5.fasta 1.bam > 23andMe_raw.vcf.gz

instead of :

samtools mpileup -C 50 -v -l 23andMe_V3_GRCh37_ref.tab.gz -f hs37d5.fasta 1.bam > 23andMe_raw.vcf.gz

The ${REF_23ANDME} is empty.

tkrahn commented 7 years ago

It seems like I can't pre-define getops parameters like in Perl. I'll have to mingle them after feching with getopts. I'll test my new version and then I'll commit i when it is tested. Thanks for making me aware.

tkrahn commented 7 years ago

The geopts error has been fixed and pushed to GitHub. Please checkout version 1.2. Thanks for reporting.

napobo3 commented 7 years ago

Tested. Works fine. Thanks.