Ejemplo n.º 1
0
    def test_report_projects_custom_fields(self):
        """report: report run in 'projects' mode with custom fields
        """
        # 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"
                }
            },
            top_dir=self.dirn)
        mockdir.create()
        # Make autoprocess instance and set required metadata
        ap = AutoProcess(analysis_dir=mockdir.dirn)
        # Generate projects report
        expected = """170901\tMISEQ_170901#87\t87\ttesting\t\tAB\tAlison Bell\tAudrey Bower\tRNA-seq\t\tHuman\tMISEQ\tMiSeq\t2\t\tyes\tAB1-2\t%s
170901\tMISEQ_170901#87\t87\ttesting\t\tCDE\tCharles David Edwards\tColin Delaney Eccleston\tChIP-seq\t\tMouse\tMISEQ\tMiSeq\t2\t\tyes\tCDE3-4\t%s
""" % (ap.params.analysis_dir, ap.params.analysis_dir)
        custom_fields = [
            'datestamp', 'run_id', 'run_number', 'source', 'null', 'project',
            'user', 'PI', 'library_type', 'single_cell_platform', 'organism',
            'platform', 'sequencer_model', '#samples', '#cells', 'paired_end',
            'samples', 'path'
        ]
        for o, e in zip(
                report_projects(ap, fields=custom_fields).split('\n'),
                expected.split('\n')):
            self.assertEqual(o, e)
Ejemplo n.º 2
0
 def test_report_no_projects(self):
     """report: report run with no projects in 'projects' 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"
         },
         top_dir=self.dirn)
     mockdir.create(no_project_dirs=True)
     # Make autoprocess instance and set required metadata
     ap = AutoProcess(analysis_dir=mockdir.dirn)
     # Generate projects report
     expected = ""
     for o, e in zip(report_projects(ap).split('\n'), expected.split('\n')):
         self.assertEqual(o, e)
Ejemplo n.º 3
0
    def test_report_projects_single_cell(self):
        """report: report single-cell run in 'projects' 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": "scRNA-seq",
                    "Organism": "Human",
                    "PI": "Audrey Bower",
                    "Single cell platform": "ICELL8",
                    "Number of cells": 1311,
                    "Sequencer model": "MiSeq"
                },
                "CDE": {
                    "User": "******",
                    "Library type": "ChIP-seq",
                    "Organism": "Mouse",
                    "PI": "Colin Delaney Eccleston",
                    "Sequencer model": "MiSeq"
                }
            },
            top_dir=self.dirn)
        mockdir.create()
        # Make autoprocess instance and set required metadata
        ap = AutoProcess(analysis_dir=mockdir.dirn)
        # Generate projects report
        expected = """MISEQ_170901#87\t87\ttesting\t\tAlison Bell\tAudrey Bower\tscRNA-seq\tICELL8\tHuman\tMISEQ\t2\t1311\tyes\tAB1-2
MISEQ_170901#87\t87\ttesting\t\tCharles David Edwards\tColin Delaney Eccleston\tChIP-seq\t\tMouse\tMISEQ\t2\t\tyes\tCDE3-4
"""
        for o, e in zip(report_projects(ap).split('\n'), expected.split('\n')):
            self.assertEqual(o, e)