예제 #1
0
파일: SProt.py 프로젝트: chapmanb/biosqlweb
def read(handle):
    from SProt import RecordParser
    parser = RecordParser()
    try:
        record = parser.parse(handle)
    except ValueError, error:
        if error.message.startswith("Line does not start with 'ID':"): 
            raise ValueError("No SwissProt record found")
        else:
            raise error
예제 #2
0
def read(handle):
    from SProt import RecordParser
    parser = RecordParser()
    try:
        record = parser.parse(handle)
    except ValueError, error:
        if error.message.startswith("Line does not start with 'ID':"):
            raise ValueError("No SwissProt record found")
        else:
            raise error
예제 #3
0
파일: SProt.py 프로젝트: chapmanb/biosqlweb
def parse(handle):
    from SProt import RecordParser
    import cStringIO
    parser = RecordParser()
    text = ""
    for line in handle:
        text += line
        if line[:2]=='//':
            handle = cStringIO.StringIO(text)
            record = parser.parse(handle)
            text = ""
            yield record
예제 #4
0
def parse(handle):
    from SProt import RecordParser
    import cStringIO
    parser = RecordParser()
    text = ""
    for line in handle:
        text += line
        if line[:2] == '//':
            handle = cStringIO.StringIO(text)
            record = parser.parse(handle)
            text = ""
            yield record