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

update af2 versions to latest #121

Merged
merged 6 commits into from
Apr 10, 2023
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
16 changes: 6 additions & 10 deletions biopandas/mmcif/pandas_mmcif.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def fetch_mmcif(self, pdb_code: Optional[str] = None, uniprot_id: Optional[str]

source : str
The source to retrieve the structure from
(`"pdb"`, `"alphafold2-v1"`, `"alphafold2-v2"` or `"alphafold2-v3"`). Defaults to `"pdb"`.
(`"pdb"`, `"alphafold2-v3"` or `"alphafold2-v4"`). Defaults to `"pdb"`.

Returns
---------
Expand All @@ -95,7 +95,7 @@ def fetch_mmcif(self, pdb_code: Optional[str] = None, uniprot_id: Optional[str]
invalid_input_identifier_2 = pdb_code is not None and uniprot_id is not None
invalid_input_combination_1 = uniprot_id is not None and source == "pdb"
invalid_input_combination_2 = pdb_code is not None and source in {
"alphafold2-v1", "alphafold2-v2", "alphafold2-v3"}
"alphafold2-v3", "alphafold2-v4"}

if invalid_input_identifier_1 or invalid_input_identifier_2:
raise ValueError(
Expand All @@ -110,19 +110,15 @@ def fetch_mmcif(self, pdb_code: Optional[str] = None, uniprot_id: Optional[str]

if source == "pdb":
self.mmcif_path, self.mmcif_text = self._fetch_mmcif(pdb_code)
elif source == "alphafold2-v1":
af2_version = 1
self.mmcif_path, self.mmcif_text = self._fetch_af2(
uniprot_id, af2_version)
elif source == "alphafold2-v2":
af2_version = 2
self.mmcif_path, self.mmcif_text = self._fetch_af2(uniprot_id, af2_version)
elif source == "alphafold2-v3":
af2_version = 3
self.mmcif_path, self.mmcif_text = self._fetch_af2(uniprot_id, af2_version)
elif source == "alphafold2-v4":
af2_version = 4
self.mmcif_path, self.mmcif_text = self._fetch_af2(uniprot_id, af2_version)
else:
raise ValueError(f"Invalid source: {source}."
" Please use one of 'pdb', 'alphafold2-v1', 'alphafold2-v2' or 'alphafold2-v3.")
" Please use one of 'pdb', 'alphafold2-v3' or 'alphafold2-v4'.")

self._df = self._construct_df(text=self.mmcif_text)
return self
Expand Down
Loading