diff --git a/README.md b/README.md index 96934bf..ab1777f 100644 --- a/README.md +++ b/README.md @@ -63,6 +63,7 @@ If you want to try other viruses, or use your own reference and bed files: - Look at our directory "DENV_primers_and_refs" for formatting file names etc - Provide the stem of each file in the "refs.txt" tesxt file in the same folder +- Make sure you have indexed your references by typing "bwa index " - Use the ``--reference-directory`` option to provide the path to the directory. diff --git a/denv_pipeline/scripts/mapper.sh b/denv_pipeline/scripts/mapper.sh index 19680b5..b3f2b68 100755 --- a/denv_pipeline/scripts/mapper.sh +++ b/denv_pipeline/scripts/mapper.sh @@ -16,11 +16,6 @@ while IFS= read -r virustype || [[ -n "$virustype" ]]; do trimbed=${primer_dir}/${virustype}.trim.bed consensus_name=${fname}.${virustype} - if ! [ -f ${primer_dir}/${virustype}.fasta.ann ]; then - echo "----->>>> making index files for ${virustype}" - bwa index ${fasta} - fi - echo "----->>>>>Mapping reads against serotype "${virustype}" reference sequence" which bwa bwa mem -v 1 -t 2 -O 10 ${fasta} $read1 $read2 | samtools view -bS -F 4 -F 2048 | samtools sort -o ${tempdir}/${fname}.${virustype}.bam diff --git a/denv_pipeline/utils/error_checks.py b/denv_pipeline/utils/error_checks.py index a103d7e..2d8d8ae 100644 --- a/denv_pipeline/utils/error_checks.py +++ b/denv_pipeline/utils/error_checks.py @@ -92,6 +92,7 @@ def check_primer_dir(config): bed_file = f'{virus_type}.bed' fasta_file = f'{virus_type}.fasta' + index_file = f'{virus_type}.fasta.amb' if not bed_file in all_files: sys.stderr.write(green(f"Error: Missing bed file for {virus_type} in {config['reference_directory']}. I am expecting it to be called {bed_file} and the '.bed' has to be lower case.\n")) @@ -99,6 +100,9 @@ def check_primer_dir(config): if not fasta_file in all_files: sys.stderr.write(green(f"Error: Missing reference file for {virus_type} in {config['reference_directory']}. I am expecting it to be called {fasta_file}\n")) sys.exit(-1) + if not index_file in all_files: + sys.stderr.write(green(f"Error: Missing reference index files for {virus_type} in {config['reference_directory']}. I am expecting it to be called {index_file}\n To generate this, please use bwa index .\n")) + sys.exit(-1) with open(os.path.join(config["reference_directory"],fasta_file)) as f: seq_count = 0