Skip to content

Commit

Permalink
Fix BLAST DB location (#34)
Browse files Browse the repository at this point in the history
* Clarify that full path to files is required on help page

* Make BLAST DB in output directory, not relative to the scripts

* Fully use expand for main rule (instead of %)
  • Loading branch information
lcoombe authored Oct 18, 2024
1 parent 50c71ef commit 4af28ec
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions mtgrasp.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
MTGRASP_VERSION = 'mtGrasp v1.1.7'

parser = argparse.ArgumentParser(description='mtGrasp: de novo assembly of reference-grade animal mitochondrial genomes')
parser.add_argument('-r1', '--read1', help='Forward read fastq.gz file [Required]')
parser.add_argument('-r2', '--read2', help='Reverse read fastq.gz file [Required]')
parser.add_argument('-r1', '--read1', help='Full path to forward read fastq.gz file [Required]')
parser.add_argument('-r2', '--read2', help='Full path to reverse read fastq.gz file [Required]')
parser.add_argument('-o', '--out_dir', help='Output directory [Required]')
parser.add_argument('-m', '--mt_gen', help='Mitochondrial genetic code [Required]')
parser.add_argument('-r', '--ref_path', help='Path to the reference fasta file [Required]')
parser.add_argument('-r', '--ref_path', help='Full path to the reference fasta file [Required]')

parser.add_argument('-t', '--threads', help='Number of threads [8]', default = 8, type=int)
parser.add_argument('-k', '--kmer', help='k-mer size used in ABySS de novo assembly [91]', default = 91, type=int)
Expand Down
10 changes: 5 additions & 5 deletions mtgrasp.smk
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ else:
# Start of the pipeline
rule all:
input:
expand(current_dir + "{library}/final_output/{library}_k{k}_kc{kc}/{library}_k{k}_kc{kc}.final-mtgrasp_%s-assembly.fa"%(mtgrasp_version), library = config["out_dir"], k = config["kmer"], kc = config["kc"])
expand(current_dir + "{library}/final_output/{library}_k{k}_kc{kc}/{library}_k{k}_kc{kc}.final-mtgrasp_{version}-assembly.fa", library = config["out_dir"], k = config["kmer"], kc = config["kc"], version=mtgrasp_version)



Expand Down Expand Up @@ -179,11 +179,11 @@ rule blast:
db_name = os.path.splitext(os.path.basename(params.ref_fasta))[0]

# check if a blast database exists
if not os.path.exists(f'{script_dir}/blast_db/{db_name}'):
shell("mkdir -p {script_dir}/blast_db/{db_name} && cd {script_dir}/blast_db/{db_name} && makeblastdb -in {params.ref_fasta} -dbtype nucl -out {db_name}")
shell("export BLASTDB={script_dir}/blast_db/{db_name} && mtgrasp_blast_best-hit.py {input} {db_name} > {output}")
if not os.path.exists(f'{library}/blast_db/{db_name}'):
shell("mkdir -p {library}/blast_db/{db_name} && cd {library}/blast_db/{db_name} && makeblastdb -in {params.ref_fasta} -dbtype nucl -out {db_name}")
shell("export BLASTDB={library}/blast_db/{db_name} && mtgrasp_blast_best-hit.py {input} {db_name} > {output}")
else:
shell("export BLASTDB={script_dir}/blast_db/{db_name} && mtgrasp_blast_best-hit.py {input} {db_name} > {output}")
shell("export BLASTDB={library}/blast_db/{db_name} && mtgrasp_blast_best-hit.py {input} {db_name} > {output}")
check_blast_tsv(f'{output}')

rule create_lists:
Expand Down

0 comments on commit 4af28ec

Please sign in to comment.