From 0404a7852888af2252760c50c54ed93512a485ee Mon Sep 17 00:00:00 2001 From: Lauren Coombe Date: Wed, 3 Apr 2024 15:59:43 -0700 Subject: [PATCH] Rename files to have mtgrasp prefix (#22) --- mtgrasp.py | 2 +- mtgrasp.smk | 14 +++++++------- abyss_mergepairs.sh => mtgrasp_abyss_mergepairs.sh | 0 add_flanks.py => mtgrasp_add_flanks.py | 0 blast_best-hit.py => mtgrasp_blast_best-hit.py | 0 ...flanks.py => mtgrasp_check_filled_add_flanks.py | 2 +- cleanup.sh => mtgrasp_cleanup.sh | 0 ...n.py => mtgrasp_create_references_for_ntjoin.py | 0 end_recover.py => mtgrasp_end_recover.py | 6 +++--- ...ct_tsv_value.py => mtgrasp_extract_tsv_value.py | 0 overlap_check.py => mtgrasp_overlap_check.py | 0 run_ntjoin.sh => mtgrasp_run_ntjoin.sh | 0 12 files changed, 12 insertions(+), 12 deletions(-) rename abyss_mergepairs.sh => mtgrasp_abyss_mergepairs.sh (100%) rename add_flanks.py => mtgrasp_add_flanks.py (100%) rename blast_best-hit.py => mtgrasp_blast_best-hit.py (100%) rename check_filled_add_flanks.py => mtgrasp_check_filled_add_flanks.py (92%) rename cleanup.sh => mtgrasp_cleanup.sh (100%) rename create_references_for_ntjoin.py => mtgrasp_create_references_for_ntjoin.py (100%) rename end_recover.py => mtgrasp_end_recover.py (95%) rename extract_tsv_value.py => mtgrasp_extract_tsv_value.py (100%) rename overlap_check.py => mtgrasp_overlap_check.py (100%) rename run_ntjoin.sh => mtgrasp_run_ntjoin.sh (100%) diff --git a/mtgrasp.py b/mtgrasp.py index 15f1036..f105d38 100755 --- a/mtgrasp.py +++ b/mtgrasp.py @@ -178,5 +178,5 @@ if delete: - subprocess.run(shlex.split(f'bash {script_dir}/cleanup.sh {out_dir}'), + subprocess.run(shlex.split(f'bash {script_dir}/mtgrasp_cleanup.sh {out_dir}'), check=True) diff --git a/mtgrasp.smk b/mtgrasp.smk index 2314dfe..1cf6b1b 100755 --- a/mtgrasp.smk +++ b/mtgrasp.smk @@ -179,9 +179,9 @@ rule blast: # 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} && blast_best-hit.py {input} {db_name} > {output}") + shell("export BLASTDB={script_dir}/blast_db/{db_name} && mtgrasp_blast_best-hit.py {input} {db_name} > {output}") else: - shell("export BLASTDB={script_dir}/blast_db/{db_name} && blast_best-hit.py {input} {db_name} > {output}") + shell("export BLASTDB={script_dir}/blast_db/{db_name} && mtgrasp_blast_best-hit.py {input} {db_name} > {output}") check_blast_tsv(f'{output}') rule create_lists: @@ -193,8 +193,8 @@ rule create_lists: benchmark: current_dir + "{library}/benchmark/k{k}_kc{kc}.create_lists.benchmark.txt" shell: - "extract_tsv_value.py {input} {output.ref_list} ref ; " - "extract_tsv_value.py {input} {output.query_list} query" + "mtgrasp_extract_tsv_value.py {input} {output.ref_list} ref ; " + "mtgrasp_extract_tsv_value.py {input} {output.query_list} query" rule extract_seq: @@ -214,7 +214,7 @@ rule extract_seq: shell: "seqtk subseq {input.assemblies} {input.query} > {output.query_out} ; " "seqtk subseq {params.ref_fasta} {input.ref} > {output.ref_out} ;" - " mkdir -p {params.ref_outdir} && create_references_for_ntjoin.py {output.ref_out} {params.ref_outdir} {params.ref_config}" + " mkdir -p {params.ref_outdir} && mtgrasp_create_references_for_ntjoin.py {output.ref_out} {params.ref_outdir} {params.ref_config}" @@ -267,7 +267,7 @@ rule pre_polishing: # If multiple contigs are found, both ntJoin and Sealer are needed else: print("Multiple contigs found, ntJoin scaffolding starts") - shell("""run_ntjoin.sh {params.workdir} {target} {params.ref_config} {log_ntjoin} {params.threads}""") + shell("""mtgrasp_run_ntjoin.sh {params.workdir} {target} {params.ref_config} {log_ntjoin} {params.threads}""") # check gaps need to be filled or not post-ntJoin if check_gaps(params.ntjoin_out) == 0: print("---No Gaps Found After ntJoin, Gap Filling Not Needed---") @@ -350,7 +350,7 @@ rule end_recovery: # end recover bf = bf_sealer(params.r1, params.r2, wildcards.library, params.threads, params.sealer_fpr,params.k) k = k_string_converter(params.k) - shell("end_recover.py {input} {bf} {params.r1} {params.r2} {params.outdir} {params.threads} {params.p} {params.mismatch_allowed} {k}") + shell("mtgrasp_end_recover.py {input} {bf} {params.r1} {params.r2} {params.outdir} {params.threads} {params.p} {params.mismatch_allowed} {k}") else: print("Error: input file is empty.") exit(1) diff --git a/abyss_mergepairs.sh b/mtgrasp_abyss_mergepairs.sh similarity index 100% rename from abyss_mergepairs.sh rename to mtgrasp_abyss_mergepairs.sh diff --git a/add_flanks.py b/mtgrasp_add_flanks.py similarity index 100% rename from add_flanks.py rename to mtgrasp_add_flanks.py diff --git a/blast_best-hit.py b/mtgrasp_blast_best-hit.py similarity index 100% rename from blast_best-hit.py rename to mtgrasp_blast_best-hit.py diff --git a/check_filled_add_flanks.py b/mtgrasp_check_filled_add_flanks.py similarity index 92% rename from check_filled_add_flanks.py rename to mtgrasp_check_filled_add_flanks.py index 73fab2f..689e79f 100755 --- a/check_filled_add_flanks.py +++ b/mtgrasp_check_filled_add_flanks.py @@ -34,7 +34,7 @@ # calculate the flank size flank_size = int((len(str(record.seq))-10)/2) - cmd = f"add_flanks.py {fake_gap_filled} {assembly} {flank_size} {output}" + cmd = f"mtgrasp_add_flanks.py {fake_gap_filled} {assembly} {flank_size} {output}" args = shlex.split(cmd) subprocess.call(args) # if the gap was not filled, copy the original assembly to the output diff --git a/cleanup.sh b/mtgrasp_cleanup.sh similarity index 100% rename from cleanup.sh rename to mtgrasp_cleanup.sh diff --git a/create_references_for_ntjoin.py b/mtgrasp_create_references_for_ntjoin.py similarity index 100% rename from create_references_for_ntjoin.py rename to mtgrasp_create_references_for_ntjoin.py diff --git a/end_recover.py b/mtgrasp_end_recover.py similarity index 95% rename from end_recover.py rename to mtgrasp_end_recover.py index 617ca58..ea9b606 100755 --- a/end_recover.py +++ b/mtgrasp_end_recover.py @@ -131,7 +131,7 @@ def create_fake_fastq_read(seq, end): create_fake_fastq_read(end_seq, 'end') create_fake_fastq_read(start_seq, 'start') - cmd = f'abyss_mergepairs.sh {out_dir} end_sequence.fastq start_sequence.fastq {mismatch_allowed}' + cmd = f'mtgrasp_abyss_mergepairs.sh {out_dir} end_sequence.fastq start_sequence.fastq {mismatch_allowed}' cmd_shlex = shlex.split(cmd) subprocess.call(cmd_shlex) # check if {outdir}/out_merged.fastq is not empty @@ -139,7 +139,7 @@ def create_fake_fastq_read(seq, end): print("abyss_mergepairs merged the ends") else: fh_out = open(f'{out_dir}/fake_gap_unfilled.fa', 'w') - print("abys_mergepairs failed to merge the ends") + print("abyss_mergepairs failed to merge the ends") print("Creating fake gap") end_bp = [] start_bp = [] @@ -179,7 +179,7 @@ def create_fake_fastq_read(seq, end): cmd_shlex = shlex.split(cmd) subprocess.call(cmd_shlex) print("Start adding flanks back to the original assembly") - cmd = f'check_filled_add_flanks.py {out_dir}/fake_gap_filled_log.txt {out_dir}/fake_gap_filled_scaffold.fa {assembly} {out_dir}/flank_added_assembly.fa {out_dir}/fake_gap_unfilled.fa' + cmd = f'mtgrasp_check_filled_add_flanks.py {out_dir}/fake_gap_filled_log.txt {out_dir}/fake_gap_filled_scaffold.fa {assembly} {out_dir}/flank_added_assembly.fa {out_dir}/fake_gap_unfilled.fa' cmd_shlex = shlex.split(cmd) subprocess.call(cmd_shlex) diff --git a/extract_tsv_value.py b/mtgrasp_extract_tsv_value.py similarity index 100% rename from extract_tsv_value.py rename to mtgrasp_extract_tsv_value.py diff --git a/overlap_check.py b/mtgrasp_overlap_check.py similarity index 100% rename from overlap_check.py rename to mtgrasp_overlap_check.py diff --git a/run_ntjoin.sh b/mtgrasp_run_ntjoin.sh similarity index 100% rename from run_ntjoin.sh rename to mtgrasp_run_ntjoin.sh