@@ -7,7 +7,9 @@ from mtsv.parsing import (
77 format_cml_params,
88 file_type, outfile_type,
99 make_table)
10- from mtsv.utils import bin_path, track_file_params, get_database_params
10+ from mtsv.utils import (
11+ bin_path, script_path,
12+ track_file_params, get_database_params)
1113
1214
1315shell.prefix("set -euo pipefail;")
6062except FileNotFoundError:
6163 SAMPLES = config['fastq']
6264SAMPLES = [os.path.basename(s) for s in SAMPLES]
65+ SAMPLE_NAMES = [os.path.splitext(s)[0] for s in SAMPLES]
6366UNALIGNED_QUERIES = [os.path.join(config['binning_outpath'],
64- "unaligned_queries_{}.fasta".format(s)) for s in SAMPLES]
67+ "unaligned_queries_{}.fasta".format(s)) for s in SAMPLE_NAMES]
68+
6569
6670rule binning_all:
6771 input: REPORT
@@ -73,7 +77,8 @@ rule binning_report:
7377 output:
7478 rep=REPORT
7579 params:
76- header = SAMPLES
80+ header = SAMPLE_NAMES,
81+ merge_file = config['merge_file']
7782 message:
7883 """
7984 Running binning report.
@@ -102,21 +107,29 @@ rule binning_report:
102107 "Unique Unaligned Queries"])
103108
104109 file_str = "\n".join(UNALIGNED_QUERIES)
110+ total_hits = summary_data['total_hits']
111+ total_unique_hits = summary_data['total_unique_hits']
112+ total_queries = summary_data['total_queries']
113+ total_unique_queries = summary_data['total_unique_queries']
114+ total_unaligned_queries = summary_data['total_unaligned_queries']
115+ total_unique_unaligned_queries = summary_data[
116+ 'total_unique_unaligned_queries']
117+
105118 track_file_params('merge_file', config['merge_file'], config)
106119
107120 report("""
108121 Binning Report
109122 ================================
110123 Hits are reported in:\n
111- {config[' merge_file']} \n
112- There were **{summary_data[' total_hits'] }** total hits
113- and **{summary_data[' total_unique_hits'] }** unique hits out
114- of **{summary_data[' total_queries'] }** total queries and
115- **{summary_data[' total_unique_queries'] }** unique queries.\n
116- There were **{summary_data[' total_unaligned_queries'] }** total
117- queries and **{summary_data[' total_unique_unaligned_queries'] }**
124+ **{params. merge_file}** \n
125+ There were **{total_hits}** total hits
126+ and **{total_unique_hits}** unique hits out
127+ of **{total_queries}** total queries and
128+ **{total_unique_queries}** unique queries.\n
129+ There were **{total_unaligned_queries}** total
130+ queries and **{total_unique_unaligned_queries}**
118131 unique queries with no hits.\n
119- Analigned query sequences are reported in:\n
132+ Unaligned query sequences are reported in:\n
120133 {file_str}.\n
121134 Query Stats:\n
122135 {table}
@@ -132,13 +145,15 @@ rule unaligned_queries:
132145 clps = config['merge_file'],
133146 fasta = config['fasta']
134147 params:
135- samples = SAMPLES
148+ samples = SAMPLE_NAMES,
149+ outpath = config['binning_outpath']
136150 threads: config['threads']
137151 log: config['log_file']
138152 message:
139153 """
140154 Finding unaligned queries.
141- Writing unaligned queries to {output}.
155+ Writing unaligned queries to {output}.
156+ Logging to {log}.
142157 Snakemake scheduler assuming {threads} thread(s)
143158 """
144159 script: SCRIPT['unaligned_queries']
0 commit comments