コード例 #1
0
    def test_out_reads(self):
        out_reads = util.file.mkstempfname('.kraken_reads.gz')
        metagenomics.kraken(self.inBam, self.db, outReads=out_reads)
        self.mock_samtofastq().execute.assert_called_once_with(
            self.inBam,
            mock.ANY,
            mock.ANY,
            picardOptions=mock.ANY,
            JVMmemory=mock.ANY)
        picard_opts = self.mock_samtofastq(
        ).execute.call_args[1]['picardOptions']
        six.assertCountEqual(self, picard_opts, [
            'CLIPPING_ACTION=X',
            'CLIPPING_ATTRIBUTE=%s' %
            tools.picard.SamToFastqTool.illumina_clipping_attribute
        ])

        self.mock_kraken().classify.assert_called_once_with(self.db,
                                                            mock.ANY,
                                                            mock.ANY,
                                                            options={
                                                                '--paired':
                                                                None,
                                                                '--threads': 1,
                                                            })

        # Exists due to test. Need a better tmpfile patcher.
        self.assertTrue(os.path.isfile(out_reads))
コード例 #2
0
 def test_num_threads(self):
     out_reads = util.file.mkstempfname('.kraken_reads.gz')
     metagenomics.kraken(self.inBam, self.db, outReads=out_reads, numThreads=11)
     self.mock_kraken().classify.assert_called_once_with(
         self.db, mock.ANY, mock.ANY, options={
             '--paired': None,
             '--threads': min(util.misc.available_cpu_count(), 11),
     })
コード例 #3
0
 def test_out_reads_and_report(self):
     out_reads = util.file.mkstempfname('.kraken_reads.gz')
     out_report = util.file.mkstempfname('.kraken_report.txt')
     metagenomics.kraken(self.inBam, self.db, outReads=out_reads, outReport=out_report)
     self.mock_kraken().classify.assert_called_once_with(
         self.db, mock.ANY, mock.ANY, options={
             '--paired': None,
             '--threads': 1,
     })
     self.mock_kraken().execute.assert_called_with(
         'kraken-report', self.db, out_report, args=[mock.ANY])
コード例 #4
0
 def test_filter_threshold(self):
     out_reads = util.file.mkstempfname('.kraken_reads.gz')
     metagenomics.kraken(self.inBam, self.db, outReads=out_reads, filterThreshold=0.05)
     self.mock_kraken().execute.assert_called_with(
         'kraken-filter', self.db, mock.ANY, args=[mock.ANY], options={
             '--threshold': 0.05
     })
     self.mock_kraken().classify.assert_called_once_with(
         self.db, mock.ANY, mock.ANY, options={
             '--paired': None,
             '--threads': 1,
     })
コード例 #5
0
 def test_num_threads(self):
     out_reads = util.file.mkstempfname('.kraken_reads.gz')
     metagenomics.kraken(self.inBam,
                         self.db,
                         outReads=out_reads,
                         numThreads=11)
     self.mock_kraken().classify.assert_called_once_with(
         self.db,
         mock.ANY,
         mock.ANY,
         options={
             '--paired': None,
             '--threads': min(util.misc.available_cpu_count(), 11),
         })
コード例 #6
0
    def test_out_report(self):
        out_report = util.file.mkstempfname('.kraken_report.txt')
        metagenomics.kraken(self.inBam, self.db, outReport=out_report)

        self.mock_kraken().classify.assert_called_once_with(self.db,
                                                            mock.ANY,
                                                            mock.ANY,
                                                            options={
                                                                '--paired':
                                                                None,
                                                                '--threads': 1,
                                                            })

        self.mock_kraken().execute.assert_called_with('kraken-report',
                                                      self.db,
                                                      out_report,
                                                      args=[mock.ANY])
コード例 #7
0
 def test_filter_threshold(self):
     out_reads = util.file.mkstempfname('.kraken_reads.gz')
     metagenomics.kraken(self.inBam,
                         self.db,
                         outReads=out_reads,
                         filterThreshold=0.05)
     self.mock_kraken().execute.assert_called_with(
         'kraken-filter',
         self.db,
         mock.ANY,
         args=[mock.ANY],
         options={'--threshold': 0.05})
     self.mock_kraken().classify.assert_called_once_with(self.db,
                                                         mock.ANY,
                                                         mock.ANY,
                                                         options={
                                                             '--paired':
                                                             None,
                                                             '--threads': 1,
                                                         })
コード例 #8
0
    def test_out_reads(self):
        out_reads = util.file.mkstempfname('.kraken_reads.gz')
        metagenomics.kraken(self.inBam, self.db, outReads=out_reads)
        self.mock_samtofastq().execute.assert_called_once_with(
            self.inBam, mock.ANY, mock.ANY, picardOptions=mock.ANY,
            JVMmemory=mock.ANY)
        picard_opts = self.mock_samtofastq().execute.call_args[1]['picardOptions']
        six.assertCountEqual(
            self, picard_opts,
            ['CLIPPING_ACTION=X', 'CLIPPING_ATTRIBUTE=%s'
             % tools.picard.SamToFastqTool.illumina_clipping_attribute])

        self.mock_kraken().classify.assert_called_once_with(
            self.db, mock.ANY, mock.ANY, options={
                '--paired': None,
                '--threads': 1,
        })

        # Exists due to test. Need a better tmpfile patcher.
        self.assertTrue(os.path.isfile(out_reads))
コード例 #9
0
 def test_assert(self):
     with self.assertRaises(AssertionError):
         metagenomics.kraken(self.inBam, self.db)
コード例 #10
0
 def test_assert(self):
     with self.assertRaises(AssertionError):
         metagenomics.kraken(self.inBam, self.db)