Skip to content

Commit

Permalink
FIX: enabling batch size to be explicitly specified (#138)
Browse files Browse the repository at this point in the history
* FIX: enabling batch size to be explicitly specified

* fixing spacing
  • Loading branch information
mortonjt authored Jul 6, 2020
1 parent 49892a7 commit c126669
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 20 deletions.
44 changes: 24 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ which can be used to estimate microbe-metabolite conditional probabilities that

```
mmvec paired-omics \
--microbe-file examples/cf/otus_nt.biom \
--metabolite-file examples/cf/lcms_nt.biom \
--summary-dir summary
--microbe-file examples/cf/otus_nt.biom \
--metabolite-file examples/cf/lcms_nt.biom \
--summary-dir summary
```

While this is running, you can open up another session and run `tensorboard --logdir .` for diagnosis, see FAQs below for more details.
Expand Down Expand Up @@ -67,24 +67,24 @@ the qiime2 plugin, run the following commands to import an example dataset

```
qiime tools import \
--input-path data/otus_nt.biom \
--output-path otus_nt.qza \
--type FeatureTable[Frequency]
--input-path data/otus_nt.biom \
--output-path otus_nt.qza \
--type FeatureTable[Frequency]
qiime tools import \
--input-path data/lcms_nt.biom \
--output-path lcms_nt.qza \
--type FeatureTable[Frequency]
--input-path data/lcms_nt.biom \
--output-path lcms_nt.qza \
--type FeatureTable[Frequency]
```

Then you can run mmvec
```
qiime mmvec paired-omics \
--i-microbes otus_nt.qza \
--i-metabolites lcms_nt.qza \
--p-learning-rate 1e-3 \
--o-conditionals ranks.qza \
--o-conditional-biplot biplot.qza
--i-microbes otus_nt.qza \
--i-metabolites lcms_nt.qza \
--p-learning-rate 1e-3 \
--o-conditionals ranks.qza \
--o-conditional-biplot biplot.qza
```

In the results, there are two files, namely `results/conditional_biplot.qza` and `results/conditionals.qza`. The conditional biplot is a biplot representation the
Expand All @@ -98,19 +98,19 @@ created as follows

```
qiime metadata tabulate \
--m-input-file results/conditionals.qza \
--o-visualization conditionals-viz.qzv
--m-input-file results/conditionals.qza \
--o-visualization conditionals-viz.qzv
```


Then you can run the following to generate a emperor biplot.

```
qiime emperor biplot \
--i-biplot conditional_biplot.qza \
--m-sample-metadata-file data/metabolite-metadata.txt \
--m-feature-metadata-file data/microbe-metadata.txt \
--o-visualization emperor.qzv
--i-biplot conditional_biplot.qza \
--m-sample-metadata-file data/metabolite-metadata.txt \
--m-feature-metadata-file data/microbe-metadata.txt \
--o-visualization emperor.qzv
```

Expand Down Expand Up @@ -293,6 +293,10 @@ qiime tools import --input-path conditionals.tsv --output-path ranks.qza --type
qiime tools import --input-path ordination.txt --output-path biplot.qza --type "PCoAResults % Properties('biplot')"
```

**Q** : Can MMvec handle small sample studies?

**A** : We have ran MMvec with studies as few as 19 samples. However running MMvec in these small sample regimes requires careful tuning of `--latent-dimension` in addition to the `--input-prior` and `--output-prior` commands. The [desert biocrust experiment](https://github.com/biocore/mmvec/tree/master/examples/soils) maybe a good dataset to refer to when analyzing these sorts of datasets.

Credits to Lisa Marotz ([@lisa55asil](https://github.com/lisa55asil)), Yoshiki Vazquez-Baeza ([@ElDeveloper](https://github.com/ElDeveloper)), Julia Gauglitz ([@jgauglitz](https://github.com/jgauglitz)) and Nickolas Bokulich ([@nbokulich](https://github.com/nbokulich)) for their README contributions.

# Citation
Expand Down
1 change: 1 addition & 0 deletions mmvec/q2/_method.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ def paired_omics(microbes: biom.Table,
model = MMvec(
latent_dim=latent_dim,
u_scale=input_prior, v_scale=output_prior,
batch_size=batch_size,
learning_rate=learning_rate)
model(session,
train_microbes_coo, train_metabolites_df.values,
Expand Down
1 change: 1 addition & 0 deletions scripts/mmvec
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ def paired_omics(microbe_file, metabolite_file,
learning_rate = learning_rate,
beta_1=beta1, beta_2=beta2,
device_name=device_name,
batch_size=batch_size,
clipnorm=clipnorm, save_path=sname)

model(session,
Expand Down

0 comments on commit c126669

Please sign in to comment.