Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add ignore zero anchor parameter for skip no matches in batch search #598

Merged
merged 1 commit into from
Sep 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion jcvi/compara/catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -666,6 +666,12 @@ def ortholog(args):
dotplot_group.add_option(
"--no_dotplot", default=False, action="store_true", help="Do not make dotplot"
)
p.add_option(
"--ignore_zero_anchor",
default=False,
action="store_true",
help="Ignore this pair of ortholog identification instead of throwing an error when performing many pairs of cataloging."
)

opts, args = p.parse_args(args)

Expand All @@ -674,6 +680,7 @@ def ortholog(args):

a, b = args
dbtype = opts.dbtype
ignore_zero_anchor = opts.ignore_zero_anchor
suffix = ".cds" if dbtype == "nucl" else ".pep"
abed, afasta = a + ".bed", a + suffix
bbed, bfasta = b + ".bed", b + suffix
Expand Down Expand Up @@ -727,7 +734,15 @@ def ortholog(args):
dargs += ["--no_strip_names"]
if opts.liftover_dist:
dargs += ["--liftover_dist={}".format(opts.liftover_dist)]
scan(dargs)
try:
scan(dargs)
except ValueError as e:
if ignore_zero_anchor:
logging.debug(f"{e}")
logging.debug("Ignoring this error and continuing...")
return
else:
raise ValueError(e)
if quota:
quota_main([lifted_anchors, "--quota={0}".format(quota), "--screen"])
if need_update(anchors, pdf, warn=True) and not opts.no_dotplot:
Expand Down