Skip to content

Commit

Permalink
Removed *Runner from class name, expanded top-level docs
Browse files Browse the repository at this point in the history
  • Loading branch information
rvosa committed Sep 8, 2024
1 parent ed5e941 commit 3631672
Show file tree
Hide file tree
Showing 8 changed files with 88 additions and 88 deletions.
20 changes: 10 additions & 10 deletions bactria/blastdb_aliastool_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,18 @@
from bactria.config import Config


class BlastdbAliastoolRunner(ToolRunner):
class BlastdbAliastool(ToolRunner):
"""
A subclass of ToolRunner specifically for running blastdb_aliastool.
Examples:
>>> config = Config()
>>> config.load_config('path/to/config.yaml')
>>> aliastool_runner = BlastdbAliastoolRunner(config)
>>> aliastool_runner.set_db('my_blast_db')
>>> aliastool_runner.set_out('my_alias_db')
>>> aliastool_runner.set_gilist('my_gi_list.txt')
>>> return_code = aliastool_runner.run()
"""

def __init__(self, config: Config):
Expand Down Expand Up @@ -193,12 +202,3 @@ def run(self) -> int:
"""
self.validate_parameters()
return super().run()

# Example usage:
# config = Config()
# config.load_config('path/to/config.yaml')
# aliastool_runner = BlastdbAliastoolRunner(config)
# aliastool_runner.set_db('my_blast_db')
# aliastool_runner.set_out('my_alias_db')
# aliastool_runner.set_gilist('my_gi_list.txt')
# return_code = aliastool_runner.run()
20 changes: 10 additions & 10 deletions bactria/blastdbcmd_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,18 @@
from bactria.config import Config


class BlastdbcommandRunner(ToolRunner):
class Blastdbcommand(ToolRunner):
"""
A subclass of ToolRunner specifically for running blastdbcmd.
Examples:
>>> config = Config()
>>> config.load_config('path/to/config.yaml')
>>> blastdbcmd_runner = Blastdbcommand(config)
>>> blastdbcmd_runner.set_db('nr')
>>> blastdbcmd_runner.set_entry(['NP_000508.1', 'NP_001018081.2'])
>>> blastdbcmd_runner.set_outfmt('%f')
>>> return_code = blastdbcmd_runner.run()
"""

def __init__(self, config: Config):
Expand Down Expand Up @@ -281,12 +290,3 @@ def run(self) -> int:
"""
self.validate_parameters()
return super().run()

# Example usage:
# config = Config()
# config.load_config('path/to/config.yaml')
# blastdbcmd_runner = BlastdbcommandRunner(config)
# blastdbcmd_runner.set_db('nr')
# blastdbcmd_runner.set_entry(['NP_000508.1', 'NP_001018081.2'])
# blastdbcmd_runner.set_outfmt('%f')
# return_code = blastdbcmd_runner.run()
28 changes: 14 additions & 14 deletions bactria/blastn_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,22 @@
from bactria.config import Config


class BLASTNRunner(ToolRunner):
class BLASTN(ToolRunner):
"""
A subclass of ToolRunner specifically for running BLASTN (Nucleotide-Nucleotide BLAST).
Examples:
>>> config = Config()
>>> config.load_config('path/to/config.yaml')
>>> blastn_runner = BLASTN(config)
>>> blastn_runner.set_query('input.fasta')
>>> blastn_runner.set_db('nr')
>>> blastn_runner.set_out('output.txt')
>>> blastn_runner.set_evalue(1e-5)
>>> blastn_runner.set_outfmt(6)
>>> blastn_runner.set_num_threads(4)
>>> blastn_runner.set_remote(True)
>>> return_code = blastn_runner.run()
"""

def __init__(self, config: Config):
Expand Down Expand Up @@ -216,16 +229,3 @@ def build_command(self) -> List[str]:
command.append(f'-{param}')

return command

# Example usage:
# config = Config()
# config.load_config('path/to/config.yaml')
# blastn_runner = BLASTNRunner(config)
# blastn_runner.set_query('input.fasta')
# blastn_runner.set_db('nr')
# blastn_runner.set_out('output.txt')
# blastn_runner.set_evalue(1e-5)
# blastn_runner.set_outfmt(6)
# blastn_runner.set_num_threads(4)
# blastn_runner.set_remote(True)
# return_code = blastn_runner.run()
22 changes: 11 additions & 11 deletions bactria/hmmalign_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,19 @@
from bactria.config import Config


class HmmalignRunner(ToolRunner):
class Hmmalign(ToolRunner):
"""
A subclass of ToolRunner specifically for running hmmalign.
Examples:
>>> config = Config()
>>> config.load_config('path/to/config.yaml')
>>> hmmalign_runner = Hmmalign(config)
>>> hmmalign_runner.set_hmmfile('model.hmm')
>>> hmmalign_runner.set_seqfile('sequences.fasta')
>>> hmmalign_runner.set_output('alignment.sto')
>>> hmmalign_runner.set_outformat('Stockholm')
>>> return_code = hmmalign_runner.run()
"""

def __init__(self, config: Config):
Expand Down Expand Up @@ -140,13 +150,3 @@ def run(self) -> int:
"""
self.validate_parameters()
return super().run()

# Example usage:
# config = Config()
# config.load_config('path/to/config.yaml')
# hmmalign_runner = HmmalignRunner(config)
# hmmalign_runner.set_hmmfile('model.hmm')
# hmmalign_runner.set_seqfile('sequences.fasta')
# hmmalign_runner.set_output('alignment.sto')
# hmmalign_runner.set_outformat('Stockholm')
# return_code = hmmalign_runner.run()
22 changes: 11 additions & 11 deletions bactria/makeblastdb_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,19 @@
from bactria.tool_runner import ToolRunner
from bactria.config import Config

class MakeblastdbRunner(ToolRunner):
class Makeblastdb(ToolRunner):
"""
A subclass of ToolRunner specifically for running makeblastdb.
Examples:
>>> config = Config()
>>> config.load_config('path/to/config.yaml')
>>> makeblastdb_runner = Makeblastdb(config)
>>> makeblastdb_runner.set_in('input_sequences.fasta')
>>> makeblastdb_runner.set_dbtype('prot')
>>> makeblastdb_runner.set_out('my_blast_db')
>>> makeblastdb_runner.set_parse_seqids()
>>> return_code = makeblastdb_runner.run()
"""

def __init__(self, config: Config):
Expand Down Expand Up @@ -213,13 +223,3 @@ def run(self) -> int:
"""
self.validate_parameters()
return super().run()

# Example usage:
# config = Config()
# config.load_config('path/to/config.yaml')
# makeblastdb_runner = MakeblastdbRunner(config)
# makeblastdb_runner.set_in('input_sequences.fasta')
# makeblastdb_runner.set_dbtype('prot')
# makeblastdb_runner.set_out('my_blast_db')
# makeblastdb_runner.set_parse_seqids()
# return_code = makeblastdb_runner.run()
18 changes: 9 additions & 9 deletions bactria/megatree_loader_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,17 @@
import logging


class MegatreeLoaderRunner(ToolRunner):
class MegatreeLoader(ToolRunner):
"""
A subclass of ToolRunner specifically for running megatree-loader.
Examples:
>>> config = Config()
>>> config.load_config('path/to/config.yaml')
>>> megatree_runner = MegatreeLoaderRunner(config)
>>> megatree_runner.set_infile('input_tree.newick')
>>> megatree_runner.set_dbfile('output_db.sqlite')
>>> return_code = megatree_runner.run()
"""

def __init__(self, config: Config):
Expand Down Expand Up @@ -80,11 +88,3 @@ def run(self) -> int:
"""
self.validate_parameters()
return super().run()

# Example usage:
# config = Config()
# config.load_config('path/to/config.yaml')
# megatree_runner = MegatreeLoaderRunner(config)
# megatree_runner.set_infile('input_tree.newick')
# megatree_runner.set_dbfile('output_db.sqlite')
# return_code = megatree_runner.run()
22 changes: 11 additions & 11 deletions bactria/megatree_pruner_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,19 @@
import logging


class MegatreePrunerRunner(ToolRunner):
class MegatreePruner(ToolRunner):
"""
A subclass of ToolRunner specifically for running megatree-pruner.
Examples:
>>> config = Config()
>>> config.load_config('path/to/config.yaml')
>>> megatree_pruner = MegatreePruner(config)
>>> megatree_pruner.set_dbfile('tree_database.sqlite')
>>> megatree_pruner.set_infile('taxa_list.txt')
>>> megatree_pruner.set_tabular(True)
>>> megatree_pruner.set_relabel(True)
>>> return_code = megatree_pruner.run()
"""

def __init__(self, config: Config):
Expand Down Expand Up @@ -115,13 +125,3 @@ def run(self) -> int:
"""
self.validate_parameters()
return super().run()

# Example usage:
# config = Config()
# config.load_config('path/to/config.yaml')
# megatree_pruner = MegatreePrunerRunner(config)
# megatree_pruner.set_dbfile('tree_database.sqlite')
# megatree_pruner.set_infile('taxa_list.txt')
# megatree_pruner.set_tabular(True)
# megatree_pruner.set_relabel(True)
# return_code = megatree_pruner.run()
24 changes: 12 additions & 12 deletions bactria/raxml_ng_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,20 @@
from bactria.config import Config


class RAXMLNGRunner(ToolRunner):
class RAXMLNG(ToolRunner):
"""
A subclass of ToolRunner specifically for running RAxML-NG (Randomized Axelerated Maximum Likelihood - Next Generation).
Examples:
>>> config = Config()
>>> config.load_config('path/to/config.yaml')
>>> raxml_runner = RAXMLNG(config)
>>> raxml_runner.set_msa('alignment.fa')
>>> raxml_runner.set_model('GTR+G')
>>> raxml_runner.set_prefix('test_run')
>>> raxml_runner.set_threads(4)
>>> raxml_runner.set_all()
>>> return_code = raxml_runner.run()
"""

def __init__(self, config: Config):
Expand Down Expand Up @@ -176,14 +187,3 @@ def build_command(self) -> List[str]:
command.append(f'--{param}')

return command

# Example usage:
# config = Config()
# config.load_config('path/to/config.yaml')
# raxml_runner = RAXMLNGRunner(config)
# raxml_runner.set_msa('alignment.fa')
# raxml_runner.set_model('GTR+G')
# raxml_runner.set_prefix('test_run')
# raxml_runner.set_threads(4)
# raxml_runner.set_all()
# return_code = raxml_runner.run()

0 comments on commit 3631672

Please sign in to comment.