def test_sample_sheet_path(self): fc = BaseFlowcell.init_flowcell(self.original_flowcell) sample_sheet = os.path.join(fc.path, 'SampleSheet.csv') sample_sheet_renamed = os.path.join(fc.path, 'SamapleSheet.csv.bckp') os.rename(sample_sheet, sample_sheet_renamed) sample_sheet_path = os.path.join("tests/test_data/sample_sheets/hiseqx", fc.name, 'SampleSheet.csv') sample_sheet_parser = SampleSheetParser(sample_sheet_path) self.assertEqual(fc.sample_sheet, sample_sheet_parser.data) os.rename(sample_sheet_renamed, sample_sheet)
def test_sample_sheet_path(self): fc = BaseFlowcell.init_flowcell(self.original_flowcell) sample_sheet = os.path.join(fc.path, 'SampleSheet.csv') sample_sheet_renamed = os.path.join(fc.path, 'SamapleSheet.csv.bckp') os.rename(sample_sheet, sample_sheet_renamed) sample_sheet_path = os.path.join( "tests/test_data/sample_sheets/hiseqx", fc.name, 'SampleSheet.csv') sample_sheet_parser = SampleSheetParser(sample_sheet_path) self.assertEqual(fc.sample_sheet, sample_sheet_parser.data) os.rename(sample_sheet_renamed, sample_sheet)
def get_running_flowcells(self): flowcells = [] for data_folder in self.config.get('data_folders', []): # go through subfolders subfolders = filter(os.path.isdir, [os.path.join(data_folder, fc_path) for fc_path in os.listdir(data_folder)]) for flowcell_path in subfolders: # skip non-flowcell foldersd if not re.match(FC_NAME_RE, os.path.basename(flowcell_path)): logging.warning("Flowcell name doesn't match regex: {}".format(flowcell_path)) continue # depending on the type, return instance of related class (hiseq, hiseqx, miseq, etc) flowcell = BaseFlowcell.init_flowcell(path=flowcell_path) flowcells.append(flowcell) return flowcells
def get_nosync_flowcells(self): flowcells = [] # check nosync folder for data_folder in self.config.get('data_folders', []): nosync_folder = os.path.join(data_folder, 'nosync') if os.path.exists(nosync_folder): # move flowcell to nosync list for flowcell_name in os.listdir(nosync_folder): flowcell_path = os.path.join(nosync_folder, flowcell_name) # skip non-flowcell folders if not re.match(FC_NAME_RE, os.path.basename(flowcell_path)): logging.warning("Flowcell name doesn't match regex: {}".format(flowcell_path)) continue flowcell = BaseFlowcell.init_flowcell(flowcell_path) flowcells.append(flowcell) return flowcells
def test_transferring(self): fc = BaseFlowcell.init_flowcell(self.original_flowcell) self.assertIsNotNone(fc.transfering_started) # to make sure it's a datetime and nothing else transfering = { 'hiseqx': { 'url': 'localhost', 'username': '******', 'path': os.path.join(os.path.abspath('tests/test_data/hiseqx')) #)'/Users/ekaterinastepanova/work/hugin/tests/test_data/hiseqx' } } config.update({'transfering': transfering}) self.assertGreater(datetime.datetime.now(), fc.transfering_started)
def test_transferring(self): fc = BaseFlowcell.init_flowcell(self.original_flowcell) self.assertIsNotNone(fc.transfering_started) # to make sure it's a datetime and nothing else transfering = { 'hiseqx': { 'url': 'localhost', 'username': '******', 'path': os.path.join( os.path.abspath('tests/test_data/hiseqx') ) #)'/Users/ekaterinastepanova/work/hugin/tests/test_data/hiseqx' } } config.update({'transfering': transfering}) self.assertGreater(datetime.datetime.now(), fc.transfering_started)
def test_seq_demux_started_done(self): fc = BaseFlowcell(self.original_flowcell) self.assertIsNotNone(fc.sequencing_started) # self.assertEqual(type(fc.sequencing_started), type(datetime.datetime)) self.assertIsNotNone(fc.sequencing_done) # self.assertEqual(type(fc.sequencing_done), type(datetime.datetime)) self.assertIsNotNone(fc.demultiplexing_started) # self.assertEqual(type(fc.demultiplexing_started), type(datetime)) self.assertIsNotNone(fc.demultiplexing_done) datetime_set = { type(fc.sequencing_started), type(fc.sequencing_done), type(fc.demultiplexing_started), type(fc.demultiplexing_done) } self.assertSetEqual({type(datetime.datetime.now())}, datetime_set)
def get_nosync_flowcells(self): flowcells = [] # check nosync folder for data_folder in self.config.get('data_folders', []): nosync_folder = os.path.join(data_folder, 'nosync') if os.path.exists(nosync_folder): # move flowcell to nosync list for flowcell_name in os.listdir(nosync_folder): flowcell_path = os.path.join(nosync_folder, flowcell_name) # skip non-flowcell folders if not re.match(FC_NAME_RE, os.path.basename(flowcell_path)): logging.warning( "Flowcell name doesn't match regex: {}".format( flowcell_path)) continue flowcell = BaseFlowcell.init_flowcell(flowcell_path) flowcells.append(flowcell) return flowcells
def get_running_flowcells(self): flowcells = [] for data_folder in self.config.get('data_folders', []): # go through subfolders subfolders = filter(os.path.isdir, [ os.path.join(data_folder, fc_path) for fc_path in os.listdir(data_folder) ]) for flowcell_path in subfolders: # skip non-flowcell foldersd if not re.match(FC_NAME_RE, os.path.basename(flowcell_path)): logging.warning( "Flowcell name doesn't match regex: {}".format( flowcell_path)) continue # depending on the type, return instance of related class (hiseq, hiseqx, miseq, etc) flowcell = BaseFlowcell.init_flowcell(path=flowcell_path) flowcells.append(flowcell) return flowcells
def test_check_status(self): fc = BaseFlowcell.init_flowcell(self.original_flowcell) self.assertEqual(fc.status, FC_STATUSES['CHECKSTATUS']) self.assertIsNotNone(fc.check_status)
def test_due_date(self): fc = BaseFlowcell.init_flowcell(self.original_flowcell) self.assertGreater(datetime.datetime.now(), fc.due_date)
def test_sequencing_started(self): fc = BaseFlowcell.init_flowcell(self.original_flowcell) self.assertIsNotNone(fc.sequencing_started)
def test_init_flowcell(self): fc = BaseFlowcell.init_flowcell(self.original_flowcell) self.assertIsInstance(fc, HiseqxFlowcell)
def test_run_info_present(self): fc = BaseFlowcell(path=self.original_flowcell) self.assertIsNotNone(fc.run_info) self.assertIsNotNone(fc.run_parameters) self.assertIsNotNone(fc.cycle_times) self.assertIsNotNone(fc.sample_sheet)
def test_path(self): fc = BaseFlowcell(self.original_flowcell) self.assertEqual(self.original_flowcell, fc.path)
def test_init_flowcell(self): fc = BaseFlowcell.init_flowcell(self.original_flowcell) self.assertIsInstance(fc, HiseqFlowcell)
def test_sequencing_started(self): fc = BaseFlowcell.init_flowcell(self.original_flowcell) self.assertIsNotNone(fc.sequencing_started)
def test_due_date(self): fc = BaseFlowcell.init_flowcell(self.original_flowcell) self.assertGreater(datetime.datetime.now(), fc.due_date)
def test_check_status(self): fc = BaseFlowcell.init_flowcell(self.original_flowcell) self.assertEqual(fc.status, FC_STATUSES['CHECKSTATUS']) self.assertIsNotNone(fc.check_status)