Skip to content

Commit

Permalink
v2023.7.20
Browse files Browse the repository at this point in the history
  • Loading branch information
jolespin committed Jul 20, 2023
1 parent cd8949a commit 5ec8b6c
Show file tree
Hide file tree
Showing 9 changed files with 375 additions and 113 deletions.
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#### Changes:
* [2023..7.20] - Added the following functions:
* `assert_acceptable_arguments`
* `check_compositional`
* `sparsity`
* `number_of_components`
* `prevalence_of_components`
* `transform_closure`
* `filter_data_highpass`

* [2022.8.31] - Added support for Python v3.10

#### Future:
* Reimplement `plot_compositional` and `plot_prevalence` from [Soothsayer](github.com/jolespin/soothsayer)
* Simplex plots (Optional: matplotlib)
* Weight components (e.g. gene size)
14 changes: 0 additions & 14 deletions LICENSE.txt → LICENSE
Original file line number Diff line number Diff line change
@@ -1,17 +1,3 @@
# ==============
# compositional
# ==============
# Compositional data analysis in Python
# ------------------------------------
# GitHub: https://github.com/jolespin/compositional
# PyPI: https://pypi.org/project/compositional
# ------------------------------------
# =======
# Contact
# =======
# Producer: Josh L. Espinoza
# Contact: [email protected], [email protected]
# Google Scholar: https://scholar.google.com/citations?user=r9y1tTQAAAAJ&hl
# =======
# License BSD-3
# =======
Expand Down
22 changes: 19 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ ete[2/3]

#### Install:
```
# "Stable" release (still developmental)
# Stable release (Preferred)
pip install compositional
# Current release
# Developmental release
pip install git+https://github.com/jolespin/compositional
```

Expand Down Expand Up @@ -89,7 +90,7 @@ import compositional as coda
import pandas as pd

# Load abundances (Gomez and Espinoza et al. 2017)
X = pd.read_csv("https://github.com/jolespin/supragingival_plaque_microbiome/blob/master/16S_amplicons/Data/X.tsv.gz?raw=true",
X = pd.read_csv("https://github.com/jolespin/projects/raw/main/supragingival_plaque_microbiome/16S_amplicons/Data/X.tsv.gz",
sep="\t",
index_col=0,
compression="gzip",
Expand All @@ -101,6 +102,21 @@ X = X + delta
# X.shape: (n=473 samples, m=481 OTUs) | delta=4.322249644494967e-06
```

#### (Highpass) Filtering of compositional data
Here we are going to first remove all samples with less than 10,000 total counts, then all features that aren't in at least 50% of the samples, and then samples that don't have at least 50 detected components.

```
X_filtered = coda.filter_data_highpass(
X=X,
minimum_total_counts=10000,
minimum_prevalence=0.5,
minimum_components=50,
)
X.shape, X_filtered.shape
# ((473, 481), (401, 93))
```

#### Pairwise operations
```
# Pairwise variance log-ratio
Expand Down
45 changes: 8 additions & 37 deletions build/lib/compositional/__init__.py
Original file line number Diff line number Diff line change
@@ -1,39 +1,6 @@
# ==============
# Compositional
# ==============
# Compositional data analysis in Python
# ------------------------------------
# GitHub: https://github.com/jolespin/compositional
# PyPI: https://pypi.org/project/compositional/
# ------------------------------------
# =======
# Contact
# =======
# Producer: Josh L. Espinoza
# Contact: [email protected], [email protected]
# Google Scholar: https://scholar.google.com/citations?user=r9y1tTQAAAAJ&hl
# =======
# License BSD-3
# =======
# https://opensource.org/licenses/BSD-3-Clause
#
# Copyright 2020 Josh L. Espinoza
#
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# -*- coding: utf-8 -*-

#
# =======
# Version
# =======
__version__= "2020.05.19"
__version__= "2023.7.20"
__author__ = "Josh L. Espinoza"
__email__ = "[email protected], [email protected]"
__url__ = "https://github.com/jolespin/compositional"
Expand All @@ -45,11 +12,15 @@
# =======
__functions__ = [
# Transforms
"transform_xlr", "transform_clr", "transform_iqlr", "transform_ilr",
"transform_xlr", "transform_clr", "transform_iqlr", "transform_ilr","transform_closure",
# Pairwise
"pairwise_vlr", "pairwise_rho","pairwise_phi",
# Utilities
"check_packages",
"check_packages","assert_acceptable_arguments","check_compositional",
# Filtering
"filter_data_highpass",
# Metrics
"sparsity","number_of_components","prevalence_of_components",
]
__classes__ = []

Expand Down
Loading

0 comments on commit 5ec8b6c

Please sign in to comment.