mirror of
https://github.com/biopython/biopython.git
synced 2025-10-20 21:53:47 +08:00
108 lines
5.6 KiB
Python
108 lines
5.6 KiB
Python
# Copyright 2024 by Samuel Prince. All rights reserved.
|
|
#
|
|
# This file is part of the Biopython distribution and governed by your
|
|
# choice of the "Biopython License Agreement" or the "BSD 3-Clause License".
|
|
# Please see the LICENSE file that should have been included as part of this
|
|
# package.
|
|
|
|
|
|
"""Tests for SearchIO InfernalIO infernal-tab indexing"""
|
|
|
|
import os
|
|
import unittest
|
|
|
|
from search_tests_common import CheckIndex
|
|
from search_tests_common import CheckRaw
|
|
|
|
|
|
class InfernalTabRawCases(CheckRaw):
|
|
fmt = "infernal-tab"
|
|
|
|
|
|
def test_infernal_tab_single(self):
|
|
"""Test infernal-tab raw string retrieval, cmsearch, single query."""
|
|
filename = os.path.join("Infernal", "U2_Yeast-threshold.tbl")
|
|
raw = """ENA|BK006936|BK006936.2 - U2 RF00004 cm 1 193 681858 681747 - no 1 0.33 0.1 98.7 5.9e-20 ! TPA_inf: Saccharomyces cerevisiae S288C chromosome II, complete sequence.
|
|
"""
|
|
self.check_raw(filename, "U2", raw)
|
|
|
|
|
|
def test_infernal_tab_multiple(self):
|
|
"""Test infernal-tab raw string retrieval, cmsearch, single query, multiple non-consecutive hits."""
|
|
filename = os.path.join("Infernal", "U2_Yeast-shuf.tbl")
|
|
raw = """ENA|BK006936|BK006936.2 - U2 RF00004 cm 1 193 681858 681747 - no 1 0.33 0.1 98.7 1.3e-20 ! -
|
|
ENA|BK006948|BK006948.2 - U2 RF00004 cm 1 193 737498 737324 - no 1 0.39 0.0 19.8 0.11 ? -
|
|
ENA|BK006936|BK006936.2 - U2 RF00004 cm 1 193 1370418 1370563 + no 1 0.34 0.1 15.6 1.1 ? -
|
|
ENA|BK006936|BK006936.2 - U2 RF00004 cm 1 193 1079243 1079392 + no 1 0.39 0.0 15.3 1.3 ? -
|
|
ENA|BK006948|BK006948.2 - U2 RF00004 cm 1 193 425490 425693 + no 1 0.34 0.9 13.7 3.1 ? -
|
|
ENA|BK006948|BK006948.2 - U2 RF00004 cm 1 193 1073786 1073950 + no 1 0.33 0.5 11.9 8.3 ? -
|
|
"""
|
|
self.check_raw(filename, "U2", raw)
|
|
|
|
|
|
def test_infernal_tab_single_first(self):
|
|
"""Test infernal-tab raw string retrieval, cmsearch, multiple queries, first."""
|
|
filename = os.path.join("Infernal", "IRES_5S_U2_Yeast-cmscan.tbl")
|
|
raw = """U2 RF00004 ENA|BK006935|BK006935.2 - cm 1 193 52929 53083 + no 1 0.44 0.0 13.5 0.91 ? U2 spliceosomal RNA
|
|
U2 RF00004 ENA|BK006935|BK006935.2 - cm 1 193 196571 196389 - no 1 0.33 5.3 12.8 1.3 ? U2 spliceosomal RNA
|
|
"""
|
|
self.check_raw(filename, "ENA|BK006935|BK006935.2", raw)
|
|
|
|
|
|
def test_infernal_tab_multiple_middle(self):
|
|
"""Test infernal-tab raw string retrieval, cmsearch, multiple queries, middle."""
|
|
filename = os.path.join("Infernal", "IRES_5S_U2_Yeast-cmscan.tbl")
|
|
raw = """U2 RF00004 ENA|BK006936|BK006936.2 - cm 1 193 681858 681747 - no 1 0.33 0.1 98.7 1.2e-20 ! U2 spliceosomal RNA
|
|
"""
|
|
self.check_raw(filename, "ENA|BK006936|BK006936.2", raw)
|
|
|
|
|
|
def test_infernal_tab_multiple_last(self):
|
|
"""Test infernal-tab raw string retrieval, cmsearch, multiple queries, last."""
|
|
filename = os.path.join("Infernal", "IRES_5S_U2_Yeast-cmscan.tbl")
|
|
raw = """5S_rRNA RF00001 ENA|BK006937|BK006937.2 - cm 1 119 761 644 - no 1 0.41 0.3 14.1 2.4 ? 5S ribosomal RNA
|
|
U2 RF00004 ENA|BK006937|BK006937.2 - cm 1 193 229986 229885 - no 1 0.32 0.1 11.1 4.7 ? U2 spliceosomal RNA
|
|
"""
|
|
self.check_raw(filename, "ENA|BK006937|BK006937.2", raw)
|
|
|
|
|
|
def test_infernal_tab_multiple_fmt_2(self):
|
|
"""Test infernal-tab raw string retrieval, cmsearch, multiple queries, fmt 2."""
|
|
filename = os.path.join("Infernal", "IRES_5S_U2_Yeast-cmscan-fmt_2.tbl")
|
|
raw = """1 U2 RF00004 ENA|BK006936|BK006936.2 - - cm 1 193 681858 681747 - no 1 0.33 0.1 98.7 1.2e-20 ! * - - - - - - 193 813184 U2 spliceosomal RNA
|
|
"""
|
|
self.check_raw(filename, "ENA|BK006936|BK006936.2", raw)
|
|
|
|
|
|
class InfernalTabIndexCases(CheckIndex):
|
|
fmt = "infernal-tab"
|
|
|
|
|
|
def test_infernal_tab_single(self):
|
|
"""Test infernal-tab indexing, cmsearch, single query."""
|
|
filename = os.path.join("Infernal", "U2_Yeast-threshold.tbl")
|
|
self.check_index(filename, self.fmt)
|
|
|
|
|
|
def test_infernal_tab_single_no_hit(self):
|
|
"""Test infernal-tab indexing, cmsearch, single query."""
|
|
filename = os.path.join("Infernal", "IRES_Yeast.tbl")
|
|
self.check_index(filename, self.fmt)
|
|
|
|
|
|
def test_infernal_tab_single_multiple_hit(self):
|
|
"""Test infernal-tab indexing, cmsearch, single query."""
|
|
filename = os.path.join("Infernal", "5S_Yeast.tbl")
|
|
self.check_index(filename, self.fmt)
|
|
|
|
|
|
def test_infernal_tab_multiple_multiple_hit(self):
|
|
"""Test infernal-tab indexing, cmscan, multiple query."""
|
|
filename = os.path.join("Infernal", "IRES_5S_U2_Yeast-cmscan.tbl")
|
|
self.check_index(filename, self.fmt)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
runner = unittest.TextTestRunner(verbosity=2)
|
|
unittest.main(testRunner=runner)
|