Skip to content

Commit

Permalink
Tiny improvements to CLI (#538)
Browse files Browse the repository at this point in the history
* use ArgumentDefaultsHelpFormatter for formatting, revert changes in manual default definition
* revert changes from .gitignore for pycharm
  • Loading branch information
gieses authored Jan 8, 2024
1 parent 675f93a commit 941feec
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 31 deletions.
4 changes: 2 additions & 2 deletions colabfold/batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import pickle
import gzip

from argparse import ArgumentParser
from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter
from pathlib import Path
from typing import Any, Callable, Dict, List, Optional, Tuple, Union, TYPE_CHECKING
from io import StringIO
Expand Down Expand Up @@ -1671,7 +1671,7 @@ def set_model_type(is_complex: bool, model_type: str) -> str:
return model_type

def main():
parser = ArgumentParser()
parser = ArgumentParser(formatter_class=ArgumentDefaultsHelpFormatter)
parser.add_argument(
"input",
default="input",
Expand Down
64 changes: 35 additions & 29 deletions colabfold/mmseqs/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import os
import shutil
import subprocess
from argparse import ArgumentParser
from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter
from pathlib import Path
from typing import List, Union

Expand Down Expand Up @@ -214,7 +214,7 @@ def mmseqs_search_pair(


def main():
parser = ArgumentParser()
parser = ArgumentParser(formatter_class=ArgumentDefaultsHelpFormatter)
parser.add_argument(
"query",
type=Path,
Expand All @@ -236,34 +236,40 @@ def main():
)
# dbs are uniref, templates and environmental
# We normally don't use templates
parser.add_argument(
"--db1", type=Path, default=Path("uniref30_2302_db"), help="UniRef database"
)
parser.add_argument("--db2", type=Path, default=Path(""), help="Templates database")
parser.add_argument(
"--db3",
type=Path,
default=Path("colabfold_envdb_202108_db"),
help="Environmental database",
)
parser.add_argument("--db1", type=Path, default=Path("uniref30_2302_db"),
help="UniRef database")
parser.add_argument("--db2", type=Path, default=Path(""),
help="Templates database")
parser.add_argument("--db3", type=Path, default=Path("colabfold_envdb_202108_db"),
help="Environmental database")

# poor man's boolean arguments
parser.add_argument("--use-env", type=int, default=1, choices=[0, 1])
parser.add_argument("--use-templates", type=int, default=0, choices=[0, 1])
parser.add_argument("--filter", type=int, default=1, choices=[0, 1])
parser.add_argument(
"--mmseqs",
type=Path,
default=Path("mmseqs"),
help="Location of the mmseqs binary",
)
parser.add_argument("--expand-eval", type=float, default=math.inf)
parser.add_argument("--align-eval", type=int, default=10)
parser.add_argument("--diff", type=int, default=3000)
parser.add_argument("--qsc", type=float, default=-20.0)
parser.add_argument("--max-accept", type=int, default=1000000)
parser.add_argument("--pairing_strategy", type=int, default=0)
parser.add_argument("--db-load-mode", type=int, default=0)
parser.add_argument("--threads", type=int, default=64)
parser.add_argument("--use-env", type=int, default=1, choices=[0, 1],
help="Use --db3")
parser.add_argument("--use-templates", type=int, default=0, choices=[0, 1],
help="Use --db2")
parser.add_argument("--filter", type=int, default=1, choices=[0, 1],
help="Filter the MSA by pre-defined align_eval, qsc, max_accept")

# mmseqs params
parser.add_argument("--mmseqs", type=Path, default=Path("mmseqs"),
help="Location of the mmseqs binary.")
parser.add_argument("--expand-eval", type=float, default=math.inf,
help="e-val threshold for 'expandaln'.")
parser.add_argument("--align-eval", type=int, default=10,
help="e-val threshold for 'align'.")
parser.add_argument("--diff", type=int, default=3000,
help="filterresult - Keep at least this many seqs in each MSA block.")
parser.add_argument("--qsc", type=float, default=-20.0,
help="filterresult - reduce diversity of output MSAs using min score thresh.")
parser.add_argument("--max-accept", type=int, default=1000000,
help="align - Maximum accepted alignments before alignment calculation for a query is stopped.")
parser.add_argument("--pairing_strategy", type=int, default=0,
help="pairaln - Pairing strategy.")
parser.add_argument("--db-load-mode", type=int, default=0,
help="Database preload mode 0: auto, 1: fread, 2: mmap, 3: mmap+touch")
parser.add_argument("--threads", type=int, default=64,
help="Number of threads to use.")
args = parser.parse_args()

queries, is_complex = get_queries(args.query, None)
Expand Down

0 comments on commit 941feec

Please sign in to comment.