diff --git a/.requirements/base.in b/.requirements/base.in index 185bd1f2..a35d1487 100644 --- a/.requirements/base.in +++ b/.requirements/base.in @@ -10,7 +10,7 @@ looseversion matplotlib>=3.4.3 multipledispatch networkx -numpy +numpy<2 pandas plotly pydantic diff --git a/CHANGELOG.md b/CHANGELOG.md index d1b66669..abc1d5a1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ #### Bugfixes +* Hotfix greater than/less than operations in PDBManager oligmer selection to include equality. [#408](https://github.com/a-r-j/graphein/pull/408). * Fixes progress bar for `download_pdb_multiprocessing`. [#394](https://github.com/a-r-j/graphein/pull/394) * Add support for DSSP >4. Backwards compatibility is still supported. [#355](https://github.com/a-r-j/graphein/pull/355). Fixes [#353](https://github.com/a-r-j/graphein/issues/353). * Fixes bug where RSA features are missing from nodes with insertion codes. [#355](https://github.com/a-r-j/graphein/pull/355). Fixes [#354](https://github.com/a-r-j/graphein/issues/353). diff --git a/graphein/ml/datasets/pdb_data.py b/graphein/ml/datasets/pdb_data.py index acd6716a..5843b51c 100644 --- a/graphein/ml/datasets/pdb_data.py +++ b/graphein/ml/datasets/pdb_data.py @@ -120,7 +120,6 @@ def __init__( ).name self.list_columns = ["ligands"] - self.labels = labels # Data self.download_metadata() @@ -166,10 +165,9 @@ def download_metadata(self): self._download_entry_metadata() self._download_exp_type() self._download_pdb_availability() - if self.labels: - self._download_pdb_chain_cath_uniprot_map() - self._download_cath_id_cath_code_map() - self._download_pdb_chain_ec_number_map() + self._download_pdb_chain_cath_uniprot_map() + self._download_cath_id_cath_code_map() + self._download_pdb_chain_ec_number_map() def get_unavailable_pdb_files( self, splits: Optional[List[str]] = None @@ -645,12 +643,15 @@ def _parse_cath_code(self) -> Dict[str, str]: with gzip.open( self.root_dir / self.cath_id_cath_code_filename, "rt" ) as f: + print(f) for line in f: + print(line) try: cath_id, cath_version, cath_code, cath_segment = ( line.strip().split() ) cath_mapping[cath_id] = cath_code + print(cath_id, cath_code) except ValueError: continue return cath_mapping @@ -1085,7 +1086,10 @@ def oligomeric( update: bool = False, ) -> pd.DataFrame: """Select molecules with a given oligmeric length. - I.e. ``df.n_chains ==/ oligomer`` + I.e. ``df.n_chains ==/ =< / >= oligomer`` + + N.b. the `comparison` arguments for `"greater"` and `"less"` are + `>=` and `=<` respectively. :param length: Oligomeric length of molecule, defaults to ``1``. :type length: int @@ -1106,9 +1110,9 @@ def oligomeric( if comparison == "equal": df = splits_df.loc[splits_df.n_chains == oligomer] elif comparison == "less": - df = splits_df.loc[splits_df.n_chains < oligomer] + df = splits_df.loc[splits_df.n_chains <= oligomer] elif comparison == "greater": - df = splits_df.loc[splits_df.n_chains > oligomer] + df = splits_df.loc[splits_df.n_chains >= oligomer] else: raise ValueError( "Comparison must be one of 'equal', 'less', or 'greater'." diff --git a/tests/protein/tensor/test_angles.py b/tests/protein/tensor/test_angles.py index 04e4a2b1..fe658d8e 100644 --- a/tests/protein/tensor/test_angles.py +++ b/tests/protein/tensor/test_angles.py @@ -86,7 +86,7 @@ def test_torsion_to_rad(): delta = ((delta + 2 * np.pi) / np.pi) % 2 np.testing.assert_allclose( - delta, torch.zeros_like(delta), atol=1e-4, rtol=1e-4 + delta, torch.zeros_like(delta), atol=1e-3, rtol=1e-3 ) @@ -126,7 +126,9 @@ def test_dihedrals_to_rad(): delta[delta.nonzero()] = torch.abs(delta[torch.nonzero(delta)] - 2 * np.pi) delta = ((delta + 2 * np.pi) / np.pi) % 2 - np.testing.assert_allclose(delta, torch.zeros_like(delta), atol=1e-5) + np.testing.assert_allclose( + delta, torch.zeros_like(delta), atol=1e-4, rtol=1e-4 + ) @pytest.mark.skipif(not TORCH_AVAIL, reason="PyTorch not available")