Skip to content

Commit a61d8e6

Browse files
authored
Merge pull request #3 from ICR-RSE-Group/fix_issue_2
update script paths following the latest repo re-structuring
2 parents fb20d74 + 3304091 commit a61d8e6

File tree

2 files changed

+34
-21
lines changed

2 files changed

+34
-21
lines changed

pages/run_pipeline.py

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,26 @@
2222
MY_SSH = ss.ss_get("MY_SSH")
2323
username = ss.ss_get("user_name")
2424

25-
# Algorithm and project selection --> we should rename
26-
pipelines = ["nf-human-variation"] # , "nf-somatic-variation", "rnaseq"]
27-
projects = ["nf-long-reads"] # , "nf-tp53"]
28-
29-
selected_pipeline = st.selectbox("Select a pipeline", pipelines)
30-
selected_project = st.selectbox("Select your project", projects)
25+
pipelines = ["epi2me-human-variation", "epi2me-somatic-variation", "nfcore-rnaseq"]
26+
projects = ["nf-long-reads", "nf-tp53", "mopopgen-support"]
27+
samples = ["all", "demo"] # , "customised"]
28+
29+
map_pipeline_project = {
30+
"epi2me-human-variation": ["nf-long-reads"],
31+
"epi2me-somatic-variation": ["nf-tp53"],
32+
"nfcore-rnaseq": ["mopopgen-support"],
33+
}
34+
selected_project = None
35+
selected_samples = None
36+
# adding "select" as the first and default choice
37+
selected_pipeline = st.selectbox("Select a pipeline", options=["select"] + list(map_pipeline_project.keys()))
38+
# display selectbox 2 if selected_pipeline is not "select"
39+
if selected_pipeline != "select":
40+
selected_project = st.selectbox("Select your project", options=map_pipeline_project[selected_pipeline])
41+
selected_samples = st.selectbox("Select your samples", samples)
3142

3243
# passing inputs between tabs
3344
if LOGIN_OK:
34-
tt.tab(username, MY_SSH, selected_pipeline, selected_project)
45+
tt.tab(username, MY_SSH, selected_pipeline, selected_project, selected_samples)
3546
else:
3647
st.write("#### To use run nextflow on Alma, please log in first")

tabs/tab_command.py

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,25 +25,25 @@ def new_write(string):
2525
st.error(str(e))
2626

2727

28-
def get_path_to_script(selected_pipeline, selected_project):
28+
def get_path_to_script(selected_pipeline, selected_project, selected="all"):
2929
NX_shared_path = "/data/scratch/shared/RSE/NF-project-configurations/"
30-
# e.g., /data/scratch/shared/RSE/NF-project-configurations/nf-long-reads/scripts
31-
path = NX_shared_path + selected_project + "/scripts/"
32-
# TODO: we need to rename all scripts and follow the same naming pattern to remove this extra complexity
33-
if selected_project == "nf-long-reads":
34-
path = path + "epi2me-samples.sh"
35-
elif selected_project == "nf-tp53":
36-
path = path + "tp53-samples.sh"
30+
# e.g., /data/scratch/shared/RSE/NF-project-configurations/epi2me-human-variation/nf-long-reads/scripts
31+
path = NX_shared_path + selected_pipeline + "/" + selected_project + "/scripts/"
32+
if selected == "all":
33+
path = path + "launch_samples.sh"
34+
elif selected == "demo":
35+
path = path + "launch_demo.sh"
3736
else:
38-
print("selected project is not supported yet")
37+
path = path + "launch_sample_analysis.sh"
38+
raise Exception("No support for sample runs on customised entries")
3939
return path
4040

4141

4242
# launch command based on the project
43-
def pipe_cmd(username, selected_pipeline=None, selected_project=None, cmd_num=0):
43+
def pipe_cmd(username, selected_pipeline=None, selected_project=None, cmd_num=0, selected_samples="all"):
4444
if cmd_num == 0:
45-
path_to_script = get_path_to_script(selected_pipeline, selected_project)
46-
cmd_pipeline = f"sbatch {path_to_script} {username} "
45+
path_to_script = get_path_to_script(selected_pipeline, selected_project, selected_samples)
46+
cmd_pipeline = f"sbatch {path_to_script}"
4747
return cmd_pipeline
4848
elif cmd_num == 1:
4949
cmd_pipeline = f"squeue -u {username}"
@@ -56,7 +56,7 @@ def pipe_cmd(username, selected_pipeline=None, selected_project=None, cmd_num=0)
5656
return cmd_pipeline
5757

5858

59-
def tab(username, MY_SSH, selected_pipeline, selected_project):
59+
def tab(username, MY_SSH, selected_pipeline, selected_project, selected_samples="all"):
6060
cols = st.columns([1, 1, 1])
6161
with cols[0]:
6262
username = st.text_input(
@@ -67,7 +67,9 @@ def tab(username, MY_SSH, selected_pipeline, selected_project):
6767
)
6868

6969
def run_nextflow(): # username, MY_SSH, selected_pipeline, selected_project):
70-
cmd_pipeline = pipe_cmd(username, selected_pipeline, selected_project, cmd_num=0) # develop this
70+
cmd_pipeline = pipe_cmd(
71+
username, selected_pipeline, selected_project, cmd_num=0, selected_samples="all"
72+
) # develop this
7173
st.write("Command used:")
7274
st.code(cmd_pipeline)
7375
out_str, err_str = MY_SSH.run_cmd(cmd_pipeline, string=True)

0 commit comments

Comments
 (0)