fhcrc / seqmagick

An imagemagick-like frontend to Biopython SeqIO
http://seqmagick.readthedocs.org
GNU General Public License v3.0
112 stars 22 forks source link

Encode hash result in hash_starts_numeric #85

Closed nileshpatra closed 4 years ago

nileshpatra commented 4 years ago

run_filter.sh ends up with the following:

Traceback (most recent call last):
  File "/usr/bin/seqmagick", line 11, in <module>
    load_entry_point('seqmagick==0.0.0', 'console_scripts', 'seqmagick')()
  File "/usr/lib/python3/dist-packages/seqmagick/scripts/cli.py", line 29, in main
    return action(arguments)
  File "/usr/lib/python3/dist-packages/seqmagick/subcommands/convert.py", line 354, in action
    transform_file(src, dest, arguments)
  File "/usr/lib/python3/dist-packages/seqmagick/subcommands/convert.py", line 318, in transform_file
    SeqIO.write(records, destination_file, destination_file_type)
  File "/usr/lib/python3/dist-packages/Bio/SeqIO/__init__.py", line 556, in write
    for record in sequences:
  File "myfunctions.py", line 17, in hash_starts_numeric
    seq_hash = hashlib.sha1(str(record.seq)).hexdigest()
TypeError: Unicode-objects must be encoded before hashing

This is an attempt to fix it.

nileshpatra commented 4 years ago

The travis test failures are not due to this PR, but due to deprecated biopython triefind. cc: #84

nileshpatra commented 4 years ago

@jgallowa07 could you please review this? The test fail because of missing Biopython trie forwhich you just merged my other PR on. On re-triggering the build, this would pass. But probably only you could do that.

jgallowa07 commented 4 years ago

@nileshpatra This looks great. However, I assume you're going to need to merge/rebase this branch with the new master so we get the https://github.com/fhcrc/seqmagick/blob/11ae5abcc1a4378d68816b4f4f5083a93ac1a317/.travis.yml#L15 in the build/travis for this to pass.

nileshpatra commented 4 years ago

@jgallowa07 Done. Please Merge :-)