Commit 43116de0 authored by Gustaf Ahdritz's avatar Gustaf Ahdritz
Browse files

Add default CPU count to AlignmentRunner

parent edffead3
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
import os import os
import datetime import datetime
from multiprocessing import cpu_count
from typing import Mapping, Optional, Sequence, Any from typing import Mapping, Optional, Sequence, Any
import numpy as np import numpy as np
...@@ -128,6 +129,7 @@ def _aatype_to_str_sequence(aatype): ...@@ -128,6 +129,7 @@ def _aatype_to_str_sequence(aatype):
for i in range(len(aatype)) for i in range(len(aatype))
]) ])
def make_protein_features( def make_protein_features(
protein_object: protein.Protein, protein_object: protein.Protein,
description: str, description: str,
...@@ -216,7 +218,6 @@ def make_msa_features( ...@@ -216,7 +218,6 @@ def make_msa_features(
class AlignmentRunner: class AlignmentRunner:
"""Runs alignment tools and saves the results""" """Runs alignment tools and saves the results"""
def __init__( def __init__(
self, self,
jackhmmer_binary_path: Optional[str] = None, jackhmmer_binary_path: Optional[str] = None,
...@@ -259,7 +260,8 @@ class AlignmentRunner: ...@@ -259,7 +260,8 @@ class AlignmentRunner:
Whether to search the BFD database alone with jackhmmer or Whether to search the BFD database alone with jackhmmer or
in conjunction with uniclust30 with hhblits. in conjunction with uniclust30 with hhblits.
no_cpus: no_cpus:
The number of CPUs available for alignment The number of CPUs available for alignment. By default, all
CPUs are used.
uniref_max_hits: uniref_max_hits:
Max number of uniref hits Max number of uniref hits
mgnify_max_hits: mgnify_max_hits:
...@@ -306,6 +308,9 @@ class AlignmentRunner: ...@@ -306,6 +308,9 @@ class AlignmentRunner:
self.mgnify_max_hits = mgnify_max_hits self.mgnify_max_hits = mgnify_max_hits
self.use_small_bfd = use_small_bfd self.use_small_bfd = use_small_bfd
if(no_cpus is None):
no_cpus = cpu_count()
self.jackhmmer_uniref90_runner = None self.jackhmmer_uniref90_runner = None
if(jackhmmer_binary_path is not None and if(jackhmmer_binary_path is not None and
uniref90_database_path is not None uniref90_database_path is not None
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment