示例#1
0
         'taxonomy_id',
         'host_organism',
         'host_taxonomy_id',
         'organelle',
         'organism_classification',
         #'references',
         'comments',
         'cross_references',
         'keywords',
         'seqinfo',
         'features',
         'sequence',
         ]

with open(datafile, "r", encoding="ascii") as data:
    my_records = list(parse_txt(data))


with open(datafile, "r", encoding="ascii") as data:
    biopython_records = list(SwissProt.parse(data))
#####################################################################
# END - Test stuff for parse_txt
#####################################################################

#####################################################################
# Test stuff for parse_txt_atomic
#####################################################################
EXPECTED_ANNOTATIONS = [
    "P62140: FUNCTION-Dephosphorylates the 'Ser-418' residue of FOXP3 in regulatory T- cells (Treg) from patients with rheumatoid arthritis, thereby inactivating FOXP3 and rendering Treg cells functionally defective - ECO:0000269-PubMed:23396208",
    'P62140: FUNCTION-Protein phosphatase that associates with over 200 regulatory proteins to form highly specific holoenzymes which dephosphorylate hundreds of biological targets - ECO:0000269-None',
    'P62140: FUNCTION-Protein phosphatase (PP1) is essential for cell division, it participates in the regulation of glycogen metabolism, muscle contractility and protein synthesis - ECO:0000269-None',
def test_parser_with_unsupported_parameter_int():
    with pytest.raises(NotImplementedError):
        for record in up.parse_txt(1):
            pass
def test_parser_with_unsupported_parameter_dict():
    d = {1: 'some'}
    with pytest.raises(NotImplementedError):
        for record in up.parse_txt(d):
            pass
def test_parser_with_Path_instance():
    p = pathlib.Path(TEST_DATA_LOCATION)
    for record in up.parse_txt(p):
        assert record.primary_accession == EXPECTED_ACC
def test_parser_with_str_path():
    for record in up.parse_txt(TEST_DATA_LOCATION):
        assert record.primary_accession == EXPECTED_ACC
def test_parser_with_WSResponse():
    mock = WSResponse(None)
    with open(TEST_DATA_LOCATION, 'r') as infile:
        mock.text = infile.read()
    for record in up.parse_txt(mock):
        assert record.primary_accession == EXPECTED_ACC
def test_parser_with_StringIO():
    with open(TEST_DATA_LOCATION, 'r') as infile:
        content = infile.read()
        stringio = StringIO(content)
    for record in up.parse_txt(stringio):
        assert record.primary_accession == EXPECTED_ACC
def test_parser_with_file_object():
    with open(TEST_DATA_LOCATION, 'r') as infile:
        for record in up.parse_txt(infile):
            assert record.primary_accession == EXPECTED_ACC
示例#9
0
def test_ignore_lowercase_entries():
    datafile = os.path.join(base_dir, 'SwissProt', 'contains_lowercase.txl')
    with open(datafile, 'r') as infile:
        entries = list(up.parse_txt(infile))
        assert len(entries) == 23
示例#10
0
"""
import pytest
import os

from Bio import SwissProt
import prunito.uniprot as up

# Import paths for data files
base_dir = os.path.dirname(__file__)
filename = 'one_sp_entry.txl'
#filename = 'many_sp_entries.txl'
#datafile = os.path.join('SwissProt', filename)
datafile = os.path.join(base_dir, 'SwissProt', filename)

with open(datafile, "r", encoding="ascii") as data:
    my_record = list(up.parse_txt(data))

with open(datafile, "r", encoding="ascii") as data:
    biopython_record = SwissProt.read(data)


def test_wrong_format_paramater_for_search():
    with pytest.raises(ValueError):
        up.search('test', frmt='xsd')


def test_uppercase_format_parameter_works_for_search():
    pass


def test_object_is_record_instance():