Skip to content

Commit

Permalink
Moved info messages to separate file in utils
Browse files Browse the repository at this point in the history
Updated `utils.info` and its calls accordingly
Added info for Filtering section
  • Loading branch information
npalacioescat committed Jun 20, 2024
1 parent 1323df4 commit d7d1f40
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 15 deletions.
1 change: 1 addition & 0 deletions src/funki/pages/clustering.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

from utils import serial_to_dataset
from utils import dataset_to_serial
from utils import info
from utils.style import tab_style
from utils.style import tab_selected_style
from utils.style import page_style
Expand Down
14 changes: 2 additions & 12 deletions src/funki/pages/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,7 @@
html.Div(
children=[
'Please upload your data file here:',
info(
'Please provide a table where rows are '
'observations (e.g. samples, cells...) and '
'columns are variables (e.g. genes, '
'proteins...)'
)
info('upload-data')
]
),
dcc.Upload(
Expand Down Expand Up @@ -100,12 +95,7 @@
html.Div(
children=[
'Please upload your annotation file here:',
info(
'Please provide a table where rows are '
'observations (e.g. samples, cells...) and '
'columns are annotation variables (e.g. sample '
'names, condition, cell type...)'
)
info('upload-obs')
]
),
dcc.Upload(
Expand Down
8 changes: 7 additions & 1 deletion src/funki/pages/norm.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

from utils import serial_to_dataset
from utils import dataset_to_serial
from utils import info
from utils.style import tab_style
from utils.style import tab_selected_style
from utils.style import page_style
Expand All @@ -27,7 +28,12 @@
html.Br(),
html.Div(
children=[
html.H3('Choose filters:'),
html.H3(
children=[
'Choose filters:',
info('filters')
]
),
'- Max. genes per cell: ',
dcc.Input(
id='max-genes',
Expand Down
19 changes: 19 additions & 0 deletions src/funki/utils/info_msg.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
msg = {
'upload-data': (
'Please provide a table where rows are observations (e.g. samples, '
'cells...) and columns are variables (e.g. genes, proteins...)'
),
'upload-obs': (
'Please provide a table where rows are observations (e.g. samples, '
'cells...) and columns are annotation variables (e.g. sample names, '
'condition, cell type...)'
),
'filters': ('Choosing proper filtering parameters is a highly context-'
'dependent task. Depending on the experimental set up, these '
'filters can vary a lot. A proper choice requires some '
'expertise and/or some trial and error. Therefore, feel free to '
'play with the parameters and observe the resulting '
'distribution of your data with the help of the plots below. A '
'good strategy is to start with lax thresholds and move up to '
'more astringent ones'),
}
5 changes: 3 additions & 2 deletions src/funki/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from dash import html

from funki.input import DataSet
from .info_msg import msg


def parse_contents(content, filename):
Expand Down Expand Up @@ -123,10 +124,10 @@ def parse_types(df):

return pd.DataFrame(result)

def info(msg):
def info(key):
return html.Abbr(
'\u2753',
title=msg,
title=msg[key] if key in msg.keys() else None,
style={
'text-decoration': 'none',
'font-size': 12,
Expand Down

0 comments on commit d7d1f40

Please sign in to comment.