Skip to content

Commit

Permalink
Merge pull request #117 from volkamerlab/update-black-formatting
Browse files Browse the repository at this point in the history
Update black formatting
  • Loading branch information
dominiquesydow authored Apr 10, 2023
2 parents 0559fb4 + 831e263 commit 8433bb6
Show file tree
Hide file tree
Showing 38 changed files with 0 additions and 69 deletions.
4 changes: 0 additions & 4 deletions kissim/api/subset.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ def _subset_fingerprint_generator_data(fingerprint_generator, klifs_residue_ids)
klifs_residue_ixs = [i - 1 for i in klifs_residue_ids]

for id_, fp in fingerprint_generator.data.items():

# Initialize new fingerprint
fp_subset = Fingerprint()
fp_subset.structure_klifs_id = fp.structure_klifs_id
Expand All @@ -151,7 +150,6 @@ def _subset_fingerprint_generator_data(fingerprint_generator, klifs_residue_ids)

# Iterate over physiochemical and spatial features
for feature_name1, features1 in fp.values_dict.items():

fp_dict[feature_name1] = {}

# Iterate over all physiochemical features
Expand All @@ -163,9 +161,7 @@ def _subset_fingerprint_generator_data(fingerprint_generator, klifs_residue_ids)

# Iterate over all spatial features (includes distances and moments!)
elif feature_name1 == "spatial":

for feature_name2, features2 in features1.items():

fp_dict[feature_name1][feature_name2] = {}

# Iterate over all distances
Expand Down
2 changes: 0 additions & 2 deletions kissim/comparison/feature_distances.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ class FeatureDistances:
"""

def __init__(self):

self.structure_pair_ids = None
self.kinase_pair_ids = None
self.distances = None
Expand All @@ -54,7 +53,6 @@ def data(self):
"""

if (self.distances is not None) and (self.bit_coverages is not None):

feature_types = list(
chain.from_iterable(
[[key] * len(value) for key, value in DISTANCES_FEATURE_NAMES.items()]
Expand Down
2 changes: 0 additions & 2 deletions kissim/comparison/feature_distances_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ def __init__(self, **kwargs):
self.structure_kinase_ids = None

def __eq__(self, other):

if isinstance(other, FeatureDistancesGenerator):
return (
self.data.equals(other.data)
Expand Down Expand Up @@ -195,7 +194,6 @@ def _get_feature_distances(pair, fingerprints):

@staticmethod
def _feature_distances_list_to_df(feature_distances_list):

structure_pair_ids_list = []
kinase_pair_ids_list = []
distances_list = []
Expand Down
1 change: 0 additions & 1 deletion kissim/comparison/fingerprint_distance.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ class FingerprintDistance:
"""

def __init__(self):

self.structure_pair_ids = None
self.kinase_pair_ids = None
self.distance = None
Expand Down
2 changes: 0 additions & 2 deletions kissim/comparison/fingerprint_distance_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,10 @@ class FingerprintDistanceGenerator(BaseGenerator):
"""

def __init__(self, *args, **kwargs):

self.data = None
self.structure_kinase_ids = None

def __eq__(self, other):

if isinstance(other, FingerprintDistanceGenerator):
return (
self.data.equals(other.data)
Expand Down
1 change: 0 additions & 1 deletion kissim/comparison/tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,6 @@ def _get_node_means(tree, matrix, node_means, leaf_mean):

# Get mean only for nodes that are not a leaf
if not tree.is_leaf():

# Iterate over the nodes to the right and the left of the current node
for left in [0, 1]:
if left:
Expand Down
1 change: 0 additions & 1 deletion kissim/definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@
DISTANCE_CUTOFFS = {}
MOMENT_CUTOFFS = {}
for how in ["fine", "coarse"]:

DISTANCE_CUTOFFS[how] = pd.read_csv(
PATH_DATA / f"min_max_distances_{how}.csv", index_col=[0, 1]
)
Expand Down
1 change: 0 additions & 1 deletion kissim/encoding/features/exposure.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ class SolventExposureFeature(BaseFeature):
"""

def __init__(self):

self.name = None
self._residue_ids = None
self._residue_ixs = None
Expand Down
1 change: 0 additions & 1 deletion kissim/encoding/features/sco.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ class SideChainOrientationFeature(BaseFeature):
"""

def __init__(self):

self.name = None
self._residue_ids = None
self._residue_ixs = None
Expand Down
1 change: 0 additions & 1 deletion kissim/encoding/features/sitealign.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ class SiteAlignFeature(BaseFeature):
"""

def __init__(self):

self.name = None
self._residue_ids = None
self._residue_ixs = None
Expand Down
1 change: 0 additions & 1 deletion kissim/encoding/features/subpockets.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ class SubpocketsFeature(BaseFeature):
"""

def __init__(self):

self.name = None
self._residue_ids = None
self._residue_ixs = None
Expand Down
1 change: 0 additions & 1 deletion kissim/encoding/fingerprint_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ class FingerprintBase:
"""

def __init__(self):

# TODO add more structure metadata? e.g. bound ligand?
self.structure_klifs_id = None
self.kinase_name = None
Expand Down
1 change: 0 additions & 1 deletion kissim/encoding/fingerprint_generator_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ class FingerprintGeneratorBase:
"""

def __init__(self):

self.structure_klifs_ids = None
self.klifs_session = None
self.data = None
Expand Down
1 change: 0 additions & 1 deletion kissim/encoding/fingerprint_generator_normalized.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ class FingerprintGeneratorNormalized(FingerprintGeneratorBase):
"""

def __init__(self):

self.structure_klifs_ids = None
self.klifs_session = None
self.data = None
Expand Down
1 change: 0 additions & 1 deletion kissim/encoding/fingerprint_normalized.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ def _normalize_moments_bits(self, values_dict, fine_grained):

if values_dict is not None:
for subpocket_name, values in values_dict.items():

# This is truly ugly!
if fine_grained:
minimum = cutoffs[cutoffs.index.get_level_values("min_max") == "min"][
Expand Down
1 change: 0 additions & 1 deletion kissim/io/biopython.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ class PocketBioPython(PocketBase):
"""

def __init__(self):

self.name = None
self._residue_ids = None
self._residue_ixs = None
Expand Down
1 change: 0 additions & 1 deletion kissim/io/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ class KlifsToKissimData:
"""

def __init__(self):

self.klifs_session = None
self.structure_klifs_id = None
self.kinase_name = None
Expand Down
1 change: 0 additions & 1 deletion kissim/tests/api/test_api_compare.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
],
)
def test_compare(fingerprint_generator, output_path, feature_weights, n_cores):

compare(fingerprint_generator, output_path, feature_weights, n_cores)

if output_path is not None:
Expand Down
1 change: 0 additions & 1 deletion kissim/tests/api/test_api_encode.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
def test_encode(
structure_klifs_ids, fingerprints_json_filepath, local_klifs_download_path, n_cores
):

with enter_temp_directory():
fingerprint_generator = encode(
structure_klifs_ids, fingerprints_json_filepath, local_klifs_download_path, n_cores
Expand Down
1 change: 0 additions & 1 deletion kissim/tests/api/test_api_outliers.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
def test_outliers(
fingerprints_path, distance_cutoff, fingerprints_wo_outliers_path, n_fingerprints_wo_outliers
):

with enter_temp_directory():
fingerprints = outliers(fingerprints_path, distance_cutoff, fingerprints_wo_outliers_path)
assert isinstance(fingerprints, FingerprintGenerator)
Expand Down
4 changes: 0 additions & 4 deletions kissim/tests/api/test_api_subset.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,7 @@ def test_subset(
fingerprints_subset_path,
klifs_pocket_residue_subset,
):

with enter_temp_directory():

# Generate regular fingerprints
fingerprints_path = Path(fingerprints_path)
fingerprint_generator = FingerprintGenerator.from_structure_klifs_ids([12347, 3835])
Expand All @@ -73,7 +71,6 @@ def test_subset(

# Test Fingerprint objects
for fingerprint_id, fingerprint_subset in fingerprint_generator_subset.data.items():

# Original fingerprint
fingerprint = fingerprint_generator.data[fingerprint_id]

Expand Down Expand Up @@ -112,7 +109,6 @@ def test_subset(
def test_subset_fingerprint_generator_data(
structure_klifs_id, klifs_session, subset_residue_ids, fp_subset_sum
):

fingerprint_generator = FingerprintGenerator.from_structure_klifs_ids(
[structure_klifs_id], klifs_session
)
Expand Down
1 change: 0 additions & 1 deletion kissim/tests/api/test_api_weights.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
],
)
def test_weights(feature_distances_path, feature_weights, fingerprint_distances_path):

with enter_temp_directory():
fingerprint_distances = weights(
feature_distances_path, feature_weights, fingerprint_distances_path
Expand Down
2 changes: 0 additions & 2 deletions kissim/tests/cli/test_cli_compare.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
],
)
def test_compare_from_cli(args):

with enter_temp_directory():
compare_from_cli(args)

Expand Down Expand Up @@ -139,7 +138,6 @@ def test_compare_from_cli(args):
],
)
def test_compare_from_cli_error(args, error):

with enter_temp_directory():
with pytest.raises(error):
compare_from_cli(args)
2 changes: 0 additions & 2 deletions kissim/tests/cli/test_cli_encode.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
],
)
def test_encode_from_cli(args):

with enter_temp_directory():
encode_from_cli(args)

Expand Down Expand Up @@ -85,6 +84,5 @@ def test_encode_from_cli(args):
],
)
def test_encode_from_cli_error(args, error):

with pytest.raises(error):
encode_from_cli(args)
1 change: 0 additions & 1 deletion kissim/tests/comparison/test_feature_distances.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,6 @@ def test_from_fingerprints(self, fingerprint_generator):
],
)
def test_from_dict(self, feature_distances_dict):

feature_distances_calculated = FeatureDistances._from_dict(feature_distances_dict)
assert isinstance(feature_distances_calculated, FeatureDistances)
assert isinstance(feature_distances_calculated.structure_pair_ids, tuple)
Expand Down
8 changes: 0 additions & 8 deletions kissim/tests/comparison/test_feature_distances_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ def test_from_fingerprints(
],
)
def test_from_structure_klifs_ids(self, structure_klifs_ids, klifs_session, n_cores):

# Test FeatureDistancesGenerator class attributes
feature_distances_generator = FeatureDistancesGenerator.from_structure_klifs_ids(
structure_klifs_ids, klifs_session, n_cores
Expand All @@ -85,38 +84,31 @@ def test_from_structure_klifs_ids(self, structure_klifs_ids, klifs_session, n_co
[[["pdbA", "kinaseA"], ["pdbB", "kinaseA"], ["pdbC", "kinaseB"]]],
)
def test_structure_kinase_ids(self, feature_distances_generator, structure_kinase_ids):

assert feature_distances_generator._structure_kinase_ids == structure_kinase_ids

@pytest.mark.parametrize(
"structure_pair_ids", [[["pdbA", "pdbB"], ["pdbA", "pdbC"], ["pdbB", "pdbC"]]]
)
def test_structure_pair_ids(self, feature_distances_generator, structure_pair_ids):

assert feature_distances_generator.structure_pair_ids == structure_pair_ids

@pytest.mark.parametrize(
"kinase_pair_ids",
[[["kinaseA", "kinaseA"], ["kinaseA", "kinaseB"], ["kinaseA", "kinaseB"]]],
)
def test_kinase_pair_ids(self, feature_distances_generator, kinase_pair_ids):

assert feature_distances_generator.kinase_pair_ids == kinase_pair_ids

@pytest.mark.parametrize("structure_ids", [["pdbA", "pdbB", "pdbC"]])
def test_structure_ids(self, feature_distances_generator, structure_ids):

assert feature_distances_generator.structure_ids == structure_ids

@pytest.mark.parametrize("kinase_ids", [["kinaseA", "kinaseB"]])
def test_kinase_ids(self, feature_distances_generator, kinase_ids):

assert feature_distances_generator.kinase_ids == kinase_ids

def test_to_from_csv(self, feature_distances_generator):

with enter_temp_directory():

filepath = Path("test.csv.bz2")

feature_distances_generator.to_csv(filepath)
Expand Down
3 changes: 0 additions & 3 deletions kissim/tests/comparison/test_fingerprint_distance.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ def test_from_feature_distances(self, feature_distances, feature_weights, distan
],
)
def test_calculate_weighted_sum(self, values, weights, calculated_weighted_sum):

fingerprint_distance = FingerprintDistance()
calculated_weighted_sum_calculated = fingerprint_distance._calculate_weighted_sum(
values, weights
Expand All @@ -97,7 +96,6 @@ def test_calculate_weighted_sum(self, values, weights, calculated_weighted_sum):
],
)
def test_calculate_weighted_sum_raises(self, values, weights):

with pytest.raises(ValueError):
fingerprint_distance = FingerprintDistance()
fingerprint_distance._calculate_weighted_sum(values, weights)
Expand All @@ -122,7 +120,6 @@ def test_calculate_weighted_sum_raises(self, values, weights):
def test_remove_nan_distances_and_recalibrate_weights(
self, distances, weights, distances_wo_nan, weights_wo_nan_recalibrated
):

fingerprint_distance = FingerprintDistance()
(
distances_wo_nan_calculated,
Expand Down
4 changes: 0 additions & 4 deletions kissim/tests/comparison/test_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,7 @@ def test_from_file(
node_means,
tree_string,
):

with enter_temp_directory():

tree_nodes_calculated, node_means_calculated = tree.from_file(
distance_matrix_path, tree_path, annotation_path, clustering_method, similarity
)
Expand All @@ -76,7 +74,6 @@ def test_from_file(
assert node_means == pytest.approx(node_means_calculated, abs=1e-6)

if tree_path:

tree_path = Path(tree_path)
# Tree file there?
assert tree_path.exists()
Expand All @@ -86,7 +83,6 @@ def test_from_file(
tree_path.unlink()

if annotation_path:

annotation_path = Path(annotation_path)
# Annotation file there?
assert annotation_path.exists()
Expand Down
1 change: 0 additions & 1 deletion kissim/tests/encoding/test_fingerprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,6 @@ def test_to_from_json(self, structure_klifs_id):
json_filepath = Path("fingerprint.json")

with enter_temp_directory():

# Save json file
fingerprint.to_json(json_filepath)
assert json_filepath.exists()
Expand Down
1 change: 0 additions & 1 deletion kissim/tests/encoding/test_fingerprint_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ def test_to_from_json(self, structure_klifs_ids, values_array_sum):
json_filepath = Path("fingerprints.json")

with enter_temp_directory():

# Save json file
fingerprints.to_json(json_filepath)
assert json_filepath.exists()
Expand Down
Loading

0 comments on commit 8433bb6

Please sign in to comment.