def test_single_index_with_lanes(self): """SampleSheetBarcodes: single index sample sheet with lanes defined """ s = SampleSheetBarcodes(self.single_index_with_lanes) # Check all barcodes self.assertEqual(s.barcodes(),["ACAGTG","CTTGTA", "GCCAAT","GTGAAA"]) # Check barcodes in each lane self.assertEqual(s.barcodes(1),["CTTGTA","GCCAAT"]) self.assertEqual(s.barcodes(2),["ACAGTG","GTGAAA"]) # Check all samples self.assertEqual(s.samples(),["EP1","EP2","ES1","ES2"]) # Check samples in each lane self.assertEqual(s.samples(1),["EP1","ES1"]) self.assertEqual(s.samples(2),["EP2","ES2"]) # Look up sample names for barcodes in each lane self.assertEqual(s.lookup_sample("GCCAAT",1),"ES1") self.assertEqual(s.lookup_sample("CTTGTA",1),"EP1") self.assertEqual(s.lookup_sample("ACAGTG",2),"ES2") self.assertEqual(s.lookup_sample("GTGAAA",2),"EP2") # Look up barcode matching sample names in each lane self.assertEqual(s.lookup_barcode("ES1",1),"GCCAAT") self.assertEqual(s.lookup_barcode("EP1",1),"CTTGTA") self.assertEqual(s.lookup_barcode("ES2",2),"ACAGTG") self.assertEqual(s.lookup_barcode("EP2",2),"GTGAAA")
def test_dual_index_no_lanes(self): """SampleSheetBarcodes: dual index sample sheet with no lanes defined """ s = SampleSheetBarcodes(self.dual_index_no_lanes) # Check all barcodes self.assertEqual(s.barcodes(),["AGGCAGAATCTTACGC", "CGTACTAGTCTTACGC", "GGACTCCTTCTTACGC", "TAAGGCGATCTTACGC", "TAGGCATGTCTTACGC", "TCCTGAGCTCTTACGC"]) # Check all samples self.assertEqual(s.samples(),["SW1","SW2","SW3","SW4","SW5","SW6"]) # Look up sample names for barcodes in each lane self.assertEqual(s.lookup_sample("TAAGGCGATCTTACGC"),"SW1") self.assertEqual(s.lookup_sample("CGTACTAGTCTTACGC"),"SW2") self.assertEqual(s.lookup_sample("AGGCAGAATCTTACGC"),"SW3") self.assertEqual(s.lookup_sample("TCCTGAGCTCTTACGC"),"SW4") self.assertEqual(s.lookup_sample("GGACTCCTTCTTACGC"),"SW5") self.assertEqual(s.lookup_sample("TAGGCATGTCTTACGC"),"SW6") # Look up barcode matching sample names in each lane self.assertEqual(s.lookup_barcode("SW1"),"TAAGGCGATCTTACGC") self.assertEqual(s.lookup_barcode("SW2"),"CGTACTAGTCTTACGC") self.assertEqual(s.lookup_barcode("SW3"),"AGGCAGAATCTTACGC") self.assertEqual(s.lookup_barcode("SW4"),"TCCTGAGCTCTTACGC") self.assertEqual(s.lookup_barcode("SW5"),"GGACTCCTTCTTACGC") self.assertEqual(s.lookup_barcode("SW6"),"TAGGCATGTCTTACGC")
def test_non_existent_lane_raises_exception(self): """SampleSheetBarcodes: request non-existent lane raises KeyError """ # Bad lane for sample sheet with lanes s = SampleSheetBarcodes(self.dual_index_with_lanes) self.assertRaises(KeyError,s.barcodes,5) self.assertRaises(KeyError,s.samples,5) # Any lane for sample sheet with no lanes s = SampleSheetBarcodes(self.dual_index_no_lanes) self.assertRaises(KeyError,s.barcodes,1) self.assertRaises(KeyError,s.samples,1)
def test_dual_index_with_lanes(self): """SampleSheetBarcodes: dual index sample sheet with lanes defined """ s = SampleSheetBarcodes(self.dual_index_with_lanes) # Check all barcodes self.assertEqual(s.barcodes(),["ACAGTGATTCTTTCCC", "ACCGATTCGCGCGTAG", "ATGCTCGTCTCGCATC", "ATGCTCGTCTCGCATC", "ATGTCAGATCTTTCCC", "CAGATCATTCTTTCCC", "CCAGCAATATCGCGAG", "CCGCGTAAGCAATAGA", "CGTGTAGGATGTAACT", "CGTGTAGGCACAGGAT", "CGTGTAGGGACCTGTA", "CGTGTAGGGTTTCAGA", "GCCAATATTCTTTCCC", "GGATTCGCTAGTAGCC", "TACCAGCGCGCTGCTG"]) # Check barcodes in each lane self.assertEqual(s.barcodes(1),["CGTGTAGGATGTAACT", "CGTGTAGGCACAGGAT", "CGTGTAGGGACCTGTA", "CGTGTAGGGTTTCAGA"]) self.assertEqual(s.barcodes(2),["CAGATCATTCTTTCCC", "GCCAATATTCTTTCCC"]) self.assertEqual(s.barcodes(3),["ACCGATTCGCGCGTAG", "ATGCTCGTCTCGCATC", "CCGCGTAAGCAATAGA", "GGATTCGCTAGTAGCC", "TACCAGCGCGCTGCTG"]) self.assertEqual(s.barcodes(4),["ACAGTGATTCTTTCCC", "ATGCTCGTCTCGCATC", "ATGTCAGATCTTTCCC", "CCAGCAATATCGCGAG"]) # Check all samples self.assertEqual(s.samples(),["AD5","AEx","AEx", "AT1","AT3","AT4","AT5", "D3K1","D3K2", "DI1","DI2","DI3","DI4", "E11","E12"]) # Check samples in each lane self.assertEqual(s.samples(1),["DI1","DI2","DI3","DI4"]) self.assertEqual(s.samples(2),["E11","E12"]) self.assertEqual(s.samples(3),["AEx","AT1","AT3","AT4","AT5"]) self.assertEqual(s.samples(4),["AD5","AEx","D3K1","D3K2"]) # Look up sample names for barcodes in each lane self.assertEqual(s.lookup_sample("CGTGTAGGGACCTGTA",1),"DI1") self.assertEqual(s.lookup_sample("CGTGTAGGATGTAACT",1),"DI2") self.assertEqual(s.lookup_sample("CGTGTAGGGTTTCAGA",1),"DI3") self.assertEqual(s.lookup_sample("CGTGTAGGCACAGGAT",1),"DI4") self.assertEqual(s.lookup_sample("GCCAATATTCTTTCCC",2),"E11") self.assertEqual(s.lookup_sample("CAGATCATTCTTTCCC",2),"E12") self.assertEqual(s.lookup_sample("GGATTCGCTAGTAGCC",3),"AT1") self.assertEqual(s.lookup_sample("TACCAGCGCGCTGCTG",3),"AT3") self.assertEqual(s.lookup_sample("ACCGATTCGCGCGTAG",3),"AT4") self.assertEqual(s.lookup_sample("CCGCGTAAGCAATAGA",3),"AT5") self.assertEqual(s.lookup_sample("ATGCTCGTCTCGCATC",3),"AEx") self.assertEqual(s.lookup_sample("ATGCTCGTCTCGCATC",4),"AEx") self.assertEqual(s.lookup_sample("CCAGCAATATCGCGAG",4),"AD5") self.assertEqual(s.lookup_sample("ACAGTGATTCTTTCCC",4),"D3K1") self.assertEqual(s.lookup_sample("ATGTCAGATCTTTCCC",4),"D3K2") # Look up barcode matching sample names in each lane self.assertEqual(s.lookup_barcode("DI1",1),"CGTGTAGGGACCTGTA") self.assertEqual(s.lookup_barcode("DI2",1),"CGTGTAGGATGTAACT") self.assertEqual(s.lookup_barcode("DI3",1),"CGTGTAGGGTTTCAGA") self.assertEqual(s.lookup_barcode("DI4",1),"CGTGTAGGCACAGGAT") self.assertEqual(s.lookup_barcode("E11",2),"GCCAATATTCTTTCCC") self.assertEqual(s.lookup_barcode("E12",2),"CAGATCATTCTTTCCC") self.assertEqual(s.lookup_barcode("AT1",3),"GGATTCGCTAGTAGCC") self.assertEqual(s.lookup_barcode("AT3",3),"TACCAGCGCGCTGCTG") self.assertEqual(s.lookup_barcode("AT4",3),"ACCGATTCGCGCGTAG") self.assertEqual(s.lookup_barcode("AT5",3),"CCGCGTAAGCAATAGA") self.assertEqual(s.lookup_barcode("AEx",3),"ATGCTCGTCTCGCATC") self.assertEqual(s.lookup_barcode("AEx",4),"ATGCTCGTCTCGCATC") self.assertEqual(s.lookup_barcode("AD5",4),"CCAGCAATATCGCGAG") self.assertEqual(s.lookup_barcode("D3K1",4),"ACAGTGATTCTTTCCC") self.assertEqual(s.lookup_barcode("D3K2",4),"ATGTCAGATCTTTCCC")