def report_logs(self, name, logs, filter=(lambda sample, field: True), renaming={}): table = mine_logs(logs, filter) if name: filename = self.workspace / (self.file_prefix + name + '.csv') io.write_csv_2(filename, table) self.p(self.href(filename)) if table: table = mine_logs(logs, filter, commas=True) self.write('<table style="font-size: 75%">\n') self.write('<tr>\n') self.write('<th>Sample</th>\n') for key in table.values()[0].keys(): self.write('<th>' + key + '</th>') self.write('</tr>\n') for sample, row in table.items(): self.write('<tr>\n') self.write('<td>' + renaming.get(sample, sample) + '</td>\n') for value in row.values(): self.write('<td>' + value + '</td>') self.write('</tr>\n') self.write('</table>\n')
def report_logs(self, name, logs, filter=(lambda sample, field: True), renaming={}): table = mine_logs(logs, filter) if name: filename = self.workspace / (self.file_prefix + name + '.csv') io.write_csv_2(filename, table) self.p(self.href(filename)) if table: table = mine_logs(logs, filter, commas=True) self.write('<table style="font-size: 75%">\n') self.write('<tr>\n') self.write('<th>Sample</th>\n') for key in table.values()[0].keys(): self.write('<th>'+key+'</th>') self.write('</tr>\n') for sample, row in table.items(): self.write('<tr>\n') self.write('<td>'+renaming.get(sample,sample)+'</td>\n') for value in row.values(): self.write('<td>'+value+'</td>') self.write('</tr>\n') self.write('</table>\n')
def _extract_raw(self): work = io.Workspace(self.output_dir, must_exist=False) raw = io.Workspace(work/'raw', must_exist=False) for name, counts, norms in [ ('genewise', work/('expression','genewise','counts.csv'), work/('expression','genewise','norm.csv'), ), ('primarypeakwise', work/('expression','primarypeakwise','counts.csv'), work/('expression','primarypeakwise','norm.csv'), ), ('peakwise', work/('expression','peakwise','counts.csv'), work/('expression','peakwise','norm.csv'), ), ('pairwise', work/('peak-shift','individual-pairs.csv'), work/('peak-shift','individual-pairs-norm.csv'), ), ]: nesoni.Vst( raw/(name+'-mlog2-RPM'), counts, norm_file = norms ).make() counts_table = io.read_grouped_table(counts) io.write_csv_2(raw/(name+'-info.csv'), counts_table['Annotation']) io.write_csv_2(raw/(name+'-count.csv'), counts_table['Count']) io.write_csv_2(raw/(name+'-tail.csv'), counts_table['Tail']) io.write_csv_2(raw/(name+'-tail-count.csv'), counts_table['Tail_count']) io.write_csv_2(raw/(name+'-proportion.csv'), counts_table['Proportion']) norm_table = io.read_grouped_table(norms) io.write_csv_2(raw/(name+'-norm.csv'), norm_table['All'])