14 def __init__(self, pdb_id, chain, prob, e_value, query_start, query_end,
15 template_start, template_end):
27 Read HHSearch result file. The result is stored in a list of hh search hits.
31 result=HHSearchResult('output.hhr')
32 for hit in result.hits:
33 print hit.pdb_id, hit.chain
34 print hit.alignment.ToString(80)
36 def __init__(self, filename, pipe_separated=False):
39 def _Read(self, filename):
45 def _ReadHeader(self, ifile):
48 stripped_line=line.strip()
51 header_lines.append(stripped_line)
52 for header_line
in header_lines:
53 var, value=re.split(
'\s+', header_line, 1)
54 setattr(self, var.lower(), value)
56 def _ReadHitSummaries(self, ifile):
64 stripped_line=line.strip()
67 summary_lines.append(line)
69 for summary_line
in summary_lines:
70 pdb_id, chain=(
None,
None)
72 parts=summary_line[4:37].split(
'|')
76 pdb_id=summary_line[4:8]
78 prob=float(summary_line[36:40])
80 query_range=summary_line[76:84].split(
'-')
81 query_start=int(query_range[0].strip())
82 query_end=int(query_range[1].strip())
83 template_range=summary_line[86:94].split(
'-')
84 template_start=int(template_range[0].strip())
85 template_end=int(template_range[1].strip())
86 summaries.append(
HitSummary(pdb_id, chain, prob, e_value, query_start,
87 query_end, template_start, template_end))
90 def _ReadHitDetails(self, ifile, summaries):
92 for summary
in summaries:
96 def _ReadHitDetail(self, ifile):
100 if skip_header==
True:
101 if line.startswith(
'>'):
104 if line.startswith(
'No'):
108 if line.startswith(
'Q ss_pred')
or line.startswith(
'Q Consensus'):
110 if line.startswith(
'T ss_pred')
or line.startswith(
'T Consensus'):
112 if line.startswith(
' '):
114 if line.startswith(
'Q'):
115 q_seq+=re.split(
'\s+', line)[3]
116 if line.startswith(
'T'):
117 t_seq+=re.split(
'\s+', line)[3]
119 ali.AddSequence(seq.Sequence.FromString(
'query', q_seq))
120 ali.AddSequence(seq.Sequence.FromString(
'target', t_seq))