Skip to content

Commit

Permalink
Merge pull request #23 from andrewcchang/master
Browse files Browse the repository at this point in the history
handle biopython bytes object
  • Loading branch information
thetechnocrat-dev committed Sep 18, 2019
2 parents 308cc1d + 04143d3 commit d15d290
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions ice/classes/sanger_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,17 @@ def initialize_from_path(self, ab1_file_path, *args, **kwargs):
self.path = ab1_file_path
self.basename = os.path.basename(ab1_file_path)
record = SeqIO.read(ab1_file_path, 'abi')
traces = {}
for c in record.annotations['abif_raw'].keys():
traces[c] = record.annotations['abif_raw'][c]

# In Biopython 1.74, some strings are converted to bytes in py3
# Convert strings with bytes-object back to regular string
traces_ = record.annotations['abif_raw']
traces = {}
for k, v in traces_.items():
if isinstance(v, bytes):
v = v.decode()
else:
v = v
traces[k] = v
self.data = traces

phred_scores = []
Expand Down

0 comments on commit d15d290

Please sign in to comment.