def _collect_casava_qc(self): qc_objects = [] read_setup = None demux_stats = None fcdir = os.path.join(os.path.abspath(self._meta.root_path), self.pargs.flowcell) # Get the fc_name, fc_date from RunInfo parser = FlowcellRunMetricsParser(fcdir) runinfo_xml = parser.parseRunInfo() runparams = parser.parseRunParameters() fc_date = runinfo_xml.get('Date', None) fc_name = runinfo_xml.get('Flowcell', None) fc_pos = runparams.get('FCPosition', '') runinfo_csv = os.path.join( os.path.join(self._meta.root_path, self.pargs.flowcell), "{}.csv".format(fc_name)) if not os.path.exists(runinfo_csv): LOG.warn("No such file {}: trying fallback SampleSheet.csv".format( runinfo_csv)) runinfo_csv = os.path.join( os.path.join(self._meta.root_path, self.pargs.flowcell), "SampleSheet.csv") runinfo = parser.parse_samplesheet_csv(runinfo_csv=runinfo_csv) if modified_within_days(fcdir, self.pargs.mtime): # Most of the code expects to have the flowcell position pre-pended to the flowcell id fc_kw = dict(fc_date=fc_date, fc_name="{}{}".format(fc_pos, fc_name)) fcobj = FlowcellRunMetricsDocument(**fc_kw) fcobj["RunInfo"] = runinfo_xml fcobj["RunParameters"] = runparams fcobj["DemultiplexConfig"] = parser.parseDemultiplexConfig(**fc_kw) fcobj["illumina"] = parser.parse_illumina_metrics(fullRTA=False, **fc_kw) fcobj["bc_metrics"] = parser.parse_bc_metrics(**fc_kw) fcobj[ "undemultiplexed_barcodes"] = parser.parse_undemultiplexed_barcode_metrics( **fc_kw) fcobj["illumina"].update({ "Demultiplex_Stats": parser.parse_demultiplex_stats_htm(**fc_kw) }) fcobj["samplesheet_csv"] = runinfo read_setup = fcobj["RunInfo"].get('Reads', []) fcobj["run_setup"] = self._run_setup(read_setup) demux_stats = fcobj["illumina"]["Demultiplex_Stats"] qc_objects.append(fcobj) qc_objects = self._parse_samplesheet(runinfo, qc_objects, fc_date, "{}{}".format(fc_pos, fc_name), fcdir, demultiplex_stats=demux_stats, setup=read_setup) return qc_objects
def _collect_casava_qc(self): qc_objects = [] read_setup = None demux_stats = None fcdir = os.path.join(os.path.abspath(self._meta.root_path), self.pargs.flowcell) # Get the fc_name, fc_date from RunInfo parser = FlowcellRunMetricsParser(fcdir) runinfo_xml = parser.parseRunInfo() runparams = parser.parseRunParameters() fc_date = runinfo_xml.get('Date',None) fc_name = runinfo_xml.get('Flowcell',None) fc_pos = runparams.get('FCPosition','') runinfo_csv = os.path.join(os.path.join(self._meta.root_path, self.pargs.flowcell), "{}.csv".format(fc_name)) if not os.path.exists(runinfo_csv): LOG.warn("No such file {}: trying fallback SampleSheet.csv".format(runinfo_csv)) runinfo_csv = os.path.join(os.path.join(self._meta.root_path, self.pargs.flowcell), "SampleSheet.csv") runinfo = parser.parse_samplesheet_csv(runinfo_csv=runinfo_csv) if modified_within_days(fcdir, self.pargs.mtime): # Most of the code expects to have the flowcell position pre-pended to the flowcell id fc_kw = dict(fc_date = fc_date, fc_name="{}{}".format(fc_pos,fc_name)) fcobj = FlowcellRunMetricsDocument(**fc_kw) fcobj["RunInfo"] = runinfo_xml fcobj["RunParameters"] = runparams fcobj["DemultiplexConfig"] = parser.parseDemultiplexConfig(**fc_kw) fcobj["illumina"] = parser.parse_illumina_metrics(fullRTA=False, **fc_kw) fcobj["bc_metrics"] = parser.parse_bc_metrics(**fc_kw) fcobj["undemultiplexed_barcodes"] = parser.parse_undemultiplexed_barcode_metrics(**fc_kw) fcobj["illumina"].update({"Demultiplex_Stats" : parser.parse_demultiplex_stats_htm(**fc_kw)}) fcobj["samplesheet_csv"] = runinfo read_setup = fcobj["RunInfo"].get('Reads',[]) fcobj["run_setup"] = self._run_setup(read_setup) demux_stats = fcobj["illumina"]["Demultiplex_Stats"] qc_objects.append(fcobj) qc_objects = self._parse_samplesheet(runinfo, qc_objects, fc_date, "{}{}".format(fc_pos,fc_name), fcdir, demultiplex_stats=demux_stats, setup=read_setup) return qc_objects