Skip to content

Commit

Permalink
hdbscan version bump, py3 fixes for 'deduplicate' subcommand (#77)
Browse files Browse the repository at this point in the history
* version bump hdbscan

* update time.time() to be compatible with py>3.7

* another python >3.7 fix

---------

Co-authored-by: Daniel Hoogestraat <dhoogest@work-mbp.local>
  • Loading branch information
dhoogest and Daniel Hoogestraat committed Oct 24, 2023
1 parent 265e31a commit 77e5fa3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion deenurp/subcommands/deduplicate_sequences.py
Expand Up @@ -51,7 +51,7 @@ def action(args):
seqhashes = dict()
for record in util.Counter(SeqIO.parse(sequences_in, 'fasta')):
seq = str(record.seq).replace('\n', '').upper()
seqhashes[record.name] = hashlib.sha1(seq).hexdigest()
seqhashes[record.name] = hashlib.sha1(seq.encode('utf-8')).hexdigest()

seqhash = pandas.Series(data=seqhashes, name='seqhash')
seqhash.index.name = 'seqname'
Expand Down
6 changes: 3 additions & 3 deletions deenurp/util.py
Expand Up @@ -48,20 +48,20 @@ def __init__(self, iterable, stream=sys.stderr, report_every=0.3,
self.stream = stream
self.report_every = report_every
self.prefix = prefix
self.start = time.clock()
self.start = time.time()
self.last = 0

def _report(self):
if self.stream:
msg = '{0}{1:15d} [{2:10.2f}s]\r'
msg = msg.format(self.prefix, self.count, time.clock()-self.start)
msg = msg.format(self.prefix, self.count, time.time()-self.start)
self.stream.write(msg)

def __iter__(self):
for i in self._it:
yield i
self.count += 1
now = time.clock()
now = time.time()
if now - self.last > self.report_every:
self._report()
self.last = now
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Expand Up @@ -4,7 +4,7 @@ decorator==5.1.1
DendroPy==4.5.2
fastalite==0.3
greenlet==1.1.2
hdbscan==0.8.28
hdbscan==0.8.33
Jinja2==3.0.3
joblib==1.1.0
MarkupSafe==2.1.0
Expand Down

0 comments on commit 77e5fa3

Please sign in to comment.