Mercurial > repos > greg > pima_report
comparison pima_report.py @ 13:f03c80bb22e9 draft
Uploaded
author | greg |
---|---|
date | Thu, 16 Mar 2023 14:42:13 +0000 |
parents | 99613333fd1f |
children | 95b1d1a9497d |
comparison
equal
deleted
inserted
replaced
12:99613333fd1f | 13:f03c80bb22e9 |
---|---|
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, bedtools_version=None, blastn_version=None, compute_sequence_length_file=None, | 19 assembly_name=None, bedtools_version=None, blastn_version=None, circos_files=None, |
20 contig_coverage_file=None, dbkey=None, dnadiff_snps_file=None, dnadiff_version=None, | 20 compute_sequence_length_file=None, contig_coverage_file=None, dbkey=None, dnadiff_snps_file=None, |
21 feature_bed_files=None, feature_png_files=None, flye_assembly_info_file=None, flye_version=None, | 21 dnadiff_version=None, feature_bed_files=None, feature_png_files=None, flye_assembly_info_file=None, |
22 genome_insertions_file=None, gzipped=None, illumina_fastq_file=None, kraken2_report_file=None, | 22 flye_version=None, genome_insertions_file=None, gzipped=None, illumina_fastq_file=None, |
23 kraken2_version=None, minimap2_version=None, mutation_regions_bed_file=None, | 23 kraken2_report_file=None, kraken2_version=None, minimap2_version=None, mutation_regions_bed_file=None, |
24 mutation_regions_tsv_files=None, pima_css=None, plasmids_file=None, reference_insertions_file=None, | 24 mutation_regions_tsv_files=None, pima_css=None, plasmids_file=None, quast_report_file=None, |
25 samtools_version=None, varscan_version=None): | 25 reference_insertions_file=None, samtools_version=None, varscan_version=None): |
26 self.ofh = open("process_log.txt", "w") | 26 self.ofh = open("process_log.txt", "w") |
27 | 27 |
28 self.ofh.write("amr_deletions_file: %s\n" % str(amr_deletions_file)) | 28 self.ofh.write("amr_deletions_file: %s\n" % str(amr_deletions_file)) |
29 self.ofh.write("amr_matrix_files: %s\n" % str(amr_matrix_files)) | 29 self.ofh.write("amr_matrix_files: %s\n" % str(amr_matrix_files)) |
30 self.ofh.write("analysis_name: %s\n" % str(analysis_name)) | 30 self.ofh.write("analysis_name: %s\n" % str(analysis_name)) |
31 self.ofh.write("assembly_fasta_file: %s\n" % str(assembly_fasta_file)) | 31 self.ofh.write("assembly_fasta_file: %s\n" % str(assembly_fasta_file)) |
32 self.ofh.write("assembly_name: %s\n" % str(assembly_name)) | 32 self.ofh.write("assembly_name: %s\n" % str(assembly_name)) |
33 self.ofh.write("bedtools_version: %s\n" % str(bedtools_version)) | 33 self.ofh.write("bedtools_version: %s\n" % str(bedtools_version)) |
34 self.ofh.write("blastn_version: %s\n" % str(blastn_version)) | 34 self.ofh.write("blastn_version: %s\n" % str(blastn_version)) |
35 self.ofh.write("circos_files: %s\n" % str(circos_files)) | |
35 self.ofh.write("compute_sequence_length_file: %s\n" % str(compute_sequence_length_file)) | 36 self.ofh.write("compute_sequence_length_file: %s\n" % str(compute_sequence_length_file)) |
36 self.ofh.write("contig_coverage_file: %s\n" % str(contig_coverage_file)) | 37 self.ofh.write("contig_coverage_file: %s\n" % str(contig_coverage_file)) |
37 self.ofh.write("dbkey: %s\n" % str(dbkey)) | 38 self.ofh.write("dbkey: %s\n" % str(dbkey)) |
38 self.ofh.write("dnadiff_snps_file: %s\n" % str(dnadiff_snps_file)) | 39 self.ofh.write("dnadiff_snps_file: %s\n" % str(dnadiff_snps_file)) |
39 self.ofh.write("dnadiff_version: %s\n" % str(dnadiff_version)) | 40 self.ofh.write("dnadiff_version: %s\n" % str(dnadiff_version)) |
49 self.ofh.write("minimap2_version: %s\n" % str(minimap2_version)) | 50 self.ofh.write("minimap2_version: %s\n" % str(minimap2_version)) |
50 self.ofh.write("mutation_regions_bed_file: %s\n" % str(mutation_regions_bed_file)) | 51 self.ofh.write("mutation_regions_bed_file: %s\n" % str(mutation_regions_bed_file)) |
51 self.ofh.write("mutation_regions_tsv_files: %s\n" % str(mutation_regions_tsv_files)) | 52 self.ofh.write("mutation_regions_tsv_files: %s\n" % str(mutation_regions_tsv_files)) |
52 self.ofh.write("pima_css: %s\n" % str(pima_css)) | 53 self.ofh.write("pima_css: %s\n" % str(pima_css)) |
53 self.ofh.write("plasmids_file: %s\n" % str(plasmids_file)) | 54 self.ofh.write("plasmids_file: %s\n" % str(plasmids_file)) |
55 self.ofh.write("quast_report_file: %s\n" % str(quast_report_file)) | |
54 self.ofh.write("reference_insertions_file: %s\n" % str(reference_insertions_file)) | 56 self.ofh.write("reference_insertions_file: %s\n" % str(reference_insertions_file)) |
55 self.ofh.write("samtools_version: %s\n" % str(samtools_version)) | 57 self.ofh.write("samtools_version: %s\n" % str(samtools_version)) |
56 self.ofh.write("varscan_version: %s\n" % str(varscan_version)) | 58 self.ofh.write("varscan_version: %s\n" % str(varscan_version)) |
57 | 59 |
58 # General | 60 # General |
60 self.report_md = 'pima_report.md' | 62 self.report_md = 'pima_report.md' |
61 | 63 |
62 # Inputs | 64 # Inputs |
63 self.amr_deletions_file = amr_deletions_file | 65 self.amr_deletions_file = amr_deletions_file |
64 self.amr_matrix_files = amr_matrix_files | 66 self.amr_matrix_files = amr_matrix_files |
65 self.analysis_name = re.sub('_', '.', analysis_name.rstrip(' _consensus_')) | 67 self.analysis_name = analysis_name.split('_')[0] |
68 self.ofh.write("self.analysis_name: %s\n" % str(self.analysis_name)) | |
66 self.assembly_fasta_file = assembly_fasta_file | 69 self.assembly_fasta_file = assembly_fasta_file |
67 self.assembly_name = re.sub('_', '.', assembly_name.rstrip(' _consensus_')) | 70 self.assembly_name = re.sub('_', '.', assembly_name.rstrip(' _consensus_')) |
68 if bedtools_version is None: | 71 if bedtools_version is None: |
69 self.bedtools_version = 'bedtools (version unknown)' | 72 self.bedtools_version = 'bedtools (version unknown)' |
70 else: | 73 else: |
71 self.bedtools_version = re.sub('_', '.', bedtools_version.rstrip(' _genome insertions')) | 74 self.bedtools_version = re.sub('_', '.', bedtools_version.rstrip(' _genome insertions')) |
72 if blastn_version is None: | 75 if blastn_version is None: |
73 self.blastn_version = 'blastn (version unknown)' | 76 self.blastn_version = 'blastn (version unknown)' |
74 else: | 77 else: |
75 self.blastn_version = re.sub('_', '.', blastn_version.rstrip(' _features_')) | 78 self.blastn_version = re.sub('_', '.', blastn_version.rstrip(' _features_')) |
79 self.circos_files = circos_files | |
76 self.compute_sequence_length_file = compute_sequence_length_file | 80 self.compute_sequence_length_file = compute_sequence_length_file |
77 self.contig_coverage_file = contig_coverage_file | 81 self.contig_coverage_file = contig_coverage_file |
78 self.dbkey = dbkey | 82 self.dbkey = dbkey |
79 self.dnadiff_snps_file = dnadiff_snps_file | 83 self.dnadiff_snps_file = dnadiff_snps_file |
80 if dnadiff_version is None: | 84 if dnadiff_version is None: |
106 self.ont_bases = None | 110 self.ont_bases = None |
107 self.ont_n50 = None | 111 self.ont_n50 = None |
108 self.ont_read_count = None | 112 self.ont_read_count = None |
109 self.pima_css = pima_css | 113 self.pima_css = pima_css |
110 self.plasmids_file = plasmids_file | 114 self.plasmids_file = plasmids_file |
115 self.quast_report_file = quast_report_file | |
116 self.reference_insertions_file = reference_insertions_file | |
111 self.reference_insertions_file = reference_insertions_file | 117 self.reference_insertions_file = reference_insertions_file |
112 if samtools_version is None: | 118 if samtools_version is None: |
113 self.samtools_version = 'samtools (version unknown)' | 119 self.samtools_version = 'samtools (version unknown)' |
114 else: | 120 else: |
115 self.samtools_version = re.sub('_', '.', samtools_version) | 121 self.samtools_version = re.sub('_', '.', samtools_version) |
137 self.mutation_methods_title = 'Mutation screening' | 143 self.mutation_methods_title = 'Mutation screening' |
138 self.plasmid_methods_title = 'Plasmid annotation' | 144 self.plasmid_methods_title = 'Plasmid annotation' |
139 self.plasmid_title = 'Plasmid annotation' | 145 self.plasmid_title = 'Plasmid annotation' |
140 self.reference_methods_title = 'Reference comparison' | 146 self.reference_methods_title = 'Reference comparison' |
141 self.snp_indel_title = 'SNPs and small indels' | 147 self.snp_indel_title = 'SNPs and small indels' |
142 self.summary_title = 'Analysis of %s' % analysis_name | 148 self.summary_title = 'Summary' |
143 | 149 |
144 # Methods | 150 # Methods |
145 self.methods = pandas.Series(dtype='float64') | 151 self.methods = pandas.Series(dtype='float64') |
146 self.methods[self.contamination_methods_title] = pandas.Series(dtype='float64') | 152 self.methods[self.contamination_methods_title] = pandas.Series(dtype='float64') |
147 self.methods[self.assembly_methods_title] = pandas.Series(dtype='float64') | 153 self.methods[self.assembly_methods_title] = pandas.Series(dtype='float64') |
161 self.did_medaka_ont_assembly = False | 167 self.did_medaka_ont_assembly = False |
162 self.feature_hits = pandas.Series(dtype='float64') | 168 self.feature_hits = pandas.Series(dtype='float64') |
163 self.illumina_length_mean = 0 | 169 self.illumina_length_mean = 0 |
164 self.illumina_read_count = 0 | 170 self.illumina_read_count = 0 |
165 self.illumina_bases = 0 | 171 self.illumina_bases = 0 |
166 self.mean_coverage = 0 | |
167 self.num_assembly_contigs = 0 | |
168 # TODO: should the following 2 values be passed as parameters? | 172 # TODO: should the following 2 values be passed as parameters? |
169 self.ont_n50_min = 2500 | 173 self.ont_n50_min = 2500 |
170 self.ont_coverage_min = 30 | 174 self.ont_coverage_min = 30 |
171 self.quast_indels = 0 | |
172 self.quast_mismatches = 0 | |
173 | 175 |
174 # Actions | 176 # Actions |
175 self.did_guppy_ont_fast5 = False | 177 self.did_guppy_ont_fast5 = False |
176 self.did_qcat_ont_fastq = False | 178 self.did_qcat_ont_fastq = False |
177 self.info_illumina_fastq() | 179 self.info_illumina_fastq() |
263 # self.illumina_length_mean /= len(self.illumina_fastq) | 265 # self.illumina_length_mean /= len(self.illumina_fastq) |
264 self.illumina_length_mean /= 1 | 266 self.illumina_length_mean /= 1 |
265 self.illumina_bases = self.format_kmg(self.illumina_bases, decimals=1) | 267 self.illumina_bases = self.format_kmg(self.illumina_bases, decimals=1) |
266 | 268 |
267 def start_doc(self): | 269 def start_doc(self): |
268 self.doc = MdUtils(file_name=self.report_md, title='') | 270 header_text = 'Analysis of ' + self.analysis_name |
271 self.doc = MdUtils(file_name=self.report_md, title=header_text) | |
269 | 272 |
270 def add_run_information(self): | 273 def add_run_information(self): |
271 self.ofh.write("\nXXXXXX In add_run_information\n\n") | 274 self.ofh.write("\nXXXXXX In add_run_information\n\n") |
272 self.doc.new_line() | 275 self.doc.new_line() |
273 self.doc.new_header(1, 'Run information') | 276 self.doc.new_header(1, 'Run information') |
317 self.doc.new_table(columns=2, rows=7, text=Table_List, text_align='left') | 320 self.doc.new_table(columns=2, rows=7, text=Table_List, text_align='left') |
318 self.doc.new_line() | 321 self.doc.new_line() |
319 | 322 |
320 def add_illumina_library_information(self): | 323 def add_illumina_library_information(self): |
321 self.ofh.write("\nXXXXXX In add_illumina_library_information\n\n") | 324 self.ofh.write("\nXXXXXX In add_illumina_library_information\n\n") |
322 if self.illumina_length_mean is None: | 325 if self.illumina_length_mean == 0: |
323 return | 326 return |
324 self.doc.new_line() | 327 self.doc.new_line() |
325 self.doc.new_header(2, 'Illumina library statistics') | 328 self.doc.new_header(2, 'Illumina library statistics') |
326 Table_List = [ | 329 Table_List = [ |
327 "Illumina Info.", | 330 "Illumina Info.", |
473 method = '%s was used to assign the raw reads into taxa.' % self.kraken2_version.rstrip('report') | 476 method = '%s was used to assign the raw reads into taxa.' % self.kraken2_version.rstrip('report') |
474 self.methods[self.contamination_methods_title] = self.methods[self.contamination_methods_title].append(pandas.Series(method)) | 477 self.methods[self.contamination_methods_title] = self.methods[self.contamination_methods_title].append(pandas.Series(method)) |
475 | 478 |
476 def add_alignment(self): | 479 def add_alignment(self): |
477 self.ofh.write("\nXXXXXX In add_alignment\n\n") | 480 self.ofh.write("\nXXXXXX In add_alignment\n\n") |
478 # TODO: implement the draw_circos function for this. | 481 if self.quast_report_file is not None: |
479 if len(self.contig_alignment) > 0: | 482 # Process quast values. |
480 alignments = self.contig_alignment | 483 quast_report = pandas.read_csv(self.quast_report_file, header=0, index_col=0, sep='\t') |
481 else: | 484 quast_mismatches = int(float(quast_report.loc['# mismatches per 100 kbp', :][0]) * (float(quast_report.loc['Total length (>= 0 bp)', :][0]) / 100000.)) |
482 return | 485 quast_indels = int(float(quast_report.loc['# indels per 100 kbp', :][0]) * (float(quast_report.loc['Total length (>= 0 bp)', :][0]) / 100000.)) |
483 self.doc.new_line() | 486 self.doc.new_line() |
484 self.doc.new_header(level=2, title=self.alignment_title) | 487 self.doc.new_header(level=2, title=self.alignment_title) |
485 self.doc.new_line() | 488 self.doc.new_line() |
486 self.doc.new_header(level=3, title=self.snp_indel_title) | 489 self.doc.new_header(level=3, title=self.snp_indel_title) |
487 Table_1 = [ | 490 Table_1 = [ |
488 "Category", | 491 "Category", |
489 "Quantity", | 492 "Quantity", |
490 'SNPs', | 493 'SNPs', |
491 '{:,}'.format(self.quast_mismatches), | 494 '{:,}'.format(quast_mismatches), |
492 'Small indels', | 495 'Small indels', |
493 '{:,}'.format(self.quast_indels) | 496 '{:,}'.format(quast_indels) |
494 ] | 497 ] |
495 self.doc.new_table(columns=2, rows=3, text=Table_1, text_align='left') | 498 self.doc.new_table(columns=2, rows=3, text=Table_1, text_align='left') |
496 self.doc.new_line('<div style="page-break-after: always;"></div>') | 499 self.doc.new_line('<div style="page-break-after: always;"></div>') |
497 self.doc.new_line() | 500 self.doc.new_line() |
501 # TODO: self.alignment_notes is not currently populated. | |
498 if len(self.alignment_notes) > 0: | 502 if len(self.alignment_notes) > 0: |
499 self.doc.new_header(level=3, title=self.alignment_notes_title) | 503 self.doc.new_header(level=3, title=self.alignment_notes_title) |
500 for note in self.alignment_notes: | 504 for note in self.alignment_notes: |
501 self.doc.new_line(note) | 505 self.doc.new_line(note) |
502 for contig in alignments.index.tolist(): | 506 if len(self.circos_files) > 0: |
503 contig_title = 'Alignment to %s' % contig | 507 # Add circos PNG files. |
504 image_png = alignments[contig] | 508 for circos_file in self.circos_files: |
505 self.doc.new_line() | 509 contig = os.path.basename(circos_file) |
506 self.doc.new_header(level=3, title=contig_title) | 510 contig_title = 'Alignment to %s' % contig |
507 self.doc.new_line(self.doc.new_inline_image(text='contig_title', path=os.path.abspath(image_png))) | 511 self.doc.new_line() |
508 self.doc.new_line('<div style="page-break-after: always;"></div>') | 512 self.doc.new_header(level=3, title=contig_title) |
509 self.doc.new_line() | 513 self.doc.new_line(self.doc.new_inline_image(text='contig_title', path=os.path.abspath(circos_file))) |
514 self.doc.new_line('<div style="page-break-after: always;"></div>') | |
515 self.doc.new_line() | |
510 method = 'The genome assembly was aligned against the reference sequencing using dnadiff version %s.' % self.dnadiff_version | 516 method = 'The genome assembly was aligned against the reference sequencing using dnadiff version %s.' % self.dnadiff_version |
511 self.methods[self.reference_methods_title] = self.methods[self.reference_methods_title].append(pandas.Series(method)) | 517 self.methods[self.reference_methods_title] = self.methods[self.reference_methods_title].append(pandas.Series(method)) |
512 | 518 |
513 def add_features(self): | 519 def add_features(self): |
514 self.ofh.write("\nXXXXXX In add_features\n\n") | 520 self.ofh.write("\nXXXXXX In add_features\n\n") |
641 Table_List = Table_List + region_mutations.iloc[i, [0, 1, 3, 4, 5, 6]].values.tolist() | 647 Table_List = Table_List + region_mutations.iloc[i, [0, 1, 3, 4, 5, 6]].values.tolist() |
642 row_count = int(len(Table_List) / 6) | 648 row_count = int(len(Table_List) / 6) |
643 self.doc.new_table(columns=6, rows=row_count, text=Table_List, text_align='left') | 649 self.doc.new_table(columns=6, rows=row_count, text=Table_List, text_align='left') |
644 method = '%s reads were mapped to the reference sequence using %s.' % (self.read_type, self.minimap2_version) | 650 method = '%s reads were mapped to the reference sequence using %s.' % (self.read_type, self.minimap2_version) |
645 self.methods[self.mutation_methods_title] = self.methods[self.mutation_methods_title].append(pandas.Series(method)) | 651 self.methods[self.mutation_methods_title] = self.methods[self.mutation_methods_title].append(pandas.Series(method)) |
646 method = 'Mutations were identified using %s mpileup and %s.' % (self.samtools_version, self.varscan_version) | 652 method = 'Mutations were identified using %s and %s.' % (self.samtools_version, self.varscan_version) |
647 self.methods[self.mutation_methods_title] = self.methods[self.mutation_methods_title].append(pandas.Series(method)) | 653 self.methods[self.mutation_methods_title] = self.methods[self.mutation_methods_title].append(pandas.Series(method)) |
648 | 654 |
649 def add_amr_matrix(self): | 655 def add_amr_matrix(self): |
650 self.ofh.write("\nXXXXXX In add_amr_matrix\n\n") | 656 self.ofh.write("\nXXXXXX In add_amr_matrix\n\n") |
651 # Make sure that we have an AMR matrix to plot | 657 # Make sure that we have an AMR matrix to plot |
670 genome_insertions = pandas.read_csv(filepath_or_buffer=self.genome_insertions_file, sep='\t', header=None) | 676 genome_insertions = pandas.read_csv(filepath_or_buffer=self.genome_insertions_file, sep='\t', header=None) |
671 except Exception: | 677 except Exception: |
672 genome_insertions = pandas.DataFrame() | 678 genome_insertions = pandas.DataFrame() |
673 large_indels['Reference insertions'] = reference_insertions | 679 large_indels['Reference insertions'] = reference_insertions |
674 large_indels['Query insertions'] = genome_insertions | 680 large_indels['Query insertions'] = genome_insertions |
675 # TODO: we don't seem to be reporting snps and deletions for some reason... | |
676 # Pull in the number of SNPs and small indels. | |
677 try: | |
678 snps = pandas.read_csv(filepath_or_buffer=self.dnadiff_snps_file, sep='\t', header=None) | |
679 # TODO: the following is not used... | |
680 # small_indels = snps.loc[(snps.iloc[:, 1] == '.') | (snps.iloc[:, 2] == '.'), :] | |
681 snps = snps.loc[(snps.iloc[:, 1] != '.') & (snps.iloc[:, 2] != '.'), :] | |
682 except Exception: | |
683 snps = pandas.DataFrame() | |
684 # Pull in deletions. | 681 # Pull in deletions. |
685 try: | 682 try: |
686 amr_deletions = pandas.read_csv(filepath_or_buffer=self.amr_deletion_file, sep='\t', header=None) | 683 amr_deletions = pandas.read_csv(filepath_or_buffer=self.amr_deletion_file, sep='\t', header=None) |
687 except Exception: | 684 except Exception: |
688 amr_deletions = pandas.DataFrame() | 685 amr_deletions = pandas.DataFrame() |
833 parser.add_argument('--analysis_name', action='store', dest='analysis_name', help='Sample identifier') | 830 parser.add_argument('--analysis_name', action='store', dest='analysis_name', help='Sample identifier') |
834 parser.add_argument('--assembly_fasta_file', action='store', dest='assembly_fasta_file', help='Assembly fasta file') | 831 parser.add_argument('--assembly_fasta_file', action='store', dest='assembly_fasta_file', help='Assembly fasta file') |
835 parser.add_argument('--assembly_name', action='store', dest='assembly_name', help='Assembly identifier') | 832 parser.add_argument('--assembly_name', action='store', dest='assembly_name', help='Assembly identifier') |
836 parser.add_argument('--bedtools_version', action='store', dest='bedtools_version', default=None, help='Bedtools version string') | 833 parser.add_argument('--bedtools_version', action='store', dest='bedtools_version', default=None, help='Bedtools version string') |
837 parser.add_argument('--blastn_version', action='store', dest='blastn_version', default=None, help='Blastn version string') | 834 parser.add_argument('--blastn_version', action='store', dest='blastn_version', default=None, help='Blastn version string') |
835 parser.add_argument('--circos_png_dir', action='store', dest='circos_png_dir', help='Directory of circos PNG files') | |
838 parser.add_argument('--compute_sequence_length_file', action='store', dest='compute_sequence_length_file', help='Comnpute sequence length tabular file') | 836 parser.add_argument('--compute_sequence_length_file', action='store', dest='compute_sequence_length_file', help='Comnpute sequence length tabular file') |
839 parser.add_argument('--contig_coverage_file', action='store', dest='contig_coverage_file', help='Contig coverage TSV file') | 837 parser.add_argument('--contig_coverage_file', action='store', dest='contig_coverage_file', help='Contig coverage TSV file') |
840 parser.add_argument('--dbkey', action='store', dest='dbkey', help='Reference genome identifier') | 838 parser.add_argument('--dbkey', action='store', dest='dbkey', help='Reference genome identifier') |
841 parser.add_argument('--dnadiff_snps_file', action='store', dest='dnadiff_snps_file', help='DNAdiff snps tabular file') | 839 parser.add_argument('--dnadiff_snps_file', action='store', dest='dnadiff_snps_file', help='DNAdiff snps tabular file') |
842 parser.add_argument('--dnadiff_version', action='store', dest='dnadiff_version', default=None, help='DNAdiff version string') | 840 parser.add_argument('--dnadiff_version', action='store', dest='dnadiff_version', default=None, help='DNAdiff version string') |
852 parser.add_argument('--minimap2_version', action='store', dest='minimap2_version', default=None, help='minimap2 version string') | 850 parser.add_argument('--minimap2_version', action='store', dest='minimap2_version', default=None, help='minimap2 version string') |
853 parser.add_argument('--mutation_regions_bed_file', action='store', dest='mutation_regions_bed_file', help='AMR mutation regions BRD file') | 851 parser.add_argument('--mutation_regions_bed_file', action='store', dest='mutation_regions_bed_file', help='AMR mutation regions BRD file') |
854 parser.add_argument('--mutation_regions_dir', action='store', dest='mutation_regions_dir', help='Directory of mutation regions TSV files') | 852 parser.add_argument('--mutation_regions_dir', action='store', dest='mutation_regions_dir', help='Directory of mutation regions TSV files') |
855 parser.add_argument('--pima_css', action='store', dest='pima_css', help='PIMA css stypesheet') | 853 parser.add_argument('--pima_css', action='store', dest='pima_css', help='PIMA css stypesheet') |
856 parser.add_argument('--plasmids_file', action='store', dest='plasmids_file', help='pChunks plasmids TSV file') | 854 parser.add_argument('--plasmids_file', action='store', dest='plasmids_file', help='pChunks plasmids TSV file') |
855 parser.add_argument('--quast_report_file', action='store', dest='quast_report_file', help='Quast report tabular file') | |
857 parser.add_argument('--reference_insertions_file', action='store', dest='reference_insertions_file', help='Reference insertions BED file') | 856 parser.add_argument('--reference_insertions_file', action='store', dest='reference_insertions_file', help='Reference insertions BED file') |
858 parser.add_argument('--samtools_version', action='store', dest='samtools_version', default=None, help='Samtools version string') | 857 parser.add_argument('--samtools_version', action='store', dest='samtools_version', default=None, help='Samtools version string') |
859 parser.add_argument('--varscan_version', action='store', dest='varscan_version', default=None, help='Varscan version string') | 858 parser.add_argument('--varscan_version', action='store', dest='varscan_version', default=None, help='Varscan version string') |
860 | 859 |
861 args = parser.parse_args() | 860 args = parser.parse_args() |
863 # Prepare the AMR matrix PNG files. | 862 # Prepare the AMR matrix PNG files. |
864 amr_matrix_files = [] | 863 amr_matrix_files = [] |
865 for file_name in sorted(os.listdir(args.amr_matrix_png_dir)): | 864 for file_name in sorted(os.listdir(args.amr_matrix_png_dir)): |
866 file_path = os.path.abspath(os.path.join(args.amr_matrix_png_dir, file_name)) | 865 file_path = os.path.abspath(os.path.join(args.amr_matrix_png_dir, file_name)) |
867 amr_matrix_files.append(file_path) | 866 amr_matrix_files.append(file_path) |
867 # Prepare the circos PNG files. | |
868 circos_files = [] | |
869 for file_name in sorted(os.listdir(args.circos_png_dir)): | |
870 file_path = os.path.abspath(os.path.join(args.circos_png_dir, file_name)) | |
871 circos_files.append(file_path) | |
868 # Prepare the features BED files. | 872 # Prepare the features BED files. |
869 feature_bed_files = [] | 873 feature_bed_files = [] |
870 for file_name in sorted(os.listdir(args.feature_bed_dir)): | 874 for file_name in sorted(os.listdir(args.feature_bed_dir)): |
871 file_path = os.path.abspath(os.path.join(args.feature_bed_dir, file_name)) | 875 file_path = os.path.abspath(os.path.join(args.feature_bed_dir, file_name)) |
872 feature_bed_files.append(file_path) | 876 feature_bed_files.append(file_path) |
886 amr_matrix_files, | 890 amr_matrix_files, |
887 args.assembly_fasta_file, | 891 args.assembly_fasta_file, |
888 args.assembly_name, | 892 args.assembly_name, |
889 args.bedtools_version, | 893 args.bedtools_version, |
890 args.blastn_version, | 894 args.blastn_version, |
895 circos_files, | |
891 args.compute_sequence_length_file, | 896 args.compute_sequence_length_file, |
892 args.contig_coverage_file, | 897 args.contig_coverage_file, |
893 args.dbkey, | 898 args.dbkey, |
894 args.dnadiff_snps_file, | 899 args.dnadiff_snps_file, |
895 args.dnadiff_version, | 900 args.dnadiff_version, |
905 args.minimap2_version, | 910 args.minimap2_version, |
906 args.mutation_regions_bed_file, | 911 args.mutation_regions_bed_file, |
907 mutation_regions_files, | 912 mutation_regions_files, |
908 args.pima_css, | 913 args.pima_css, |
909 args.plasmids_file, | 914 args.plasmids_file, |
915 args.quast_report_file, | |
910 args.reference_insertions_file, | 916 args.reference_insertions_file, |
911 args.samtools_version, | 917 args.samtools_version, |
912 args.varscan_version) | 918 args.varscan_version) |
913 markdown_report.make_report() | 919 markdown_report.make_report() |