Exemplo n.º 1
0
    def test_compute_n50_from_file(self):
        """
        Test getting N50 from file
        """
        with self.assertRaises(IOError):
            get_fasta_readlengths('what.ever')

        fasta = os.path.join( ROOT_DATA_DIR, 'polished_assembly', 'polished_assembly.fasta.gz')
        self.assertEqual( 33586, compute_n50_from_file(fasta) )
Exemplo n.º 2
0
    def test_compute_n50_from_file(self):
        """
        Test getting N50 from file
        """
        with self.assertRaises(IOError):
            get_fasta_readlengths('what.ever')

        fasta = os.path.join(ROOT_DATA_DIR, 'polished_assembly',
                             'polished_assembly.fasta.gz')
        self.assertEqual(33586, compute_n50_from_file(fasta))
Exemplo n.º 3
0
    def test_get_fasta_readlengths(self):
        """
        Test getting num reads and total readlength
        """
        with self.assertRaises(IOError):
            get_fasta_readlengths('what.ever')

        fasta = os.path.join( ROOT_DATA_DIR, 'polished_assembly', 'polished_assembly.fasta.gz')
        l = get_fasta_readlengths(fasta)
        self.assertEqual( 2, len(l) )
        self.assertEqual( 47938, sum(l) )
Exemplo n.º 4
0
    def test_get_fasta_readlengths(self):
        """
        Test getting num reads and total readlength
        """
        with self.assertRaises(IOError):
            get_fasta_readlengths('what.ever')

        fasta = os.path.join(ROOT_DATA_DIR, 'polished_assembly',
                             'polished_assembly.fasta.gz')
        l = get_fasta_readlengths(fasta)
        self.assertEqual(2, len(l))
        self.assertEqual(47938, sum(l))
Exemplo n.º 5
0
 def test_compute_n50_from_readlenths(self):
     """
     Test getting N50 from length list
     """
     fasta = os.path.join( ROOT_DATA_DIR, 'polished_assembly', 'polished_assembly.fasta.gz')
     l = get_fasta_readlengths(fasta)
     self.assertEqual( 33586, compute_n50(l) )
Exemplo n.º 6
0
 def test_compute_n50_from_readlenths(self):
     """
     Test getting N50 from length list
     """
     fasta = os.path.join(ROOT_DATA_DIR, 'polished_assembly',
                          'polished_assembly.fasta.gz')
     l = get_fasta_readlengths(fasta)
     self.assertEqual(33586, compute_n50(l))
Exemplo n.º 7
0
 def from_file(file_name):
     #        nreads, total = _compute_values(file_name)
     read_lens = get_fasta_readlengths(file_name)
     nreads = len(read_lens)
     total = sum(read_lens)
     return FastaContainer(nreads, total, file_name)