hh-suite icon indicating copy to clipboard operation
hh-suite copied to clipboard

hh_reader.py giving TypeError

Open Stochastic13 opened this issue 3 years ago • 3 comments

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

  • Latest version of the file
  • Windows

Stochastic13 avatar Dec 09 '20 10:12 Stochastic13

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.

milot-mirdita avatar Dec 09 '20 12:12 milot-mirdita

@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. :)

Stochastic13 avatar Dec 10 '20 07:12 Stochastic13

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.

alephreish avatar Apr 12 '22 10:04 alephreish