Ejemplo n.º 1
0
def process_sample_sheet(sample_sheet):
    """Create a SequencingRun object for the specified sample sheet.

    Arguments:
    sample_sheet -- a `SampleSheet.csv` file that refers to an Illumina
    MiSeq sequencing run.

    Returns: an individual SequencingRun object for the sample sheet,
    ready to be uploaded.
    """
    try:
        logging.info("going to parse metadata")
        run_metadata = parse_metadata(sample_sheet)

        logging.info("going to parse samples")
        samples = complete_parse_samples(sample_sheet)

        logging.info("going to build sequencing run")
        sequencing_run = SequencingRun(run_metadata, samples, sample_sheet)

        logging.info("going to validate sequencing run")
        validate_run(sequencing_run)

        send_message(DirectoryScannerTopics.run_discovered, run=sequencing_run)

        return sequencing_run
    except SampleSheetError, e:
        logging.exception("Failed to parse sample sheet.")
        send_message(DirectoryScannerTopics.garbled_sample_sheet,
                     sample_sheet=sample_sheet,
                     error=e)
Ejemplo n.º 2
0
    def test_parse_metadata(self):

        sheet_file = path.join(path_to_module, "fake_ngs_data",
                               "SampleSheet.csv")
        meta_data = parse_metadata(sheet_file)

        correct_metadata = {"readLengths": "251",
                            "assay": "Nextera XT",
                            "description": "Superbug",
                            "application": "FASTQ Only",
                            "investigatorName": "Some Guy",
                            "adapter": "AAAAGGGGAAAAGGGGAAA",
                            "workflow": "GenerateFASTQ",
                            "reversecomplement": "0",
                            "iemfileversion": "4",
                            "date": "10/15/2013",
                            "experimentName": "1",
                            "chemistry": "Amplicon",
                            "layoutType": "PAIRED_END"}

        self.assertEqual(correct_metadata, meta_data)
Ejemplo n.º 3
0
    def test_parse_metadata_extra_commas(self):

        sheet_file = path.join(path_to_module, "testValidSheetTrailingCommas",
                               "SampleSheet.csv")
        meta_data = parse_metadata(sheet_file)

        correct_metadata = {"readLengths": "301",
                            "assay": "TruSeq HT",
                            "description": "252",
                            "application": "FASTQ Only",
                            "investigatorName": "Investigator",
                            "adapter": "AGATCGGAAGAGCACACGTCTGAACTCCAGTCA",
			    "adapterread2": "AGATCGGAAGAGCGTCGTGTAGGGAAAGAGTGT",
                            "workflow": "GenerateFASTQ",
                            "reversecomplement": "0",
                            "iemfileversion": "4",
                            "date": "2015-11-12",
                            "experimentName": "252",
                            "chemistry": "Amplicon",
                            "layoutType": "PAIRED_END"}

        self.assertEqual(correct_metadata, meta_data)
Ejemplo n.º 4
0
    def test_parse_extra_metadata(self):
        sample_sheet = path.join(path_to_module, 'extra-metadata', 'SampleSheet.csv')

        # test that these parsers don't throw on unexpected sections or keys
        metadata = parse_metadata(sample_sheet)
        samples = complete_parse_samples(sample_sheet)
Ejemplo n.º 5
0
 def test_super_invalid_sample_sheets(self):
     with self.assertRaises(SampleSheetError):
         parse_metadata(path.join(path_to_module, "super-invalid-sample-sheet", "SampleSheet.csv"))