Mercurial > repos > greg > pima_report
comparison pima_report.py @ 10:7c4077c9b3ad draft
Uploaded
author | greg |
---|---|
date | Thu, 09 Mar 2023 18:21:26 +0000 |
parents | 9d608c530bbc |
children | 4a7c31f28197 |
comparison
equal
deleted
inserted
replaced
9:9d608c530bbc | 10:7c4077c9b3ad |
---|---|
427 kraken_fracs['Fraction'] = (kraken_fracs['Fraction'] / 100).round(4) | 427 kraken_fracs['Fraction'] = (kraken_fracs['Fraction'] / 100).round(4) |
428 kraken_fracs.sort_values(by='Fraction', inplace=True, ascending=False) | 428 kraken_fracs.sort_values(by='Fraction', inplace=True, ascending=False) |
429 kraken_fracs['Taxa'] = kraken_fracs['Taxa'].str.lstrip() | 429 kraken_fracs['Taxa'] = kraken_fracs['Taxa'].str.lstrip() |
430 self.doc.new_line() | 430 self.doc.new_line() |
431 self.doc.new_header(2, 'Contamination check') | 431 self.doc.new_header(2, 'Contamination check') |
432 for read_type, kraken_fracs in kraken_fracs.iteritems(): | 432 self.doc.new_line(self.read_type + ' classifications') |
433 self.doc.new_line(self.read_type + ' classifications') | 433 self.doc.new_line() |
434 self.doc.new_line() | 434 Table_List = ["Percent of Reads", "Reads", "Level", "Label"] |
435 Table_List = ["Percent of Reads", "Reads", "Level", "Label"] | 435 for index, row in kraken_fracs.iterrows(): |
436 for index, row in kraken_fracs.iteritems(): | 436 Table_List = Table_List + row.tolist() |
437 Table_List = Table_List + row.tolist() | 437 row_count = int(len(Table_List) / 4) |
438 row_count = int(len(Table_List) / 4) | 438 self.doc.new_table(columns=4, rows=row_count, text=Table_List, text_align='left') |
439 self.doc.new_table(columns=4, rows=row_count, text=Table_List, text_align='left') | 439 if self.contamination_methods_title not in self.methods: |
440 if self.contamination_methods_title not in self.methods: | 440 self.methods[self.contamination_methods_title] = '' |
441 self.methods[self.contamination_methods_title] = '' | |
442 method = 'Kraken2 version %s was used to assign the raw reads into taxa.' % self.kraken2_version | 441 method = 'Kraken2 version %s was used to assign the raw reads into taxa.' % self.kraken2_version |
443 self.methods[self.contamination_methods_title] = self.methods[self.contamination_methods_title].append(pandas.Series(method)) | 442 self.methods[self.contamination_methods_title] = self.methods[self.contamination_methods_title].append(pandas.Series(method)) |
444 | 443 |
445 def add_alignment(self): | 444 def add_alignment(self): |
446 self.ofh.write("\nXXXXXX In add_alignment\n\n") | 445 self.ofh.write("\nXXXXXX In add_alignment\n\n") |