Beispiel #1
0
 def setUp(self):
     # Create and populate a SolidPrimaryData instance
     self.solid_primary_data = SolidPrimaryData()
     self.solid_primary_data.add_file(utils.MockArchiveFile('test1_F3.csfasta'))
     self.solid_primary_data.add_file(utils.MockArchiveFile('test1_F3_QV.qual'))
     self.solid_primary_data.add_file(utils.MockArchiveFile('test1_F5-BC.csfasta'))
     self.solid_primary_data.add_file(utils.MockArchiveFile('test1_F5-BC_QV.qual'))
Beispiel #2
0
 def test_paired_end(self):
     # F3 file pair
     self.assertFalse(SolidPrimaryData(
         utils.MockArchiveFile('test1_F3.csfasta'),
         utils.MockArchiveFile('test1_F3_QV.qual')).paired_end)
     # F5 file pair
     self.assertTrue(SolidPrimaryData(
         utils.MockArchiveFile('test1_F5-BC.csfasta'),
         utils.MockArchiveFile('test1_F5-BC_QV.qual')).paired_end)
     # Not a file pair
     self.assertFalse(SolidPrimaryData(
         utils.MockArchiveFile('test1_F5-BC.csfasta')).paired_end)
Beispiel #3
0
 def test_timestamps(self):
     # No timestamps for 'empty' library
     lib = SolidLibrary('PB','PJB_01')
     self.assertEqual(lib.timestamps,[])
     # Add dummy fileset
     lib.add_file_set('9876543210',SolidPrimaryData())
     self.assertEqual(lib.timestamps,['9876543210'])
Beispiel #4
0
 def test_get_file_sets(self):
     # Add and retrieve fileset to/from a library
     lib = SolidLibrary('PB','PJB_01')
     fs1 = SolidPrimaryData()
     lib.add_file_set('9876543210',fs1)
     # Retrieve from specific timestamp
     self.assertEqual(lib.get_file_sets('9876543210'),[fs1])
     # Retrieve all file sets
     self.assertEqual(lib.get_file_sets(),[fs1])
Beispiel #5
0
 def test_is_valid(self):
     # F3 file pair
     self.assertTrue(SolidPrimaryData(
         utils.MockArchiveFile('test1_F3.csfasta'),
         utils.MockArchiveFile('test1_F3_QV.qual')).is_valid)
     # F5 file pair
     self.assertTrue(SolidPrimaryData(
         utils.MockArchiveFile('test1_F5-BC.csfasta'),
         utils.MockArchiveFile('test1_F5-BC_QV.qual')).is_valid)
     # Not a file pair
     self.assertFalse(SolidPrimaryData(
         utils.MockArchiveFile('test1_F3.csfasta')).is_valid)
     self.assertFalse(SolidPrimaryData(
         utils.MockArchiveFile('test1_F5-BC_QV.qual')).is_valid)
     # Too many files
     self.assertFalse(SolidPrimaryData(
         utils.MockArchiveFile('test1_F3.csfasta'),
         utils.MockArchiveFile('test1_F3_QV.qual'),
         utils.MockArchiveFile('test2_F3_QV.qual')).is_valid)
Beispiel #6
0
 def test_add_file_set(self):
     # Add a fileset to a library
     # !!!This isn't really a test!!!
     lib = SolidLibrary('PB','PJB_01')
     lib.add_file_set('9876543210',SolidPrimaryData())
Beispiel #7
0
class TestSolidPrimaryData(unittest.TestCase):
    def setUp(self):
        # Create and populate a SolidPrimaryData instance
        self.solid_primary_data = SolidPrimaryData()
        self.solid_primary_data.add_file(utils.MockArchiveFile('test1_F3.csfasta'))
        self.solid_primary_data.add_file(utils.MockArchiveFile('test1_F3_QV.qual'))
        self.solid_primary_data.add_file(utils.MockArchiveFile('test1_F5-BC.csfasta'))
        self.solid_primary_data.add_file(utils.MockArchiveFile('test1_F5-BC_QV.qual'))
    def test_add_file(self):
        # Add files
        # !!!This isn't really a test!!!
        raise unittest.SkipTest("SolidPrimaryData.add_file not testable?")
    def test_f3(self):
        # Retrieve F3 files
        self.assertEqual(len(self.solid_primary_data.f3),2)
        files = [f.path for f in self.solid_primary_data.f3]
        self.assertTrue(os.path.abspath('test1_F3.csfasta') in files)
        self.assertTrue(os.path.abspath('test1_F3_QV.qual') in files)
    def test_f5(self):
        # Retrieve F5 files
        self.assertEqual(len(self.solid_primary_data.f5),2)
        files = [f.path for f in self.solid_primary_data.f5]
        self.assertTrue(os.path.abspath('test1_F5-BC.csfasta') in files)
        self.assertTrue(os.path.abspath('test1_F5-BC_QV.qual') in files)
    def test_files(self):
        # Retrieve all files
        self.assertEqual(len(self.solid_primary_data.files),4)
        files = [f.path for f in self.solid_primary_data.files]
        self.assertTrue(os.path.abspath('test1_F3.csfasta') in files)
        self.assertTrue(os.path.abspath('test1_F3_QV.qual') in files)
        self.assertTrue(os.path.abspath('test1_F5-BC.csfasta') in files)
        self.assertTrue(os.path.abspath('test1_F5-BC_QV.qual') in files)
    def test_is_valid(self):
        # F3 file pair
        self.assertTrue(SolidPrimaryData(
            utils.MockArchiveFile('test1_F3.csfasta'),
            utils.MockArchiveFile('test1_F3_QV.qual')).is_valid)
        # F5 file pair
        self.assertTrue(SolidPrimaryData(
            utils.MockArchiveFile('test1_F5-BC.csfasta'),
            utils.MockArchiveFile('test1_F5-BC_QV.qual')).is_valid)
        # Not a file pair
        self.assertFalse(SolidPrimaryData(
            utils.MockArchiveFile('test1_F3.csfasta')).is_valid)
        self.assertFalse(SolidPrimaryData(
            utils.MockArchiveFile('test1_F5-BC_QV.qual')).is_valid)
        # Too many files
        self.assertFalse(SolidPrimaryData(
            utils.MockArchiveFile('test1_F3.csfasta'),
            utils.MockArchiveFile('test1_F3_QV.qual'),
            utils.MockArchiveFile('test2_F3_QV.qual')).is_valid)
    def test_paired_end(self):
        # F3 file pair
        self.assertFalse(SolidPrimaryData(
            utils.MockArchiveFile('test1_F3.csfasta'),
            utils.MockArchiveFile('test1_F3_QV.qual')).paired_end)
        # F5 file pair
        self.assertTrue(SolidPrimaryData(
            utils.MockArchiveFile('test1_F5-BC.csfasta'),
            utils.MockArchiveFile('test1_F5-BC_QV.qual')).paired_end)
        # Not a file pair
        self.assertFalse(SolidPrimaryData(
            utils.MockArchiveFile('test1_F5-BC.csfasta')).paired_end)