Esempio n. 1
0
    def test_to_from_file(self):

        indexes = np.array([1, 2, 3, 4, 5, 6, 7, 8])
        values = np.array([1, 2, 3, 4, 5, 6, 7, 8])

        sv = SparseValues(indexes, values)
        sv.track_size = 10
        sv.to_sparse_files("test_sparsevalues.tmp")

        new = sv.from_sparse_files("test_sparsevalues.tmp")
        self.assertEqual(sv, new)
    def test_get_summits(self):

        qvalues = SparseValues(np.array([0]), np.array([3]))
        qvalues.track_size = 22
        qvalues.to_sparse_files("tests/test_qvalues")

        run_argument_parser([
            "create_ob_graph", "-o", "tests/testgraph.obg",
            "tests/vg_test_graph.json"
        ])
        max_paths = PeakCollection([Peak(0, 2, [1, 2], score=3)])
        PeakFasta(self.correct_sequence_graph).write_max_path_sequences(
            "tests/test_max_paths.fasta", max_paths)

        run_argument_parser([
            "get_summits", "-g", "tests/testgraph.obg",
            "tests/test_max_paths.fasta", "tests/test_qvalues", "2"
        ])

        result = PeakCollection.from_fasta_file(
            "tests/test_max_paths_summits.fasta")
        self.assertEqual(result.intervals[0], Peak(2, 6, [1]))
        self.assertEqual(result.intervals[0].sequence.lower(), "tccc")