Skip to content

Commit

Permalink
Revert "Adaptations for SDRF file creation from MetabolLights studies…
Browse files Browse the repository at this point in the history
… mentioned in bigbio/proteomics-sample-metadata#678"

This reverts commit da0bd61.
  • Loading branch information
nilshoffmann committed Jan 30, 2024
1 parent 6d0cba1 commit c616dd3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
13 changes: 5 additions & 8 deletions Home.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@
from PIL import Image
import base64
import io

max_samples = 350

st.set_page_config(
page_title="lesSDRF",
layout="wide",
Expand Down Expand Up @@ -108,12 +105,12 @@ def load_data():
Upload your intermediate SDRF file here:""")

upload_df = st.file_uploader(
"Upload intermediate SDRF file", type=["tsv"], accept_multiple_files=False, help=f'Upload a previously saved SDRF file. It should be in tsv format and should not contain more than {max_samples} samples'
"Upload intermediate SDRF file", type=["tsv"], accept_multiple_files=False, help='Upload a previously saved SDRF file. It should be in tsv format and should not contain more than 250 samples'
)
if upload_df is not None:
template_df = pd.read_csv(upload_df, sep='\t')
if template_df.shape[0]>max_samples:
st.error(f'Too many samples, please upload a maximum of {max_samples}')
if template_df.shape[0]>250:
st.error('Too many samples, please upload a maximum of 250 samples')
else:
st.write(template_df)
st.session_state["template_df"] = template_df
Expand Down Expand Up @@ -153,8 +150,8 @@ def load_data():
#remove trailing and leading spaces
uploaded_names = [name.strip() for name in uploaded_names]
filenames.append(uploaded_names)
if len(filenames[0]) > max_samples:
st.error(f'Too many samples, please upload a maximum of {max_samples} samples')
if len(filenames[0]) > 250:
st.error('Too many samples, please upload a maximum of 250 samples')
else:
st.write(f"Added filenames: {filenames[0]}")
## Store filenames in the dataframe
Expand Down
6 changes: 2 additions & 4 deletions pages/1_1. Mapping_local_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def get_base64_image(image):
"""If you have a local metadata file available, you can use this file to map the data to the required SDRF information. """
)
st.markdown(
"""**Important:** you can upload the file in csv, tsv, txt (tab-separated), or xlsx format.
"""**Important:** you can upload the file in csv, tsv or xlsx format.
The order of your raw file names should match the order in which you inputted them in the previous step"""
)

Expand All @@ -77,16 +77,14 @@ def get_base64_image(image):
*The experimental metadata has been generated using lesSDRF and is available through ProteomeXchange with the dataset identifier [PXDxxxxxxx]*""")
# Ask the user to upload their own metadata file and to map it to the columns of the template file
metadata_sheet = st.file_uploader(
"Upload your local metadata file (.csv, .tsv, .txt (tab-separated), or .xls)", type=["csv", "tsv", "txt", "xlsx"]
"Upload your local metadata file (.csv, .tsv or .xls)", type=["csv", "tsv", "xlsx"]
)
if metadata_sheet is not None:
file_extension = metadata_sheet.name.split(".")[-1]
if file_extension == "csv":
metadata_df = pd.read_csv(metadata_sheet)
elif file_extension == "tsv":
metadata_df = pd.read_csv(metadata_sheet, sep="\t")
elif file_extension == "txt":
metadata_df = pd.read_csv(metadata_sheet, sep="\t")
elif file_extension == "xlsx":
metadata_df = pd.read_excel(metadata_sheet)
st.write("Your metadata file:")
Expand Down

0 comments on commit c616dd3

Please sign in to comment.