Skip to content

Commit

Permalink
Changed: Changed some key_suffix parsing templates.
Browse files Browse the repository at this point in the history
  • Loading branch information
AAnzel committed Jan 11, 2022
1 parent 61bac1c commit aa111e3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
4 changes: 4 additions & 0 deletions Source/case_study.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ def case_study_genomics():

folder_path_or_df, data_set_type = upload_intro(
cache_folder_path, key_suffix)
key_suffix += '_CASE_STUDY'

return common.work_with_zip(
folder_path_or_df, data_set_type, cache_folder_path, key_suffix)
Expand All @@ -156,6 +157,7 @@ def case_study_metabolomics():

folder_path_or_df, data_set_type = upload_intro(
cache_folder_path, key_suffix)
key_suffix += '_CASE_STUDY'

return common.work_with_csv(
folder_path_or_df, cache_folder_path, key_suffix)
Expand All @@ -167,6 +169,7 @@ def case_study_transcriptomics():

folder_path_or_df, data_set_type = upload_intro(
cache_folder_path, key_suffix)
key_suffix += '_CASE_STUDY'

return common.work_with_zip(
folder_path_or_df, data_set_type, cache_folder_path, key_suffix)
Expand All @@ -178,6 +181,7 @@ def case_study_phy_che():

folder_path_or_df, data_set_type = upload_intro(
cache_folder_path, key_suffix)
key_suffix += '_CASE_STUDY'

return common.work_with_csv(
folder_path_or_df, cache_folder_path, key_suffix)
Expand Down
22 changes: 13 additions & 9 deletions Source/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -1543,7 +1543,7 @@ def work_with_data_set(df, data_set_type, folder_path, recache, key_suffix):
df[i[0]] = i[1]
chosen_charts += visualize_data_set(
df, temporal_feature, feature_list,
'Cluster_FASTA_' + key_suffix + '_' + i[0])
'Cluster_FASTA_' + i[0] + '_' + key_suffix)

elif data_set_type == 'KEGG':
KEGG_DATA_SET_NAME = 'kegg.pkl'
Expand All @@ -1569,7 +1569,7 @@ def work_with_data_set(df, data_set_type, folder_path, recache, key_suffix):
df[i[0]] = i[1]
chosen_charts += visualize_data_set(
df, temporal_feature, feature_list,
'Cluster_KEGG_' + key_suffix + '_' + i[0])
'Cluster_KEGG_' + i[0] + '_' + key_suffix)

elif data_set_type == 'BINS':
BINS_DATA_SET_NAME = 'bins.pkl'
Expand Down Expand Up @@ -1714,6 +1714,10 @@ def visualize_data_set(df, temporal_feature, feature_list, key_suffix):
'Whisker plot'],
key='vis_data_' + key_suffix)
else:
# TODO: Put preselected values for use case scenario
# We can differentiate use case scenario by checking whether the
# key_suffix ends with CASE_STUDY. This keywords is preceeded by the
# omic name, which can also be used to differentiate omics
visualizations = st.multiselect(
'Choose your visualization:',
options=['Feature through time', 'Two features plot',
Expand All @@ -1731,27 +1735,27 @@ def visualize_data_set(df, temporal_feature, feature_list, key_suffix):
chosen_charts.append(
(visualize.visualize_clusters(df, temporal_feature,
feature_list, 'PCA'),
i + '_' + key_suffix + '_PCA'))
i + '_PCA_' + key_suffix))

elif i == 'MDS visualization':
chosen_charts.append(
(visualize.visualize_clusters(df, temporal_feature,
feature_list, 'MDS'),
i + '_' + key_suffix + '_MDS'))
i + '_MDS_' + key_suffix))

elif i == 't-SNE visualization':
chosen_charts.append(
(visualize.visualize_clusters(df, temporal_feature,
feature_list, 't-SNE'),
i + '_' + key_suffix + '_t-SNE'))
i + '_t-SNE_' + key_suffix))

elif i == 'Feature through time' and temporal_feature is not None:
selected_features = st.multiselect(
i + ': select features to visualize', options=feature_list)

encode_feature_color = st.checkbox(
'Encode one nominal feature with color?',
key=i + '_' + key_suffix + 'color checkbox')
key=i + '_color checkbox_' + key_suffix)

if encode_feature_color:
color_feature_list = [feature for feature in feature_list
Expand All @@ -1776,13 +1780,13 @@ def visualize_data_set(df, temporal_feature, feature_list, key_suffix):
feature_2 = None

feature_1 = st.selectbox(i + ': select 1. feature', feature_list,
key=i + '_' + key_suffix + '1. feature')
key=i + '_1. feature_' + key_suffix)

new_feature_list = [i for i in feature_list if i != feature_1]

feature_2 = st.selectbox(
i + ': select 2. feature', new_feature_list,
key=i + '_' + key_suffix + '2. feature')
key=i + '_2. feature_' + key_suffix)

if feature_1 is not None and feature_2 is not None:
chosen_charts.append(
Expand Down Expand Up @@ -1840,7 +1844,7 @@ def visualize_data_set(df, temporal_feature, feature_list, key_suffix):

target_feature = st.selectbox(
i + ': select color feature', feature_list,
key=i + '_' + key_suffix + 'target_feature')
key=i + '_target_feature_' + key_suffix)

if target_feature is not None:
chosen_charts.append((
Expand Down

0 comments on commit aa111e3

Please sign in to comment.