Skip to content

Commit

Permalink
Merge pull request #3 from bokulich-lab/2024.10
Browse files Browse the repository at this point in the history
update to q2 2024.10
  • Loading branch information
nbokulich authored Nov 5, 2024
2 parents 9c9cb7e + 1031968 commit c0b45b9
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 26 deletions.
45 changes: 29 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,26 @@ Note: this plugin is under active development during pre-release. The code shoul

## Installation instructions

### Installation of stable release (QIIME 2 version 2024.5)
The easiest way to install q2-kmerizer is to install it directly into an existing installation of [QIIME 2](https://qiime2.org/) (amplicon distribution version 2024.10 or later). If you have the QIIME 2 amplicon distribution installed, activate your environment and run the following to install q2-kmerizer into this environment:
```
pip install q2_kmerizer@git+https://github.com/bokulich-lab/q2-kmerizer.git@main
```

And refresh your cache:
```
qiime dev refresh-cache
```

If the installation worked correctly, the following command should display a description of the plugin in your terminal:
```
qiime kmerizer --help
```



### Installation of stable release

If you do not already have QIIME 2 installed, you can follow these instructions to install the QIIME 2 amplicon distribution as well as the latest stable version of q2-kmerizer.

[Miniconda](https://conda.io/miniconda.html) provides the `conda` environment and package manager, and is currently the only supported way to install QIIME 2.
Follow the instructions for downloading and installing Miniconda.
Expand All @@ -17,27 +36,19 @@ After installing Miniconda and opening a new terminal, make sure you're running
conda update conda
```

Now install q2-kmerizer and QIIME 2:
Now ue conda to install q2-kmerizer and QIIME 2:

```shell
conda env create -n q2-kmerizer2 --file https://raw.githubusercontent.com/bokulich-lab/q2-kmerizer/main/environments/q2-kmerizer-qiime2-amplicon-2024.10.yml
conda env create -n kmerizer-stable --file https://raw.githubusercontent.com/bokulich-lab/q2-kmerizer/main/environments/q2-kmerizer-qiime2-amplicon-2024.10.yml
```

After this completes, activate the new environment you created by running:

```shell
conda activate q2-kmerizer-dev
conda activate kmerizer-stable
```

And refresh your cache:
```
qiime dev refresh-cache
```

If the installation worked correctly, the following command should display a description of the plugin in your terminal:
```
qiime kmerizer --help
```
Then refresh your cache and test as shown above.


### Install development version of `q2-kmerizer`
Expand Down Expand Up @@ -71,6 +82,8 @@ Finally, run:
make install
```

Then refresh your cache and test as shown above.



## Examples
Expand All @@ -80,9 +93,9 @@ As an example test, we will use data from [Sampson et al, 2016](https://www.ncbi
First we will download the test data:

```
wget https://data.qiime2.org/2024.5/tutorials/pd-mice/sample_metadata.tsv
wget https://docs.qiime2.org/2024.5/data/tutorials/pd-mice/dada2_table.qza
wget https://docs.qiime2.org/2024.5/data/tutorials/pd-mice/dada2_rep_set.qza
wget https://data.qiime2.org/2024.10/tutorials/pd-mice/sample_metadata.tsv
wget https://docs.qiime2.org/2024.10/data/tutorials/pd-mice/dada2_table.qza
wget https://docs.qiime2.org/2024.10/data/tutorials/pd-mice/dada2_rep_set.qza
```

We can count kmer frequencies per sample with this command:
Expand Down
5 changes: 1 addition & 4 deletions environments/q2-kmerizer-qiime2-amplicon-2024.10.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
name: q2-kmerizer-qiime2-amplicon-2024.10
channels:
- https://packages.qiime2.org/qiime2/2024.10/amplicon/passed
- https://packages.qiime2.org/qiime2/2024.10/amplicon/released
- conda-forge
- bioconda
dependencies:
- qiime2-amplicon
- numpy
- scikit-learn
- frictionless
- pip
- pip:
- "q2_kmerizer@git+https://github.com/bokulich-lab/q2-kmerizer.git@main"
- "q2_vizard@git+https://github.com/qiime2/q2-vizard.git@dev"
- "q2_stats@git+https://github.com/qiime2/q2-stats.git@dev"
4 changes: 2 additions & 2 deletions q2_kmerizer/_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def seqs_to_kmers(sequences: pd.Series, table: pd.DataFrame,
def core_metrics(ctx, sequences, table, sampling_depth, metadata,
kmer_size=16, tfidf=False, max_df=1.0, min_df=1,
max_features=None, with_replacement=False, n_jobs=1,
pc_dimensions=3, color_by_group=None):
pc_dimensions=3, color_by=None):

rarefy = ctx.get_action('feature_table', 'rarefy')
kmerize = ctx.get_action('kmerizer', 'seqs_to_kmers')
Expand Down Expand Up @@ -104,6 +104,6 @@ def core_metrics(ctx, sequences, table, sampling_depth, metadata,
results += scatter(metadata=metadata,
# x_measure=pc_result.columns[0],
# y_measure=pc_result.columns[1],
color_by_group=color_by_group)
color_by=color_by)

return tuple(results)
6 changes: 3 additions & 3 deletions q2_kmerizer/plugin_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
'with_replacement': Bool,
'n_jobs': Int % Range(1, None) | Str % Choices(['auto']),
'pc_dimensions': Int,
'color_by_group': Str},
'color_by': Str},
outputs=[
('rarefied_table', FeatureTable[Frequency]),
('kmer_table', FeatureTable[Frequency]),
Expand All @@ -118,8 +118,8 @@
'n_jobs': '[beta methods only] - %s' % n_jobs_description,
'pc_dimensions': 'Number of principal coordinate dimensions to keep '
'for plotting.',
'color_by_group': 'Categorical measure from the input Metadata that '
'should be used for color-coding the scatterplot.'},
'color_by': 'Categorical measure from the input Metadata that '
'should be used for color-coding the scatterplot.'},
output_descriptions={
'rarefied_table': 'The resulting rarefied feature table.',
'kmer_table': 'Frequencies of kmers per sample.',
Expand Down
2 changes: 1 addition & 1 deletion q2_kmerizer/tests/test_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,4 @@ def test_core_metrics(self):
table = Artifact.import_data('FeatureTable[Frequency]', self.table)
self.core_metrics(seqs, table, metadata=metadata,
sampling_depth=1, kmer_size=7,
color_by_group='color')
color_by='color')

0 comments on commit c0b45b9

Please sign in to comment.