Skip to content

Commit

Permalink
remove index from pipeline, add error and readme section
Browse files Browse the repository at this point in the history
  • Loading branch information
ViralVerity committed May 22, 2024
1 parent 75a5ad6 commit cd28963
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <reference.fasta>"
- Use the ``--reference-directory`` option to provide the path to the directory.


Expand Down
5 changes: 0 additions & 5 deletions denv_pipeline/scripts/mapper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions denv_pipeline/utils/error_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,17 @@ 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"))
sys.exit(-1)
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 <reference sequence>.\n"))
sys.exit(-1)

with open(os.path.join(config["reference_directory"],fasta_file)) as f:
seq_count = 0
Expand Down

0 comments on commit cd28963

Please sign in to comment.