soedinglab / hh-suite

Remote protein homology detection suite.
https://bmcbioinformatics.biomedcentral.com/articles/10.1186/s12859-019-3019-7
GNU General Public License v3.0
515 stars 128 forks source link

hh_reader.py giving TypeError #234

Open Stochastic13 opened 3 years ago

Stochastic13 commented 3 years ago

I am running the script scripts/hh_reader.py individually to parse hhr files as downloaded after running a HHPRED server query. The printing fails with a TypeError

Expected Behavior

Prints the query and template alignments for all the discovered hits

Current Behavior

Raises TypeError because the internal variable result.query_ali and result.template_ali are lists and not strings as required for appropriate printing

Steps to Reproduce (for bugs)

Ran python hh_reader.py x.hhr

Context

Presumably coming from some internal coercion to a list while parsing the results in the file

Your Environment

milot-mirdita commented 3 years ago

The scripts folder is barely maintained currently. You could try a scripts from other HHsuite users such as this one: https://github.com/jrjhealey/bioinfo-tools/blob/master/tabulateHHpred.py

I'd be happy to merge a fix if you happen to find the issue.

Stochastic13 commented 3 years ago

@milot-mirdita Thanks! I think this particular script serves me better than the one you cited. I do have a simple work-around which works perfectly well in my case (i.e. for the hhr files I am parsing), though am not absolutely sure that the work-around would be valid for all files meant to be parsed via this script. I can create a PR for this if that is not an issue. :)

alephreish commented 2 years ago

Sorry for spamming in this old thread, but I think none of the tools provide a full representation of hhr in tabular format. I added a function to my R package of custom parsers that outputs all hits and includes alignments: https://github.com/alephreish/bioformatr/blob/master/R/read.hhr.R . This function can also be used in a standalone R script that takes input from stdin and outputs to stdout and is thus applicable for ffindex_apply.

Unfortunately my pure R implementation is more like proof of the principle and is extremely slow, so a robust implementation in a more efficient language is still a desideratum.