Exemplo n.º 1
0
 def _collect_pre_casava_qc(self):
     qc_objects = []
     runinfo_yaml = os.path.join(os.path.abspath(self.pargs.flowcell), "run_info.yaml")
     try:
         with open(runinfo_yaml) as fh:
             runinfo = yaml.load(fh)
     except IOError as e:
         self.app.log.warn(str(e))
         raise e
     fcdir = os.path.abspath(self.pargs.flowcell)
     (fc_date, fc_name) = self._fc_parts()
     ## Check modification time
     if modified_within_days(fcdir, self.pargs.mtime):
         fc_kw = dict(path=fcdir, fc_date = fc_date, fc_name=fc_name)
         fcobj = FlowcellRunMetrics(**fc_kw)
         fcobj.parse_illumina_metrics(fullRTA=False)
         fcobj.parse_bc_metrics()
         fcobj.parse_filter_metrics()
         if not fcobj.parse_samplesheet_csv():
             fcobj.parse_run_info_yaml()
         qc_objects.append(fcobj)
     else:
         return qc_objects
     for info in runinfo:
         if not info.get("multiplex", None):
             self.app.log.warn("No multiplex information for lane {}".format(info.get("lane")))
             sample.update({k: info.get(k, None) for k in ('analysis', 'description', 'flowcell_id', 'lane')})
             sample_kw = dict(path=fcdir, flowcell=fc_name, date=fc_date, lane=sample.get('lane', None), barcode_name=sample.get('name', None), sample_prj=sample.get('sample_prj', None),
                              barcode_id=sample.get('barcode_id', None), sequence=sample.get('sequence', "NoIndex"))
         for sample in info["multiplex"]:
             sample.update({k: info.get(k, None) for k in ('analysis', 'description', 'flowcell_id', 'lane')})
             sample_kw = dict(path=fcdir, flowcell=fc_name, date=fc_date, lane=sample['lane'], barcode_name=sample['name'], sample_prj=sample.get('sample_prj', None),
                              barcode_id=sample['barcode_id'], sequence=sample.get('sequence', "NoIndex"))
             obj = SampleRunMetrics(**sample_kw)
             obj.read_picard_metrics()
             obj.parse_fastq_screen()
             obj.parse_bc_metrics()
             obj.read_fastqc_metrics()
             qc_objects.append(obj)
     return qc_objects