Skip to content

Commit

Permalink
fix lack of dimensions passing to workflow bug
Browse files Browse the repository at this point in the history
  • Loading branch information
JatGreer committed Apr 10, 2024
1 parent b5fa8c2 commit 990e66d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 43 deletions.
31 changes: 9 additions & 22 deletions src/roodmus/heterogeneity/het_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,16 +261,6 @@ def add_arguments(parser: argparse.ArgumentParser):
default=[2],
)

parser.add_argument(
"--variance_coverage",
help="Used in the same way as the --dimensions argument, here"
" dimensions are reduced based on the variance of the dataset"
" which is explained (whenever possible)",
nargs="+",
type=float,
default=[None],
)

# clustering alg
parser.add_argument(
"--cluster_alg",
Expand Down Expand Up @@ -691,6 +681,14 @@ def determine_workflow_permutations(
"cluster_alg",
"clusters",
]
if verbose:
print("alignment: {}".format(alignment))
print("dimension_reduction: {}".format(dimension_reduction))
print("dimensions: {}".format(dimensions))
print("distance_metric: {}".format(distance_metric))
print("cluster_alg: {}".format(cluster_alg))
print("clusters: {}".format(clusters))

workflows = []
for al in alignment:
for dr in dimension_reduction:
Expand Down Expand Up @@ -1594,17 +1592,6 @@ def pilot_study(args):
embedding: 2D pca sklearn
clustering: k-means sklearn
"""

# can only use one of dimsions or variance_coverage
# ensure by default that dimensions is used
if (args.dimensions != [None]) and (args.variance_coverage != [None]):
raise ValueError(
"Must use only one of --dimensions or --variance_coverage"
)
dimensions = args.dimensions
if args.variance_coverage is not [None]:
dimensions = args.variance_coverage

# using mdtraj to compute RMSD clustering of traj
# and subsequently pairwise distance clustering of traj???
# load traj
Expand All @@ -1625,7 +1612,7 @@ def pilot_study(args):
alignment=args.alignment,
distance_metric=args.distance_metric,
dimension_reduction=args.dimension_reduction,
dimensions=dimensions,
dimensions=args.dimensions,
cluster_alg=args.cluster_alg,
clusters=args.n_clusters,
overwrite=args.overwrite,
Expand Down
22 changes: 1 addition & 21 deletions src/roodmus/heterogeneity/latent_clustering.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,16 +163,6 @@ def add_arguments(parser: argparse.ArgumentParser):
default=[2],
)

parser.add_argument(
"--variance_coverage",
help="Used in the same way as the --dimensions argument, here"
" dimensions are reduced based on the variance of the dataset"
" which is explained (whenever possible)",
nargs="+",
type=float,
default=[None],
)

# clustering alg
parser.add_argument(
"--cluster_alg",
Expand Down Expand Up @@ -891,16 +881,6 @@ def run_cluster_alg(self, cluster_alg, distance_matrix, n_clusters):


def pilot_study_latent(args):
# can only use one of dimsions or variance_coverage
# ensure by default that dimensions is used
if (args.dimensions != [None]) and (args.variance_coverage != [None]):
raise ValueError(
"Must use only one of --dimensions or --variance_coverage"
)
dimensions = args.dimensions
if args.variance_coverage is not [None]:
dimensions = args.variance_coverage

# init latentClustering
# determine_workflow_permutations is called
# determine_workflow_pkl_locations is also called
Expand All @@ -910,7 +890,7 @@ def pilot_study_latent(args):
results_dir=args.output_dir,
workflows_filename=args.workflows_filename,
dimension_reduction=args.dimension_reduction,
dimensions=dimensions,
dimensions=args.dimensions,
cluster_alg=args.cluster_alg,
clusters=args.n_clusters,
overwrite=args.overwrite,
Expand Down

0 comments on commit 990e66d

Please sign in to comment.