def test_get_bases_mask_dual_index_no_sample_sheet(self): """get_bases_mask: handle dual index (no samplesheet) """ # Make a RunInfo.xml file run_info_xml = os.path.join(self.wd,"RunInfo.xml") with open(run_info_xml,'w') as fp: fp.write(RunInfoXml.hiseq("171020_SN7001250_00002_AHGXXXX")) # Check the bases mask self.assertEqual(get_bases_mask(run_info_xml),"y101,I8,I8,y101")
def test_get_bases_mask_single_index_no_sample_sheet(self): """get_bases_mask: handle single index (no samplesheet) """ # Make a single index RunInfo.xml file run_info_xml = os.path.join(self.wd,"RunInfo.xml") with open(run_info_xml,'w') as fp: fp.write(RunInfoXml.nextseq("171020_NB500968_00002_AHGXXXX")) # Check the bases mask self.assertEqual(get_bases_mask(run_info_xml),"y76,I6,y76")
def test_get_bases_mask_10x_atac_I16_I16_dual_indexes(self): """get_bases_mask_10x_atac: run with I16,I16 dual indexes """ # Make a single index RunInfo.xml file run_info_xml = os.path.join(self.wd,"RunInfo.xml") with open(run_info_xml,'w') as fp: fp.write(RunInfoXml.create("171020_NB500968_00002_AHGXXXX", "y76,I16,I16,y76",4,12)) self.assertEqual(get_bases_mask_10x_atac(run_info_xml), "y76,I8nnnnnnnn,y16,y76")
def test_get_bases_mask_10x_atac_too_short_index(self): """get_bases_mask_10x_atac: run with too-short index """ # Make a single index RunInfo.xml file run_info_xml = os.path.join(self.wd, "RunInfo.xml") with open(run_info_xml, 'w') as fp: fp.write( RunInfoXml.create("171020_NB500968_00002_AHGXXXX", "y76,I6,I16,y76", 4, 12)) self.assertRaises(Exception, get_bases_mask_10x_atac, run_info_xml)
def test_get_bases_mask_10x_atac_wrong_number_of_reads(self): """get_bases_mask_10x_atac: run with wrong number of reads """ # Make a single index RunInfo.xml file run_info_xml = os.path.join(self.wd,"RunInfo.xml") with open(run_info_xml,'w') as fp: fp.write(RunInfoXml.create("171020_NB500968_00002_AHGXXXX", "y76,I8,y76",4,12)) self.assertRaises(Exception, get_bases_mask_10x_atac, run_info_xml)
def test_get_bases_mask_dual_index_no_barcode(self): """get_bases_mask: handle dual index with no barcode """ # Make a RunInfo.xml file run_info_xml = os.path.join(self.wd,"RunInfo.xml") with open(run_info_xml,'w') as fp: fp.write(RunInfoXml.hiseq("171020_SN7001250_00002_AHGXXXX")) # Make a matching sample sheet sample_sheet_content = """[Header] IEMFileVersion,4 Date,11/23/2015 Workflow,GenerateFASTQ Application,FASTQ Only Assay,TruSeq HT Description, Chemistry,Amplicon [Reads] 76 76 [Settings] ReverseComplement,0 Adapter,AGATCGGAAGAGCACACGTCTGAACTCCAGTCA AdapterRead2,AGATCGGAAGAGCGTCGTGTAGGGAAAGAGTGT [Data] Lane,Sample_ID,Sample_Name,Sample_Plate,Sample_Well,I7_Index_ID,index,I5_Index,index2,Sample_Project,Description 1,AB1,AB1,,,,,,,AB, 2,AB2,AB2,,,,,,,AB, 3,AB1,AB1,,,,,,,AB, 4,AB2,AB2,,,,,,,AB, 5,CD1,CD1,,,,,,,CD, 6,CD2,CD2,,,,,,,CD, 7,CD1,CD1,,,,,,,CD, 8,CD2,CD2,,,,,,,CD, """ sample_sheet = os.path.join(self.wd,"SampleSheet.csv") with open(sample_sheet,'w') as fp: fp.write(sample_sheet_content) # Check the bases mask self.assertEqual(get_bases_mask(run_info_xml,sample_sheet), "y101,nnnnnnnn,nnnnnnnn,y101")
def test_get_bases_mask_10xgenomics_sample_set(self): """get_bases_mask: handle 10xGenomics sample set IDs """ # Make a RunInfo.xml file run_info_xml = os.path.join(self.wd,"RunInfo.xml") with open(run_info_xml,'w') as fp: fp.write(RunInfoXml.nextseq("171020_NB500968_00002_AHGXXXX")) # Make a matching sample sheet sample_sheet_content = """[Header] IEMFileVersion,4 Date,4/24/2018 Workflow,GenerateFASTQ Application,NextSeq FASTQ Only Assay,Nextera XT v2 Set A Description, Chemistry,Default [Reads] 76 76 [Settings] Adapter,CTGTCTCTTATACACATCT [Data] Sample_ID,Sample_Name,Sample_Plate,Sample_Well,I7_Index_ID,index,Sample_Project,Description SL1,SL1,,,N701,SI-GA-A2,SL, SL2,SL2,,,N702,SI-GA-B2,SL, SL3,SL3,,,N703,SI-GA-C2,SL, SL4,SL4,,,N704,SI-GA-D2,SL, """ sample_sheet = os.path.join(self.wd,"SampleSheet.csv") with open(sample_sheet,'w') as fp: fp.write(sample_sheet_content) # Check the bases mask self.assertEqual(get_bases_mask(run_info_xml,sample_sheet), "y76,I6,y76")
def test_get_bases_mask_single_index_truncated(self): """get_bases_mask: handle truncated single index """ # Make a single index RunInfo.xml file run_info_xml = os.path.join(self.wd,"RunInfo.xml") with open(run_info_xml,'w') as fp: fp.write(RunInfoXml.nextseq("171020_NB500968_00002_AHGXXXX")) # Make a matching sample sheet sample_sheet_content = """[Header] IEMFileVersion,4 Date,11/23/2015 Workflow,GenerateFASTQ Application,FASTQ Only Assay,TruSeq HT Description, Chemistry,Amplicon [Reads] 76 76 [Settings] ReverseComplement,0 Adapter,AGATCGGAAGAGCACACGTCTGAACTCCAGTCA AdapterRead2,AGATCGGAAGAGCGTCGTGTAGGGAAAGAGTGT [Data] Sample_ID,Sample_Name,Sample_Plate,Sample_Well,I7_Index_ID,index,Sample_Project,Description AB1,AB1,,,D701,CGTGT,AB, AB2,AB2,,,D702,ATTCA,AB, """ sample_sheet = os.path.join(self.wd,"SampleSheet.csv") with open(sample_sheet,'w') as fp: fp.write(sample_sheet_content) # Check the bases mask self.assertEqual(get_bases_mask(run_info_xml,sample_sheet), "y76,I5n,y76")