def testGetTumourSamples(self):
        mnf = Manifest.Manifest(os.path.join(wdir, 'contrast2.txt'))
        ts = mnf.get_tumour_samples()
        self.assertTrue(type(ts) == set)
        self.assertEqual(['B', 'C'], sorted(list(ts)))

        # W/o tumour samples
        mnf = Manifest.Manifest(os.path.join(wdir, 'fastqc.txt'))
        self.assertEqual(set(), mnf.get_tumour_samples())
    def testCanGetFastqcTable(self):
        mnf = Manifest.Manifest(os.path.join(wdir, 'mnf.txt'))
        self.assertEqual(6, len(
            mnf.fastqc))  # mnf.txt has 4 rows  with a duplicate fastq pair
        self.assertEqual('N1/fastqc/N1_S4_R1_001.fastq.gz.md5',
                         list(mnf.fastqc['fastq_md5'])[0])

        mnf = Manifest.Manifest(os.path.join(wdir, 'fastqc.txt'))
        self.assertEqual(2, len(mnf.fastqc))
        self.assertEqual('L1/fastqc/R1/reads.fastq.gz.md5',
                         list(mnf.fastqc['fastq_md5'])[0])
        self.assertEqual('L1/fastqc/R2/reads.fastq.gz.md5',
                         list(mnf.fastqc['fastq_md5'])[1])
 def testCanSymlinkBamFiles(self):
     shutil.rmtree('N1', ignore_errors=True)
     shutil.rmtree('P1', ignore_errors=True)
     shutil.rmtree('T1', ignore_errors=True)
     shutil.rmtree('T3', ignore_errors=True)
     mnf = Manifest.Manifest('manifest_bam.txt')
     mnf.symlink_bam()
     # Note Output tree is created in cwd
     self.assertTrue(os.path.islink('N1/bwa/N1.bam'))
     self.assertTrue(os.path.islink('N1/bwa/N1.bam.bai'))
     self.assertTrue(os.path.islink('T1/bwa/T1.bam'))
     self.assertTrue(os.path.islink('T1/bwa/T1.bam.bai'))
     shutil.rmtree('N1', ignore_errors=True)
     shutil.rmtree('P1', ignore_errors=True)
     shutil.rmtree('T1', ignore_errors=True)
     shutil.rmtree('T3', ignore_errors=True)
Beispiel #4
0
    def __init__(self,
                 manifest,
                 freq_file,
                 count=100,
                 prefix=None,
                 debug=False):
        self.debug = debug
        # Read in the manifest and store it as a dictionary
        self.manifest = Manifest(manifest)
        # Generate a set of variants specified in the manifest to be associated with disease somehow.
        # Specify the frequency file
        self.freq_file = freq_file

        self.count = int(count)

        self.samples = None

        self.prefix = prefix
        if prefix is None:
            self.prefix = "gsim.%s" % count
        self.run()
 def testFailMultipleBamsToSameSample(self):
     shutil.rmtree('N1', ignore_errors=True)
     shutil.rmtree('T1', ignore_errors=True)
     mnf = Manifest.Manifest('manifest_bam_dup.txt')
     with self.assertRaises(errors.InvalidManifestError):
         mnf.symlink_bam()
 def testCanMatchedManyToMany(self):
     mnf = Manifest.Manifest(os.path.join(wdir, 'manyToMany.txt'))
     self.assertEqual(4, len(mnf.contrasts))
 def testCanGetMatchedNormalContrasts(self):
     mnf = Manifest.Manifest(os.path.join(wdir, 'mnf.txt'))
     self.assertEqual(1, len(mnf.contrasts))
     self.assertEqual('N1', mnf.contrasts['normal_smp'][0])
     self.assertEqual('T1', mnf.contrasts['tumour_smp'][0])
 def testLibraryNameSameAsSampleName(self):
     # Since manifest does not have 'library' we use the sample name as library id.
     mnf = Manifest.Manifest(os.path.join(wdir, 'mnf.txt'))
     self.assertEqual(list(mnf.df['sample']), list(mnf.df['library']))
 def testCanGetLibraries(self):
     mnf = Manifest.Manifest(os.path.join(wdir, 'mnf.txt'))
     self.assertEqual(3, len(mnf.sample))
 def test_tn_pair_can_be_null(self):
     mnf = Manifest.Manifest('contrast2.txt')
     self.assertEqual(0, len(mnf.contrasts))
 def testFailTooManySamplesToOneContrast(self):
     with self.assertRaises(errors.InvalidManifestError):
         mnf = Manifest.Manifest('contrast.txt')
 def testFailOnManifestWithDuplicateFq(self):
     with self.assertRaises(errors.InvalidManifestError):
         mnf = Manifest.Manifest('invalid.txt')