Skip to content

Commit c0a52d7

Browse files
committed
clean
1 parent 02997f3 commit c0a52d7

File tree

1 file changed

+6
-37
lines changed

1 file changed

+6
-37
lines changed

notebooks/integrated_alanines.py

+6-37
Original file line numberDiff line numberDiff line change
@@ -35,42 +35,6 @@
3535
sep = "\n\n=======\n\n"
3636

3737

38-
def get_scn_format(datafile, pdb_code="auto", chain="A", num=1):
39-
""" Gets a PDB ID in sidechainet format
40-
Inputs:
41-
* datafile: str. url to RCSB PDB or relative route in the files system.
42-
* pdb_code: str. 4-letter PDB code. if auto, will take first 4
43-
letters of datafile file name.
44-
* chain: str. the chain in the PDB structure to retrieve
45-
* num: int. the num in the PDB structure to retrieve.
46-
Outputs: dict with
47-
* seq: 1-letter code string
48-
* coords (L, 14, 3)
49-
* mask (whether coords for residue are known or now)
50-
"""
51-
data = {"seq": None, "coords": None, "mask": None}
52-
# get pdb code
53-
if pdb_code == "auto":
54-
pdb_code = datafile.split("/")[-1][:4].upper()
55-
# download if URL
56-
download = False
57-
if datafile.startswith("http"):
58-
os.system("wget {0}".format(datafile))
59-
download = True
60-
datafile = datafile.split("/")[-1]
61-
62-
# read data
63-
chain = pr.parsePDB(datafile, chain=chain, model=num)
64-
if download:
65-
os.system("rm {0}".format(datafile))
66-
# download seq from PDB API
67-
# data["seq_pdb"] = sidechainnet.utils.download.get_seq_from_pdb(pdb_code, chain=1)
68-
# get coords
69-
keys = ["angles_np", "coords_np", "observed_sequence", "unmodified_sequence", "is_nonstd"]
70-
parsed = sidechainnet.utils.measure.get_seq_coords_and_angles(chain)
71-
return {k:v for k,v in zip(keys, parsed)}
72-
73-
7438
# begin tests
7539
if __name__ == "__main__":
7640

@@ -92,7 +56,12 @@ def get_scn_format(datafile, pdb_code="auto", chain="A", num=1):
9256

9357
for i,filename in enumerate(filenames):
9458

95-
data = get_scn_format(filename, chain="A", num=1)
59+
# get data
60+
keys = ["angles_np", "coords_np", "observed_sequence"]
61+
chain = pr.parsePDB(datafile, chain=chain, model=1)
62+
parsed = sidechainnet.utils.measure.get_seq_coords_and_angles(chain)
63+
data = {k:v for k,v in zip(keys, parsed)}
64+
# get scaffs
9665
scaffolds = mp_nerf.proteins.build_scaffolds_from_scn_angles(data["observed_sequence"],
9766
torch.from_numpy(data["angles_np"]).to(device))
9867

0 commit comments

Comments
 (0)