Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
colinvwood committed Sep 12, 2024
1 parent 2e5a566 commit 6a2e647
Show file tree
Hide file tree
Showing 12 changed files with 22 additions and 27 deletions.
6 changes: 2 additions & 4 deletions q2_qsip2/_wrangling.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@
#
# The full license is in the file LICENSE, distributed with this software.
# ----------------------------------------------------------------------------
import pandas as pd

from collections import namedtuple
from typing import NamedTuple, Optional
from typing import Optional

import qiime2

Expand Down Expand Up @@ -166,7 +164,7 @@ def _handle_metadata(
metadata_type='source',
extracted=extracted
)
sample_metadata =_validate_metadata_columns(
sample_metadata = _validate_metadata_columns(
sample_metadata,
sample_column_mapping,
metadata_type='sample',
Expand Down
2 changes: 1 addition & 1 deletion q2_qsip2/plugin_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import importlib

from qiime2.plugin import Bool, Citations, List, Metadata, Plugin, Str
from qiime2.plugin import Citations, List, Metadata, Plugin, Str
from q2_types.feature_table import FeatureTable, Frequency

from q2_qsip2 import __version__
Expand Down
3 changes: 2 additions & 1 deletion q2_qsip2/tests/test_wrangling.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def test_extract_source_metadata(self):
'source-level-data': ['x', 'y'],
})

self.assertTrue( exp.equals(extracted) )
self.assertTrue(exp.equals(extracted))

def metadata_to_validate(self):
df = pd.DataFrame({
Expand All @@ -58,6 +58,7 @@ def metadata_column_mapping(self):
'isotope': None,
'isotopolog': 'my-isotopolog-col',
}

def test_validate_metadata_columns(self):
metadata = self.metadata_to_validate()
columns_mapping = self.metadata_column_mapping()
Expand Down
11 changes: 8 additions & 3 deletions q2_qsip2/types/_deferred_setup/_transformers.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
import pandas as pd
# ----------------------------------------------------------------------------
# Copyright (c) 2024, QIIME 2 development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# ----------------------------------------------------------------------------

from rpy2.robjects.methods import RS4

import pickle

import qiime2

from q2_qsip2.plugin_setup import plugin
from q2_qsip2.types import QSIP2DataFormat

Expand Down
3 changes: 1 addition & 2 deletions q2_qsip2/types/_formats.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@
#
# The full license is in the file LICENSE, distributed with this software.
# ----------------------------------------------------------------------------
import pandas as pd

import rpy2.robjects as ro

import pickle

import qiime2
from qiime2.plugin import ValidationError
import qiime2.plugin.model as model

Expand Down
2 changes: 1 addition & 1 deletion q2_qsip2/types/_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# The full license is in the file LICENSE, distributed with this software.
# ----------------------------------------------------------------------------

from qiime2.plugin import SemanticType, ValidationError
from qiime2.plugin import SemanticType


QSIP2Data = SemanticType('QSIP2Data')
1 change: 0 additions & 1 deletion q2_qsip2/types/tests/test_formats.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

import biom
import pandas as pd
from pandas.testing import assert_frame_equal
import rpy2.robjects as ro
from rpy2.robjects.methods import RS4

Expand Down
4 changes: 1 addition & 3 deletions q2_qsip2/types/tests/test_transformers.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@
#
# The full license is in the file LICENSE, distributed with this software.
# ----------------------------------------------------------------------------
import pandas as pd
from pandas.testing import assert_frame_equal

import rpy2.robjects as ro
from rpy2.robjects.methods import RS4

import importlib.resources
import pickle

import qiime2
from qiime2.plugin.testing import TestPluginBase

from q2_qsip2.types import QSIP2DataFormat
Expand Down
5 changes: 2 additions & 3 deletions q2_qsip2/visualizers/_helpers.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
# ----------------------------------------------------------------------------
# Copyright (c) 2024, QIIME2.
# Copyright (c) 2024, QIIME 2 development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# ----------------------------------------------------------------------------

import rpy2.robjects as ro
from rpy2.robjects.packages import importr

import importlib.resources
from pathlib import Path
import shutil
import tempfile

ggplot2 = importr('ggplot2')


def _ggplot2_object_to_visualization(
ggplot2_obj: object, output_dir: Path, width: int, height: int
) -> None:
Expand Down
1 change: 1 addition & 0 deletions q2_qsip2/visualizers/_visualizers.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

qsip2 = importr('qSIP2')


def plot_weighted_average_densities(
output_dir: str, qsip_data: RS4, group: Optional[str] = None
) -> None:
Expand Down
1 change: 0 additions & 1 deletion q2_qsip2/visualizers/tests/test_visualizers.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

from qiime2.plugin.testing import TestPluginBase

from q2_qsip2.visualizers._visualizers import plot_weighted_average_density

class VisualizerTests(TestPluginBase):
package = 'q2_qsip2.visualizers.tests'
Expand Down
10 changes: 3 additions & 7 deletions q2_qsip2/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
# The full license is in the file LICENSE, distributed with this software.
# ----------------------------------------------------------------------------
import biom
import pandas as pd
import rpy2
import rpy2.robjects as ro
from rpy2.robjects.packages import importr
from rpy2.robjects.methods import RS4
Expand All @@ -20,7 +18,6 @@
from q2_qsip2._wrangling import (
_construct_column_mapping,
_handle_metadata,
_extract_source_metadata
)

qsip2 = importr('qSIP2')
Expand All @@ -35,7 +32,6 @@ def standard_workflow(
return table



def create_qsip_data(
table: biom.Table,
sample_metadata: qiime2.Metadata,
Expand Down Expand Up @@ -119,9 +115,9 @@ def create_qsip_data(
table_df, feature_id='ASV'
)
R_qsip_obj = qsip2.qsip_data(
source_data = R_source_obj,
sample_data = R_sample_obj,
feature_data = R_feature_obj
source_data=R_source_obj,
sample_data=R_sample_obj,
feature_data=R_feature_obj
)

return R_qsip_obj

0 comments on commit 6a2e647

Please sign in to comment.