diff --git a/.github/workflows/build-docker-images.yml b/.github/workflows/build-docker-images.yml index d13b6446..ec1ceb3d 100644 --- a/.github/workflows/build-docker-images.yml +++ b/.github/workflows/build-docker-images.yml @@ -13,6 +13,6 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - name: Build the full Docker image - run: docker build . --file Dockerfile --tag streamlitapp:latest \ No newline at end of file + - uses: actions/checkout@v3 + - name: Build the full Docker image + run: docker build --file Dockerfile --tag streamlitapp:latest --output type=tar,dest=/dev/null . \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index cacfca71..7bea3162 100644 --- a/Dockerfile +++ b/Dockerfile @@ -81,7 +81,7 @@ SHELL ["mamba", "run", "-n", "streamlit-env", "/bin/bash", "-c"] # Install up-to-date cmake via mamba and packages for pyOpenMS build. RUN mamba install cmake -RUN pip install --upgrade pip && python -m pip install -U setuptools nose Cython autowrap pandas 'numpy==1.26.4' pytest +RUN pip install --upgrade pip && python -m pip install -U setuptools nose 'Cython<3.1' autowrap pandas 'numpy==1.26.4' pytest # Clone OpenMS branch and the associcated contrib+thirdparties+pyOpenMS-doc submodules. RUN git clone --recursive --depth=1 -b ${OPENMS_BRANCH} --single-branch ${OPENMS_REPO} && cd /OpenMS diff --git a/content/FLASHTnT/FLASHTnTLayoutManager.py b/content/FLASHTnT/FLASHTnTLayoutManager.py index 9ad67e68..b951584d 100644 --- a/content/FLASHTnT/FLASHTnTLayoutManager.py +++ b/content/FLASHTnT/FLASHTnTLayoutManager.py @@ -12,6 +12,9 @@ 'Internal fragment map (Protein table needed)', 'Tag table (Protein table needed)', 'Sequence tag view (Tag table needed)', + 'Score Distribution Plot', + 'MS1 raw heatmap', + 'MS1 deconvolved heatmap' ] COMPONENT_NAMES=[ @@ -19,7 +22,10 @@ 'sequence_view', 'internal_fragment_map', 'tag_table', - 'combined_spectrum' + 'combined_spectrum', + 'id_fdr_plot', + 'ms1_raw_heatmap', + 'ms1_deconv_heat_map' ] # Setup cache access diff --git a/src/parse/tnt.py b/src/parse/tnt.py index 56259c87..6d2af9d9 100644 --- a/src/parse/tnt.py +++ b/src/parse/tnt.py @@ -5,6 +5,7 @@ from io import StringIO from pyopenms import AASequence +from scipy.stats import gaussian_kde from src.parse.masstable import parseFLASHDeconvOutput, parseFLASHTaggerOutput from src.render.sequence import ( @@ -157,4 +158,31 @@ def parseTnT(file_manager, dataset_id, deconv_mzML, anno_mzML, tag_tsv, protein_ } file_manager.store_data( dataset_id, 'settings', settings - ) \ No newline at end of file + ) + + density_target, density_decoy = fdr_density_distribution(protein_df, logger=logger) + file_manager.store_data(dataset_id, 'density_id_target', density_target) + file_manager.store_data(dataset_id, 'density_id_decoy', density_decoy) + + +def fdr_density_distribution(df, logger=None): + df = df[df['ProteoformLevelQvalue'] > 0] + # Find density targets + target_qscores = df[~df['accession'].str.startswith('DECOY_')]['ProteoformLevelQvalue'].dropna() + if len(target_qscores) > 0: + x_target = np.linspace(target_qscores.min(), target_qscores.max(), 200) + kde_target = gaussian_kde(target_qscores) + density_target = pd.DataFrame({'x': x_target, 'y': kde_target(x_target)}) + else: + density_target = pd.DataFrame(columns=['x', 'y']) + + # Find density decoys (if present) + decoy_qscores = df[df['accession'].str.startswith('DECOY_')]['ProteoformLevelQvalue'].dropna() + if len(decoy_qscores) > 0: + x_decoy = np.linspace(decoy_qscores.min(), decoy_qscores.max(), 200) + kde_decoy = gaussian_kde(decoy_qscores) + density_decoy = pd.DataFrame({'x': x_decoy, 'y': kde_decoy(x_decoy)}) + else: + density_decoy = pd.DataFrame(columns=['x', 'y']) + + return density_target, density_decoy \ No newline at end of file diff --git a/src/render/initialize.py b/src/render/initialize.py index c02411c1..60cc75bc 100644 --- a/src/render/initialize.py +++ b/src/render/initialize.py @@ -104,6 +104,12 @@ def initialize_data(comp_name, selected_data, file_manager, tool): data = file_manager.get_results(selected_data, ['density_decoy']) data_to_send['density_decoy'] = data['density_decoy'] component_arguments = FDRPlotly(title="FDR Plot") + elif comp_name == 'id_fdr_plot': + data = file_manager.get_results(selected_data, ['density_id_target']) + data_to_send['density_target'] = data['density_id_target'] + data = file_manager.get_results(selected_data, ['density_id_decoy']) + data_to_send['density_decoy'] = data['density_id_decoy'] + component_arguments = FDRPlotly(title="FDR Plot") elif comp_name == 'protein_table': # TODO: Unify lookup or remove in vue data = file_manager.get_results(selected_data, ['scan_table'])