def _casava_report_to_metrics(run_info_file, casava_report, dirs):
    """Convert the supplied CASAVA demultiplex report into bcbb-style
    metric files, based on the configuration in the run_info_file.
    Metric files are written to the workdir
    """

    metric_files = []
    metrics = defaultdict(dict)
    for report in casava_report:
        for lane, data in dmx._parse_demultiplex_stats_htm(report).items():
            for sequence, metric in data.items():
                # Assert that we are not overwriting a previously parsed metric
                assert not (lane in metrics and sequence in metrics[lane]), \
                "Conflicting demultiplex metrics found for lane {} and index {}. " \
                "This means that there are multiple demultiplex results for the same sample. " \
                "Please review and rectify before proceeding!".format(lane,sequence)
                metrics[lane][sequence] = metric

    with open(run_info_file) as fh:
        info = yaml.load(fh)

        fc_name, fc_date = fc.get_flowcell_info(dirs["flowcell"])
        for item in info:
            metrics_file = "{}_{}_{}.bc_metrics".format(
                item["lane"], fc_date, fc_name)
            multiplex = item.get("multiplex", [])
            for plex in multiplex:
                plex["lane"] = item["lane"]

            dmx._write_demultiplex_metrics(
                multiplex, metrics, os.path.join(dirs["work"], metrics_file))
            metric_files.append(metrics_file)
    return metric_files
def _casava_report_to_metrics(run_info_file, casava_report, dirs):
    """Convert the supplied CASAVA demultiplex report into bcbb-style
    metric files, based on the configuration in the run_info_file.
    Metric files are written to the workdir
    """
    
    metric_files = []
    metrics = defaultdict(dict)
    for report in casava_report:
        for lane, data in dmx._parse_demultiplex_stats_htm(report).items():
            for sequence, metric in data.items():
                # Assert that we are not overwriting a previously parsed metric
                assert not (lane in metrics and sequence in metrics[lane]), \
                "Conflicting demultiplex metrics found for lane {} and index {}. " \
                "This means that there are multiple demultiplex results for the same sample. " \
                "Please review and rectify before proceeding!".format(lane,sequence)
                metrics[lane][sequence] = metric
                
    with open(run_info_file) as fh:
        info = yaml.load(fh)

        fc_name, fc_date = fc.get_flowcell_info(dirs["flowcell"])
        for item in info:
            metrics_file = "{}_{}_{}.bc_metrics".format(item["lane"], fc_date, fc_name)
            multiplex = item.get("multiplex", [])
            for plex in multiplex:
                plex["lane"] = item["lane"]

            dmx._write_demultiplex_metrics(multiplex, metrics, os.path.join(dirs["work"], metrics_file))
            metric_files.append(metrics_file)
    return metric_files
def _casava_report_to_metrics(run_info_file, casava_report, dirs):
    """Convert the supplied CASAVA demultiplex report into bcbb-style
    metric files, based on the configuration in the run_info_file.
    Metric files are written to the workdir
    """
    
    metric_files = []
    metrics = dmx._parse_demultiplex_stats_htm(casava_report)    
    with open(run_info_file) as fh:
        info = yaml.load(fh)

        fc_name, fc_date = fc.get_flowcell_info(dirs["flowcell"])
        for item in info:
            metrics_file = "{}_{}_{}.bc_metrics".format(item["lane"], fc_date, fc_name)
            multiplex = item.get("multiplex", [])
            for plex in multiplex:
                plex["lane"] = item["lane"]

            dmx._write_demultiplex_metrics(multiplex, metrics, os.path.join(dirs["work"], metrics_file))
            metric_files.append(metrics_file)
    return metric_files
Exemple #4
0
def _casava_report_to_metrics(run_info_file, casava_report, dirs):
    """Convert the supplied CASAVA demultiplex report into bcbb-style
    metric files, based on the configuration in the run_info_file.
    Metric files are written to the workdir
    """

    metric_files = []
    metrics = dmx._parse_demultiplex_stats_htm(casava_report)
    with open(run_info_file) as fh:
        info = yaml.load(fh)

        fc_name, fc_date = fc.get_flowcell_info(dirs["flowcell"])
        for item in info:
            metrics_file = "{}_{}_{}.bc_metrics".format(
                item["lane"], fc_date, fc_name)
            multiplex = item.get("multiplex", [])
            for plex in multiplex:
                plex["lane"] = item["lane"]

            dmx._write_demultiplex_metrics(
                multiplex, metrics, os.path.join(dirs["work"], metrics_file))
            metric_files.append(metrics_file)
    return metric_files