Mercurial > repos > greg > pima_report
comparison pima_report.py @ 26:46edd7435555 draft
Uploaded
author | greg |
---|---|
date | Tue, 25 Apr 2023 20:31:35 +0000 |
parents | 4986a7fb2145 |
children | ddc056cf16bf |
comparison
equal
deleted
inserted
replaced
25:4986a7fb2145 | 26:46edd7435555 |
---|---|
18 class PimaReport: | 18 class PimaReport: |
19 | 19 |
20 def __init__(self, analysis_name=None, amr_deletions_file=None, amr_matrix_files=None, assembler_version=None, | 20 def __init__(self, analysis_name=None, amr_deletions_file=None, amr_matrix_files=None, assembler_version=None, |
21 assembly_fasta_file=None, assembly_name=None, bedtools_version=None, blastn_version=None, | 21 assembly_fasta_file=None, assembly_name=None, bedtools_version=None, blastn_version=None, |
22 circos_files=None, compute_sequence_length_file=None, contig_coverage_file=None, dbkey=None, | 22 circos_files=None, compute_sequence_length_file=None, contig_coverage_file=None, dbkey=None, |
23 dnadiff_snps_file=None, dnadiff_version=None, errors_file=None, fastq_file=None, feature_bed_files=None, | 23 dnadiff_snps_file=None, dnadiff_version=None, errors_file=None, feature_bed_files=None, |
24 feature_png_files=None, flye_assembly_info_file=None, genome_insertions_file=None, gzipped=None, | 24 feature_png_files=None, flye_assembly_info_file=None, genome_insertions_file=None, gzipped=None, |
25 kraken2_report_file=None, kraken2_version=None, minimap2_version=None, mutation_regions_bed_file=None, | 25 illumina_forward_read_file=None, illumina_reverse_read_file=None, kraken2_report_file=None, |
26 mutation_regions_tsv_files=None, pima_css=None, plasmids_file=None, quast_report_file=None, | 26 kraken2_version=None, minimap2_version=None, mutation_regions_bed_file=None, |
27 mutation_regions_tsv_files=None, ont_file=None, pima_css=None, plasmids_file=None, quast_report_file=None, | |
27 read_type=None, reference_insertions_file=None, samtools_version=None, varscan_version=None): | 28 read_type=None, reference_insertions_file=None, samtools_version=None, varscan_version=None): |
28 self.ofh = open("process_log.txt", "w") | 29 self.ofh = open("process_log.txt", "w") |
29 | 30 |
30 self.ofh.write("amr_deletions_file: %s\n" % str(amr_deletions_file)) | 31 self.ofh.write("amr_deletions_file: %s\n" % str(amr_deletions_file)) |
31 self.ofh.write("amr_matrix_files: %s\n" % str(amr_matrix_files)) | 32 self.ofh.write("amr_matrix_files: %s\n" % str(amr_matrix_files)) |
40 self.ofh.write("contig_coverage_file: %s\n" % str(contig_coverage_file)) | 41 self.ofh.write("contig_coverage_file: %s\n" % str(contig_coverage_file)) |
41 self.ofh.write("dbkey: %s\n" % str(dbkey)) | 42 self.ofh.write("dbkey: %s\n" % str(dbkey)) |
42 self.ofh.write("dnadiff_snps_file: %s\n" % str(dnadiff_snps_file)) | 43 self.ofh.write("dnadiff_snps_file: %s\n" % str(dnadiff_snps_file)) |
43 self.ofh.write("dnadiff_version: %s\n" % str(dnadiff_version)) | 44 self.ofh.write("dnadiff_version: %s\n" % str(dnadiff_version)) |
44 self.ofh.write("errors_file: %s\n" % str(errors_file)) | 45 self.ofh.write("errors_file: %s\n" % str(errors_file)) |
45 self.ofh.write("fastq_file: %s\n" % str(fastq_file)) | |
46 self.ofh.write("feature_bed_files: %s\n" % str(feature_bed_files)) | 46 self.ofh.write("feature_bed_files: %s\n" % str(feature_bed_files)) |
47 self.ofh.write("feature_png_files: %s\n" % str(feature_png_files)) | 47 self.ofh.write("feature_png_files: %s\n" % str(feature_png_files)) |
48 self.ofh.write("flye_assembly_info_file: %s\n" % str(flye_assembly_info_file)) | 48 self.ofh.write("flye_assembly_info_file: %s\n" % str(flye_assembly_info_file)) |
49 self.ofh.write("gzipped: %s\n" % str(gzipped)) | 49 self.ofh.write("gzipped: %s\n" % str(gzipped)) |
50 self.ofh.write("genome_insertions_file: %s\n" % str(genome_insertions_file)) | 50 self.ofh.write("genome_insertions_file: %s\n" % str(genome_insertions_file)) |
51 self.ofh.write("illumina_forward_read_file: %s\n" % str(illumina_forward_read_file)) | |
52 self.ofh.write("illumina_reverse_read_file: %s\n" % str(illumina_reverse_read_file)) | |
51 self.ofh.write("kraken2_report_file: %s\n" % str(kraken2_report_file)) | 53 self.ofh.write("kraken2_report_file: %s\n" % str(kraken2_report_file)) |
52 self.ofh.write("kraken2_version: %s\n" % str(kraken2_version)) | 54 self.ofh.write("kraken2_version: %s\n" % str(kraken2_version)) |
53 self.ofh.write("minimap2_version: %s\n" % str(minimap2_version)) | 55 self.ofh.write("minimap2_version: %s\n" % str(minimap2_version)) |
54 self.ofh.write("mutation_regions_bed_file: %s\n" % str(mutation_regions_bed_file)) | 56 self.ofh.write("mutation_regions_bed_file: %s\n" % str(mutation_regions_bed_file)) |
55 self.ofh.write("mutation_regions_tsv_files: %s\n" % str(mutation_regions_tsv_files)) | 57 self.ofh.write("mutation_regions_tsv_files: %s\n" % str(mutation_regions_tsv_files)) |
58 self.ofh.write("ont_file: %s\n" % str(ont_file)) | |
56 self.ofh.write("pima_css: %s\n" % str(pima_css)) | 59 self.ofh.write("pima_css: %s\n" % str(pima_css)) |
57 self.ofh.write("plasmids_file: %s\n" % str(plasmids_file)) | 60 self.ofh.write("plasmids_file: %s\n" % str(plasmids_file)) |
58 self.ofh.write("quast_report_file: %s\n" % str(quast_report_file)) | 61 self.ofh.write("quast_report_file: %s\n" % str(quast_report_file)) |
59 self.ofh.write("read_type: %s\n" % str(read_type)) | 62 self.ofh.write("read_type: %s\n" % str(read_type)) |
60 self.ofh.write("reference_insertions_file: %s\n" % str(reference_insertions_file)) | 63 self.ofh.write("reference_insertions_file: %s\n" % str(reference_insertions_file)) |
103 self.feature_bed_files = feature_bed_files | 106 self.feature_bed_files = feature_bed_files |
104 self.feature_png_files = feature_png_files | 107 self.feature_png_files = feature_png_files |
105 self.flye_assembly_info_file = flye_assembly_info_file | 108 self.flye_assembly_info_file = flye_assembly_info_file |
106 self.gzipped = gzipped | 109 self.gzipped = gzipped |
107 self.genome_insertions_file = genome_insertions_file | 110 self.genome_insertions_file = genome_insertions_file |
111 self.illumina_forward_read_file = illumina_forward_read_file | |
112 self.illumina_reverse_read_file = illumina_reverse_read_file | |
108 self.kraken2_report_file = kraken2_report_file | 113 self.kraken2_report_file = kraken2_report_file |
109 if kraken2_version is None: | 114 if kraken2_version is None: |
110 self.kraken2_version = 'kraken2 (version unknown)' | 115 self.kraken2_version = 'kraken2 (version unknown)' |
111 else: | 116 else: |
112 self.kraken2_version = re.sub('_', '.', kraken2_version.rstrip(' _report_')) | 117 self.kraken2_version = re.sub('_', '.', kraken2_version.rstrip(' _report_')) |
172 self.contig_alignment = pandas.Series(dtype=object) | 177 self.contig_alignment = pandas.Series(dtype=object) |
173 | 178 |
174 # Values | 179 # Values |
175 self.assembly_size = 0 | 180 self.assembly_size = 0 |
176 self.contig_info = None | 181 self.contig_info = None |
177 self.did_medaka_ont_assembly = False | |
178 self.feature_hits = pandas.Series(dtype='float64') | 182 self.feature_hits = pandas.Series(dtype='float64') |
179 self.illumina_length_mean = None | 183 self.ont_fast5 = None |
180 self.illumina_read_count = None | 184 self.ont_file = ont_file |
181 self.illumina_bases = None | 185 self.ont_n50 = None |
182 self.ont_bases = None | 186 self.ont_read_count = None |
183 # TODO: should the following be passed as a parameter? | 187 # TODO: should the following be passed as a parameter? |
184 self.ont_coverage_min = 30 | 188 self.ont_coverage_min = 30 |
185 self.ont_fast5 = None | |
186 self.fastq_file = fastq_file | |
187 self.ont_n50 = None | |
188 # TODO: should the following be passed as a parameter? | 189 # TODO: should the following be passed as a parameter? |
189 self.ont_n50_min = 2500 | 190 self.ont_n50_min = 2500 |
191 | |
190 if self.read_type == 'ONT': | 192 if self.read_type == 'ONT': |
191 self.ont_raw_fastq = self.analysis_name | 193 self.ont_raw_fastq = self.analysis_name |
194 self.ont_bases = 0 | |
195 self.illumina_bases = None | |
192 self.illumina_fastq = None | 196 self.illumina_fastq = None |
193 else: | 197 self.illumina_length_mean = None |
198 self.illumina_read_count = None | |
199 else: | |
200 self.illumina_fastq = self.analysis_name | |
201 self.illumina_bases = 0 | |
202 self.illumina_length_mean = 0 | |
203 self.illumina_read_count = 0 | |
204 self.ont_bases = None | |
194 self.ont_raw_fastq = None | 205 self.ont_raw_fastq = None |
195 self.illumina_fastq = self.analysis_name | |
196 self.ont_read_count = None | |
197 | 206 |
198 # Actions | 207 # Actions |
199 self.did_guppy_ont_fast5 = False | 208 self.did_guppy_ont_fast5 = False |
200 self.did_qcat_ont_fastq = False | 209 self.did_qcat_ont_fastq = False |
201 self.ofh.write("self.read_type: %s\n" % str(self.read_type)) | 210 self.ofh.write("self.read_type: %s\n" % str(self.read_type)) |
202 if self.read_type == 'ONT': | 211 if self.read_type == 'ONT': |
203 self.info_ont_fastq(self.fastq_file) | 212 self.info_ont_fastq(self.ont_file) |
204 else: | 213 else: |
205 self.info_illumina_fastq(self.fastq_file) | 214 self.info_illumina_fastq([self.illumina_forward_read_file, self.illumina_reverse_read_file]) |
206 self.load_contig_info() | 215 self.load_contig_info() |
207 | 216 |
208 def run_command(self, command): | 217 def run_command(self, command): |
209 self.ofh.write("\nXXXXXX In run_command, command:\n%s\n\n" % str(command)) | 218 self.ofh.write("\nXXXXXX In run_command, command:\n%s\n\n" % str(command)) |
210 try: | 219 try: |
228 | 237 |
229 def load_contig_info(self): | 238 def load_contig_info(self): |
230 self.contig_info = pandas.Series(dtype=object) | 239 self.contig_info = pandas.Series(dtype=object) |
231 self.contig_info[self.read_type] = pandas.read_csv(self.contig_coverage_file, header=None, index_col=None, sep='\t').sort_values(1, axis=0, ascending=False) | 240 self.contig_info[self.read_type] = pandas.read_csv(self.contig_coverage_file, header=None, index_col=None, sep='\t').sort_values(1, axis=0, ascending=False) |
232 self.contig_info[self.read_type].columns = ['contig', 'size', 'coverage'] | 241 self.contig_info[self.read_type].columns = ['contig', 'size', 'coverage'] |
233 self.mean_coverage = (self.contig_info[self.read_type].iloc[:, 1] * self.contig_info[self.read_type].iloc[:, 2]).sum() / self.contig_info[self.read_type].iloc[:, 1].sum() | 242 mean_coverage = (self.contig_info[self.read_type].iloc[:, 1] * self.contig_info[self.read_type].iloc[:, 2]).sum() / self.contig_info[self.read_type].iloc[:, 1].sum() |
234 if self.mean_coverage <= self.ont_coverage_min: | 243 if mean_coverage <= self.ont_coverage_min: |
235 warning = '%s mean coverage ({:.0f}X) is less than the recommended minimum ({:.0f}X).'.format(self.mean_coverage, self.ont_coverage_min) % self.read_type | 244 warning = '%s mean coverage ({:.0f}X) is less than the recommended minimum ({:.0f}X).'.format(mean_coverage, self.ont_coverage_min) % self.read_type |
236 self.assembly_notes = self.assembly_notes.append(pandas.Series(warning)) | 245 self.assembly_notes = self.assembly_notes.append(pandas.Series(warning)) |
237 # Report if some contigs have low coverage. | 246 # Report if some contigs have low coverage. |
238 low_coverage = self.contig_info[self.read_type].loc[self.contig_info[self.read_type]['coverage'] < self.ont_coverage_min, :] | 247 low_coverage = self.contig_info[self.read_type].loc[self.contig_info[self.read_type]['coverage'] < self.ont_coverage_min, :] |
239 if low_coverage.shape[0] >= 0: | 248 if low_coverage.shape[0] >= 0: |
240 for contig_i in range(low_coverage.shape[0]): | 249 for contig_i in range(low_coverage.shape[0]): |
241 warning = '%s coverage of {:s} ({:.0f}X) is less than the recommended minimum ({:.0f}X).'.format(low_coverage.iloc[contig_i, 0], low_coverage.iloc[contig_i, 2], self.ont_coverage_min) % self.read_type | 250 warning = '%s coverage of {:s} ({:.0f}X) is less than the recommended minimum ({:.0f}X).'.format(low_coverage.iloc[contig_i, 0], low_coverage.iloc[contig_i, 2], self.ont_coverage_min) % self.read_type |
242 self.assembly_notes = self.assembly_notes.append(pandas.Series(warning)) | 251 self.assembly_notes = self.assembly_notes.append(pandas.Series(warning)) |
243 # See if some contigs have anolously low coverage. | 252 # See if some contigs have anonymously low coverage. |
244 fold_coverage = self.contig_info[self.read_type]['coverage'] / self.mean_coverage | 253 fold_coverage = self.contig_info[self.read_type]['coverage'] / mean_coverage |
245 low_coverage = self.contig_info[self.read_type].loc[fold_coverage < 1 / 5, :] | 254 low_coverage = self.contig_info[self.read_type].loc[fold_coverage < 1 / 5, :] |
246 if low_coverage.shape[0] >= 0: | 255 if low_coverage.shape[0] >= 0: |
247 for contig_i in range(low_coverage.shape[0]): | 256 for contig_i in range(low_coverage.shape[0]): |
248 warning = '%s coverage of {:s} ({:.0f}X) is less than 1/5 the mean coverage ({:.0f}X).'.format(low_coverage.iloc[contig_i, 0], low_coverage.iloc[contig_i, 2], self.mean_coverage) % self.read_type | 257 warning = '%s coverage of {:s} ({:.0f}X) is less than 1/5 the mean coverage ({:.0f}X).'.format(low_coverage.iloc[contig_i, 0], low_coverage.iloc[contig_i, 2], mean_coverage) % self.read_type |
249 self.assembly_notes = self.assembly_notes.append(pandas.Series(warning)) | 258 self.assembly_notes = self.assembly_notes.append(pandas.Series(warning)) |
250 | 259 |
251 def load_fasta(self, fasta): | 260 def load_fasta(self, fasta): |
252 sequence = pandas.Series(dtype=object) | 261 sequence = pandas.Series(dtype=object) |
253 for contig in SeqIO.parse(fasta, 'fasta'): | 262 for contig in SeqIO.parse(fasta, 'fasta'): |
255 return sequence | 264 return sequence |
256 | 265 |
257 def load_assembly(self): | 266 def load_assembly(self): |
258 self.assembly = self.load_fasta(self.assembly_fasta_file) | 267 self.assembly = self.load_fasta(self.assembly_fasta_file) |
259 self.num_assembly_contigs = len(self.assembly) | 268 self.num_assembly_contigs = len(self.assembly) |
260 for i in self.assembly: | 269 self.assembly_size = self.format_kmg(sum([len(x) for x in self.assembly]), decimals=1) |
261 self.assembly_size += len(i.seq) | 270 |
262 self.assembly_size = self.format_kmg(self.assembly_size, decimals=1) | 271 def info_illumina_fastq(self, illumina_read_files): |
263 | |
264 def info_illumina_fastq(self, fastq_file): | |
265 self.ofh.write("\nXXXXXX In info_illumina_fastq\n\n") | 272 self.ofh.write("\nXXXXXX In info_illumina_fastq\n\n") |
266 if self.illumina_length_mean is None: | |
267 return | |
268 if self.gzipped: | 273 if self.gzipped: |
269 opener = 'gunzip -c' | 274 opener = 'gunzip -c' |
270 else: | 275 else: |
271 opener = 'cat' | 276 opener = 'cat' |
272 command = ' '.join([opener, | 277 for fastq_file in illumina_read_files: |
273 fastq_file, | 278 command = ' '.join([opener, |
274 '| awk \'{getline;s += length($1);getline;getline;}END{print s/(NR/4)"\t"(NR/4)"\t"s}\'']) | 279 fastq_file, |
275 output = self.run_command(command) | 280 '| awk \'{getline;s += length($1);getline;getline;}END{print s/(NR/4)"\t"(NR/4)"\t"s}\'']) |
276 self.ofh.write("output:\n%s\n" % str(output)) | 281 output = self.run_command(command) |
277 self.ofh.write("re.split('\\t', self.run_command(command)[0]:\n%s\n" % str(re.split('\\t', self.run_command(command)[0]))) | 282 self.ofh.write("output:\n%s\n" % str(output)) |
278 values = [] | 283 self.ofh.write("re.split('\\t', self.run_command(command)[0]:\n%s\n" % str(re.split('\\t', self.run_command(command)[0]))) |
279 for i in re.split('\\t', self.run_command(command)[0]): | 284 values = [] |
280 if i == '': | 285 for i in re.split('\\t', self.run_command(command)[0]): |
281 values.append(float('nan')) | 286 if i == '': |
282 else: | 287 values.append(float('nan')) |
283 values.append(float(i)) | 288 else: |
284 self.ofh.write("values:\n%s\n" % str(values)) | 289 values.append(float(i)) |
285 self.ofh.write("values[0]:\n%s\n" % str(values[0])) | 290 self.ofh.write("values:\n%s\n" % str(values)) |
286 self.illumina_length_mean += values[0] | 291 self.ofh.write("values[0]:\n%s\n" % str(values[0])) |
287 self.ofh.write("values[1]:\n%s\n" % str(values[1])) | 292 self.illumina_length_mean += values[0] |
288 self.illumina_read_count += int(values[1]) | 293 self.ofh.write("values[1]:\n%s\n" % str(values[1])) |
289 self.ofh.write("values[2]:\n%s\n" % str(values[2])) | 294 self.illumina_read_count += int(values[1]) |
290 self.illumina_bases += int(values[2]) | 295 self.ofh.write("values[2]:\n%s\n" % str(values[2])) |
291 self.illumina_length_mean /= 1 | 296 self.illumina_bases += int(values[2]) |
297 self.illumina_length_mean /= 2 | |
292 self.illumina_bases = self.format_kmg(self.illumina_bases, decimals=1) | 298 self.illumina_bases = self.format_kmg(self.illumina_bases, decimals=1) |
293 | 299 |
294 def start_doc(self): | 300 def start_doc(self): |
295 header_text = 'Analysis of ' + self.analysis_name | 301 header_text = 'Analysis of ' + self.analysis_name |
296 self.doc = MdUtils(file_name=self.report_md, title=header_text) | 302 self.doc = MdUtils(file_name=self.report_md, title=header_text) |
452 else: | 458 else: |
453 return string | 459 return string |
454 | 460 |
455 def add_contig_info(self): | 461 def add_contig_info(self): |
456 self.ofh.write("\nXXXXXX In add_contig_info\n\n") | 462 self.ofh.write("\nXXXXXX In add_contig_info\n\n") |
457 if self.contig_info is None: | 463 if self.contig_info is None or self.read_type not in self.contig_info.index: |
458 return | 464 return |
459 for method in ['ONT', 'Illumina']: | 465 self.doc.new_line() |
460 if method not in self.contig_info.index: | 466 self.doc.new_header(2, 'Assembly coverage by ' + self.read_type) |
461 continue | 467 Table_List = ["Contig", "Length (bp)", "Coverage (X)"] |
462 self.doc.new_line() | 468 formatted = self.contig_info[self.read_type].copy() |
463 self.doc.new_header(2, 'Assembly coverage by ' + method) | 469 formatted.iloc[:, 1] = formatted.iloc[:, 1].apply(lambda x: '{:,}'.format(x)) |
464 Table_List = ["Contig", "Length (bp)", "Coverage (X)"] | 470 for i in range(self.contig_info[self.read_type].shape[0]): |
465 formatted = self.contig_info[method].copy() | 471 Table_List = Table_List + formatted.iloc[i, :].values.tolist() |
466 formatted.iloc[:, 1] = formatted.iloc[:, 1].apply(lambda x: '{:,}'.format(x)) | 472 row_count = int(len(Table_List) / 3) |
467 for i in range(self.contig_info[method].shape[0]): | 473 self.doc.new_table(columns=3, rows=row_count, text=Table_List, text_align='left') |
468 Table_List = Table_List + formatted.iloc[i, :].values.tolist() | |
469 row_count = int(len(Table_List) / 3) | |
470 self.doc.new_table(columns=3, rows=row_count, text=Table_List, text_align='left') | |
471 | 474 |
472 def add_assembly_notes(self): | 475 def add_assembly_notes(self): |
473 self.ofh.write("\nXXXXXX In add_assembly_notes\n\n") | 476 self.ofh.write("\nXXXXXX In add_assembly_notes\n\n") |
474 if len(self.assembly_notes) == 0: | 477 if len(self.assembly_notes) == 0: |
475 return | 478 return |
792 if self.did_guppy_ont_fast5: | 795 if self.did_guppy_ont_fast5: |
793 methods += ['ONT reads were basecalled using guppy'] | 796 methods += ['ONT reads were basecalled using guppy'] |
794 if self.did_qcat_ont_fastq: | 797 if self.did_qcat_ont_fastq: |
795 methods += ['ONT reads were demultiplexed and trimmed using qcat'] | 798 methods += ['ONT reads were demultiplexed and trimmed using qcat'] |
796 self.methods[self.basecalling_methods_title] = pandas.Series(methods) | 799 self.methods[self.basecalling_methods_title] = pandas.Series(methods) |
797 # self.add_illumina_library_information() | 800 self.add_illumina_library_information() |
801 self.add_assembly_information() | |
798 self.add_contig_info() | 802 self.add_contig_info() |
799 self.evaluate_assembly() | 803 self.evaluate_assembly() |
800 self.add_assembly_information() | |
801 if self.assembler_version is not None: | 804 if self.assembler_version is not None: |
802 if self.read_type == 'ONT': | 805 if self.read_type == 'ONT': |
803 method = 'ONT reads were assembled using %s' % self.assembler_version | 806 method = 'ONT reads were assembled using %s' % self.assembler_version |
804 self.methods[self.assembly_methods_title] = self.methods[self.assembly_methods_title].append(pandas.Series(method)) | 807 self.methods[self.assembly_methods_title] = self.methods[self.assembly_methods_title].append(pandas.Series(method)) |
805 # Pull in the assembly summary and look at the coverage. | 808 # Pull in the assembly summary and look at the coverage. |
810 open_contig_ids = open_contigs.index.values | 813 open_contig_ids = open_contigs.index.values |
811 warning = 'Flye reported {:d} open contigs ({:s}); assembly may be incomplete.'.format(open_contigs.shape[0], ', '.join(open_contig_ids)) | 814 warning = 'Flye reported {:d} open contigs ({:s}); assembly may be incomplete.'.format(open_contigs.shape[0], ', '.join(open_contig_ids)) |
812 self.assembly_notes = self.assembly_notes.append(pandas.Series(warning)) | 815 self.assembly_notes = self.assembly_notes.append(pandas.Series(warning)) |
813 else: | 816 else: |
814 method = 'Illumina reads were assembled using %s' % self.assembler_version | 817 method = 'Illumina reads were assembled using %s' % self.assembler_version |
815 if self.did_medaka_ont_assembly: | 818 method = 'The genome assembly was polished using ONT reads and medaka.' |
816 method = 'the genome assembly was polished using ont reads and medaka.' | 819 self.methods[self.assembly_methods_title] = self.methods[self.assembly_methods_title].append(pandas.series(method)) |
817 self.methods[self.assembly_methods_title] = self.methods[self.assembly_methods_title].append(pandas.series(method)) | |
818 self.add_assembly_notes() | 820 self.add_assembly_notes() |
819 | 821 |
820 def make_tex(self): | 822 def make_tex(self): |
821 self.doc.new_table_of_contents(table_title='detailed run information', depth=2, marker="tableofcontents") | 823 self.doc.new_table_of_contents(table_title='detailed run information', depth=2, marker="tableofcontents") |
822 text = self.doc.file_data_text | 824 text = self.doc.file_data_text |
867 parser.add_argument('--contig_coverage_file', action='store', dest='contig_coverage_file', help='Contig coverage TSV file') | 869 parser.add_argument('--contig_coverage_file', action='store', dest='contig_coverage_file', help='Contig coverage TSV file') |
868 parser.add_argument('--dbkey', action='store', dest='dbkey', help='Reference genome identifier') | 870 parser.add_argument('--dbkey', action='store', dest='dbkey', help='Reference genome identifier') |
869 parser.add_argument('--dnadiff_snps_file', action='store', dest='dnadiff_snps_file', help='DNAdiff snps tabular file') | 871 parser.add_argument('--dnadiff_snps_file', action='store', dest='dnadiff_snps_file', help='DNAdiff snps tabular file') |
870 parser.add_argument('--dnadiff_version', action='store', dest='dnadiff_version', default=None, help='DNAdiff version string') | 872 parser.add_argument('--dnadiff_version', action='store', dest='dnadiff_version', default=None, help='DNAdiff version string') |
871 parser.add_argument('--errors_file', action='store', dest='errors_file', default=None, help='AMR mutations errors encountered txt file') | 873 parser.add_argument('--errors_file', action='store', dest='errors_file', default=None, help='AMR mutations errors encountered txt file') |
872 parser.add_argument('--fastq_file', action='store', dest='fastq_file', help='Input sample') | |
873 parser.add_argument('--feature_bed_dir', action='store', dest='feature_bed_dir', help='Directory of best feature hits bed files') | 874 parser.add_argument('--feature_bed_dir', action='store', dest='feature_bed_dir', help='Directory of best feature hits bed files') |
874 parser.add_argument('--feature_png_dir', action='store', dest='feature_png_dir', help='Directory of best feature hits png files') | 875 parser.add_argument('--feature_png_dir', action='store', dest='feature_png_dir', help='Directory of best feature hits png files') |
875 parser.add_argument('--flye_assembly_info_file', action='store', dest='flye_assembly_info_file', default=None, help='Flye assembly info tabular file') | 876 parser.add_argument('--flye_assembly_info_file', action='store', dest='flye_assembly_info_file', default=None, help='Flye assembly info tabular file') |
876 parser.add_argument('--genome_insertions_file', action='store', dest='genome_insertions_file', help='Genome insertions BED file') | 877 parser.add_argument('--genome_insertions_file', action='store', dest='genome_insertions_file', help='Genome insertions BED file') |
877 parser.add_argument('--gzipped', action='store_true', dest='gzipped', default=False, help='Input sample is gzipped') | 878 parser.add_argument('--gzipped', action='store_true', dest='gzipped', default=False, help='Sample(s) is/are gzipped') |
879 parser.add_argument('--illumina_forward_read_file', action='store', dest='illumina_forward_read_file', help='Illumina forward read file') | |
880 parser.add_argument('--illumina_reverse_read_file', action='store', dest='illumina_reverse_read_file', help='Illumina reverse read file') | |
878 parser.add_argument('--kraken2_report_file', action='store', dest='kraken2_report_file', default=None, help='kraken2 report file') | 881 parser.add_argument('--kraken2_report_file', action='store', dest='kraken2_report_file', default=None, help='kraken2 report file') |
879 parser.add_argument('--kraken2_version', action='store', dest='kraken2_version', default=None, help='kraken2 version string') | 882 parser.add_argument('--kraken2_version', action='store', dest='kraken2_version', default=None, help='kraken2 version string') |
880 parser.add_argument('--minimap2_version', action='store', dest='minimap2_version', default=None, help='minimap2 version string') | 883 parser.add_argument('--minimap2_version', action='store', dest='minimap2_version', default=None, help='minimap2 version string') |
881 parser.add_argument('--mutation_regions_bed_file', action='store', dest='mutation_regions_bed_file', help='AMR mutation regions BRD file') | 884 parser.add_argument('--mutation_regions_bed_file', action='store', dest='mutation_regions_bed_file', help='AMR mutation regions BRD file') |
882 parser.add_argument('--mutation_regions_dir', action='store', dest='mutation_regions_dir', help='Directory of mutation regions TSV files') | 885 parser.add_argument('--mutation_regions_dir', action='store', dest='mutation_regions_dir', help='Directory of mutation regions TSV files') |
886 parser.add_argument('--ont_file', action='store', dest='ont_file', help='ONT single read file') | |
883 parser.add_argument('--pima_css', action='store', dest='pima_css', help='PIMA css stypesheet') | 887 parser.add_argument('--pima_css', action='store', dest='pima_css', help='PIMA css stypesheet') |
884 parser.add_argument('--plasmids_file', action='store', dest='plasmids_file', default=None, help='pChunks plasmids TSV file') | 888 parser.add_argument('--plasmids_file', action='store', dest='plasmids_file', default=None, help='pChunks plasmids TSV file') |
885 parser.add_argument('--quast_report_file', action='store', dest='quast_report_file', help='Quast report tabular file') | 889 parser.add_argument('--quast_report_file', action='store', dest='quast_report_file', help='Quast report tabular file') |
886 parser.add_argument('--read_type', action='store', dest='read_type', help='Sample read type (ONT or Illumina)') | 890 parser.add_argument('--read_type', action='store', dest='read_type', help='Sample read type (ONT or Illumina)') |
887 parser.add_argument('--reference_insertions_file', action='store', dest='reference_insertions_file', help='Reference insertions BED file') | 891 parser.add_argument('--reference_insertions_file', action='store', dest='reference_insertions_file', help='Reference insertions BED file') |
929 args.contig_coverage_file, | 933 args.contig_coverage_file, |
930 args.dbkey, | 934 args.dbkey, |
931 args.dnadiff_snps_file, | 935 args.dnadiff_snps_file, |
932 args.dnadiff_version, | 936 args.dnadiff_version, |
933 args.errors_file, | 937 args.errors_file, |
934 args.fastq_file, | |
935 feature_bed_files, | 938 feature_bed_files, |
936 feature_png_files, | 939 feature_png_files, |
937 args.flye_assembly_info_file, | 940 args.flye_assembly_info_file, |
938 args.genome_insertions_file, | 941 args.genome_insertions_file, |
939 args.gzipped, | 942 args.gzipped, |
943 args.illumina_forward_read_file, | |
944 args.illumina_reverse_read_file, | |
940 args.kraken2_report_file, | 945 args.kraken2_report_file, |
941 args.kraken2_version, | 946 args.kraken2_version, |
942 args.minimap2_version, | 947 args.minimap2_version, |
943 args.mutation_regions_bed_file, | 948 args.mutation_regions_bed_file, |
944 mutation_regions_files, | 949 mutation_regions_files, |
950 args.ont_file, | |
945 args.pima_css, | 951 args.pima_css, |
946 args.plasmids_file, | 952 args.plasmids_file, |
947 args.quast_report_file, | 953 args.quast_report_file, |
948 args.read_type, | 954 args.read_type, |
949 args.reference_insertions_file, | 955 args.reference_insertions_file, |