[Biopython] parsing hmmer results
Wibowo Arindrarto
w.arindrarto at gmail.com
Tue Mar 11 13:18:25 UTC 2014
Hi Michael,
Do you have an example file you can send over (sending it to me
privately also works). The parser has not been tested with HMMER
version 3.1, and I suppose they introduced some changes which breaks
the parser.
Best,
Bow
On Tue, Mar 11, 2014 at 1:43 PM, Michael Thon <mike.thon at gmail.com> wrote:
> I’m trying to parse a batch hmmer v3.1b1 report but I keep getting this error. I think its happening when the parser hits a hmmer report with no hits, but I’m not sure.
>
> Here’s the error:
>
> Traceback (most recent call last):
> File "parse-dbcan.py", line 6, in <module>
> for qresult in SearchIO.parse(argv[1], 'hmmer3-text'):
> File "/Library/Python/2.7/site-packages/Bio/SearchIO/__init__.py", line 316, in parse
> for qresult in generator:
> File "/Library/Python/2.7/site-packages/Bio/SearchIO/HmmerIO/hmmer3_text.py", line 47, in __iter__
> for qresult in self._parse_qresult():
> File "/Library/Python/2.7/site-packages/Bio/SearchIO/HmmerIO/hmmer3_text.py", line 109, in _parse_qresult
> qid = regx.group(1).strip()
> AttributeError: 'NoneType' object has no attribute ‘group'
>
>
> Here’s my script:
>
> #!/usr/bin/python
> from Bio import SearchIO
> from sys import argv
> import pdb
>
> for qresult in SearchIO.parse(argv[1], 'hmmer3-text'):
> hits = qresult.hits
> if len(hits) > 0:
> beste = hits[0].hsps[0].evalue
> query = hits[0].query_id
> hit = hits[0].id.replace('.hmm', '')
> print query + ',' + hit + ',' + str(beste)
> #pdb.set_trace()
>
> I ran hmmscan like this:
>
> hmmscan --cpu 2 -E 1e-3 HMMs.txt prots.fasta >oute-3.txt
> _______________________________________________
> Biopython mailing list - Biopython at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/biopython
More information about the Biopython
mailing list