Mercurial > repos > greg > pima_report
comparison pima_report.py @ 2:9cb62054a87a draft
Uploaded
author | greg |
---|---|
date | Thu, 09 Mar 2023 16:26:29 +0000 |
parents | 67d0939b56b0 |
children | b13d4c14caaa |
comparison
equal
deleted
inserted
replaced
1:67d0939b56b0 | 2:9cb62054a87a |
---|---|
14 | 14 |
15 | 15 |
16 class PimaReport: | 16 class PimaReport: |
17 | 17 |
18 def __init__(self, analysis_name=None, amr_deletions_file=None, amr_matrix_files=None, assembly_fasta_file=None, | 18 def __init__(self, analysis_name=None, amr_deletions_file=None, amr_matrix_files=None, assembly_fasta_file=None, |
19 assembly_name=None, compute_sequence_length_file=None, contig_coverage_file=None, dbkey=None, | 19 assembly_name=None, blastn_version=None, compute_sequence_length_file=None, contig_coverage_file=None, |
20 dnadiff_snps_file=None, feature_bed_files=None, feature_png_files=None, flye_assembly_info_file=None, | 20 dbkey=None, dnadiff_snps_file=None, dnadiff_version=None, feature_bed_files=None, feature_png_files=None, |
21 flye_version=None, genome_insertions_file=None, gzipped=None, illumina_fastq_file=None, | 21 flye_assembly_info_file=None, flye_version=None, genome_insertions_file=None, gzipped=None, |
22 mutation_regions_bed_file=None, mutation_regions_tsv_files=None, pima_css=None, plasmids_file=None, | 22 illumina_fastq_file=None, kraken2_report_file=None, kraken2_version=None, mutation_regions_bed_file=None, |
23 reference_insertions_file=None): | 23 mutation_regions_tsv_files=None, pima_css=None, plasmids_file=None, reference_insertions_file=None): |
24 self.ofh = open("process_log.txt", "w") | 24 self.ofh = open("process_log.txt", "w") |
25 | 25 |
26 self.ofh.write("amr_deletions_file: %s\n" % str(amr_deletions_file)) | 26 self.ofh.write("amr_deletions_file: %s\n" % str(amr_deletions_file)) |
27 self.ofh.write("amr_matrix_files: %s\n" % str(amr_matrix_files)) | 27 self.ofh.write("amr_matrix_files: %s\n" % str(amr_matrix_files)) |
28 self.ofh.write("analysis_name: %s\n" % str(analysis_name)) | 28 self.ofh.write("analysis_name: %s\n" % str(analysis_name)) |
29 self.ofh.write("assembly_fasta_file: %s\n" % str(assembly_fasta_file)) | 29 self.ofh.write("assembly_fasta_file: %s\n" % str(assembly_fasta_file)) |
30 self.ofh.write("assembly_name: %s\n" % str(assembly_name)) | 30 self.ofh.write("assembly_name: %s\n" % str(assembly_name)) |
31 self.ofh.write("blastn_version: %s\n" % str(blastn_version)) | |
31 self.ofh.write("compute_sequence_length_file: %s\n" % str(compute_sequence_length_file)) | 32 self.ofh.write("compute_sequence_length_file: %s\n" % str(compute_sequence_length_file)) |
32 self.ofh.write("contig_coverage_file: %s\n" % str(contig_coverage_file)) | 33 self.ofh.write("contig_coverage_file: %s\n" % str(contig_coverage_file)) |
33 self.ofh.write("dbkey: %s\n" % str(dbkey)) | 34 self.ofh.write("dbkey: %s\n" % str(dbkey)) |
34 self.ofh.write("dnadiff_snps_file: %s\n" % str(dnadiff_snps_file)) | 35 self.ofh.write("dnadiff_snps_file: %s\n" % str(dnadiff_snps_file)) |
36 self.ofh.write("dnadiff_version: %s\n" % str(dnadiff_version)) | |
35 self.ofh.write("feature_bed_files: %s\n" % str(feature_bed_files)) | 37 self.ofh.write("feature_bed_files: %s\n" % str(feature_bed_files)) |
36 self.ofh.write("feature_png_files: %s\n" % str(feature_png_files)) | 38 self.ofh.write("feature_png_files: %s\n" % str(feature_png_files)) |
37 self.ofh.write("flye_assembly_info_file: %s\n" % str(flye_assembly_info_file)) | 39 self.ofh.write("flye_assembly_info_file: %s\n" % str(flye_assembly_info_file)) |
38 self.ofh.write("flye_version: %s\n" % str(flye_version)) | 40 self.ofh.write("flye_version: %s\n" % str(flye_version)) |
39 self.ofh.write("gzipped: %s\n" % str(gzipped)) | 41 self.ofh.write("gzipped: %s\n" % str(gzipped)) |
40 self.ofh.write("genome_insertions_file: %s\n" % str(genome_insertions_file)) | 42 self.ofh.write("genome_insertions_file: %s\n" % str(genome_insertions_file)) |
41 self.ofh.write("illumina_fastq_file: %s\n" % str(illumina_fastq_file)) | 43 self.ofh.write("illumina_fastq_file: %s\n" % str(illumina_fastq_file)) |
44 self.ofh.write("kraken2_report_file: %s\n" % str(kraken2_report_file)) | |
45 self.ofh.write("kraken2_version: %s\n" % str(kraken2_version)) | |
42 self.ofh.write("mutation_regions_bed_file: %s\n" % str(mutation_regions_bed_file)) | 46 self.ofh.write("mutation_regions_bed_file: %s\n" % str(mutation_regions_bed_file)) |
43 self.ofh.write("mutation_regions_tsv_files: %s\n" % str(mutation_regions_tsv_files)) | 47 self.ofh.write("mutation_regions_tsv_files: %s\n" % str(mutation_regions_tsv_files)) |
44 self.ofh.write("pima_css: %s\n" % str(pima_css)) | 48 self.ofh.write("pima_css: %s\n" % str(pima_css)) |
45 self.ofh.write("plasmids_file: %s\n" % str(plasmids_file)) | 49 self.ofh.write("plasmids_file: %s\n" % str(plasmids_file)) |
46 # self.ofh.write("reference_genome: %s\n" % str(reference_genome)) | 50 # self.ofh.write("reference_genome: %s\n" % str(reference_genome)) |
54 self.amr_deletions_file = amr_deletions_file | 58 self.amr_deletions_file = amr_deletions_file |
55 self.amr_matrix_files = amr_matrix_files | 59 self.amr_matrix_files = amr_matrix_files |
56 self.analysis_name = analysis_name | 60 self.analysis_name = analysis_name |
57 self.assembly_fasta_file = assembly_fasta_file | 61 self.assembly_fasta_file = assembly_fasta_file |
58 self.assembly_name = assembly_name | 62 self.assembly_name = assembly_name |
63 self.blastn_version = blastn_version | |
59 self.compute_sequence_length_file = compute_sequence_length_file | 64 self.compute_sequence_length_file = compute_sequence_length_file |
60 self.contig_coverage_file = contig_coverage_file | 65 self.contig_coverage_file = contig_coverage_file |
61 self.dbkey = dbkey | 66 self.dbkey = dbkey |
62 self.dnadiff_snps_file = dnadiff_snps_file | 67 self.dnadiff_snps_file = dnadiff_snps_file |
68 self.dnadiff_version = dnadiff_version | |
63 self.feature_bed_files = feature_bed_files | 69 self.feature_bed_files = feature_bed_files |
64 self.feature_png_files = feature_png_files | 70 self.feature_png_files = feature_png_files |
65 self.flye_assembly_info_file = flye_assembly_info_file | 71 self.flye_assembly_info_file = flye_assembly_info_file |
66 self.flye_version = flye_version | 72 self.flye_version = flye_version |
67 self.gzipped = gzipped | 73 self.gzipped = gzipped |
68 self.genome_insertions_file = genome_insertions_file | 74 self.genome_insertions_file = genome_insertions_file |
69 self.illumina_fastq_file = illumina_fastq_file | 75 self.illumina_fastq_file = illumina_fastq_file |
76 self.kraken2_report_file = kraken2_report_file | |
77 self.kraken2_version = kraken2_version | |
70 self.mutation_regions_bed_file = mutation_regions_bed_file | 78 self.mutation_regions_bed_file = mutation_regions_bed_file |
71 self.mutation_regions_tsv_files = mutation_regions_tsv_files | 79 self.mutation_regions_tsv_files = mutation_regions_tsv_files |
72 self.read_type = 'Illumina' | 80 self.read_type = 'Illumina' |
73 self.ont_bases = None | 81 self.ont_bases = None |
74 self.ont_n50 = None | 82 self.ont_n50 = None |
99 self.plasmid_title = 'Plasmid annotation' | 107 self.plasmid_title = 'Plasmid annotation' |
100 self.reference_methods_title = 'Reference comparison' | 108 self.reference_methods_title = 'Reference comparison' |
101 self.snp_indel_title = 'SNPs and small indels' | 109 self.snp_indel_title = 'SNPs and small indels' |
102 self.summary_title = 'Analysis of %s' % analysis_name | 110 self.summary_title = 'Analysis of %s' % analysis_name |
103 | 111 |
112 # Contamination | |
113 self.kraken_fracs = pandas.Series(dtype=object) | |
114 | |
104 # Methods | 115 # Methods |
105 self.methods = pandas.Series(dtype='float64') | 116 self.methods = pandas.Series(dtype='float64') |
106 self.methods[self.contamination_methods_title] = pandas.Series(dtype='float64') | 117 self.methods[self.contamination_methods_title] = pandas.Series(dtype='float64') |
107 self.methods[self.assembly_methods_title] = pandas.Series(dtype='float64') | 118 self.methods[self.assembly_methods_title] = pandas.Series(dtype='float64') |
108 self.methods[self.reference_methods_title] = pandas.Series(dtype='float64') | 119 self.methods[self.reference_methods_title] = pandas.Series(dtype='float64') |
109 self.methods[self.mutation_methods_title] = pandas.Series(dtype='float64') | 120 self.methods[self.mutation_methods_title] = pandas.Series(dtype='float64') |
110 self.methods[self.feature_methods_title] = pandas.Series(dtype='float64') | 121 self.methods[self.feature_methods_title] = pandas.Series(dtype='float64') |
111 self.methods[self.plasmid_methods_title] = pandas.Series(dtype='float64') | 122 self.methods[self.plasmid_methods_title] = pandas.Series(dtype='float64') |
112 | |
113 # Contamination | |
114 self.kraken_fracs = pandas.Series(dtype=object) | |
115 | 123 |
116 # Notes | 124 # Notes |
117 self.assembly_notes = pandas.Series(dtype=object) | 125 self.assembly_notes = pandas.Series(dtype=object) |
118 self.alignment_notes = pandas.Series(dtype=object) | 126 self.alignment_notes = pandas.Series(dtype=object) |
119 self.contig_alignment = pandas.Series(dtype=object) | 127 self.contig_alignment = pandas.Series(dtype=object) |
408 for note in self.assembly_notes: | 416 for note in self.assembly_notes: |
409 self.doc.new_line(note) | 417 self.doc.new_line(note) |
410 | 418 |
411 def add_contamination(self): | 419 def add_contamination(self): |
412 self.ofh.write("\nXXXXXX In add_contamination\n\n") | 420 self.ofh.write("\nXXXXXX In add_contamination\n\n") |
413 if len(self.kraken_fracs) == 0: | 421 if self.kraken2_report_file is None: |
414 return | 422 return |
423 # Read in the Kraken fractions and pull out the useful parts | |
424 self.kraken_fracs = pandas.read_csv(self.kraken_report_file, delimiter='\t', header=None) | |
425 self.kraken_fracs.index = self.kraken_fracs.iloc[:, 4].values | |
426 self.kraken_fracs = self.kraken_fracs.loc[self.kraken_fracs.iloc[:, 3].str.match('[UG]1?'), :] | |
427 self.kraken_fracs = self.kraken_fracs.loc[(self.kraken_fracs.iloc[:, 0] >= 1) | (self.kraken_fracs.iloc[:, 3] == 'U'), :] | |
428 self.kraken_fracs = self.kraken_fracs.iloc[:, [0, 1, 3, 5]] | |
429 self.kraken_fracs.columns = ['Fraction', 'Reads', 'Level', 'Taxa'] | |
430 self.kraken_fracs['Fraction'] = (self.kraken_fracs['Fraction'] / 100).round(4) | |
431 self.kraken_fracs.sort_values(by='Fraction', inplace=True, ascending=False) | |
432 self.kraken_fracs['Taxa'] = self.kraken_fracs['Taxa'].str.lstrip() | |
415 self.doc.new_line() | 433 self.doc.new_line() |
416 self.doc.new_header(2, 'Contamination check') | 434 self.doc.new_header(2, 'Contamination check') |
417 for read_type, kraken_fracs in self.kraken_fracs.iteritems(): | 435 for kraken_fracs in self.kraken_fracs.iteritems(): |
418 self.doc.new_line(read_type + ' classifications') | 436 self.doc.new_line(self.read_type + ' classifications') |
419 self.doc.new_line() | 437 self.doc.new_line() |
420 Table_List = ["Percent of Reads", "Reads", "Level", "Label"] | 438 Table_List = ["Percent of Reads", "Reads", "Level", "Label"] |
421 for index, row in kraken_fracs.iterrows(): | 439 for index, row in kraken_fracs.iterrows(): |
422 Table_List = Table_List + row.tolist() | 440 Table_List = Table_List + row.tolist() |
423 row_count = int(len(Table_List) / 4) | 441 row_count = int(len(Table_List) / 4) |
424 self.doc.new_table(columns=4, rows=row_count, text=Table_List, text_align='left') | 442 self.doc.new_table(columns=4, rows=row_count, text=Table_List, text_align='left') |
425 if self.contamination_methods_title not in self.methods: | 443 if self.contamination_methods_title not in self.methods: |
426 self.methods[self.contamination_methods_title] = '' | 444 self.methods[self.contamination_methods_title] = '' |
427 method = 'Kraken2 was used to assign the raw reads into taxa.' | 445 method = 'Kraken2 version %s was used to assign the raw reads into taxa.' % self.kraken2_version |
428 self.methods[self.contamination_methods_title] = self.methods[self.contamination_methods_title].append(pandas.Series(method)) | 446 self.methods[self.contamination_methods_title] = self.methods[self.contamination_methods_title].append(pandas.Series(method)) |
429 | 447 |
430 def add_alignment(self): | 448 def add_alignment(self): |
431 self.ofh.write("\nXXXXXX In add_alignment\n\n") | 449 self.ofh.write("\nXXXXXX In add_alignment\n\n") |
432 # TODO: implement the draw_circos function for this. | 450 # TODO: implement the draw_circos function for this. |
459 self.doc.new_line() | 477 self.doc.new_line() |
460 self.doc.new_header(level=3, title=contig_title) | 478 self.doc.new_header(level=3, title=contig_title) |
461 self.doc.new_line(self.doc.new_inline_image(text='contig_title', path=os.path.abspath(image_png))) | 479 self.doc.new_line(self.doc.new_inline_image(text='contig_title', path=os.path.abspath(image_png))) |
462 self.doc.new_line('<div style="page-break-after: always;"></div>') | 480 self.doc.new_line('<div style="page-break-after: always;"></div>') |
463 self.doc.new_line() | 481 self.doc.new_line() |
464 method = 'The genome assembly was aligned against the reference sequencing using dnadiff.' | 482 method = 'The genome assembly was aligned against the reference sequencing using dnadiff version %s.' % self.dnadiff_version |
465 self.methods[self.reference_methods_title] = self.methods[self.reference_methods_title].append(pandas.Series(method)) | 483 self.methods[self.reference_methods_title] = self.methods[self.reference_methods_title].append(pandas.Series(method)) |
466 | 484 |
467 def add_features(self): | 485 def add_features(self): |
468 self.ofh.write("\nXXXXXX In add_features\n\n") | 486 self.ofh.write("\nXXXXXX In add_features\n\n") |
469 if len(self.feature_bed_files) == 0: | 487 if len(self.feature_bed_files) == 0: |
498 for i in range(contig_features.shape[0]): | 516 for i in range(contig_features.shape[0]): |
499 self.ofh.write("i: %s\n" % str(i)) | 517 self.ofh.write("i: %s\n" % str(i)) |
500 feature = contig_features.iloc[i, :].copy(deep=True) | 518 feature = contig_features.iloc[i, :].copy(deep=True) |
501 self.ofh.write("feature: %s\n" % str(feature)) | 519 self.ofh.write("feature: %s\n" % str(feature)) |
502 feature[4] = '{:.3f}'.format(feature[4]) | 520 feature[4] = '{:.3f}'.format(feature[4]) |
503 # FIXME: Uncommenting the following line (which is | 521 self.ofh.write("feature[1:].values.tolist(): %s\n" % str(feature[1:].values.tolist())) |
504 # https://github.com/appliedbinf/pima_md/blob/main/MarkdownReport.py#L317) | 522 Table_List = Table_List + feature[1:].values.tolist() |
505 # will cause the job to fail with this exception: | |
506 # ValueError: columns * rows is not equal to text length | |
507 # Table_List = Table_List + feature[1:].values.tolist() | |
508 self.ofh.write("Table_List: %s\n" % str(Table_List)) | 523 self.ofh.write("Table_List: %s\n" % str(Table_List)) |
509 row_count = int(len(Table_List) / 5) | 524 row_count = int(len(Table_List) / 5) |
510 self.ofh.write("row_count: %s\n" % str(row_count)) | 525 self.ofh.write("row_count: %s\n" % str(row_count)) |
511 self.doc.new_line() | 526 self.doc.new_line() |
512 self.ofh.write("Before new_table, len(Table_List):: %s\n" % str(len(Table_List))) | 527 self.ofh.write("Before new_table, len(Table_List):: %s\n" % str(len(Table_List))) |
513 self.doc.new_table(columns=5, rows=row_count, text=Table_List, text_align='left') | 528 self.doc.new_table(columns=5, rows=row_count, text=Table_List, text_align='left') |
514 blastn_version = 'The genome assembly was queried for features using blastn.' | 529 if self.blastn_version is not None: |
530 blastn_version = 'The genome assembly was queried for features using blastn version %s.' % self.blastn_version | |
515 bedtools_version = 'Feature hits were clustered using bedtools and the highest scoring hit for each cluster was reported.' | 531 bedtools_version = 'Feature hits were clustered using bedtools and the highest scoring hit for each cluster was reported.' |
516 method = '%s %s' % (blastn_version, bedtools_version) | 532 method = '%s %s' % (blastn_version, bedtools_version) |
517 self.methods[self.feature_methods_title] = self.methods[self.feature_methods_title].append(pandas.Series(method)) | 533 self.methods[self.feature_methods_title] = self.methods[self.feature_methods_title].append(pandas.Series(method)) |
518 | 534 |
519 def add_feature_plots(self): | 535 def add_feature_plots(self): |
579 region_mutation_drugs = pandas.Series(region['drug'] * region_mutations.shape[0], name='DRUG', index=region_mutations.index) | 595 region_mutation_drugs = pandas.Series(region['drug'] * region_mutations.shape[0], name='DRUG', index=region_mutations.index) |
580 region_notes = pandas.Series(region['note'] * region_mutations.shape[0], name='NOTE', index=region_mutations.index) | 596 region_notes = pandas.Series(region['note'] * region_mutations.shape[0], name='NOTE', index=region_mutations.index) |
581 region_mutations = pandas.concat([region_mutations, region_mutation_types, region_mutation_drugs, region_notes], axis=1) | 597 region_mutations = pandas.concat([region_mutations, region_mutation_types, region_mutation_drugs, region_notes], axis=1) |
582 region_mutations = region_mutations[['#CHROM', 'POS', 'TYPE', 'REF', 'ALT', 'DRUG', 'NOTE']] | 598 region_mutations = region_mutations[['#CHROM', 'POS', 'TYPE', 'REF', 'ALT', 'DRUG', 'NOTE']] |
583 amr_mutations[region['name']] = region_mutations | 599 amr_mutations[region['name']] = region_mutations |
584 # Report the mutations. | 600 if (amr_mutations.shape[0] > 0): |
585 self.doc.new_line() | 601 # Report the mutations. |
586 self.doc.new_header(level=2, title=self.mutation_title) | |
587 for region_name in amr_mutations.index.tolist(): | |
588 region_mutations = amr_mutations[region_name].copy() | |
589 self.doc.new_line() | 602 self.doc.new_line() |
590 self.doc.new_header(level=3, title=region_name) | 603 self.doc.new_header(level=2, title=self.mutation_title) |
591 if (region_mutations.shape[0] == 0): | 604 for region_name in amr_mutations.index.tolist(): |
592 self.doc.append('None') | 605 region_mutations = amr_mutations[region_name].copy() |
593 continue | 606 self.doc.new_line() |
594 region_mutations.iloc[:, 1] = region_mutations.iloc[:, 1].apply(lambda x: '{:,}'.format(x)) | 607 self.doc.new_header(level=3, title=region_name) |
595 Table_List = ['Reference contig', 'Position', 'Reference', 'Alternate', 'Drug', 'Note'] | 608 if (region_mutations.shape[0] == 0): |
596 for i in range(region_mutations.shape[0]): | 609 self.doc.append('None') |
597 Table_List = Table_List + region_mutations.iloc[i, [0, 1, 3, 4, 5, 6]].values.tolist() | 610 continue |
598 row_count = int(len(Table_List) / 6) | 611 region_mutations.iloc[:, 1] = region_mutations.iloc[:, 1].apply(lambda x: '{:,}'.format(x)) |
599 self.doc.new_table(columns=6, rows=row_count, text=Table_List, text_align='left') | 612 Table_List = ['Reference contig', 'Position', 'Reference', 'Alternate', 'Drug', 'Note'] |
613 for i in range(region_mutations.shape[0]): | |
614 Table_List = Table_List + region_mutations.iloc[i, [0, 1, 3, 4, 5, 6]].values.tolist() | |
615 row_count = int(len(Table_List) / 6) | |
616 self.doc.new_table(columns=6, rows=row_count, text=Table_List, text_align='left') | |
600 method = '%s reads were mapped to the reference sequence using minimap2.' % self.read_type | 617 method = '%s reads were mapped to the reference sequence using minimap2.' % self.read_type |
601 self.methods[self.mutation_methods_title] = self.methods[self.mutation_methods_title].append(pandas.Series(method)) | 618 self.methods[self.mutation_methods_title] = self.methods[self.mutation_methods_title].append(pandas.Series(method)) |
602 method = 'Mutations were identified using samtools mpileup and varscan.' | 619 method = 'Mutations were identified using samtools mpileup and varscan.' |
603 self.methods[self.mutation_methods_title] = self.methods[self.mutation_methods_title].append(pandas.Series(method)) | 620 self.methods[self.mutation_methods_title] = self.methods[self.mutation_methods_title].append(pandas.Series(method)) |
604 | 621 |
688 Table_List = Table_List + plasmids.iloc[i, 0:6].values.tolist() | 705 Table_List = Table_List + plasmids.iloc[i, 0:6].values.tolist() |
689 row_count = int(len(Table_List) / 6) | 706 row_count = int(len(Table_List) / 6) |
690 self.doc.new_table(columns=6, rows=row_count, text=Table_List, text_align='left') | 707 self.doc.new_table(columns=6, rows=row_count, text=Table_List, text_align='left') |
691 method = 'The plasmid reference database was queried against the genome assembly using minimap2.' | 708 method = 'The plasmid reference database was queried against the genome assembly using minimap2.' |
692 self.methods[self.plasmid_methods_title] = self.methods[self.plasmid_methods_title].append(pandas.Series(method)) | 709 self.methods[self.plasmid_methods_title] = self.methods[self.plasmid_methods_title].append(pandas.Series(method)) |
693 method = 'The resulting SAM was converted to a PSL using a custom version of sam2psl.' | 710 method = 'The resulting BAM was converted to a PSL using a custom version of sam2psl.' |
694 self.methods[self.plasmid_methods_title] = self.methods[self.plasmid_methods_title].append(pandas.Series(method)) | 711 self.methods[self.plasmid_methods_title] = self.methods[self.plasmid_methods_title].append(pandas.Series(method)) |
695 method = 'Plasmid-to-genome hits were resolved using the pChunks algorithm.' | 712 method = 'Plasmid-to-genome hits were resolved using the pChunks algorithm.' |
696 self.methods[self.plasmid_methods_title] = self.methods[self.plasmid_methods_title].append(pandas.Series(method)) | 713 self.methods[self.plasmid_methods_title] = self.methods[self.plasmid_methods_title].append(pandas.Series(method)) |
697 | 714 |
698 def add_methods(self): | 715 def add_methods(self): |
764 self.add_features() | 781 self.add_features() |
765 self.add_feature_plots() | 782 self.add_feature_plots() |
766 self.add_mutations() | 783 self.add_mutations() |
767 self.add_large_indels() | 784 self.add_large_indels() |
768 self.add_plasmids() | 785 self.add_plasmids() |
769 # TODO stuff working to here... | |
770 self.add_amr_matrix() | 786 self.add_amr_matrix() |
771 # self.add_snps() | 787 # self.add_snps() |
772 self.add_methods() | 788 self.add_methods() |
773 self.make_tex() | 789 self.make_tex() |
774 # It took me quite a long time to find out that the value of the -t | 790 # It took me quite a long time to find out that the value of the -t |
788 parser.add_argument('--amr_deletions_file', action='store', dest='amr_deletions_file', help='AMR deletions BED file') | 804 parser.add_argument('--amr_deletions_file', action='store', dest='amr_deletions_file', help='AMR deletions BED file') |
789 parser.add_argument('--amr_matrix_png_dir', action='store', dest='amr_matrix_png_dir', help='Directory of AMR matrix PNG files') | 805 parser.add_argument('--amr_matrix_png_dir', action='store', dest='amr_matrix_png_dir', help='Directory of AMR matrix PNG files') |
790 parser.add_argument('--analysis_name', action='store', dest='analysis_name', help='Sample identifier') | 806 parser.add_argument('--analysis_name', action='store', dest='analysis_name', help='Sample identifier') |
791 parser.add_argument('--assembly_fasta_file', action='store', dest='assembly_fasta_file', help='Assembly fasta file') | 807 parser.add_argument('--assembly_fasta_file', action='store', dest='assembly_fasta_file', help='Assembly fasta file') |
792 parser.add_argument('--assembly_name', action='store', dest='assembly_name', help='Assembly identifier') | 808 parser.add_argument('--assembly_name', action='store', dest='assembly_name', help='Assembly identifier') |
809 parser.add_argument('--blastn_version', action='store', dest='blastn_version', default=None, help='Blastn version string') | |
793 parser.add_argument('--compute_sequence_length_file', action='store', dest='compute_sequence_length_file', help='Comnpute sequence length tabular file') | 810 parser.add_argument('--compute_sequence_length_file', action='store', dest='compute_sequence_length_file', help='Comnpute sequence length tabular file') |
794 parser.add_argument('--contig_coverage_file', action='store', dest='contig_coverage_file', help='Contig coverage TSV file') | 811 parser.add_argument('--contig_coverage_file', action='store', dest='contig_coverage_file', help='Contig coverage TSV file') |
795 parser.add_argument('--dbkey', action='store', dest='dbkey', help='Reference genome identifier') | 812 parser.add_argument('--dbkey', action='store', dest='dbkey', help='Reference genome identifier') |
796 parser.add_argument('--dnadiff_snps_file', action='store', dest='dnadiff_snps_file', help='DNAdiff snps tabular file') | 813 parser.add_argument('--dnadiff_snps_file', action='store', dest='dnadiff_snps_file', help='DNAdiff snps tabular file') |
814 parser.add_argument('--dnadiff_version', action='store', dest='dnadiff_version', help='DNAdiff version string') | |
797 parser.add_argument('--feature_bed_dir', action='store', dest='feature_bed_dir', help='Directory of best feature hits bed files') | 815 parser.add_argument('--feature_bed_dir', action='store', dest='feature_bed_dir', help='Directory of best feature hits bed files') |
798 parser.add_argument('--feature_png_dir', action='store', dest='feature_png_dir', help='Directory of best feature hits png files') | 816 parser.add_argument('--feature_png_dir', action='store', dest='feature_png_dir', help='Directory of best feature hits png files') |
799 parser.add_argument('--flye_assembly_info_file', action='store', dest='flye_assembly_info_file', default=None, help='Flye assembly info tabular file') | 817 parser.add_argument('--flye_assembly_info_file', action='store', dest='flye_assembly_info_file', default=None, help='Flye assembly info tabular file') |
800 parser.add_argument('--flye_version', action='store', dest='flye_version', default=None, help='Flye version string') | 818 parser.add_argument('--flye_version', action='store', dest='flye_version', default=None, help='Flye version string') |
801 parser.add_argument('--genome_insertions_file', action='store', dest='genome_insertions_file', help='Genome insertions BED file') | 819 parser.add_argument('--genome_insertions_file', action='store', dest='genome_insertions_file', help='Genome insertions BED file') |
802 parser.add_argument('--gzipped', action='store_true', dest='gzipped', default=False, help='Input sample is gzipped') | 820 parser.add_argument('--gzipped', action='store_true', dest='gzipped', default=False, help='Input sample is gzipped') |
803 parser.add_argument('--illumina_fastq_file', action='store', dest='illumina_fastq_file', help='Input sample') | 821 parser.add_argument('--illumina_fastq_file', action='store', dest='illumina_fastq_file', help='Input sample') |
822 parser.add_argument('--kraken2_report_file', action='store', dest='kraken2_report_file', default=None, help='kraken2 report file') | |
823 parser.add_argument('--kraken2_version', action='store', dest='kraken2_version', default=None, help='kraken2 version string') | |
804 parser.add_argument('--mutation_regions_bed_file', action='store', dest='mutation_regions_bed_file', help='AMR mutation regions BRD file') | 824 parser.add_argument('--mutation_regions_bed_file', action='store', dest='mutation_regions_bed_file', help='AMR mutation regions BRD file') |
805 parser.add_argument('--mutation_regions_dir', action='store', dest='mutation_regions_dir', help='Directory of mutation regions TSV files') | 825 parser.add_argument('--mutation_regions_dir', action='store', dest='mutation_regions_dir', help='Directory of mutation regions TSV files') |
806 parser.add_argument('--pima_css', action='store', dest='pima_css', help='PIMA css stypesheet') | 826 parser.add_argument('--pima_css', action='store', dest='pima_css', help='PIMA css stypesheet') |
807 parser.add_argument('--plasmids_file', action='store', dest='plasmids_file', help='pChunks plasmids TSV file') | 827 parser.add_argument('--plasmids_file', action='store', dest='plasmids_file', help='pChunks plasmids TSV file') |
808 parser.add_argument('--reference_insertions_file', action='store', dest='reference_insertions_file', help='Reference insertions BED file') | 828 parser.add_argument('--reference_insertions_file', action='store', dest='reference_insertions_file', help='Reference insertions BED file') |
834 markdown_report = PimaReport(args.analysis_name, | 854 markdown_report = PimaReport(args.analysis_name, |
835 args.amr_deletions_file, | 855 args.amr_deletions_file, |
836 amr_matrix_files, | 856 amr_matrix_files, |
837 args.assembly_fasta_file, | 857 args.assembly_fasta_file, |
838 args.assembly_name, | 858 args.assembly_name, |
859 args.blastn_version, | |
839 args.compute_sequence_length_file, | 860 args.compute_sequence_length_file, |
840 args.contig_coverage_file, | 861 args.contig_coverage_file, |
841 args.dbkey, | 862 args.dbkey, |
842 args.dnadiff_snps_file, | 863 args.dnadiff_snps_file, |
864 args.dnadiff_version, | |
843 feature_bed_files, | 865 feature_bed_files, |
844 feature_png_files, | 866 feature_png_files, |
845 args.flye_assembly_info_file, | 867 args.flye_assembly_info_file, |
846 args.flye_version, | 868 args.flye_version, |
847 args.genome_insertions_file, | 869 args.genome_insertions_file, |
848 args.gzipped, | 870 args.gzipped, |
849 args.illumina_fastq_file, | 871 args.illumina_fastq_file, |
872 args.kraken2_report_file, | |
873 args.kraken2_version, | |
850 args.mutation_regions_bed_file, | 874 args.mutation_regions_bed_file, |
851 mutation_regions_files, | 875 mutation_regions_files, |
852 args.pima_css, | 876 args.pima_css, |
853 args.plasmids_file, | 877 args.plasmids_file, |
854 args.reference_insertions_file) | 878 args.reference_insertions_file) |