示例#1
0
 def test_lane_barcode_valid_case(self):
     path = os.path.dirname(os.path.abspath(__file__))
     parsed_lane_barcodes = classes.LaneBarcodeParser(
         os.path.join(
             path,
             '../test_data/150424_ST-E00214_0031_BH2WY7CCXX/Demultiplexing/',
             'Reports/html/H2WY7CCXX/all/all/all/laneBarcode.html'))
     expected_flowcell_data = {
         u'Yield (MBases)': u'939,600',
         u'Clusters(PF)': u'3,111,257,766',
         u'Clusters (Raw)': u'4,966,525,440'
     }
     expected_sample_data = [{
         u'Sample': u'56.64',
         u'Lane': u'1',
         u'#': u'GAATTCGT',
         u'Filtered data': u'P1775_147',
         u'Project': u'351,637,396',
         u'Raw data': u'D_Moreno_15_01',
         u'Clusters': u'106,194',
         u'Barcode sequence': u'351,637,396'
     }, {
         u'Sample': u'43.36',
         u'Lane': u'1',
         u'#': u'unknown',
         u'Filtered data': u'unknown',
         u'Project': u'269,178,284',
         u'Raw data': u'default',
         u'Clusters': u'13,232',
         u'Barcode sequence': u'43,813,954'
     }]
     assert parsed_lane_barcodes.flowcell_data == expected_flowcell_data
     assert parsed_lane_barcodes.sample_data == expected_sample_data
示例#2
0
def test_lane():
    path = os.path.dirname(os.path.abspath(__file__))
    k = classes.LaneBarcodeParser(
        os.path.join(
            path,
            '../test_data/150424_ST-E00214_0031_BH2WY7CCXX/Demultiplexing/Reports/html/H2WY7CCXX/all/all/all/laneBarcode.html'
        ))
    assert (k.sample_data is not None)
示例#3
0
 def test_lane_valid_case(self):
     path = os.path.dirname(os.path.abspath(__file__))
     parsed_lane = classes.LaneBarcodeParser(os.path.join(
         path,
         '../test_data/150424_ST-E00214_0031_BH2WY7CCXX/Demultiplexing/',
         'Reports/html/H2WY7CCXX/all/all/all/lane.html'))
     expected_sample_data = [{u'Yield (Mbases)': u'37.75',
                              u'Lane': u'1',
                              u'% One mismatchbarcode': u'63.70',
                              u'% Perfectbarcode': u'119,426',
                              u'#': u'95.00',
                              u'Filtered data': u'100.00',
                              u'Raw data': u'620,815,680',
                              u'Clusters': u'88.69',
                              u'% of thelane': u'395,451,350'}]
     self.assertEqual(parsed_lane.sample_data, expected_sample_data)
示例#4
0
def write_demuxfile(proc_stats, demux_id):
    #Includes windows drive letter support
    datafolder = "{}_data".format(proc_stats["Instrument"])
    lanebc_path = os.path.join(os.sep, "srv", "mfs", datafolder,
                               proc_stats["Run ID"], "laneBarcode.html")
    try:
        laneBC = classes.LaneBarcodeParser(lanebc_path)
    except Exception as e:
        problem_handler(
            "exit", "Unable to fetch laneBarcode.html from {}: {}".format(
                lanebc_path, str(e)))
    fname = "{}_demuxstats_{}.csv".format(demux_id, proc_stats["Flow Cell ID"])

    #Writes less undetermined info than undemultiplex_index.py. May cause problems downstreams
    with open(fname, "w") as csvfile:
        writer = csv.writer(csvfile)
        writer.writerow([
            "Project", "Sample ID", "Lane", "# Reads", "Index", "Index name",
            "% of >= Q30 Bases (PF)"
        ])
        for entry in laneBC.sample_data:
            index_name = ""
            if "PF Clusters" in entry:
                reads = entry["PF Clusters"]
            else:
                reads = entry["Clusters"]

            if proc_stats["Paired"]:
                reads = int(reads.replace(",", "")) * 2
            else:
                reads = int(reads.replace(",", ""))

            try:
                writer.writerow([entry["Project"],entry["Sample"],entry["Lane"],reads, \
                                 entry["Barcode sequence"],index_name,entry["% >= Q30bases"]])
            except Exception as e:
                problem_handler(
                    "exit",
                    "Flowcell parser is unable to fetch all necessary fields for demux file: {}"
                    .format(str(e)))
    return laneBC.sample_data