コード例 #1
0
    def test_24_ENSG00000163519_codon_aln(self):
        """
        test kpic-gappy with codon alignment of mammalian sequences
        usage: clipkit 24_ENSG00000163519_codon_aln.fasta -m kpic-gappy
        """
        input_file = f"{here.parent}/samples/24_ENSG00000163519_codon_aln.fasta"
        output_file = "output/24_ENSG00000163519_codon_aln.fasta.clipkit"

        kwargs = dict(
            input_file=input_file,
            output_file=output_file,
            input_file_format='fasta',
            output_file_format='fasta',
            complement=False,
            gaps=0.9,
            mode=TrimmingMode.kpic_gappy,
            use_log=False,
        )
        execute(**kwargs)

        with open(
                f"{here.parent}/expected/24_ENSG00000163519_codon_aln.fasta_kpic_gappy",
                "r") as expected:
            expected_content = expected.read()

        with open(output_file, "r") as out_file:
            output_content = out_file.read()

        assert expected_content == output_content
コード例 #2
0
    def test_EOG091N44M8_nt(self):
        """
        test kpic-gappy with nucleotide alignment of Penicillium sequences
        usage: clipkit EOG091N44M8_nt.fa -m kpic-gappy
        """
        input_file = f"{here.parent}/samples/EOG091N44M8_nt.fa"
        output_file = "output/EOG091N44M8_nt.fa.clipkit"

        kwargs = dict(
            input_file=input_file,
            output_file=output_file,
            input_file_format='fasta',
            output_file_format='fasta',
            complement=False,
            gaps=0.9,
            mode=TrimmingMode.kpic_gappy,
            use_log=False,
        )
        execute(**kwargs)

        with open(f"{here.parent}/expected/EOG091N44M8_nt.fa_kpic_gappy",
                  "r") as expected:
            expected_content = expected.read()

        with open(output_file, "r") as out_file:
            output_content = out_file.read()

        assert expected_content == output_content
コード例 #3
0
ファイル: test_gappy_mode.py プロジェクト: altingia/ClipKIT
    def test_12_YIL115C_Anc_2_253_codon_aln(self):
        """
        test gappy with codon alignment of yeast sequences
        usage: clipkit 12_YIL115C_Anc_2.253_codon_aln.fasta -g 0.3
        """
        input_file = f"{here.parent}/samples/12_YIL115C_Anc_2.253_codon_aln.fasta"
        output_file = "output/12_YIL115C_Anc_2.253_codon_aln.fasta.clipkit"
        in_file_format = 'fasta'
        out_file_format = 'fasta'

        kwargs = dict(
            input_file=input_file,
            output_file=output_file,
            input_file_format='fasta',
            output_file_format='fasta',
            complement=False,
            gaps=0.3,
            mode=TrimmingMode.gappy,
            use_log=False,
        )
        execute(**kwargs)

        with open(
                f"{here.parent}/expected/12_YIL115C_Anc_2.253_codon_aln.fasta_gappy_custom_gaps",
                "r",
        ) as expected:
            expected_content = expected.read()

        with open(output_file, "r") as out_file:
            output_content = out_file.read()

        assert expected_content == output_content
コード例 #4
0
    def test_simple(self):
        """
        usage: clipkit simple.fa -m kpic-gappy
        """
        input_file = f"{here.parent}/samples/simple.fa"
        output_file = "output/simpla.fa.TestKpiMode_test_simple.clipkit"

        kwargs = dict(
            input_file=input_file,
            output_file=output_file,
            input_file_format='fasta',
            output_file_format='fasta',
            complement=False,
            gaps=0.9,
            mode=TrimmingMode.kpic_gappy,
            use_log=False,
        )
        execute(**kwargs)

        with open(f"{here.parent}/expected/simple.fa_kpic_gappy",
                  "r") as expected:
            expected_content = expected.read()

        with open(output_file, "r") as out_file:
            output_content = out_file.read()

        assert expected_content == output_content
コード例 #5
0
ファイル: test_gappy_mode.py プロジェクト: altingia/ClipKIT
    def test_simple_no_change(self):
        """
        test gappy where no changes are expected in the resulting 
        output alignment.
        usage: clipkit simple.fa
        """
        input_file = f"{here.parent}/samples/simple.fa"
        output_file = "output/simpla.fa.clipkit"
        kwargs = dict(
            input_file=input_file,
            output_file=output_file,
            input_file_format='fasta',
            output_file_format='fasta',
            complement=False,
            gaps=0.9,
            mode=TrimmingMode.gappy,
            use_log=False,
        )
        execute(**kwargs)

        with open(input_file, "r") as expected:
            expected_content = expected.read()

        with open(output_file, "r") as out_file:
            output_content = out_file.read()

        assert expected_content == output_content
コード例 #6
0
ファイル: test_gappy_mode.py プロジェクト: altingia/ClipKIT
    def test_simple(self):
        """
        test gappy with a custom gaps parameter
        usage: clipkit simple.fa -g 0.2
        """
        input_file = f"{here.parent}/samples/simple.fa"
        output_file = "output/simpla.fa.clipkit"
        in_file_format = 'fasta'
        out_file_format = 'fasta'

        kwargs = dict(
            input_file=input_file,
            output_file=output_file,
            input_file_format='fasta',
            output_file_format='fasta',
            complement=False,
            gaps=0.2,
            mode=TrimmingMode.gappy,
            use_log=False,
        )
        execute(**kwargs)

        with open(f"{here.parent}/expected/simple.fa_gappy_gaps_set_to_0.2",
                  "r") as expected:
            expected_content = expected.read()

        with open(output_file, "r") as out_file:
            output_content = out_file.read()

        assert expected_content == output_content
コード例 #7
0
    def test_simple_long_description(self):
        """
        test output in clustal format
        usage: clipkit simple_long_description.fa -l
        """
        input_file = f"{here.parent}/samples/simple_long_description.fa"
        output_file = "output/simple_long_description.fa.clipkit"

        kwargs = dict(
            input_file=input_file,
            output_file=output_file,
            input_file_format='fasta',
            output_file_format='fasta',
            complement=False,
            gaps=0.9,
            mode=TrimmingMode.gappy,
            use_log=True,
        )
        execute(**kwargs)

        with open(
                f"{here.parent}/expected/simple_long_description.fa.clipkit.log",
                "r") as expected:
            expected_content = expected.read()

        with open(f"{output_file}.log", "r") as out_file:
            output_content = out_file.read()

        assert expected_content == output_content
コード例 #8
0
    def test_24_ENSG00000163519_aa_aln(self):
        """
        test gappy with amino acid alignment of mammalian sequences
        usage: clipkit 24_ENSG00000163519_aa_aln.fasta 
        """
        input_file = f"{here.parent}/samples/24_ENSG00000163519_aa_aln.fasta"
        output_file = "output/24_ENSG00000163519_aa_aln.fasta.clipkit"
        in_file_format = 'fasta'
        out_file_format = 'fasta'

        kwargs = dict(
            input_file=input_file,
            output_file=output_file,
            input_file_format='fasta',
            output_file_format='fasta',
            complement=False,
            gaps=0.9583,
            mode=TrimmingMode.smart_gap,
            use_log=False,
        )
        execute(**kwargs)

        with open(
                f"{here.parent}/expected/24_ENSG00000163519_aa_aln.clipkit_smart_gaps",
                "r") as expected:
            expected_content = expected.read()

        with open(output_file, "r") as out_file:
            output_content = out_file.read()

        assert expected_content == output_content
コード例 #9
0
    def test_12_YIL115C_Anc_2_253_aa_aln_complement(self):
        """
        test complementary output file for amino acid yeast sequences
        usage: clipkit 12_YIL115C_Anc_2.253_aa_aln.fasta -c
        """
        output_file = "output/12_YIL115C_Anc_2.253_aa_aln.fasta_gappy"
        complement_out_file = f"{output_file}.complement"

        kwargs = dict(
            input_file=
            f"{here.parent}/samples/12_YIL115C_Anc_2.253_aa_aln.fasta",
            output_file=output_file,
            input_file_format='fasta',
            output_file_format='fasta',
            complement=True,
            gaps=0.9,
            mode=TrimmingMode.gappy,
            use_log=False,
        )
        execute(**kwargs)

        with open(
                f"{here.parent}/expected/12_YIL115C_Anc_2.253_aa_aln.fasta_gappy.complement",
                "r",
        ) as expected:
            expected_content = expected.read()

        with open(complement_out_file, "r") as out_file:
            output_content = out_file.read()

        assert expected_content == output_content
コード例 #10
0
    def test_EOG091N44M8_aa_complement(self):
        """
        test complementary output file for amino acid Penicillium sequences
        usage: clipkit EOG091N44M8_aa.fa -c
        """
        output_file = "output/EOG091N44M8_aa.fa_gappy"
        complement_out_file = f"{output_file}.complement"

        kwargs = dict(
            input_file=f"{here.parent}/samples/EOG091N44M8_aa.fa",
            output_file=output_file,
            input_file_format='fasta',
            output_file_format='fasta',
            complement=True,
            gaps=0.9,
            mode=TrimmingMode.gappy,
            use_log=False,
        )
        execute(**kwargs)

        with open(f"{here.parent}/expected/EOG091N44M8_aa.fa_gappy.complement",
                  "r") as expected:
            expected_content = expected.read()

        with open(complement_out_file, "r") as out_file:
            output_content = out_file.read()

        assert expected_content == output_content
コード例 #11
0
    def test_simple_complement(self):
        """
        test complementary output file with a simple case
        usage: clipkit simple.fa -c
        """
        output_file = "output/simple.fa_gappy"
        complement_out_file = f"{output_file}.complement"

        kwargs = dict(
            input_file=f"{here.parent}/samples/simple.fa",
            output_file=output_file,
            input_file_format='fasta',
            output_file_format='fasta',
            complement=True,
            gaps=0.9,
            mode=TrimmingMode.gappy,
            use_log=False,
        )

        execute(**kwargs)

        with open(f"{here.parent}/expected/simple.fa_gappy.complement",
                  "r") as expected:
            expected_content = expected.read()

        with open(complement_out_file, "r") as out_file:
            output_content = out_file.read()

        assert expected_content == output_content
コード例 #12
0
    def test_simple_no_change(self):
        """
        usage: clipkit simple_long_description.fa -m kpic-smart-gap
        """
        input_file = f"{here.parent}/samples/simple_long_description.fa"
        output_file = "output/simple_long_description.fa_kpic_smart_gaps"
        kwargs = dict(
            input_file=input_file,
            output_file=output_file,
            input_file_format='fasta',
            output_file_format='fasta',
            complement=False,
            gaps=0.8,
            mode=TrimmingMode.kpic_smart_gap,
            use_log=False,
        )
        execute(**kwargs)

        with open(
                f"{here.parent}/expected/simple_long_description.fa_kpic_smart_gaps",
                "r") as expected:
            expected_content = expected.read()

        with open(output_file, "r") as out_file:
            output_content = out_file.read()

        assert expected_content == output_content
コード例 #13
0
    def test_EOG091N44M8_aa(self):
        """
        test gappy with amino acid alignment of Penicillium sequences
        usage: clipkit EOG091N44M8_aa.fa -m kpic-smart-gap
        """
        input_file = f"{here.parent}/samples/EOG091N44M8_aa.fa"
        output_file = "output/EOG091N44M8_aa.fa.clipkit"
        in_file_format = 'fasta'
        out_file_format = 'fasta'

        kwargs = dict(
            input_file=input_file,
            output_file=output_file,
            input_file_format='fasta',
            output_file_format='fasta',
            complement=False,
            gaps=0.8803,
            mode=TrimmingMode.kpic_smart_gap,
            use_log=False,
        )
        execute(**kwargs)

        with open(
                f"{here.parent}/expected/EOG091N44M8_aa.clipkit_kpic_smart_gaps",
                "r") as expected:
            expected_content = expected.read()

        with open(output_file, "r") as out_file:
            output_content = out_file.read()

        assert expected_content == output_content
コード例 #14
0
    def test_EOG092C0CZK_aa(self):
        """
        test kpic-gappy with amino alignment of fungal sequences
        usage: clipkit EOG092C0CZK_aa_aln.fasta -m kpic-gappy
        """
        input_file = f"{here.parent}/samples/EOG092C0CZK_aa_aln.fasta"
        output_file = "output/EOG092C0CZK_aa_aln.fasta.clipkitc"

        kwargs = dict(
            input_file=input_file,
            output_file=output_file,
            input_file_format='fasta',
            output_file_format='fasta',
            complement=False,
            gaps=0.9,
            mode=TrimmingMode.kpic_gappy,
            use_log=False,
        )
        execute(**kwargs)

        with open(
                f"{here.parent}/expected/EOG092C0CZK_aa_aln.fasta_kpic_gappy",
                "r") as expected:
            expected_content = expected.read()

        with open(output_file, "r") as out_file:
            output_content = out_file.read()

        assert expected_content == output_content
コード例 #15
0
    def test_12_YIL115C_Anc_2_253_codon_aln(self):
        """
        test output in clustal format
        usage: clipkit 12_YIL115C_Anc_2.253_codon_aln.fasta -l
        """
        input_file = f"{here.parent}/samples/12_YIL115C_Anc_2.253_codon_aln.fasta"
        output_file = "output/12_YIL115C_Anc_2.253_codon_aln.fasta.clipkit"

        kwargs = dict(
            input_file=input_file,
            output_file=output_file,
            input_file_format='fasta',
            output_file_format='fasta',
            complement=False,
            gaps=0.9,
            mode=TrimmingMode.gappy,
            use_log=True,
        )
        execute(**kwargs)

        with open(
                f"{here.parent}/expected/12_YIL115C_Anc_2.253_codon_aln.fasta.clipkit.log",
                "r",
        ) as expected:
            expected_content = expected.read()

        with open(f"{output_file}.log", "r") as out_file:
            output_content = out_file.read()

        assert expected_content == output_content
コード例 #16
0
    def test_12_YIL115C_Anc_2_253_aa_aln(self):
        """
        test kpic-gappy with amino acid alignment of yeast sequences
        usage: clipkit 12_YIL115C_Anc_2.253_aa_aln.fasta -m kpic-gappy
        """
        input_file = f"{here.parent}/samples/12_YIL115C_Anc_2.253_aa_aln.fasta"
        output_file = "output/12_YIL115C_Anc_2.253_aa_aln.fasta.clipkit"

        kwargs = dict(
            input_file=input_file,
            output_file=output_file,
            input_file_format='fasta',
            output_file_format='fasta',
            complement=False,
            gaps=0.9,
            mode=TrimmingMode.kpic_gappy,
            use_log=False,
        )
        execute(**kwargs)

        with open(
                f"{here.parent}/expected/12_YIL115C_Anc_2.253_aa_aln.fasta_kpic_gappy",
                "r") as expected:
            expected_content = expected.read()

        with open(output_file, "r") as out_file:
            output_content = out_file.read()

        assert expected_content == output_content
    def test_phylip(self):
        """
        test output in phylip format
        usage: clipkit simple.fa -of phylip
        """
        input_file = f"{here.parent}/samples/simple.fa"
        output_file = "output/simple.phylip"

        kwargs = dict(
            input_file=input_file,
            output_file=output_file,
            input_file_format='fasta',
            output_file_format='phylip',
            complement=False,
            gaps=0.9,
            mode=TrimmingMode.gappy,
            use_log=False,
        )
        execute(**kwargs)

        with open(f"{here.parent}/expected/simple.phylip", "r") as expected:
            expected_content = expected.read()

        with open(output_file, "r") as out_file:
            output_content = out_file.read()

        assert expected_content == output_content