Skip to content

Commit

Permalink
Fix bug in analysis.py
Browse files Browse the repository at this point in the history
  • Loading branch information
ASintsova authored Feb 8, 2024
1 parent 3d3aad5 commit 632d514
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions mbarq/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,12 +383,14 @@ def process_results(self, contrasts_run=()):
self.logger.info('Writing out final results.')
if not contrasts_run:
contrasts_run = self.sd.contrasts
try:
res = pd.concat([pd.read_table(self.output_dir / f"{self.name}_{i}_vs_{self.sd.baseline}.gene_summary.txt")
.assign(contrast=i) for i in contrasts_run])
except:
print(f"Warning: No such file or directory: {self.output_dir}/{self.name}_{i}_vs_{self.sd.baseline}.gene_summary.txt")

contrast_dfs = []
for con in contrasts_run:
try:
contrast_dfs.append(pd.read_table(self.output_dir / f"{self.name}_{con}_vs_{self.sd.baseline}.gene_summary.txt")
.assign(contrast=con))
except:
print(f"Warning: No such file or directory: {self.output_dir}/{self.name}_{con}_vs_{self.sd.baseline}.gene_summary.txt")
res = pd.concat(contrast_dfs)
bc_res = pd.concat([pd.read_table(self.output_dir / f"{self.name}_{i}_vs_{self.sd.baseline}.sgrna_summary.txt")
.assign(contrast=i) for i in contrasts_run]).rename({'sgrna': 'barcode', 'Gene': 'Name'}, axis=1)
fres = res[['id', 'num', 'neg|lfc', 'neg|fdr', 'pos|fdr', 'contrast']]
Expand Down

0 comments on commit 632d514

Please sign in to comment.