def test_basic(self):
        output_dir = tempfile.mkdtemp(suffix="filter_subread_")
        t = tempfile.NamedTemporaryFile(delete=False, suffix=".json")
        t.close()
        report_json = t.name
        exe = "filter_subread"
        cmd = "{e} --debug -o {o} -r {r} {csv}".format(
            e=exe,
            csv=self.filtered_subread_summary_csv,
            r=report_json,
            o=output_dir)

        rcode = run_backticks(cmd)
        self.assertEqual(0, rcode)

        with open(report_json, 'r') as f:
            d = json.loads(f.read())

        report = dict_to_report(d)
        log.info("deserialized report:")
        log.info(pformat(report.to_dict()))

        self.assertIsNotNone(isinstance(report, Report))

        # Cleanup
        self.assertTrue(os.path.exists(report_json))
        os.remove(report_json)
    def test_basic(self):
        output_dir = tempfile.mkdtemp(suffix="filter_subread_")
        t = tempfile.NamedTemporaryFile(delete=False, suffix=".json")
        t.close()
        report_json = t.name
        exe = "filter_subread"
        cmd = "{e} --debug -o {o} -r {r} {csv}".format(
            e=exe, csv=self.filtered_subread_summary_csv, r=report_json, o=output_dir
        )

        rcode = run_backticks(cmd)
        self.assertEqual(0, rcode)

        with open(report_json, "r") as f:
            d = json.loads(f.read())

        report = dict_to_report(d)
        log.info("deserialized report:")
        log.info(pformat(report.to_dict()))

        self.assertIsNotNone(isinstance(report, Report))

        # Cleanup
        self.assertTrue(os.path.exists(report_json))
        os.remove(report_json)
 def test_basic(self):
     t = tempfile.NamedTemporaryFile(delete=False, suffix=".json")
     t.close()
     report_json = t.name
     exe = "amplicon_analysis_consensus_report"
     cmd = "{e} --debug {csv} {r}".format(e=exe, csv=self.file_name, r=report_json)
     exit_code = run_backticks(cmd, 1)
     # Assert the job failed
     self.assertEqual(exit_code, 1)
 def setUpClass(cls):
     cls.report_constants = pbreports.report.isoseq_cluster.Constants
     cls.results_dir = tempfile.mkdtemp(prefix="isoseq_results_")
     cls.input_fasta = os.path.join(_DATA_DIR, 'isoseq_flnc.fasta')
     cls.output_summary_txt = os.path.join(_DATA_DIR, 'isoseq_cluster_summary.txt')
     cls.report_json = os.path.join(cls.results_dir, "isoseq_cluster.json")
     _d = dict(o=cls.results_dir, f=cls.input_fasta, s=cls.output_summary_txt, j=cls.report_json)
     cmd = 'isoseq_cluster_report --debug {f} {s} {j}'.format(**_d)
     cls.code = run_backticks(cmd)
 def test_exit_code_0(self):
     """
     Like a cram test. Assert exits with 0.
     """
     cmd = "python -m pbreports.report.variants {o} {r} {c} {a} {v}".format(
         o=self._output_dir, r="rpt.json", c=self.REFERENCE, a=self.ALIGNMENT_SUMMARY, v=self.VARIANTS_GFF
     )
     rcode = run_backticks(cmd)
     self.assertEquals(0, rcode)
     self.assertTrue(op.exists(op.join(self._output_dir, "rpt.json")))
    def test_basic(self):
        t = tempfile.NamedTemporaryFile(suffix="_motif_report.json", delete=False)
        t.close()
        json_report = t.name
        output_dir = os.path.dirname(json_report)

        _d = dict(g=_MOTIF_GFF, c=_MOTIF_SUMMARY_CSV, j=json_report, d=output_dir, e=EXE)
        cmd_str = "{e} {g} {c} {j}".format(**_d)

        rcode = run_backticks(cmd_str)
        self.assertEqual(rcode, 0, "Exit code '{o}' for command '{c}'".format(o=rcode, c=cmd_str))
 def test_exit_code_0_fasta(self):
     """
     Like a cram test. Assert exits with 0 with fasta.
     """
     cmd = 'python -m pbreports.report.variants {o} {r} {c} {a} {v}'.format(
         o=self._output_dir, r='rpt.json', c=self._get_reference_fasta(),
         a=self.ALIGNMENT_SUMMARY,
         v=self.VARIANTS_GFF)
     rcode = run_backticks(cmd)
     self.assertEquals(0, rcode)
     self.assertTrue(op.exists(op.join(self._output_dir, 'rpt.json')))
Пример #8
0
 def test_basic(self):
     t = tempfile.NamedTemporaryFile(delete=False, suffix=".json")
     t.close()
     report_json = t.name
     exe = "amplicon_analysis_consensus_report"
     cmd = "{e} --debug {csv} {r}".format(e=exe,
                                          csv=self.file_name,
                                          r=report_json)
     exit_code = run_backticks(cmd, 1)
     # Assert the job failed
     self.assertEqual(exit_code, 1)
Пример #9
0
 def test_exit_code_0(self):
     """
     Like a cram test. Assert exits with 0.
     """
     cmd = 'python -m pbreports.report.variants {r} {c} {a} {v}'.format(
         r='rpt.json',
         c=self.REFERENCE,
         a=self.ALIGNMENT_SUMMARY,
         v=self.VARIANTS_GFF)
     rcode = run_backticks(cmd)
     self.assertEquals(0, rcode)
     self.assertTrue('rpt.json')
 def test_exit_code_0(self):
     """
     Like a cram test. Assert exits with 0.
     """
     ref = self.REFERENCE
     gff = self.VARIANTS_GFF
     j = 'rpt.json'
     cmd = 'python -m pbreports.report.top_variants {j} {g} {r}'.format(
         g=gff, r=ref, j=j)
     log.info(cmd)
     rcode = run_backticks(cmd)
     self.assertEquals(0, rcode)
 def test_exit_code_0(self):
     """
     Like a cram test. Assert exits with 0.
     """
     cmd = 'python -m pbreports.report.variants {r} {c} {a} {v}'.format(
         r='rpt.json',
         c=self.REFERENCE,
         a=self.ALIGNMENT_SUMMARY,
         v=self.VARIANTS_GFF)
     rcode = run_backticks(cmd)
     self.assertEquals(0, rcode)
     self.assertTrue('rpt.json')
 def test_basic(self):
     cmd = _to_cmd(self.ALIGNMENTS, self.report_json)
     rcode = run_backticks(cmd)
     self.assertEqual(rcode, 0)
     with open(self.report_json, 'r') as f:
         s = json.load(f)
         log.info("JsonReport: ")
         log.info(pprint.pformat(s, indent=4))
     report = dict_to_report(s)
     self.assertIsNotNone(report)
     self.assertEqual(len(report.tables), 1)
     log.info(str(report.tables[0]))
     validate_report_metadata(self, report, meta_rpt)
 def test_basic(self):
     cmd = _to_cmd(self.ALIGNMENTS, self.report_json)
     rcode = run_backticks(cmd)
     self.assertEqual(rcode, 0)
     with open(self.report_json, 'r') as f:
         s = json.load(f)
         log.info("JsonReport: ")
         log.info(pprint.pformat(s, indent=4))
     report = dict_to_report(s)
     self.assertIsNotNone(report)
     self.assertEqual(len(report.tables), 1)
     log.info(str(report.tables[0]))
     validate_report_metadata(self, report, meta_rpt)
Пример #14
0
 def test_exit_code_0(self):
     """
     Like a cram test. Assert exits with 0.
     """
     ref = self.REFERENCE
     gff = self.VARIANTS_GFF
     j = 'rpt.json'
     cmd = 'python -m pbreports.report.top_variants {o} {j} {g} {r}'.format(
         o=self._output_dir, g=gff, r=ref, j=j)
     log.info(cmd)
     rcode = run_backticks(cmd)
     self.assertEquals(0, rcode)
     self.assertTrue(os.path.exists(os.path.join(self._output_dir, j)))
 def setUpClass(cls):
     cls.report_constants = pbreports.report.isoseq_cluster.Constants
     cls.results_dir = tempfile.mkdtemp(prefix="isoseq_results_")
     cls.input_fasta = os.path.join(_DATA_DIR, 'isoseq_flnc.fasta')
     cls.output_summary_json = os.path.join(_DATA_DIR,
                                            'isoseq_cluster_summary.json')
     cls.report_json = os.path.join(cls.results_dir, "isoseq_cluster.json")
     _d = dict(o=cls.results_dir,
               f=cls.input_fasta,
               s=cls.output_summary_json,
               j=cls.report_json)
     cmd = 'isoseq_cluster_report --debug {f} {s} {j}'.format(**_d)
     cls.code = run_backticks(cmd)
 def test_exit_code_0(self):
     """
     Like a cram test. Assert exits with 0.
     """
     ref = self.REFERENCE
     gff = self.VARIANTS_GFF
     j = 'rpt.json'
     cmd = 'python -m pbreports.report.top_variants {o} {j} {g} {r}'.format(
         o=self._output_dir, g=gff, r=ref, j=j)
     log.info(cmd)
     rcode = run_backticks(cmd)
     self.assertEquals(0, rcode)
     self.assertTrue(os.path.exists(os.path.join(self._output_dir, j)))
    def test_basic(self):
        t = tempfile.NamedTemporaryFile(delete=False, suffix=".csv")
        t.close()
        output_csv = t.name
        exe = "filter_subread_summary"
        cmd = "{e} --debug {r} -o {csv}".format(e=exe, r=self.region_fofn,
                                                csv=output_csv)

        rcode = run_backticks(cmd)
        self.assertEqual(0, rcode)

        # Cleanup
        self.assertTrue(os.path.exists(output_csv))
        os.remove(output_csv)
 def test_exit_code_0_referenceset(self):
     """
     Like a cram test. Assert exits with 0 with ReferenceSet XML
     """
     ref_name = op.join(self._output_dir, "refset.xml")
     refset = ReferenceSet(self._get_reference_fasta())
     refset.write(ref_name)
     ref = ref_name
     cmd = 'python -m pbreports.report.variants {o} {r} {c} {a} {v}'.format(
         o=self._output_dir, r='rpt.json', c=ref, a=self.ALIGNMENT_SUMMARY,
         v=self.VARIANTS_GFF)
     rcode = run_backticks(cmd)
     self.assertEquals(0, rcode)
     self.assertTrue(op.exists(op.join(self._output_dir, "rpt.json")))
Пример #19
0
 def test_exit_code_0_referenceset(self):
     """
     Like a cram test. Assert exits with 0 with ReferenceSet XML
     """
     ref_name = op.join(self._output_dir, "refset.xml")
     refset = ReferenceSet(self._get_reference_fasta())
     refset.write(ref_name)
     ref = ref_name
     cmd = 'python -m pbreports.report.variants {r} {c} {a} {v}'.format(
         r='rpt.json', c=ref, a=self.ALIGNMENT_SUMMARY,
         v=self.VARIANTS_GFF)
     rcode = run_backticks(cmd)
     self.assertEquals(0, rcode)
     self.assertTrue(op.exists("rpt.json"))
    def test_basic(self):
        t = tempfile.NamedTemporaryFile(delete=False, suffix=".csv")
        t.close()
        output_csv = t.name
        exe = "filter_subread_summary"
        cmd = "{e} --debug {r} -o {csv}".format(e=exe,
                                                r=self.region_fofn,
                                                csv=output_csv)

        rcode = run_backticks(cmd)
        self.assertEqual(0, rcode)

        # Cleanup
        self.assertTrue(os.path.exists(output_csv))
        os.remove(output_csv)
Пример #21
0
 def test_integration(self):
     t = tempfile.NamedTemporaryFile(delete=False, suffix=".json")
     t.close()
     report_json = t.name
     exe = "amplicon_analysis_input_report"
     cmd = "{e} --debug {s} {r}".format(e=exe,
                                        s=self.csv_file,
                                        r=report_json)
     exit_code = run_backticks(cmd)
     self.assertEqual(exit_code, 0)
     with open(report_json, 'r') as f:
         d = json.loads(f.read())
     self.assertIsNotNone(d)
     # cleanup
     if os.path.exists(report_json):
         os.remove(report_json)
    def test_exit_code_0_referenceset(self):
        """
        Like a cram test. Assert exits with 0 with ReferenceSet XML
        """
        ref = self._get_reference_fasta()
        ref_name = os.path.join(self._output_dir, "refset.xml")
        refset = ReferenceSet(ref)
        refset.write(ref_name)
        ref = ref_name
        j = 'rpt.json'
        cmd = 'python -m pbreports.report.top_variants {j} {g} {r}'.format(
            g=self.VARIANTS_GFF, r=ref, j=j)
        log.info(cmd)

        rcode = run_backticks(cmd)
        self.assertEquals(0, rcode)
 def test_integration(self):
     t = tempfile.NamedTemporaryFile(delete=False, suffix=".json")
     t.close()
     report_json = t.name
     exe = "amplicon_analysis_input_report"
     cmd = "{e} --debug {s} {r}".format(e=exe,
                                        s=self.csv_file,
                                        r=report_json)
     exit_code = run_backticks(cmd)
     self.assertEqual(exit_code, 0)
     with open(report_json, 'r') as f:
         d = json.loads(f.read())
     self.assertIsNotNone(d)
     # cleanup
     if os.path.exists(report_json):
         os.remove(report_json)
Пример #24
0
    def test_basic(self):
        report_json = tempfile.NamedTemporaryFile(suffix=".json").name
        exe = "amplicon_analysis_timing_report"
        cmd = "{e} --debug {l} {r}".format(e=exe,
                                           l=self.input_log_file,
                                           r=report_json)
        exit_code = run_backticks(cmd)
        self.assertEqual(exit_code, 0)

        with open(report_json, 'r') as f:
            d = json.loads(f.read())

        self.assertIsNotNone(d)

        # cleanup
        if os.path.exists(report_json):
            os.remove(report_json)
    def test_basic(self):
        t = tempfile.NamedTemporaryFile(suffix="_motif_report.json",
                                        delete=False)
        t.close()
        json_report = t.name
        output_dir = os.path.dirname(json_report)

        _d = dict(g=_MOTIF_GFF,
                  c=_MOTIF_SUMMARY_CSV,
                  j=json_report,
                  d=output_dir,
                  e=EXE)
        cmd_str = '{e} {g} {c} {j}'.format(**_d)

        rcode = run_backticks(cmd_str)
        self.assertEqual(
            rcode, 0, "Exit code '{o}' for command '{c}'".format(o=rcode,
                                                                 c=cmd_str))
    def test_exit_code_0_referenceset(self):
        """
        Like a cram test. Assert exits with 0 with ReferenceSet XML
        """
        ref = self._get_reference_fasta()
        ref_name = os.path.join(self._output_dir, "refset.xml")
        refset = ReferenceSet(ref)
        refset.write(ref_name)
        ref = ref_name
        j = 'rpt.json'
        cmd = 'python -m pbreports.report.top_variants {o} {j} {g} {r}'.format(
            o=self._output_dir,
            g=self.VARIANTS_GFF, r=ref, j=j)
        log.info(cmd)

        rcode = run_backticks(cmd)
        self.assertEquals(0, rcode)
        self.assertTrue(os.path.exists(os.path.join(self._output_dir, j)))
Пример #27
0
 def _run_cmd(self, file_name):
     """Run an subprocess of the command and verify that report is present"""
     exe = "ccs_report"
     output_dir = tempfile.mkdtemp()
     temp_file = tempfile.NamedTemporaryFile(delete=False, suffix=".json")
     json_report_file_name = temp_file.name
     temp_file.close()
     cmd = "{e} --debug --output-dir {o} {i} {r}".format(
         e=exe, i=file_name, r=json_report_file_name, o=output_dir)
     rcode = run_backticks(cmd)
     self.assertEqual(0, rcode)
     with open(json_report_file_name, 'r') as f:
         s = json.load(f)
         log.info("JsonReport: ")
         log.info(pprint.pformat(s, indent=4))
     self.assertIsNotNone(s)
     # cleanup
     os.remove(json_report_file_name)
 def _run_cmd(self, file_name):
     """Run an subprocess of the command and verify that report is present"""
     exe = "ccs_report"
     output_dir = tempfile.mkdtemp()
     temp_file = tempfile.NamedTemporaryFile(delete=False, suffix=".json")
     json_report_file_name = temp_file.name
     temp_file.close()
     cmd = "{e} --debug --output-dir {o} {i} {r}".format(
         e=exe,
         i=file_name,
         r=json_report_file_name,
         o=output_dir)
     rcode = run_backticks(cmd)
     self.assertEqual(0, rcode)
     with open(json_report_file_name, 'r') as f:
         s = json.load(f)
         log.info("JsonReport: ")
         log.info(pprint.pformat(s, indent=4))
     self.assertIsNotNone(s)
     # cleanup
     os.remove(json_report_file_name)
    def test_basic(self):
        output_dir = tempfile.mkdtemp(suffix="filter_stats_integration_")
        t = tempfile.NamedTemporaryFile(dir=output_dir, delete=False)
        t.close()
        report_json = t.name

        exe = "filter_stats"
        cmd = "{e} --debug -o {o} -r {r} {csv}".format(e=exe, o=output_dir,
                                                       r=report_json,
                                                       csv=self.CSV_FILE)
        rcode = run_backticks(cmd)
        self.assertEqual(rcode, 0)

        with open(report_json, 'r') as f:
            s = json.load(f)
            log.info("JsonReport: ")
            log.info(pprint.pformat(s, indent=4))

        self.assertIsNotNone(s)

        # cleanup
        os.remove(report_json)
Пример #30
0
 def test_basic(self):
     cmd = "overview_report --debug {i} {o}".format(i=self.input_file,
                                                    o=self.report_json)
     rcode = run_backticks(cmd)
     self.assertEqual(rcode, 0)
 def test_help(self):
     rcode = run_backticks("{e} --help".format(e=_EXE))
     self.assertEqual(rcode, 0)
    def test_basic(self):
        csv = _generate_tmp_file()

        cmd = _to_cmd(_INPUT_FOFN, _CONTROL_CMP_H5, csv)
        rcode = run_backticks(cmd)
        self.assertEqual(rcode, 0)
Пример #33
0
 def test_help(self):
     rcode = run_backticks("{e} --help".format(e=_EXE))
     self.assertEqual(rcode, 0)
Пример #34
0
    def test_basic(self):
        csv = _generate_tmp_file()

        cmd = _to_cmd(_INPUT_FOFN, _CONTROL_CMP_H5, csv)
        rcode = run_backticks(cmd)
        self.assertEqual(rcode, 0)
    def test_basic(self):

        cmd = "overview_report --debug {i} {o}".format(i=self.input_file,
                                                       o=self.report_json)
        rcode = run_backticks(cmd)
        self.assertEqual(rcode, 0)