Skip to content

Commit

Permalink
Added tutorials. Fixed single-species model loading in gradient scripts.
Browse files Browse the repository at this point in the history
  • Loading branch information
Johannes Linder committed Oct 4, 2024
1 parent 23e49dd commit 4621882
Show file tree
Hide file tree
Showing 58 changed files with 2,683 additions and 10 deletions.
14 changes: 12 additions & 2 deletions src/scripts/borzoi_satg_gene.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,13 @@ def main():
# load first model fold to get parameters

seqnn_model = seqnn.SeqNN(params_model)

model_path = model_folder + "/f" + str(options.folds[0]) + "c0/train/model" + str(options.head_i) + "_best.h5"
if not os.path.isfile(model_path) :
model_path = model_folder + "/f" + str(options.folds[0]) + "c0/train/model_best.h5"

seqnn_model.restore(
model_folder + "/f" + str(options.folds[0]) + "c0/train/model" + str(options.head_i) + "_best.h5",
model_path,
options.head_i
)
seqnn_model.build_slice(targets_df.index, False)
Expand Down Expand Up @@ -308,8 +313,13 @@ def main():

# load model fold
seqnn_model = seqnn.SeqNN(params_model)

model_path = model_folder + "/f" + str(fold_ix) + "c" + str(cross_ix) + "/train/model" + str(options.head_i) + "_best.h5"
if not os.path.isfile(model_path) :
model_path = model_folder + "/f" + str(fold_ix) + "c" + str(cross_ix) + "/train/model_best.h5"

seqnn_model.restore(
model_folder + "/f" + str(fold_ix) + "c" + str(cross_ix) + "/train/model" + str(options.head_i) + "_best.h5",
model_path,
options.head_i
)
seqnn_model.build_slice(targets_df.index, False)
Expand Down
14 changes: 12 additions & 2 deletions src/scripts/borzoi_satg_gene_crispr_ism_shuffle.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,13 @@ def main():
# load first model fold to get parameters

seqnn_model = seqnn.SeqNN(params_model)

model_path = model_folder + "/f" + str(options.folds[0]) + "c0/train/model" + str(options.head_i) + "_best.h5"
if not os.path.isfile(model_path) :
model_path = model_folder + "/f" + str(options.folds[0]) + "c0/train/model_best.h5"

seqnn_model.restore(
model_folder + "/f" + str(options.folds[0]) + "c0/train/model" + str(options.head_i) + "_best.h5",
model_path,
options.head_i
)
seqnn_model.build_slice(targets_df.index, False)
Expand Down Expand Up @@ -376,8 +381,13 @@ def main():

# load model fold
seqnn_model = seqnn.SeqNN(params_model)

model_path = model_folder + "/f" + str(fold_ix) + "c" + str(cross_ix) + "/train/model" + str(options.head_i) + "_best.h5"
if not os.path.isfile(model_path) :
model_path = model_folder + "/f" + str(fold_ix) + "c" + str(cross_ix) + "/train/model_best.h5"

seqnn_model.restore(
model_folder + "/f" + str(fold_ix) + "c" + str(cross_ix) + "/train/model" + str(options.head_i) + "_best.h5",
model_path,
options.head_i
)
seqnn_model.build_slice(targets_df.index, False)
Expand Down
14 changes: 12 additions & 2 deletions src/scripts/borzoi_satg_gene_focused_ism.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,13 @@ def main():
# load first model fold to get parameters

seqnn_model = seqnn.SeqNN(params_model)

model_path = model_folder + "/f" + str(options.folds[0]) + "c0/train/model" + str(options.head_i) + "_best.h5"
if not os.path.isfile(model_path) :
model_path = model_folder + "/f" + str(options.folds[0]) + "c0/train/model_best.h5"

seqnn_model.restore(
model_folder + "/f" + str(options.folds[0]) + "c0/train/model" + str(options.head_i) + "_best.h5",
model_path,
options.head_i
)
seqnn_model.build_slice(targets_df.index, False)
Expand Down Expand Up @@ -514,8 +519,13 @@ def main():

# load model fold
seqnn_model = seqnn.SeqNN(params_model)

model_path = model_folder + "/f" + str(fold_ix) + "c" + str(cross_ix) + "/train/model" + str(options.head_i) + "_best.h5"
if not os.path.isfile(model_path) :
model_path = model_folder + "/f" + str(fold_ix) + "c" + str(cross_ix) + "/train/model_best.h5"

seqnn_model.restore(
model_folder + "/f" + str(fold_ix) + "c" + str(cross_ix) + "/train/model" + str(options.head_i) + "_best.h5",
model_path,
options.head_i
)
seqnn_model.build_slice(targets_df.index, False)
Expand Down
14 changes: 12 additions & 2 deletions src/scripts/borzoi_satg_polya.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,13 @@ def main():
# load first model fold to get parameters

seqnn_model = seqnn.SeqNN(params_model)

model_path = model_folder + "/f" + str(options.folds[0]) + "c0/train/model" + str(options.head_i) + "_best.h5"
if not os.path.isfile(model_path) :
model_path = model_folder + "/f" + str(options.folds[0]) + "c0/train/model_best.h5"

seqnn_model.restore(
model_folder + "/f" + str(options.folds[0]) + "c0/train/model" + str(options.head_i) + "_best.h5",
model_path,
options.head_i
)
seqnn_model.build_slice(targets_df.index, False)
Expand Down Expand Up @@ -309,8 +314,13 @@ def main():

# load model fold
seqnn_model = seqnn.SeqNN(params_model)

model_path = model_folder + "/f" + str(fold_ix) + "c" + str(cross_ix) + "/train/model" + str(options.head_i) + "_best.h5"
if not os.path.isfile(model_path) :
model_path = model_folder + "/f" + str(fold_ix) + "c" + str(cross_ix) + "/train/model_best.h5"

seqnn_model.restore(
model_folder + "/f" + str(fold_ix) + "c" + str(cross_ix) + "/train/model" + str(options.head_i) + "_best.h5",
model_path,
options.head_i
)
seqnn_model.build_slice(targets_df.index, False)
Expand Down
14 changes: 12 additions & 2 deletions src/scripts/borzoi_satg_splice.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,13 @@ def main():
# load first model fold to get parameters

seqnn_model = seqnn.SeqNN(params_model)

model_path = model_folder + "/f" + str(options.folds[0]) + "c0/train/model" + str(options.head_i) + "_best.h5"
if not os.path.isfile(model_path) :
model_path = model_folder + "/f" + str(options.folds[0]) + "c0/train/model_best.h5"

seqnn_model.restore(
model_folder + "/f" + str(options.folds[0]) + "c0/train/model" + str(options.head_i) + "_best.h5",
model_path,
options.head_i
)
seqnn_model.build_slice(targets_df.index, False)
Expand Down Expand Up @@ -281,8 +286,13 @@ def main():

# load model fold
seqnn_model = seqnn.SeqNN(params_model)

model_path = model_folder + "/f" + str(fold_ix) + "c" + str(cross_ix) + "/train/model" + str(options.head_i) + "_best.h5"
if not os.path.isfile(model_path) :
model_path = model_folder + "/f" + str(fold_ix) + "c" + str(cross_ix) + "/train/model_best.h5"

seqnn_model.restore(
model_folder + "/f" + str(fold_ix) + "c" + str(cross_ix) + "/train/model" + str(options.head_i) + "_best.h5",
model_path,
options.head_i
)
seqnn_model.build_slice(targets_df.index, False)
Expand Down
Loading

0 comments on commit 4621882

Please sign in to comment.