BjornFJohansson / pydna

Clone with Python! Data structures for double stranded DNA & simulation of homologous recombination, Gibson assembly, cut & paste cloning.
Other
166 stars 45 forks source link

Entering β in the description of a Dseqrecord causes an exception when using the write method #71

Closed ITS-Account closed 3 years ago

ITS-Account commented 3 years ago

Aside from removing the β character from the description are there any possible solutions to this error?

This is the value that the descriptions holds: out_pydna.description '30-506915946-NGS000053 with BβaI, GTGT/AGCC'

Exception that occurs when utilizing the out_pydna.write(path\to\some\gb\file.gb, f='gb') method: Exception has occurred: UnicodeEncodeError 'charmap' codec can't encode character '\u03b2' in position 122: character maps to <undefined>

I attempted to encode the description value to utf-8, but got the following error: Exception has occurred: TypeError can't concat str to bytes

Any help would be appreciated.

~ Cheers

Marcelo

BjornFJohansson commented 3 years ago

Thanks for your input! I'll have a look at this right away.

BTW what is the version of pydna and biopython you are using?

BjornFJohansson commented 3 years ago

I tried to replicate the issue using the latest version (4.0.0a10):

https://gist.github.com/BjornFJohansson/7c3caa7e521e64a32e274df573fefa34

It seems to work?

ITS-Account commented 3 years ago

Hey @BjornFJohansson, sorry for the late reply. I'm using version 3.1.3 which was installed via pip: pip install pydna I'm assuming that pip installs 3.1.3 by default? I'll try upgrading and get back to you.

BjornFJohansson commented 3 years ago

Try pip install pydna==4.0.0a12

ITS-Account commented 3 years ago

I tried that and still got the same error. I made a comment in the gist: https://gist.github.com/BjornFJohansson/7c3caa7e521e64a32e274df573fefa34#gistcomment-3886736

BjornFJohansson commented 3 years ago

I think I might have solved this bug. Try pip install pydna==4.0.0a13 I have not been able to test manually on windows, but all tests pass on all platforms.

ITS-Account commented 3 years ago

@BjornFJohansson I was still getting the same error after https://github.com/BjornFJohansson/pydna/commit/58de04def891e8dc36056b8760510398fcc47496. I added some missing encodings and now it works!

BjornFJohansson commented 3 years ago

Thanks for the PR. I added it to version 4.0.0a14.

ITS-Account commented 3 years ago

Sweet, thanks. I'll close this issue now.