Skip to content

Commit

Permalink
Update docs for v.1.1.0
Browse files Browse the repository at this point in the history
- Docs updated for new output files
- Long output filenames simplified
  • Loading branch information
edgardomortiz committed Dec 23, 2024
1 parent 7a8a0cd commit 1e3c44e
Show file tree
Hide file tree
Showing 33 changed files with 363 additions and 208 deletions.
10 changes: 5 additions & 5 deletions captus/align.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
"""
Copyright 2020-2024 Edgardo M. Ortiz ([email protected])
Copyright 2020-2025 Edgardo M. Ortiz ([email protected])
https://github.com/edgardomortiz/Captus
This file is part of Captus. Captus is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -36,7 +36,7 @@ def align(full_command, args):

captus_start = time.time()
out_dir, out_dir_msg = make_output_dir(args.out)
log.logger = log.Log(Path(args.out, "captus-assembly_align.log"), stdout_verbosity_level=1)
log.logger = log.Log(Path(args.out, "captus-align.log"), stdout_verbosity_level=1)

mar = 26 # Margin for aligning parameters and values

Expand Down Expand Up @@ -1538,7 +1538,7 @@ def write_paralog_stats(out_dir, tsv_comment, shared_paralog_stats):
if not shared_paralog_stats:
return red("No paralogs were found...")
else:
stats_tsv_file = Path(out_dir, "captus-assembly_align.paralogs.tsv")
stats_tsv_file = Path(out_dir, "captus-align_paralogs.tsv")
with open(stats_tsv_file, "wt") as tsv_out:
tsv_out.write(tsv_comment)
tsv_out.write("\t".join(["marker_type",
Expand Down Expand Up @@ -1783,7 +1783,7 @@ def write_aln_stats(out_dir, tsv_comment, shared_aln_stats):
if not shared_aln_stats:
return None
else:
stats_tsv_file = Path(out_dir, "captus-assembly_align.alignments.tsv")
stats_tsv_file = Path(out_dir, "captus-align_alignments.tsv")
with open(stats_tsv_file, "wt") as tsv_out:
tsv_out.write(tsv_comment)
tsv_out.write("\t".join(["path",
Expand Down Expand Up @@ -1817,7 +1817,7 @@ def write_sam_stats(out_dir, tsv_comment, shared_sam_stats):
if not shared_sam_stats:
return None
else:
stats_tsv_file = Path(out_dir, "captus-assembly_align.samples.tsv")
stats_tsv_file = Path(out_dir, "captus-align_samples.tsv")
with open(stats_tsv_file, "wt") as tsv_out:
tsv_out.write(tsv_comment)
tsv_out.write("\t".join(["sample",
Expand Down
12 changes: 6 additions & 6 deletions captus/assemble.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
"""
Copyright 2020-2024 Edgardo M. Ortiz ([email protected])
Copyright 2020-2025 Edgardo M. Ortiz ([email protected])
https://github.com/edgardomortiz/Captus
This file is part of Captus. Captus is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -33,7 +33,7 @@ def assemble(full_command, args):

captus_start = time.time()
out_dir, out_dir_msg = make_output_dir(args.out)
log.logger = log.Log(Path(args.out, "captus-assembly_assemble.log"), stdout_verbosity_level=1)
log.logger = log.Log(Path(args.out, "captus-assemble.log"), stdout_verbosity_level=1)

mar = 21 # Margin for aligning parameters and values

Expand Down Expand Up @@ -1021,7 +1021,7 @@ def calc_asm_stats(


msg = (
f"'{sample_name}' {stage.upper()}: {num_contigs:,} contigs, total {tot_length:,} bp,"
f"'{sample_name}': {stage.upper()} {num_contigs:,} contigs, total {tot_length:,} bp,"
f" min {min_length:,} bp, max {max_length:,} bp, avg {avg_length:,} bp, N50 {n50:,} bp"
)
return msg
Expand Down Expand Up @@ -1096,9 +1096,9 @@ def collect_asm_stats(out_dir, tsv_comment):
depth_tsv_files = sorted(list(Path(out_dir).resolve().rglob("depth_stats.tsv")))
length_tsv_files = sorted(list(Path(out_dir).resolve().rglob("length_stats.tsv")))

assembly_stats_tsv = Path(out_dir, "captus-assembly_assemble.assembly_stats.tsv")
depth_stats_tsv = Path(out_dir, "captus-assembly_assemble.depth_stats.tsv")
length_stats_tsv = Path(out_dir, "captus-assembly_assemble.length_stats.tsv")
assembly_stats_tsv = Path(out_dir, "captus-assemble_assembly_stats.tsv")
depth_stats_tsv = Path(out_dir, "captus-assemble_depth_stats.tsv")
length_stats_tsv = Path(out_dir, "captus-assemble_length_stats.tsv")

if not assembly_tsv_files or not depth_tsv_files or not length_tsv_files:
return None, None, None
Expand Down
4 changes: 2 additions & 2 deletions captus/bait.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
"""
Copyright 2020-2024 Edgardo M. Ortiz ([email protected])
Copyright 2020-2025 Edgardo M. Ortiz ([email protected])
https://github.com/edgardomortiz/Captus
This file is part of Captus. Captus is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -36,7 +36,7 @@ def bait(full_command, args):

captus_start = time.time()
out_dir, out_dir_msg = make_output_dir(args.out)
log.logger = log.Log(Path(out_dir, "captus-design_bait.log"), stdout_verbosity_level=1)
log.logger = log.Log(Path(out_dir, "captus-bait.log"), stdout_verbosity_level=1)

mar = 28 # Margin for aligning parameters and values

Expand Down
2 changes: 1 addition & 1 deletion captus/bioformats.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
"""
Copyright 2020-2024 Edgardo M. Ortiz ([email protected])
Copyright 2020-2025 Edgardo M. Ortiz ([email protected])
https://github.com/edgardomortiz/Captus
This file is part of Captus. Captus is free software: you can redistribute it and/or modify
Expand Down
2 changes: 1 addition & 1 deletion captus/captus_assembly.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
"""
Copyright 2020-2024 Edgardo M. Ortiz ([email protected])
Copyright 2020-2025 Edgardo M. Ortiz ([email protected])
https://github.com/edgardomortiz/Captus
This is the control program for the assembly pipeline of Captus.
Expand Down
2 changes: 1 addition & 1 deletion captus/captus_design.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
"""
Copyright 2020-2024 Edgardo M. Ortiz ([email protected])
Copyright 2020-2025 Edgardo M. Ortiz ([email protected])
https://github.com/edgardomortiz/Captus
This is the control program for the bait design pipeline of Captus.
Expand Down
4 changes: 2 additions & 2 deletions captus/clean.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
"""
Copyright 2020-2024 Edgardo M. Ortiz ([email protected])
Copyright 2020-2025 Edgardo M. Ortiz ([email protected])
https://github.com/edgardomortiz/Captus
This file is part of Captus. Captus is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -32,7 +32,7 @@ def clean(full_command, args):

captus_start = time.time()
out_dir, out_dir_msg = make_output_dir(args.out)
log.logger = log.Log(Path(out_dir, "captus-assembly_clean.log"), stdout_verbosity_level=1)
log.logger = log.Log(Path(out_dir, "captus-clean.log"), stdout_verbosity_level=1)

mar = 21 # Margin for aligning parameters and values

Expand Down
6 changes: 3 additions & 3 deletions captus/cluster.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
"""
Copyright 2020-2024 Edgardo M. Ortiz ([email protected])
Copyright 2020-2025 Edgardo M. Ortiz ([email protected])
https://github.com/edgardomortiz/Captus
This file is part of Captus. Captus is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -35,7 +35,7 @@ def cluster(full_command, args):

captus_start = time.time()
out_dir, out_dir_msg = make_output_dir(args.out)
log.logger = log.Log(Path(out_dir, "captus-design_cluster.log"), stdout_verbosity_level=1)
log.logger = log.Log(Path(out_dir, "captus-cluster.log"), stdout_verbosity_level=1)

mar = 23 # Margin for aligning parameters and values

Expand Down Expand Up @@ -1274,7 +1274,7 @@ def min_copies(aln_trimmed: dict, aln_width: int):


def write_aln_stats(out_dir: Path, shared_aln_stats: list):
stats_tsv_file = Path(out_dir, "captus-design_cluster.alignments.tsv")
stats_tsv_file = Path(out_dir, "captus-cluster_alignments.tsv")
if not shared_aln_stats:
if stats_tsv_file.exists() and not file_is_empty(stats_tsv_file):
return stats_tsv_file
Expand Down
8 changes: 4 additions & 4 deletions captus/extract.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
"""
Copyright 2020-2024 Edgardo M. Ortiz ([email protected])
Copyright 2020-2025 Edgardo M. Ortiz ([email protected])
https://github.com/edgardomortiz/Captus
This file is part of Captus. Captus is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -43,7 +43,7 @@ def extract(full_command, args):

captus_start = time.time()
out_dir, out_dir_msg = make_output_dir(args.out)
log.logger = log.Log(Path(args.out, "captus-assembly_extract.log"), stdout_verbosity_level=1)
log.logger = log.Log(Path(args.out, "captus-extract.log"), stdout_verbosity_level=1)
mar = 25 # Margin for aligning parameters and values

################################################################################################
Expand Down Expand Up @@ -1997,7 +1997,7 @@ def blat_misc_dna(
else:
if not keep_all:
Path(blat_dna_out_file).unlink()
write_gff3(dna_hits, marker_type, disable_stitching, dna_gff_file)
write_gff3(dna_hits, marker_type, disable_stitching, tsv_comment, dna_gff_file)
recovery_stats = write_fastas_and_report(dna_hits, sample_name, dna_target,
blat_dna_out_dir, marker_type,
max_loci_files, tsv_comment, overwrite)
Expand Down Expand Up @@ -2470,7 +2470,7 @@ def collect_ext_stats(out_dir, tsv_comment):
if not samples_stats:
return None
else:
stats_file_out = Path(out_dir, "captus-assembly_extract.stats.tsv")
stats_file_out = Path(out_dir, "captus-extract_stats.tsv")
header = "\t".join(settings.EXT_STATS_HEADER) + "\n"
with open(stats_file_out, "wt") as tsv_out:
tsv_out.write(tsv_comment)
Expand Down
2 changes: 1 addition & 1 deletion captus/log.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
"""
Copyright 2020-2024 Edgardo M. Ortiz ([email protected])
Copyright 2020-2025 Edgardo M. Ortiz ([email protected])
https://github.com/edgardomortiz/Captus
This module contains Unicycler's class for writing output to both stdout and a log file.
Expand Down
2 changes: 1 addition & 1 deletion captus/misc.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
"""
Copyright 2020-2024 Edgardo M. Ortiz ([email protected])
Copyright 2020-2025 Edgardo M. Ortiz ([email protected])
https://github.com/edgardomortiz/Captus
This file is part of Captus. Captus is free software: you can redistribute it and/or modify
Expand Down
12 changes: 6 additions & 6 deletions captus/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -1516,7 +1516,7 @@ def build_qc_report(out_dir, qc_extras_dir):
<pre><code>Version: {version}{command}</code></pre>
</body>
"""
qc_html_report = Path(out_dir, "captus-assembly_clean.report.html")
qc_html_report = Path(out_dir, "captus-clean_report.html")
with open(qc_html_report, "w") as f:
f.write(html_header)
for fig in figs:
Expand Down Expand Up @@ -2312,7 +2312,7 @@ def build_assembly_report(out_dir, asm_stats_tsv, len_stats_tsv, dep_stats_tsv):
<pre><code>Version: {version}{command}</code></pre>
</body>
"""
asm_html_report = Path(out_dir, "captus-assembly_assemble.report.html")
asm_html_report = Path(out_dir, "captus-assemble_report.html")
with open(asm_html_report, "w") as f:
f.write(html_header)
for fig in figs:
Expand Down Expand Up @@ -2864,7 +2864,7 @@ def build_extraction_report(out_dir, ext_stats_tsv):
<pre><code>Version: {version}{command}</code></pre>
</body>
"""
ext_html_report = Path(out_dir, "captus-assembly_extract.report.html")
ext_html_report = Path(out_dir, "captus-extract_report.html")
with open(ext_html_report, "w") as f:
f.write(html_header)
for fig in figs:
Expand Down Expand Up @@ -3750,7 +3750,7 @@ def build_alignment_report(out_dir, aln_stats_tsv, sam_stats_tsv):
</body>
"""
# Save plot in html
aln_html_report = Path(out_dir, "captus-assembly_align.report.html")
aln_html_report = Path(out_dir, "captus-align_report.html")
with open(aln_html_report, "w") as f:
f.write(html_header)
for i, fig in enumerate(figs):
Expand Down Expand Up @@ -4066,10 +4066,10 @@ def build_design_report(out_dir, des_stats_tsv, step):
)
if step == "cluster":
report_title = "Captus-design: Cluster (Alignment Report)"
des_html_report = Path(out_dir, "captus-design_cluster.report.html")
des_html_report = Path(out_dir, "captus-cluster_report.html")
elif step == "select":
report_title = "Captus-design: Select (Alignment Report)"
des_html_report = Path(out_dir, "captus-design_select.report.html")
des_html_report = Path(out_dir, "captus-select_report.html")
with open(des_stats_tsv, "r") as f:
version = f.readline().lstrip("#")
command = f.readline().lstrip("#")
Expand Down
8 changes: 4 additions & 4 deletions captus/select.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
"""
Copyright 2020-2024 Edgardo M. Ortiz ([email protected])
Copyright 2020-2025 Edgardo M. Ortiz ([email protected])
https://github.com/edgardomortiz/Captus
This file is part of Captus. Captus is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -28,7 +28,7 @@ def select(full_command, args):

captus_start = time.time()
out_dir, out_dir_msg = make_output_dir(args.out)
log.logger = log.Log(Path(out_dir, "captus-design_select.log"), stdout_verbosity_level=1)
log.logger = log.Log(Path(out_dir, "captus-select.log"), stdout_verbosity_level=1)

mar = 33 # Margin for aligning parameters and values

Expand Down Expand Up @@ -145,7 +145,7 @@ def select(full_command, args):

def load_aln_stats_tsv(clusters_dir: Path):
start = time.time()
aln_stats_tsv_path = Path(clusters_dir, "captus-design_cluster.alignments.tsv")
aln_stats_tsv_path = Path(clusters_dir, "captus-cluster_alignments.tsv")
if aln_stats_tsv_path.exists():
aln_stats = {}
with open(aln_stats_tsv_path, "rt") as stats:
Expand Down Expand Up @@ -457,7 +457,7 @@ def copy_loci(aln_stats: dict, out_dir: Path, overwrite: bool, show_more: bool):


def write_aln_stats(out_dir: Path, aln_stats_filtered: dict):
stats_tsv_file = Path(out_dir, "captus-design_select.alignments.tsv")
stats_tsv_file = Path(out_dir, "captus-select_alignments.tsv")
if not aln_stats_filtered:
if stats_tsv_file.exists() and not file_is_empty(stats_tsv_file):
return stats_tsv_file
Expand Down
8 changes: 4 additions & 4 deletions captus/settings.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/usr/bin/env python3
"""
Copyright 2020-2024 Edgardo M. Ortiz ([email protected])
Copyright 2020-2025 Edgardo M. Ortiz ([email protected])
https://github.com/edgardomortiz/Captus
This module contains hard-coded settings for Captus-assembly
This module contains hard-coded settings for Captus
This file is part of Captus. Captus is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by the Free Software Foundation,
Expand Down Expand Up @@ -336,7 +336,7 @@
TRANSLATED_REF_SUFFIX = ".captus.faa"

# JSON with paths to references filename
JSON_REFS = "captus-assembly_extract.refs.json"
JSON_REFS = "captus-extract_refs.json"

# Valid combinations of marker directories and format directories
VALID_MARKER_FORMAT_COMBO = [(m, f) for m in ["NUC","PTD","MIT"] for f in ["AA","NT","GE","GF"]]
Expand Down Expand Up @@ -598,7 +598,7 @@

# File name for sequence-to-sample equivalence table used by ASTRAL-Pro to analyze trees that
# include paralogs
ASTRAL_PRO_EQ = "captus-assembly_align.astral-pro.tsv"
ASTRAL_PRO_EQ = "captus-align_astral-pro.tsv"

# Import data for clustering file names
DES_SUFFIXES = {
Expand Down
2 changes: 1 addition & 1 deletion captus/version.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
"""
Copyright 2020-2024 Edgardo M. Ortiz ([email protected])
Copyright 2020-2025 Edgardo M. Ortiz ([email protected])
https://github.com/edgardomortiz/Captus
Captus' version is stored here in a separate file so it can exist in only one place.
Expand Down
2 changes: 1 addition & 1 deletion captus_assembly-runner.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
"""
Copyright 2020-2024 Edgardo M. Ortiz ([email protected])
Copyright 2020-2025 Edgardo M. Ortiz ([email protected])
https://github.com/edgardomortiz/Captus
This file is a convenience wrapper for running Captus assemble directly from the source tree. By
Expand Down
2 changes: 1 addition & 1 deletion captus_design-runner.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
"""
Copyright 2020-2024 Edgardo M. Ortiz ([email protected])
Copyright 2020-2025 Edgardo M. Ortiz ([email protected])
https://github.com/edgardomortiz/Captus
This file is a convenience wrapper for running Captus design directly from the source tree. By
Expand Down
Loading

0 comments on commit 1e3c44e

Please sign in to comment.