@@ -135,22 +135,22 @@ To use Stacked Faith through QIIME2, given similar artifacts, you can use:
135
135
The library can be accessed directly from within Python. If operating in this mode, the API methods are expecting a filepath to a BIOM-Format V2.1.0 table, and a filepath to a Newick formatted phylogeny.
136
136
137
137
$ python
138
- Python 3.7.8 | packaged by conda-forge | (default, Nov 27 2020, 19:24:58)
139
- [GCC 9.3.0] on linux
138
+ Python 3.10.8 | packaged by conda-forge | (main, Nov 22 2022, 08:23:14) [GCC 10.4.0] on linux
140
139
Type "help", "copyright", "credits" or "license" for more information.
141
140
>>> import unifrac
142
141
>>> dir(unifrac)
143
- ['__all__', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__',
144
- '__package__', '__path__', '__spec__', '__version__', '_api', '_meta', '_methods',
145
- 'faith_pd',
146
- 'generalized', 'generalized_fp32', 'generalized_fp32_to_file', 'generalized_to_file',
147
- 'h5pcoa', 'h5unifrac', 'meta', 'pkg_resources', 'ssu', 'ssu_to_file',
148
- 'unweighted', 'unweighted_fp32', 'unweighted_fp32_to_file', 'unweighted_to_file',
149
- 'weighted_normalized', 'weighted_normalized_fp32', 'weighted_normalized_fp32_to_file', 'weighted_normalized_to_file',
150
- 'weighted_unnormalized', 'weighted_unnormalized_fp32', 'weighted_unnormalized_fp32_to_file', 'weighted_unnormalized_to_file']
151
- >>> print(unifrac.unweighted_fp32.__doc__)
152
- Compute Unweighted UniFrac using fp32 math
153
-
142
+ ['__all__', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__',
143
+ '__path__', '__spec__', '__version__', '_api', '_meta', '_methods', 'faith_pd',
144
+ 'generalized', 'generalized_fp32', 'generalized_fp32_to_file', 'generalized_fp64', 'generalized_fp64_to_file', 'generalized_to_file',
145
+ 'h5pcoa', 'h5unifrac', 'meta', 'pkg_resources', 'ssu', 'ssu_fast', 'ssu_inmem', 'ssu_to_file',
146
+ 'unweighted', 'unweighted_fp32', 'unweighted_fp32_to_file', 'unweighted_fp64', 'unweighted_fp64_to_file', 'unweighted_to_file',
147
+ 'weighted_normalized', 'weighted_normalized_fp32', 'weighted_normalized_fp32_to_file',
148
+ 'weighted_normalized_fp64', 'weighted_normalized_fp64_to_file', 'weighted_normalized_to_file',
149
+ 'weighted_unnormalized', 'weighted_unnormalized_fp32', 'weighted_unnormalized_fp32_to_file',
150
+ 'weighted_unnormalized_fp64', 'weighted_unnormalized_fp64_to_file', 'weighted_unnormalized_to_file']
151
+ >>> print(unifrac.unweighted.__doc__)
152
+ Compute Unweighted UniFrac
153
+
154
154
Parameters
155
155
----------
156
156
table : str
@@ -166,12 +166,12 @@ The library can be accessed directly from within Python. If operating in this mo
166
166
by about 50%, but is an approximation.
167
167
n_substeps : int, optional
168
168
Internally split the problem in substeps for reduced memory footprint.
169
-
169
+
170
170
Returns
171
171
-------
172
172
skbio.DistanceMatrix
173
173
The resulting distance matrix.
174
-
174
+
175
175
Raises
176
176
------
177
177
IOError
@@ -180,7 +180,7 @@ The library can be accessed directly from within Python. If operating in this mo
180
180
ValueError
181
181
If the table does not appear to be BIOM-Format v2.1.
182
182
If the phylogeny does not appear to be in Newick format.
183
-
183
+
184
184
Environment variables
185
185
---------------------
186
186
OMP_NUM_THREADS
@@ -189,14 +189,14 @@ The library can be accessed directly from within Python. If operating in this mo
189
189
Enable or disable GPU offload. If not defined, autodetect.
190
190
ACC_DEVICE_NUM
191
191
The GPU to use. If not defined, the first GPU will be used.
192
-
192
+
193
193
Notes
194
194
-----
195
195
Unweighted UniFrac was originally described in [1]_. Variance Adjusted
196
196
UniFrac was originally described in [2]_, and while its application to
197
197
Unweighted UniFrac was not described, factoring in the variance adjustment
198
198
is still feasible and so it is exposed.
199
-
199
+
200
200
References
201
201
----------
202
202
.. [1] Lozupone, C. & Knight, R. UniFrac: a new phylogenetic method for
@@ -205,10 +205,10 @@ The library can be accessed directly from within Python. If operating in this mo
205
205
.. [2] Chang, Q., Luan, Y. & Sun, F. Variance adjusted weighted UniFrac: a
206
206
powerful beta diversity measure for comparing communities based on
207
207
phylogeny. BMC Bioinformatics 12:118 (2011).
208
-
209
- >>> print(unifrac.unweighted_fp32_to_file .__doc__)
210
- Compute Unweighted UniFrac using fp32 math and write to file
211
-
208
+
209
+ >>> print(unifrac.unweighted_to_file .__doc__)
210
+ Compute Unweighted UniFrac and write to file
211
+
212
212
Parameters
213
213
----------
214
214
table : str
@@ -235,12 +235,12 @@ The library can be accessed directly from within Python. If operating in this mo
235
235
can be used to reduce the amount of memory needed.
236
236
n_substeps : int, optional
237
237
Internally split the problem in substeps for reduced memory footprint.
238
-
238
+
239
239
Returns
240
240
-------
241
241
str
242
242
A filepath to the output file.
243
-
243
+
244
244
Raises
245
245
------
246
246
IOError
@@ -250,7 +250,7 @@ The library can be accessed directly from within Python. If operating in this mo
250
250
ValueError
251
251
If the table does not appear to be BIOM-Format v2.1.
252
252
If the phylogeny does not appear to be in Newick format.
253
-
253
+
254
254
Environment variables
255
255
---------------------
256
256
OMP_NUM_THREADS
@@ -259,14 +259,14 @@ The library can be accessed directly from within Python. If operating in this mo
259
259
Enable or disable GPU offload. If not defined, autodetect.
260
260
ACC_DEVICE_NUM
261
261
The GPU to use. If not defined, the first GPU will be used.
262
-
262
+
263
263
Notes
264
264
-----
265
265
Unweighted UniFrac was originally described in [1]_. Variance Adjusted
266
266
UniFrac was originally described in [2]_, and while its application to
267
267
Unweighted UniFrac was not described, factoring in the variance adjustment
268
268
is still feasible and so it is exposed.
269
-
269
+
270
270
References
271
271
----------
272
272
.. [1] Lozupone, C. & Knight, R. UniFrac: a new phylogenetic method for
@@ -275,27 +275,27 @@ The library can be accessed directly from within Python. If operating in this mo
275
275
.. [2] Chang, Q., Luan, Y. & Sun, F. Variance adjusted weighted UniFrac: a
276
276
powerful beta diversity measure for comparing communities based on
277
277
phylogeny. BMC Bioinformatics 12:118 (2011).
278
-
278
+
279
279
>>> print(unifrac.h5unifrac.__doc__)
280
280
Read UniFrac from a hdf5 file
281
-
281
+
282
282
Parameters
283
283
----------
284
284
h5file : str
285
285
A filepath to a hdf5 file.
286
-
286
+
287
287
Returns
288
288
-------
289
289
skbio.DistanceMatrix
290
290
The distance matrix.
291
-
291
+
292
292
Raises
293
293
------
294
294
OSError
295
295
If the hdf5 file is not found
296
296
KeyError
297
297
If the hdf5 does not have the necessary fields
298
-
298
+
299
299
References
300
300
----------
301
301
.. [1] Lozupone, C. & Knight, R. UniFrac: a new phylogenetic method for
@@ -304,7 +304,7 @@ The library can be accessed directly from within Python. If operating in this mo
304
304
.. [2] Chang, Q., Luan, Y. & Sun, F. Variance adjusted weighted UniFrac: a
305
305
powerful beta diversity measure for comparing communities based on
306
306
phylogeny. BMC Bioinformatics 12:118 (2011).
307
-
307
+
308
308
>>> print(unifrac.faith_pd.__doc__)
309
309
Execute a call to the Stacked Faith API in the UniFrac package
310
310
@@ -402,14 +402,30 @@ The methods can also be used directly through the command line after install:
402
402
403
403
## Minor test dataset
404
404
405
- A small test ` .biom ` and ` .tre ` can be found in ` sucpp/ ` . An example with expected output is below, and should execute in 10s of milliseconds:
406
-
407
- $ ssu -i sucpp/test.biom -t sucpp/test.tre -m unweighted -o test.out
408
- $ cat test.out
409
- Sample1 Sample2 Sample3 Sample4 Sample5 Sample6
410
- Sample1 0 0.2 0.5714285714285714 0.6 0.5 0.2
411
- Sample2 0.2 0 0.4285714285714285 0.6666666666666666 0.6 0.3333333333333333
412
- Sample3 0.5714285714285714 0.4285714285714285 0 0.7142857142857143 0.8571428571428571 0.4285714285714285
413
- Sample4 0.6 0.6666666666666666 0.7142857142857143 0 0.3333333333333333 0.4
414
- Sample5 0.5 0.6 0.8571428571428571 0.3333333333333333 0 0.6
415
- Sample6 0.2 0.3333333333333333 0.4285714285714285 0.4 0.6 0
405
+ A small test ` .biom ` and ` .tre ` can be found in ` unifrac/tests/data/ ` . An example with expected output is below, and should execute in 10s of milliseconds:
406
+
407
+ $ python
408
+ Python 3.10.8 | packaged by conda-forge | (main, Nov 22 2022, 08:23:14) [GCC 10.4.0] on linux
409
+ Type "help", "copyright", "credits" or "license" for more information.
410
+ >>> import unifrac
411
+ >>> d=unifrac.unweighted('unifrac/tests/data/crawford.biom','unifrac/tests/data/crawford.tre')
412
+ >>> d.data
413
+ array([[0. , 0.71836066, 0.7131736 , 0.6974604 , 0.6258721 ,
414
+ 0.7282667 , 0.72065896, 0.7264058 , 0.7360605 ],
415
+ [0.71836066, 0. , 0.7030297 , 0.734073 , 0.6548042 ,
416
+ 0.71547383, 0.7839781 , 0.723184 , 0.7613893 ],
417
+ [0.7131736 , 0.7030297 , 0. , 0.6104128 , 0.623313 ,
418
+ 0.71848303, 0.7041634 , 0.75258476, 0.7924903 ],
419
+ [0.6974604 , 0.734073 , 0.6104128 , 0. , 0.6439278 ,
420
+ 0.7005273 , 0.6983272 , 0.77818936, 0.72959894],
421
+ [0.6258721 , 0.6548042 , 0.623313 , 0.6439278 , 0. ,
422
+ 0.75782686, 0.7100514 , 0.75065047, 0.7894437 ],
423
+ [0.7282667 , 0.71547383, 0.71848303, 0.7005273 , 0.75782686,
424
+ 0. , 0.63593644, 0.71283615, 0.5831464 ],
425
+ [0.72065896, 0.7839781 , 0.7041634 , 0.6983272 , 0.7100514 ,
426
+ 0.63593644, 0. , 0.6920076 , 0.6897206 ],
427
+ [0.7264058 , 0.723184 , 0.75258476, 0.77818936, 0.75065047,
428
+ 0.71283615, 0.6920076 , 0. , 0.7151408 ],
429
+ [0.7360605 , 0.7613893 , 0.7924903 , 0.72959894, 0.7894437 ,
430
+ 0.5831464 , 0.6897206 , 0.7151408 , 0. ]], dtype=float32)
431
+
0 commit comments