Skip to content

Commit

Permalink
Updated commands to use limited integer ranges
Browse files Browse the repository at this point in the history
Signed-off-by: Timothy Click <tcthepoet@yahoo.com>
  • Loading branch information
Timothy Click authored and Timothy Click committed Nov 6, 2017
1 parent b1e649f commit 4bd611e
Show file tree
Hide file tree
Showing 11 changed files with 33 additions and 38 deletions.
2 changes: 1 addition & 1 deletion src/fluctmatch/commands/cmd_convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
"charmm_version",
metavar="VERSION",
default=41,
type=click.INT,
type=click.IntRange(27, None, clamp=True),
help="CHARMM version",
)
@click.option(
Expand Down
8 changes: 4 additions & 4 deletions src/fluctmatch/commands/cmd_diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@
"--ressep",
metavar="RESSEP",
default=3,
type=click.INT,
help="Separation between residues (I,I+n)"
type=click.IntRange(0, None, clamp=True),
help="Number of residues to exclude in I,I+r (default: 2)"
)
@click.argument(
"table1",
Expand Down Expand Up @@ -105,7 +105,7 @@ def cli(outdir, ressep, table1, table2):

filename = path.join(outdir, "dcoupling.txt")
with open(filename, mode="wb") as output:
print("Writing table differences to {}".format(filename))
click.echo("Writing table differences to {}".format(filename))
d_table = d_table.to_csv(
header=True,
index=True,
Expand All @@ -129,7 +129,7 @@ def cli(outdir, ressep, table1, table2):

filename = path.join(outdir, "dinteractions.txt")
with open(filename, mode="wb") as output:
print("Writing residue-residue differences to {}".format(filename))
click.echo("Writing residue-residue differences to {}".format(filename))
d_interactions = d_interactions.to_csv(
header=True,
index=True,
Expand Down
10 changes: 5 additions & 5 deletions src/fluctmatch/commands/cmd_framediff.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@
"--ressep",
metavar="RESSEP",
default=3,
type=click.INT,
help="Separation between residues (I,I+n)"
type=click.IntRange(0, None, clamp=True),
help="Number of residues to exclude in I,I+r (default: 2)"
)
@click.argument(
"table",
Expand Down Expand Up @@ -85,7 +85,7 @@ def cli(outdir, ressep, table):

filename = path.join(outdir, "dframe_coupling.txt")
with open(filename, mode="wb") as output:
print("Writing frame differences to {}".format(filename))
click.echo("Writing frame differences to {}".format(filename))
d_table = d_table.to_csv(
header=True,
index=True,
Expand All @@ -97,7 +97,7 @@ def cli(outdir, ressep, table):

filename = path.join(outdir, "dframe_perres.txt")
with open(filename, mode="wb") as output:
print("Writing per residue frame differences to {}".format(filename))
click.echo("Writing per residue frame differences to {}".format(filename))
d_perres = d_perres.to_csv(
header=True,
index=True,
Expand All @@ -109,7 +109,7 @@ def cli(outdir, ressep, table):

filename = path.join(outdir, "dframe_interactions.txt")
with open(filename, mode="wb") as output:
print(
click.echo(
"Writing residue-residue frame differences to {}".format(filename)
)
d_interactions = d_interactions.to_csv(
Expand Down
4 changes: 2 additions & 2 deletions src/fluctmatch/commands/cmd_normdiff.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@
"--ressep",
metavar="RESSEP",
default=3,
type=click.INT,
help="Separation between residues (I,I+n)"
type=click.IntRange(0, None, clamp=True),
help="Number of residues to exclude in I,I+r (default: 2)"
)
@click.argument(
"kb",
Expand Down
9 changes: 2 additions & 7 deletions src/fluctmatch/commands/cmd_sca.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,16 +73,11 @@
@click.option(
"-r",
"--ressep",
metavar="RESSEP",
default=2,
type=click.IntRange(0, None, clamp=True),
help="Number of residues to exclude in I,I+r (default: 2)"
)
@click.option(
"-s",
"--subset",
type=(native_str, click.IntRange(1, None, clamp=True), click.IntRange(1, None, clamp=True)),
multiple=True, help="Subset of a system (SEGID FIRST LAST)"
)
@click.option(
"-o",
"--output",
Expand All @@ -103,7 +98,7 @@
)
)
def calculate_scafluct(
ntrials, std, kpos, pcut, ressep, subset, output, filename
ntrials, std, kpos, pcut, ressep, output, filename
):
# Load the table, separate by I,I+r, and if requested, create a subset.
table = ParamTable(ressep=ressep)
Expand Down
8 changes: 4 additions & 4 deletions src/fluctmatch/commands/cmd_splittraj.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,31 +137,31 @@
"--system",
metavar="NDXNUM",
default=0,
type=click.INT,
type=click.IntRange(0, None, clamp=True),
help="System selection based upon Gromacs index file",
)
@click.option(
"-b",
"start",
metavar="FRAME",
default=1,
type=click.INT,
type=click.IntRange(1, None, clamp=True),
help="Start time of trajectory",
)
@click.option(
"-e",
"stop",
metavar="FRAME",
default=10000,
type=click.INT,
type=click.IntRange(1, None, clamp=True),
help="Stop time of total trajectory",
)
@click.option(
"-w",
"window_size",
metavar="WINSIZE",
default=10000,
type=click.INT,
type=click.IntRange(2, None, clamp=True),
help="Size of each subtrajectory",
)
def cli(
Expand Down
16 changes: 8 additions & 8 deletions src/fluctmatch/commands/cmd_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@
"--ressep",
metavar="RESSEP",
default=3,
type=click.INT,
help="Separation between residues (I,I+n)"
type=click.IntRange(0, None, clamp=True),
help="Number of residues to exclude in I,I+r (default: 2)"
)
@click.option(
"-t",
Expand Down Expand Up @@ -97,7 +97,7 @@ def cli(stats, hist, outdir, ressep, tbltype, table):
"_".join((tbltype.lower(), "table", "stats.txt"))
)
with open(filename, mode="wb") as stat_file:
print("Writing table statistics to {}".format(filename))
click.echo("Writing table statistics to {}".format(filename))
info = ps.table_stats().to_csv(
header=True,
index=True,
Expand All @@ -110,7 +110,7 @@ def cli(stats, hist, outdir, ressep, tbltype, table):
if tbltype == "Kb":
filename = path.join(outdir, "interaction_stats.txt")
with open(filename, mode="wb") as stat_file:
print(
click.echo(
"Writing residue-residue statistics to {}".format(filename)
)
ps._table._ressep = 0
Expand All @@ -125,7 +125,7 @@ def cli(stats, hist, outdir, ressep, tbltype, table):

filename = path.join(outdir, "residue_stats.txt")
with open(filename, mode="wb") as stat_file:
print(
click.echo(
"Writing individual residue statistics "
"to {}".format(filename)
)
Expand All @@ -145,7 +145,7 @@ def cli(stats, hist, outdir, ressep, tbltype, table):
"_".join((tbltype.lower(), "table", "hist.txt"))
)
with open(filename, mode="wb") as stat_file:
print("Writing table histogram to {}".format(filename))
click.echo("Writing table histogram to {}".format(filename))
info = ps.table_hist().to_csv(
index=True,
sep=native_str(" "),
Expand All @@ -157,7 +157,7 @@ def cli(stats, hist, outdir, ressep, tbltype, table):
if tbltype == "Kb":
filename = path.join(outdir, "interaction_hist.txt")
with open(filename, mode="wb") as stat_file:
print(
click.echo(
"Writing residue-residue histogram to {}".format(filename)
)
ps._table._ressep = 0
Expand All @@ -171,7 +171,7 @@ def cli(stats, hist, outdir, ressep, tbltype, table):

filename = path.join(outdir, "residue_hist.txt")
with open(filename, mode="wb") as stat_file:
print(
click.echo(
"Writing individual residue histogram "
"to {}".format(filename)
)
Expand Down
4 changes: 2 additions & 2 deletions src/fluctmatch/commands/cmd_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@
"--ressep",
metavar="RESSEP",
default=3,
type=click.INT,
help="Separation between residues (I,I+n)"
type=click.IntRange(0, None, clamp=True),
help="Number of residues to exclude in I,I+r (default: 2)"
)
@click.option(
"-v",
Expand Down
2 changes: 1 addition & 1 deletion src/fluctmatch/commands/cmd_thermo.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
"charmm_version",
metavar="VERSION",
default=41,
type=click.INT,
type=click.IntRange(27, None, clamp=True),
help="CHARMM version",
)
def cli(
Expand Down
6 changes: 3 additions & 3 deletions src/fluctmatch/commands/cmd_wordom.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,22 +66,22 @@
"start",
metavar="FRAME",
default=0,
type=click.INT,
type=click.IntRange(0, None, clamp=True),
help="Start time of trajectory",
)
@click.option(
"-e",
"stop",
metavar="FRAME",
type=click.INT,
type=click.IntRange(0, None, clamp=True),
help="Stop time of total trajectory",
)
@click.option(
"-dt",
"step",
metavar="STEP",
default=1,
type=click.INT,
type=click.IntRange(1, None, clamp=True),
help="Interval between frames"
)
@click.option(
Expand Down
2 changes: 1 addition & 1 deletion src/fluctmatch/commands/cmd_write_charmm.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
"charmm_version",
metavar="VERSION",
default=41,
type=click.INT,
type=click.IntRange(27, None, clamp=True),
help="CHARMM version",
)
@click.option(
Expand Down

0 comments on commit 4bd611e

Please sign in to comment.