You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm currently using ampal in a project. I need to download several PDBs to handle with ampal. I looked at the load_pdb function in pdb_parser, and was thinking about passing an optional argument eg. fetch_pdb = True and then have a condition right before the PdbParser to download the PDBs into a specific folder and pass the path to PdbParser.
The fetching logic could be something like:
import urllib
from pathlib import Path
PDB_REQUEST_URL = 'https://files.rcsb.org/download/'
PROTEIN_DATA_FOLDER = Path('protein_data')
PROTEIN_DATA_FOLDER.mkdir(parents=True, exist_ok=True)
def download_pdb(pdb_id, output_folder):
"""
Downloads a specific pdb file into a specific folder.
"""
urllib.request.urlretrieve(PDB_REQUEST_URL + pdb_id + '.pdb1.gz', filename=PROTEIN_DATA_FOLDER / f'{pdb_id}.pdb1.gz')
download_pdb('3qy1', PROTEIN_DATA_FOLDER)
Let me know what you think :)
The text was updated successfully, but these errors were encountered:
I'm in favour of this, but I think it should be a function along side load_pdb called fetch_pdb, which mirrors the command names in PyMol. I'd prefer PDBe as the endpoint rather than RSCB, mainly because we can fetch biological units from there.
I'll open a pull request in the next couple of days. I'll add a test case as well. While I'm at it, should I also fix the incorrect documentation in the tests or should I open another issue for that?
def test_parse_1ek9(self):
"""Check that **3qy1** has been parsed correctly."""
test_file_path = str(TEST_FILE_FOLDER / '1ek9.pdb')
self.check_ampal_contents(test_file_path)
def test_parse_2ht0(self):
"""Check that **3qy1** has been parsed correctly."""
test_file_path = str(TEST_FILE_FOLDER / '2ht0.pdb')
self.check_ampal_contents(test_file_path)
Ie. def test_parse_2ht0 should check 2ht0 rather than 3qy1
Hi there!
I'm currently using ampal in a project. I need to download several PDBs to handle with ampal. I looked at the
load_pdb
function inpdb_parser
, and was thinking about passing an optional argument eg.fetch_pdb = True
and then have a condition right before thePdbParser
to download the PDBs into a specific folder and pass the path toPdbParser
.The fetching logic could be something like:
Let me know what you think :)
The text was updated successfully, but these errors were encountered: