def test_report_summary_single_cell(self): """report: report single-cell run in 'summary' mode """ # Make a mock auto-process directory mockdir = MockAnalysisDirFactory.bcl2fastq2( '170901_M00879_0087_000000000-AGEW9', 'miseq', metadata={ "source": "testing", "run_number": 87, "bcl2fastq_software": "('/usr/bin/bcl2fastq', 'bcl2fastq', '2.17.1.14')", "cellranger_software": "('/usr/bin/cellranger', 'cellranger', '3.0.1')", "assay": "Nextera" }, project_metadata={ "AB": { "User": "******", "Library type": "scRNA-seq", "Organism": "Human", "PI": "Audrey Bower", "Single cell platform": "ICELL8", "Number of cells": 1311 }, "CDE": { "User": "******", "Library type": "ChIP-seq", "Organism": "Mouse", "PI": "Colin Delaney Eccleston", "Comments": "Repeat of previous run" } }, top_dir=self.dirn) mockdir.create() # Make autoprocess instance ap = AutoProcess(analysis_dir=mockdir.dirn) # Generate summary report expected = """MISEQ run #87 datestamped 170901 ================================ Run name : 170901_M00879_0087_000000000-AGEW9 Reference : MISEQ_170901#87 Platform : MISEQ Directory : %s Endedness : Paired end Bcl2fastq : bcl2fastq 2.17.1.14 Cellranger: cellranger 3.0.1 Assay : Nextera 2 projects: - 'AB': Alison Bell Human scRNA-seq (ICELL8) 2 samples/1311 cells (PI Audrey Bower) - 'CDE': Charles David Edwards Mouse ChIP-seq 2 samples (PI Colin Delaney Eccleston) Additional notes/comments: - CDE: Repeat of previous run """ % mockdir.dirn for o, e in zip(report_summary(ap).split('\n'), expected.split('\n')): self.assertEqual(o, e)
def test_report_summary(self): """report: report run in 'summary' mode """ # Make a mock auto-process directory mockdir = MockAnalysisDirFactory.bcl2fastq2( '170901_M00879_0087_000000000-AGEW9', 'miseq', metadata={ "source": "testing", "run_number": 87, "sequencer_model": "MiSeq" }, project_metadata={ "AB": { "User": "******", "Library type": "RNA-seq", "Organism": "Human", "PI": "Audrey Bower", "Sequencer model": "MiSeq" }, "CDE": { "User": "******", "Library type": "ChIP-seq", "Organism": "Mouse", "PI": "Colin Delaney Eccleston", "Sequencer model": "MiSeq", "Comments": "Repeat of previous run" } }, top_dir=self.dirn) mockdir.create() # Make autoprocess instance ap = AutoProcess(analysis_dir=mockdir.dirn) # Generate summary report expected = """MISEQ run #87 datestamped 170901 ================================ Run name : 170901_M00879_0087_000000000-AGEW9 Reference: MISEQ_170901#87 Platform : MISEQ Sequencer: MiSeq Directory: %s Endedness: Paired end Bcl2fastq: Unknown 2 projects: - 'AB': Alison Bell Human RNA-seq 2 samples (PI Audrey Bower) - 'CDE': Charles David Edwards Mouse ChIP-seq 2 samples (PI Colin Delaney Eccleston) Additional notes/comments: - CDE: Repeat of previous run """ % mockdir.dirn for o, e in zip(report_summary(ap).split('\n'), expected.split('\n')): self.assertEqual(o, e)
def test_report_summary_no_projects(self): """report: report run with no projects in 'summary' mode """ # Make a mock auto-process directory mockdir = MockAnalysisDirFactory.bcl2fastq2( '170901_M00879_0087_000000000-AGEW9', 'miseq', metadata={ "source": "testing", "run_number": 87, "processing_software": "{ 'bcl2fastq': ('/usr/bin/bcl2fastq', 'bcl2fastq', '2.17.1.14'), 'cellranger': ('/usr/bin/cellranger', 'cellranger', '3.0.1') }", "bcl2fastq_software": "('/usr/bin/bcl2fastq', 'bcl2fastq', '2.17.1.14')", "cellranger_software": "('/usr/bin/cellranger', 'cellranger', '3.0.1')", "sequencer_model": "MiSeq" }, top_dir=self.dirn) mockdir.create(no_project_dirs=True) # Make autoprocess instance ap = AutoProcess(analysis_dir=mockdir.dirn) # Generate summary report expected = """MISEQ run #87 datestamped 170901 ================================ Run name : 170901_M00879_0087_000000000-AGEW9 Reference : MISEQ_170901#87 Platform : MISEQ Sequencer : MiSeq Directory : %s Endedness : Paired end Bcl2fastq : bcl2fastq 2.17.1.14 Cellranger: cellranger 3.0.1 No projects found; 'bcl2fastq' directory contains the following data: - 'AB': 2 samples - 'CDE': 2 samples""" % mockdir.dirn report = report_summary(ap) self.assertEqual(len(report.split('\n')), len(expected.split('\n'))) for o, e in zip(report.split('\n'), expected.split('\n')): self.assertEqual(o, e)