Skip to content

Commit ebb8b59

Browse files
authored
Merge pull request #53 from yangchen2/master
Filter out discriminatory taxa in utils.py, add in README that QADABRA is WIP software, add install from source instructions in README
2 parents fb66934 + a78121a commit ebb8b59

File tree

2 files changed

+39
-9
lines changed

2 files changed

+39
-9
lines changed

README.md

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@ Importantly, Qadabra focuses on both FDR corrected p-values *and* [feature ranks
1010

1111
![Schematic](images/Qadabra_schematic.svg)
1212

13+
Please note this software is currently a work in progress. Your patience is appreciated as we continue to develop and enhance its features. Please leave an issue on GitHub should you run into any errors.
14+
1315
## Installation
16+
17+
### Option 1: Pip install from [PyPI](https://pypi.org/project/qadabra/0.3.0a1/)
1418
```
1519
pip install qadabra
1620
```
@@ -24,12 +28,31 @@ Qadabra requires the following dependencies:
2428
* cython
2529
* iow
2630

31+
Check out the [tutorial](tutorial.md) for more in-depth instructions on installation.
32+
33+
34+
### Option 2: Install from source (this GitHub repository)
35+
Prerequisites
36+
37+
Before you begin, ensure you have Git and the necessary build tools installed on your system.
38+
39+
Clone the Repository
40+
```
41+
git clone https://github.com/biocore/qadabra.git
42+
```
43+
44+
Navigate to repo root directory where the `setup.py` file is located and then install QADABRA in editable mode
45+
```
46+
cd qadabra
47+
pip install -e .
48+
```
49+
2750
## Usage
2851

2952
### 1. Creating the workflow directory
3053

3154
Qadabra can be used on multiple datasets at once.
32-
First, we want to create the workflow directory to perfrom differential abundance with all methods:
55+
First, we want to create the workflow directory to perform differential abundance with all methods:
3356

3457
```
3558
qadabra create-workflow --workflow-dest <directory_name>
@@ -97,7 +120,7 @@ This will create a zipped directory containing the report.
97120
Unzip this file and open the `report.html` file to view the report containing results and visualizations in your browser.
98121

99122
## Tutorial
100-
See the [tutorial](tutorial.md) page for a walkthroughon using Qadabra workflow with a microbiome dataset.
123+
See the [tutorial](tutorial.md) page for a walkthrough on using Qadabra workflow with a microbiome dataset.
101124

102125
## FAQs
103126
Coming soon: An [FAQs](FAQs.md) page of commonly asked question on the statistics and code pertaining to Qadabra.

qadabra/utils.py

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import biom
66
import pandas as pd
7-
7+
import warnings
88

99
def _validate_input(
1010
logger: logging.Logger,
@@ -51,11 +51,18 @@ def _validate_input(
5151
joint_df = tbl_df.join(md)
5252
gb = joint_df.groupby(factor_name).sum(numeric_only=True)
5353
feat_presence = gb.apply(lambda x: x.all())
54-
if not feat_presence.all():
55-
raise ValueError(
56-
"Some taxa in the table perfectly discriminate factor groups. "
57-
"Please filter out these taxa before running Qadabra."
58-
)
54+
55+
discriminating_feats = feat_presence[~feat_presence].index.tolist()
56+
57+
if len(discriminating_feats) > 0:
58+
logger.warn("Number of discriminating features: " + str(len(discriminating_feats)))
59+
warning_msg = f"Some features in the table perfectly discriminate factor groups. Automatically filtering out {len(discriminating_feats)} features before running Qadabra..."
60+
warnings.warn(warning_msg, category=Warning)
61+
62+
# Filtering out the discriminating features from the BIOM table
63+
tbl = tbl.filter(lambda value, id_, metadata: id_ not in discriminating_feats, axis='observation', inplace=False)
64+
logger.info(f"Table shape after filtering: {tbl.shape}")
65+
5966

6067
if tree:
6168
from bp import parse_newick, to_skbio_treenode
@@ -69,4 +76,4 @@ def _validate_input(
6976
raise ValueError("Tree tips are not a subset of table features!")
7077
else:
7178
logger.info("Reading phylogenetic tree...")
72-
logger.info("(Optional tree file not provided. Skipping tree validation.)")
79+
logger.info("(Optional tree file not provided. Skipping tree validation.)")

0 commit comments

Comments
 (0)