Skip to content

Commit

Permalink
Remove use of stdlib
Browse files Browse the repository at this point in the history
  • Loading branch information
jakobnissen committed Jul 22, 2024
1 parent 12d6dde commit 922d968
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions vamb/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
from torch.utils.data import DataLoader
from functools import partial
from loguru import logger
from array import array

_ncpu = os.cpu_count()
DEFAULT_THREADS = 8 if _ncpu is None else min(_ncpu, 8)
Expand Down Expand Up @@ -1413,7 +1412,7 @@ def predict_taxonomy(
predicted_vector[i] > taxonomy_options.softmax_threshold
)
ranks = list(nodes_ar[threshold_mask][1:])
probs = array("f", predicted_vector[i][threshold_mask][1:])
probs = predicted_vector[i][threshold_mask][1:]
tax = vamb.taxonomy.PredictedContigTaxonomy(
vamb.taxonomy.ContigTaxonomy(ranks), probs
)
Expand Down
4 changes: 2 additions & 2 deletions vamb/taxonomy.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from typing import Optional, IO
from pathlib import Path
from vamb.parsecontigs import CompositionMetaData
import array
import numpy as np


class ContigTaxonomy:
Expand Down Expand Up @@ -121,7 +121,7 @@ def parse_tax_file(
class PredictedContigTaxonomy:
slots = ["contig_taxonomy", "probs"]

def __init__(self, tax: ContigTaxonomy, probs: array.array[float]):
def __init__(self, tax: ContigTaxonomy, probs: np.ndarray):
if len(probs) != len(tax.ranks):
raise ValueError("The length of probs must equal that of ranks")
self.tax = tax
Expand Down

0 comments on commit 922d968

Please sign in to comment.