|
19 | 19 |
|
20 | 20 | from skbio.tree import TreeNode |
21 | 21 | from skbio.util import remove_files |
22 | | -from biom import Table |
23 | | -from biom.util import biom_open |
| 22 | +from biom import load_table |
24 | 23 |
|
25 | 24 | from qiime.util import load_qiime_config, count_seqs, get_qiime_temp_dir |
26 | 25 | from qiime.workflow.util import (call_commands_serially, no_status_updates, |
@@ -139,8 +138,7 @@ def test_pick_subsampled_open_reference_otus_step_1_and_4(self): |
139 | 138 | "PyNAST failures file doesn't exist") |
140 | 139 |
|
141 | 140 | # all OTUs in final OTU table occur more than once |
142 | | - with biom_open(otu_table_fp) as biom_file: |
143 | | - otu_table = Table.from_hdf5(biom_file) |
| 141 | + otu_table = load_table(otu_table_fp) |
144 | 142 | for row in otu_table.iter_data(axis='observation'): |
145 | 143 | self.assertTrue(sum(row) >= 2, |
146 | 144 | "Singleton OTU detected in OTU table.") |
@@ -191,8 +189,7 @@ def test_pick_subsampled_open_reference_otus_step_1_and_4(self): |
191 | 189 |
|
192 | 190 | # OTU table without singletons or pynast failures has same number of |
193 | 191 | # otus as there are aligned sequences |
194 | | - with biom_open(otu_table_fp) as biom_file: |
195 | | - otu_table = Table.from_hdf5(biom_file) |
| 192 | + otu_table = load_table(otu_table_fp) |
196 | 193 | self.assertEqual(len(otu_table.ids(axis='observation')), |
197 | 194 | num_align_seqs) |
198 | 195 |
|
@@ -265,8 +262,7 @@ def test_pick_subsampled_open_reference_otus_step_1_through_4(self): |
265 | 262 | "PyNAST failures file doesn't exist") |
266 | 263 |
|
267 | 264 | # all OTUs in final OTU table occur more than once |
268 | | - with biom_open(otu_table_fp) as biom_file: |
269 | | - otu_table = Table.from_hdf5(biom_file) |
| 265 | + otu_table = load_table(otu_table_fp) |
270 | 266 | for row in otu_table.iter_data(axis='observation'): |
271 | 267 | self.assertTrue(sum(row) >= 2, |
272 | 268 | "Singleton OTU detected in OTU table.") |
@@ -317,8 +313,7 @@ def test_pick_subsampled_open_reference_otus_step_1_through_4(self): |
317 | 313 |
|
318 | 314 | # OTU table without singletons or pynast failures has same number of |
319 | 315 | # otus as there are aligned sequences |
320 | | - with biom_open(otu_table_fp) as biom_file: |
321 | | - otu_table = Table.from_hdf5(biom_file) |
| 316 | + otu_table = load_table(otu_table_fp) |
322 | 317 | self.assertEqual(len(otu_table.ids(axis='observation')), |
323 | 318 | num_align_seqs) |
324 | 319 |
|
@@ -403,8 +398,7 @@ def test_pick_subsampled_open_reference_otus_rdp_tax_assign(self): |
403 | 398 | "rdp taxonomy assignment result doesn't exist") |
404 | 399 |
|
405 | 400 | # all OTUs in final OTU table occur more than once |
406 | | - with biom_open(otu_table_fp) as biom_file: |
407 | | - otu_table = Table.from_hdf5(biom_file) |
| 401 | + otu_table = load_table(otu_table_fp) |
408 | 402 | for row in otu_table.iter_data(axis='observation'): |
409 | 403 | self.assertTrue(sum(row) >= 2, |
410 | 404 | "Singleton OTU detected in OTU table.") |
@@ -455,8 +449,7 @@ def test_pick_subsampled_open_reference_otus_rdp_tax_assign(self): |
455 | 449 |
|
456 | 450 | # OTU table without singletons or pynast failures has same number of |
457 | 451 | # otus as there are aligned sequences |
458 | | - with biom_open(otu_table_fp) as biom_file: |
459 | | - otu_table = Table.from_hdf5(biom_file) |
| 452 | + otu_table = load_table(otu_table_fp) |
460 | 453 | self.assertEqual(len(otu_table.ids(axis='observation')), |
461 | 454 | num_align_seqs) |
462 | 455 |
|
@@ -531,8 +524,7 @@ def test_pick_subsampled_open_reference_otus_usearch(self): |
531 | 524 | "PyNAST failures file doesn't exist") |
532 | 525 |
|
533 | 526 | # all OTUs in final OTU table occur more than once |
534 | | - with biom_open(otu_table_fp) as biom_file: |
535 | | - otu_table = Table.from_hdf5(biom_file) |
| 527 | + otu_table = load_table(otu_table_fp) |
536 | 528 | for row in otu_table.iter_data(axis='observation'): |
537 | 529 | self.assertTrue(sum(row) >= 2, |
538 | 530 | "Singleton OTU detected in OTU table.") |
@@ -582,8 +574,7 @@ def test_pick_subsampled_open_reference_otus_usearch(self): |
582 | 574 |
|
583 | 575 | # OTU table without singletons or pynast failures has same number of |
584 | 576 | # otus as there are aligned sequences |
585 | | - with biom_open(otu_table_fp) as biom_file: |
586 | | - otu_table = Table.from_hdf5(biom_file) |
| 577 | + otu_table = load_table(otu_table_fp) |
587 | 578 | self.assertEqual(len(otu_table.ids(axis='observation')), |
588 | 579 | num_align_seqs) |
589 | 580 |
|
@@ -664,8 +655,7 @@ def test_pick_subsampled_open_reference_otus_sortmerna_sumaclust(self): |
664 | 655 | "PyNAST failures file doesn't exist") |
665 | 656 |
|
666 | 657 | # all OTUs in final OTU table occur more than once |
667 | | - with biom_open(otu_table_fp) as biom_file: |
668 | | - otu_table = Table.from_hdf5(biom_file) |
| 658 | + otu_table = load_table(otu_table_fp) |
669 | 659 | for row in otu_table.iter_data(axis='observation'): |
670 | 660 | self.assertTrue(sum(row) >= 2, |
671 | 661 | "Singleton OTU detected in OTU table.") |
@@ -734,8 +724,7 @@ def test_pick_subsampled_open_reference_otus_sortmerna_sumaclust(self): |
734 | 724 |
|
735 | 725 | # OTU table without singletons or pynast failures has same number of |
736 | 726 | # otus as there are aligned sequences |
737 | | - with biom_open(otu_table_fp) as biom_file: |
738 | | - otu_table = Table.from_hdf5(biom_file) |
| 727 | + otu_table = load_table(otu_table_fp) |
739 | 728 | self.assertEqual(len(otu_table.ids(axis='observation')), |
740 | 729 | num_align_seqs) |
741 | 730 |
|
@@ -816,8 +805,7 @@ def test_pick_subsampled_open_reference_otus_sortmerna_sumaclust_step2_3(self): |
816 | 805 | "PyNAST failures file doesn't exist") |
817 | 806 |
|
818 | 807 | # all OTUs in final OTU table occur more than once |
819 | | - with biom_open(otu_table_fp) as biom_file: |
820 | | - otu_table = Table.from_hdf5(biom_file) |
| 808 | + otu_table = load_table(otu_table_fp) |
821 | 809 | for row in otu_table.iter_data(axis='observation'): |
822 | 810 | self.assertTrue(sum(row) >= 2, |
823 | 811 | "Singleton OTU detected in OTU table.") |
@@ -883,8 +871,7 @@ def test_pick_subsampled_open_reference_otus_sortmerna_sumaclust_step2_3(self): |
883 | 871 |
|
884 | 872 | # OTU table without singletons or pynast failures has same number of |
885 | 873 | # otus as there are aligned sequences |
886 | | - with biom_open(otu_table_fp) as biom_file: |
887 | | - otu_table = Table.from_hdf5(biom_file) |
| 874 | + otu_table = load_table(otu_table_fp) |
888 | 875 | self.assertEqual(len(otu_table.ids(axis='observation')), |
889 | 876 | num_align_seqs) |
890 | 877 |
|
@@ -973,8 +960,7 @@ def test_pick_subsampled_open_reference_otus_sortmerna_sumaclust_db(self): |
973 | 960 | "PyNAST failures file doesn't exist") |
974 | 961 |
|
975 | 962 | # all OTUs in final OTU table occur more than once |
976 | | - with biom_open(otu_table_fp) as biom_file: |
977 | | - otu_table = Table.from_hdf5(biom_file) |
| 963 | + otu_table = load_table(otu_table_fp) |
978 | 964 | for row in otu_table.iter_data(axis='observation'): |
979 | 965 | self.assertTrue(sum(row) >= 2, |
980 | 966 | "Singleton OTU detected in OTU table.") |
@@ -1037,8 +1023,7 @@ def test_pick_subsampled_open_reference_otus_sortmerna_sumaclust_db(self): |
1037 | 1023 |
|
1038 | 1024 | # OTU table without singletons or pynast failures has same number of |
1039 | 1025 | # otus as there are aligned sequences |
1040 | | - with biom_open(otu_table_fp) as biom_file: |
1041 | | - otu_table = Table.from_hdf5(biom_file) |
| 1026 | + otu_table = load_table(otu_table_fp) |
1042 | 1027 | self.assertEqual(len(otu_table.ids(axis='observation')), |
1043 | 1028 | num_align_seqs) |
1044 | 1029 |
|
@@ -1172,8 +1157,7 @@ def test_pick_subsampled_open_reference_otus_no_prefilter(self): |
1172 | 1157 | "PyNAST failures file doesn't exist") |
1173 | 1158 |
|
1174 | 1159 | # all OTUs in final OTU table occur more than once |
1175 | | - with biom_open(otu_table_fp) as biom_file: |
1176 | | - otu_table = Table.from_hdf5(biom_file) |
| 1160 | + otu_table = load_table(otu_table_fp) |
1177 | 1161 | for row in otu_table.iter_data(axis='observation'): |
1178 | 1162 | self.assertTrue(sum(row) >= 2, |
1179 | 1163 | "Singleton OTU detected in OTU table.") |
@@ -1225,8 +1209,7 @@ def test_pick_subsampled_open_reference_otus_no_prefilter(self): |
1225 | 1209 |
|
1226 | 1210 | # OTU table without singletons or pynast failures has same number of |
1227 | 1211 | # otus as there are aligned sequences |
1228 | | - with biom_open(otu_table_fp) as biom_file: |
1229 | | - otu_table = Table.from_hdf5(biom_file) |
| 1212 | + otu_table = load_table(otu_table_fp) |
1230 | 1213 | self.assertEqual(len(otu_table.ids(axis='observation')), |
1231 | 1214 | num_align_seqs) |
1232 | 1215 |
|
@@ -1300,8 +1283,7 @@ def test_pick_subsampled_open_reference_otus_parallel(self): |
1300 | 1283 | "PyNAST failures file doesn't exist") |
1301 | 1284 |
|
1302 | 1285 | # all OTUs in final OTU table occur more than once |
1303 | | - with biom_open(otu_table_fp) as biom_file: |
1304 | | - otu_table = Table.from_hdf5(biom_file) |
| 1286 | + otu_table = load_table(otu_table_fp) |
1305 | 1287 | for row in otu_table.iter_data(axis='observation'): |
1306 | 1288 | self.assertTrue(sum(row) >= 2, |
1307 | 1289 | "Singleton OTU detected in OTU table.") |
@@ -1352,8 +1334,7 @@ def test_pick_subsampled_open_reference_otus_parallel(self): |
1352 | 1334 |
|
1353 | 1335 | # OTU table without singletons or pynast failures has same number of |
1354 | 1336 | # otus as there are aligned sequences |
1355 | | - with biom_open(otu_table_fp) as biom_file: |
1356 | | - otu_table = Table.from_hdf5(biom_file) |
| 1337 | + otu_table = load_table(otu_table_fp) |
1357 | 1338 | self.assertEqual(len(otu_table.ids(axis='observation')), |
1358 | 1339 | num_align_seqs) |
1359 | 1340 |
|
@@ -1432,8 +1413,7 @@ def test_pick_subsampled_open_reference_otus_suppress_step4(self): |
1432 | 1413 | "PyNAST failures file doesn't exist") |
1433 | 1414 |
|
1434 | 1415 | # all OTUs in final OTU table occur more than once |
1435 | | - with biom_open(otu_table_fp) as biom_file: |
1436 | | - otu_table = Table.from_hdf5(biom_file) |
| 1416 | + otu_table = load_table(otu_table_fp) |
1437 | 1417 | for row in otu_table.iter_data(axis='observation'): |
1438 | 1418 | self.assertTrue(sum(row) >= 2, |
1439 | 1419 | "Singleton OTU detected in OTU table.") |
@@ -1488,8 +1468,7 @@ def test_pick_subsampled_open_reference_otus_suppress_step4(self): |
1488 | 1468 |
|
1489 | 1469 | # OTU table without singletons or pynast failures has same number of |
1490 | 1470 | # otus as there are aligned sequences |
1491 | | - with biom_open(otu_table_fp) as biom_file: |
1492 | | - otu_table = Table.from_hdf5(biom_file) |
| 1471 | + otu_table = load_table(otu_table_fp) |
1493 | 1472 | self.assertEqual(len(otu_table.ids(axis='observation')), |
1494 | 1473 | num_align_seqs) |
1495 | 1474 |
|
@@ -1592,8 +1571,7 @@ def test_iterative_pick_subsampled_open_reference_otus_no_prefilter(self): |
1592 | 1571 | "Iteration 1 OTU map with singletons doesn't exist") |
1593 | 1572 |
|
1594 | 1573 | # all OTUs in final OTU table occur more than once |
1595 | | - with biom_open(otu_table_fp) as biom_file: |
1596 | | - otu_table = Table.from_hdf5(biom_file) |
| 1574 | + otu_table = load_table(otu_table_fp) |
1597 | 1575 | for row in otu_table.iter_data(axis='observation'): |
1598 | 1576 | self.assertTrue(sum(row) >= 2, |
1599 | 1577 | "Singleton OTU detected in OTU table.") |
@@ -1734,8 +1712,7 @@ def test_iterative_pick_subsampled_open_reference_otus(self): |
1734 | 1712 | "Iteration 1 OTU map with singletons doesn't exist") |
1735 | 1713 |
|
1736 | 1714 | # all OTUs in final OTU table occur more than once |
1737 | | - with biom_open(otu_table_fp) as biom_file: |
1738 | | - otu_table = Table.from_hdf5(biom_file) |
| 1715 | + otu_table = load_table(otu_table_fp) |
1739 | 1716 | for row in otu_table.iter_data(axis='observation'): |
1740 | 1717 | self.assertTrue(sum(row) >= 2, |
1741 | 1718 | "Singleton OTU detected in OTU table.") |
@@ -1876,8 +1853,7 @@ def test_iterative_pick_subsampled_open_reference_otus_parallel(self): |
1876 | 1853 | "Iteration 1 OTU map with singletons doesn't exist") |
1877 | 1854 |
|
1878 | 1855 | # all OTUs in final OTU table occur more than once |
1879 | | - with biom_open(otu_table_fp) as biom_file: |
1880 | | - otu_table = Table.from_hdf5(biom_file) |
| 1856 | + otu_table = load_table(otu_table_fp) |
1881 | 1857 | for row in otu_table.iter_data(axis='observation'): |
1882 | 1858 | self.assertTrue(sum(row) >= 2, |
1883 | 1859 | "Singleton OTU detected in OTU table.") |
|
0 commit comments