Skip to content

Commit

Permalink
Merge pull request #6 from MannLabs/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
ammarcsj authored Mar 1, 2023
2 parents 3cc02f7 + 082a42f commit 8855bf9
Show file tree
Hide file tree
Showing 20 changed files with 140 additions and 146 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/publish_and_release.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
on:
# push:
# branches: [ main ]
push:
branches: [ main ]
workflow_dispatch:


Expand Down
15 changes: 11 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ You can process DIA and DDA data analyzed by [AlphaPept](https://github.com/Mann
- [About](#about)
- [Installation](#installation)
- [One-click GUI](#one-click-gui)
- [Pip](#pip)
- [Developer](#developer)
- [Running directLFQ](#running-directlfq)
- [GUI](#gui)
Expand Down Expand Up @@ -67,16 +68,22 @@ The GUI of directlfq is a completely stand-alone tool that requires no knowledge

Older releases remain available on the [release page](https://github.com/MannLabs/directlfq/releases), but no backwards compatibility is guaranteed.

<!---
-
### Pip

directlfq can be installed in an existing Python 3.8 environment with a single `bash` command. *This `bash` command can also be run directly from within a Jupyter notebook by prepending it with a `!`*:
directLFQ can be installed in an existing Python 3.8 environment with a single `bash` command.

```bash
pip install directlfq
```

Installing directlfq like this avoids conflicts when integrating it in other tools, as this does not enforce strict versioning of dependencies. However, if new versions of dependencies are released, they are not guaranteed to be fully compatible with directlfq. While this should only occur in rare cases where dependencies are not backwards compatible, you can always force directlfq to use dependancy versions which are known to be compatible with:
This installs the core directLFQ without graphical user interface (GUI). If you want to install with additional dependencies for GUI support, you can do this with:

```bash
pip install "directlfq[gui]"
```

For installation with stable dependencies, use:

```bash
pip install "directlfq[stable]"
Expand All @@ -89,7 +96,7 @@ For those who are really adventurous, it is also possible to directly install an
```bash
pip install "git+https://github.com/MannLabs/directlfq.git@development#egg=directlfq[stable,development-stable]"
```
-->

### Developer

directlfq can also be installed in editable (i.e. developer) mode with a few `bash` commands. This allows to fully customize the software and even modify the source code to your specific needs. When an editable Python package is installed, its source code is stored in a transparent location of your choice. While optional, it is advised to first (create and) navigate to e.g. a general software folder:
Expand Down
2 changes: 1 addition & 1 deletion directlfq/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


__project__ = "directlfq"
__version__ = "0.2.7"
__version__ = "0.2.8"
__license__ = "Apache"
__description__ = "An open-source Python package of the AlphaPept ecosystem"
__author__ = "Mann Labs"
Expand Down
9 changes: 5 additions & 4 deletions directlfq/_modidx.py
Original file line number Diff line number Diff line change
Expand Up @@ -642,9 +642,6 @@
'directlfq/utils.py'),
'directlfq.utils.parse_channel_from_peptide_column': ( 'utils.html#parse_channel_from_peptide_column',
'directlfq/utils.py'),
'directlfq.utils.plot_relative_to_median_fcs': ( 'utils.html#plot_relative_to_median_fcs',
'directlfq/utils.py'),
'directlfq.utils.plot_withincond_fcs': ('utils.html#plot_withincond_fcs', 'directlfq/utils.py'),
'directlfq.utils.prepare_loaded_tables': ('utils.html#prepare_loaded_tables', 'directlfq/utils.py'),
'directlfq.utils.process_with_dask': ('utils.html#process_with_dask', 'directlfq/utils.py'),
'directlfq.utils.reformat_and_save_input_file': ( 'utils.html#reformat_and_save_input_file',
Expand Down Expand Up @@ -726,4 +723,8 @@
'directlfq.visualizations.MultiOrganismMultiMethodBoxPlot._add_expected_fold_changes': ( 'visualizations.html#multiorganismmultimethodboxplot._add_expected_fold_changes',
'directlfq/visualizations.py'),
'directlfq.visualizations.MultiOrganismMultiMethodBoxPlot.plot_boxplot': ( 'visualizations.html#multiorganismmultimethodboxplot.plot_boxplot',
'directlfq/visualizations.py')}}}
'directlfq/visualizations.py'),
'directlfq.visualizations.plot_relative_to_median_fcs': ( 'visualizations.html#plot_relative_to_median_fcs',
'directlfq/visualizations.py'),
'directlfq.visualizations.plot_withincond_fcs': ( 'visualizations.html#plot_withincond_fcs',
'directlfq/visualizations.py')}}}
43 changes: 1 addition & 42 deletions directlfq/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
'get_original_file_from_aq_reformat', 'import_config_dict', 'load_samplemap', 'prepare_loaded_tables',
'LongTableReformater', 'AcquisitionTableHandler', 'AcquisitionTableInfo', 'AcquisitionTableHeaders',
'AcquisitionTableOutputPaths', 'AcquisitionTableReformater', 'AcquisitionTableHeaderFilter',
'merge_acquisition_df_parameter_df', 'plot_withincond_fcs', 'plot_relative_to_median_fcs']
'merge_acquisition_df_parameter_df']

# %% ../nbdev_nbs/04_utils.ipynb 2
import os
Expand Down Expand Up @@ -1190,44 +1190,3 @@ def merge_acquisition_df_parameter_df(acquisition_df, parameter_df, groupby_merg
merged_df = merged_df.groupby('ion').max().reset_index()
merged_df = merged_df.dropna(axis=1, how='all')
return merged_df

# %% ../nbdev_nbs/04_utils.ipynb 54
import matplotlib.pyplot as plt
import itertools

def plot_withincond_fcs(normed_intensity_df, cut_extremes = True):
"""takes a normalized intensity dataframe and plots the fold change distribution between all samples. Column = sample, row = ion"""

samplecombs = list(itertools.combinations(normed_intensity_df.columns, 2))

for spair in samplecombs:#compare all pairs of samples
s1 = spair[0]
s2 = spair[1]
diff_fcs = normed_intensity_df[s1].to_numpy() - normed_intensity_df[s2].to_numpy() #calculate fold changes by subtracting log2 intensities of both samples

if cut_extremes:
cutoff = max(abs(np.nanquantile(diff_fcs,0.025)), abs(np.nanquantile(diff_fcs, 0.975))) #determine 2.5% - 97.5% interval, i.e. remove extremes
range = (-cutoff, cutoff)
else:
range = None
plt.hist(diff_fcs,80,density=True, histtype='step',range=range) #set the cutoffs to focus the visualization
plt.xlabel("log2 peptide fcs")

plt.show()

# %% ../nbdev_nbs/04_utils.ipynb 55
import matplotlib.pyplot as plt
import itertools

def plot_relative_to_median_fcs(normed_intensity_df):

median_intensities = normed_intensity_df.median(axis=1)
median_intensities = median_intensities.to_numpy()

diff_fcs = []
for col in normed_intensity_df.columns:
median_fcs = normed_intensity_df[col].to_numpy() - median_intensities
diff_fcs.append(np.nanmedian(median_fcs))
plt.hist(diff_fcs,80,density=True, histtype='step')
plt.xlabel("log2 peptide fcs")
plt.show()
44 changes: 43 additions & 1 deletion directlfq/visualizations.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

# %% auto 0
__all__ = ['a4_dims', 'a4_width_no_margin', 'AlphaPeptColorMap', 'CmapRegistrator', 'IonTraceCompararisonPlotter',
'IonTraceCompararisonPlotterNoDirectLFQTrace', 'IonTraceVisualizer', 'MultiOrganismMultiMethodBoxPlot']
'IonTraceCompararisonPlotterNoDirectLFQTrace', 'IonTraceVisualizer', 'MultiOrganismMultiMethodBoxPlot',
'plot_withincond_fcs', 'plot_relative_to_median_fcs']

# %% ../nbdev_nbs/05_visualizations.ipynb 1
a4_dims = (11.7, 8.27)
Expand Down Expand Up @@ -180,3 +181,44 @@ def _add_expected_fold_changes(self):
self.ax.axhline(fc, color = color)



# %% ../nbdev_nbs/05_visualizations.ipynb 6
import matplotlib.pyplot as plt
import itertools

def plot_withincond_fcs(normed_intensity_df, cut_extremes = True):
"""takes a normalized intensity dataframe and plots the fold change distribution between all samples. Column = sample, row = ion"""

samplecombs = list(itertools.combinations(normed_intensity_df.columns, 2))

for spair in samplecombs:#compare all pairs of samples
s1 = spair[0]
s2 = spair[1]
diff_fcs = normed_intensity_df[s1].to_numpy() - normed_intensity_df[s2].to_numpy() #calculate fold changes by subtracting log2 intensities of both samples

if cut_extremes:
cutoff = max(abs(np.nanquantile(diff_fcs,0.025)), abs(np.nanquantile(diff_fcs, 0.975))) #determine 2.5% - 97.5% interval, i.e. remove extremes
range = (-cutoff, cutoff)
else:
range = None
plt.hist(diff_fcs,80,density=True, histtype='step',range=range) #set the cutoffs to focus the visualization
plt.xlabel("log2 peptide fcs")

plt.show()

# %% ../nbdev_nbs/05_visualizations.ipynb 7
import matplotlib.pyplot as plt
import itertools

def plot_relative_to_median_fcs(normed_intensity_df):

median_intensities = normed_intensity_df.median(axis=1)
median_intensities = median_intensities.to_numpy()

diff_fcs = []
for col in normed_intensity_df.columns:
median_fcs = normed_intensity_df[col].to_numpy() - median_intensities
diff_fcs.append(np.nanmedian(median_fcs))
plt.hist(diff_fcs,80,density=True, histtype='step')
plt.xlabel("log2 peptide fcs")
plt.show()
2 changes: 1 addition & 1 deletion misc/bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.2.7
current_version = 0.2.8
commit = True
tag = False
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\-(?P<release>[a-z]+)(?P<build>\d+))?
Expand Down
9 changes: 0 additions & 9 deletions nbdev_nbs/01_lfq_manager.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,6 @@
"display_name": "alphatemplate",
"language": "python",
"name": "python3"
},
"language_info": {
"name": "python",
"version": "3.8.13"
},
"vscode": {
"interpreter": {
"hash": "6323a234a298f1b06d100e5b842ce6ca7904d43140794ca9cb8f0b055bce87c6"
}
}
},
"nbformat": 4,
Expand Down
Loading

0 comments on commit 8855bf9

Please sign in to comment.