Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

REF: fix private imports for q2-types refactor #95

Merged
merged 2 commits into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions q2_assembly/iss/tests/test_iss.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
import biom
import pandas as pd
from q2_types.feature_data import DNAIterator
from q2_types.feature_table._transformer import _table_to_dataframe
from qiime2.plugin.testing import TestPluginBase
from qiime2.plugin.util import transform

from q2_assembly.iss.iss import (
_abundances_to_biom,
Expand Down Expand Up @@ -153,13 +153,13 @@ def test_abundances_to_biom(self):
glob.glob(os.path.join(self.get_data_path("abundances"), "*.txt"))
)
obs_table = _abundances_to_biom(abunds_fp)
obs_df = transform(obs_table, to_type=pd.DataFrame)

with open(self.get_data_path("abundances/biom_table.tsv"), "r") as f:
exp_table = biom.Table.from_tsv(f, None, None, lambda x: x)
exp_df = transform(exp_table, to_type=pd.DataFrame)

pd.testing.assert_frame_equal(
_table_to_dataframe(obs_table), _table_to_dataframe(exp_table)
)
pd.testing.assert_frame_equal(obs_df, exp_df)

def test_generate_reads_wrong_genome_counts(self):
with self.assertRaisesRegex(Exception, r".*provided 2 kingdom\(s\) but 1.*"):
Expand Down Expand Up @@ -189,6 +189,8 @@ def test_generate_reads_action(self, p1, p2, p3):
["samp1", "samp2"], self.test_params_list, test_temp_dir.name
)

obs_abundances_df = transform(obs_abundances, to_type=pd.DataFrame)

exp_genomes = {
"genome1": "ATGCATGC",
"genome2": "GATCGCATGA",
Expand All @@ -201,9 +203,8 @@ def test_generate_reads_action(self, p1, p2, p3):

with open(self.get_data_path("abundances/biom_table.tsv"), "r") as f:
exp_biom_table = biom.Table.from_tsv(f, None, None, lambda x: x)
pd.testing.assert_frame_equal(
_table_to_dataframe(obs_abundances), _table_to_dataframe(exp_biom_table)
)
exp_df = transform(exp_biom_table, to_type=pd.DataFrame)
pd.testing.assert_frame_equal(obs_abundances_df, exp_df)


if __name__ == "__main__":
Expand Down
2 changes: 1 addition & 1 deletion q2_assembly/plugin_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
SequencesWithQuality,
SingleBowtie2Index,
)
from q2_types.per_sample_sequences._type import AlignmentMap
from q2_types.per_sample_sequences import AlignmentMap
from q2_types.sample_data import SampleData
from qiime2.core.type import Bool, Choices, Properties, Str, TypeMap, Visualization
from qiime2.plugin import Citations, Collection, Int, List, Plugin, Range
Expand Down
Loading