예제 #1
0
    def __init__(self, options, filename):
        genome = list(FASTA.from_file(filename))
        assert len(genome) == 1, len(genome)

        self._genome = genome[0].sequence.upper()
        self._sequence = None
        self._positions = None
        self._annotations = None

        self._mutate(options)
예제 #2
0
    def __init__(self, options, filename):
        genome = list(FASTA.from_file(filename))
        assert len(genome) == 1, len(genome)

        self._genome = genome[0].sequence.upper()
        self._sequence = None
        self._positions = None
        self._annotations = None

        self._mutate(options)
예제 #3
0
def test_fasta__from_file(func, tmp_path):
    expected = [
        FASTA("This_is_FASTA!", None, "ACGTN"),
        FASTA("This_is_ALSO_FASTA!", None, "CGTNA"),
    ]

    with func(tmp_path / "file", "wt") as handle:
        for item in expected:
            item.write(handle)

    assert list(FASTA.from_file(tmp_path / "file")) == expected
예제 #4
0
파일: paml.py 프로젝트: muslih14/paleomix
    def _setup(self, _config, temp):
        self._update_ctl_file(source      = self._control_file,
                              destination = os.path.join(temp, "template.ctl"))

        os.symlink(os.path.abspath(self._trees_file), os.path.join(temp, "template.trees"))
        with open(os.path.join(temp, "template.seqs"), "w") as handle:
            for record in FASTA.from_file(self._sequence_file):
                if record.name not in self._exclude_groups:
                    name = record.name
                    sequence = record.sequence.upper()
                    handle.write("%s\n" % (FASTA(name, None, sequence),))
예제 #5
0
파일: paml.py 프로젝트: jelber2/paleomix
    def _setup(self, _config, temp):
        self._update_ctl_file(source=self._control_file,
                              destination=os.path.join(temp, "template.ctl"))

        os.symlink(os.path.abspath(self._trees_file),
                   os.path.join(temp, "template.trees"))
        with open(os.path.join(temp, "template.seqs"), "w") as handle:
            for record in FASTA.from_file(self._sequence_file):
                if record.name not in self._exclude_groups:
                    name = record.name
                    sequence = record.sequence.upper()
                    handle.write("%s\n" % (FASTA(name, None, sequence), ))
예제 #6
0
def test_fasta__from_file__compressed_bz2():
    expected = [FASTA("This_is_BZ_FASTA!", None, "CGTNA"),
                FASTA("This_is_ALSO_BZ_FASTA!", None, "ACGTN")]
    results = list(FASTA.from_file(test_file("fasta_file.fasta.bz2")))
    assert_equal(results, expected)
예제 #7
0
def test_fasta__from_file__compressed_bz2():
    expected = [FASTA("This_is_BZ_FASTA!", None, "CGTNA"),
                FASTA("This_is_ALSO_BZ_FASTA!", None, "ACGTN")]
    results = list(FASTA.from_file(test_file("fasta_file.fasta.bz2")))
    assert_equal(results, expected)