Skip to content

Commit

Permalink
add option to disable marker discovery
Browse files Browse the repository at this point in the history
  • Loading branch information
borauyar committed Jun 11, 2024
1 parent 622f15c commit c3d3f0b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
18 changes: 11 additions & 7 deletions flexynesis/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ def main():
parser.add_argument("--threads", help="(Optional) How many threads to use when using CPU (default is 4)", type=int, default = 4)
parser.add_argument("--use_gpu", action="store_true",
help="(Optional) If set, the system will attempt to use CUDA/GPU if available.")
parser.add_argument("--disable_marker_finding", action="store_true",
help="(Optional) If set, marker discovery after model training is disabled.")
# DirectPredGCNN args.
parser.add_argument("--graph", help="Graph to use, name of the database or path to the edge list on the disk.", type=str, default="STRING")
parser.add_argument("--string_organism", help="STRING DB organism id.", type=int, default=9606)
Expand Down Expand Up @@ -255,13 +257,15 @@ class AvailableModels(NamedTuple):
flexynesis.get_predicted_labels(model.predict(test_dataset), test_dataset, 'test')],
ignore_index=True)
predicted_labels.to_csv(os.path.join(args.outdir, '.'.join([args.prefix, 'predicted_labels.csv'])), header=True, index=False)
# compute feature importance values
print("[INFO] Computing variable importance scores")
for var in model.target_variables:
model.compute_feature_importance(train_dataset, var, steps = 50)
df_imp = pd.concat([model.feature_importances[x] for x in model.target_variables],
ignore_index = True)
df_imp.to_csv(os.path.join(args.outdir, '.'.join([args.prefix, 'feature_importance.csv'])), header=True, index=False)

if not args.disable_marker_finding: # unless marker discovery is disabled
# compute feature importance values
print("[INFO] Computing variable importance scores")
for var in model.target_variables:
model.compute_feature_importance(train_dataset, var, steps = 50)
df_imp = pd.concat([model.feature_importances[x] for x in model.target_variables],
ignore_index = True)
df_imp.to_csv(os.path.join(args.outdir, '.'.join([args.prefix, 'feature_importance.csv'])), header=True, index=False)

# get sample embeddings and save
print("[INFO] Extracting sample embeddings")
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "flexynesis"
version = "0.1.4"
version = "0.1.6"
authors = [
{name = "Bora Uyar", email = "[email protected]"},
{name = "Taras Savchyn", email = "[email protected]"},
Expand Down

0 comments on commit c3d3f0b

Please sign in to comment.