Ejemplo n.º 1
0
def _sample_based_run_info(fc):
    """Convert a regular run info file into a sample-based info file, one sample per lane"""
    sample_fc = PostProcessedFlowcell(fc.get_fc_name(),
                                      fc.get_fc_date(), {},
                                      fc_alias=fc.get_fc_alias(),
                                      fc_dir=fc.get_fc_dir())
    lane_num = 0
    for l in fc.get_lanes():
        bcids = l.get_barcode_ids()
        for barcode_id in bcids:
            s = l.get_sample_by_barcode(barcode_id)
            lane_num = lane_num + 1
            newl = Lane(
                data={
                    "description": str(s.get_name()),
                    "lane": lane_num,
                    "multiplex": [],
                    "analysis": "Minimal",
                    "genome_build": s.get_genome_build(),
                    "sample_prj": s.get_project()
                })
            newl.set_name("%s" % lane_num)
            files = l.get_files()
            if options.customer_delivery or options.barcode_id_to_name:
                pat = "%s.*_%s_[12].*$" % (
                    l.get_name(), get_sample_name(s.get_barcode_name()))
            else:
                pat = "%s.*_%s_[12].*$" % (l.get_name(), barcode_id)
            bc_files = re.compile(pat, re.IGNORECASE)
            files = filter(bc_files.search, files)
            newl.set_files(files)
            sample_fc.add_lane(newl)
    _save_run_info(sample_fc, "sample_project_run_info.yaml")
Ejemplo n.º 2
0
def _convert_barcode_id_to_name(multiplex, fc_name, fq):
    bcid2name = dict([(str(mp.get_barcode_id()), mp.get_full_name()) for mp in multiplex])
    if options.no_full_names:
        bcid2name = dict([(str(mp.get_barcode_id()), get_sample_name(mp.get_barcode_name())) for mp in multiplex])
    bcid = re.search("_(\d+)_(\d+)_fastq.txt", fq)
    from_str = "%s_%s_fastq.txt" % (bcid.group(1), bcid.group(2))
    to_str   = "%s_%s.fastq" % (bcid2name[bcid.group(1)], bcid.group(2))
    return fq.replace(from_str, to_str)
Ejemplo n.º 3
0
def _convert_barcode_id_to_name(multiplex, fc_name, fq):
    bcid2name = dict([(str(mp.get_barcode_id()), mp.get_full_name())
                      for mp in multiplex])
    if options.no_full_names:
        bcid2name = dict([(str(mp.get_barcode_id()),
                           get_sample_name(mp.get_barcode_name()))
                          for mp in multiplex])
    bcid = re.search("_(\d+)_(\d+)_fastq.txt", fq)
    from_str = "%s_%s_fastq.txt" % (bcid.group(1), bcid.group(2))
    to_str = "%s_%s.fastq" % (bcid2name[bcid.group(1)], bcid.group(2))
    return fq.replace(from_str, to_str)
Ejemplo n.º 4
0
def _sample_based_run_info(fc):
    """Convert a regular run info file into a sample-based info file, one sample per lane"""
    sample_fc = PostProcessedFlowcell(fc.get_fc_name(), fc.get_fc_date(), {}, fc_alias = fc.get_fc_alias(), fc_dir=fc.get_fc_dir())    
    lane_num = 0
    for l in fc.get_lanes():
        bcids = l.get_barcode_ids()
        for barcode_id in bcids:
            s = l.get_sample_by_barcode(barcode_id)
            lane_num = lane_num + 1
            newl = Lane(data={"description":str(s.get_name()), "lane" :lane_num, "multiplex":[], "analysis":"Minimal", "genome_build":s.get_genome_build(), "sample_prj":s.get_project()})
            newl.set_name("%s" % lane_num)
            files = l.get_files()
            if options.customer_delivery or options.barcode_id_to_name:
                pat = "%s.*_%s_[12].*$" % (l.get_name(), get_sample_name(s.get_barcode_name()))
            else:
                pat = "%s.*_%s_[12].*$" % (l.get_name(), barcode_id)
            bc_files = re.compile(pat, re.IGNORECASE)
            files = filter(bc_files.search, files) 
            newl.set_files(files)
            sample_fc.add_lane(newl)
    _save_run_info(sample_fc, "sample_project_run_info.yaml")