Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
executable file
·
48 lines (43 loc) · 1.54 KB

File metadata and controls

executable file
·
48 lines (43 loc) · 1.54 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env python
docstring='''
strip_sidechain.py fullatom.pdb > backbone.pdb
strip side chain from full atom PDB "fullatom.pdb"
options:
-convertAA={GLY,ALA} convert any residue to one specific amino acid type
default is do not convert
-amide={true,false} whether preserve amide bond atomsbackbone atoms
'''
import sys
def strip_sidechain(fullatom,convertAA=False,amide=True):
'''strip side chain from full atom PDB file "fullatom"
convertAA - convert all amino acid to one specific type
amide - whether preserve amide bond atoms'''
atom_name_set=["CA","C ","N ","O "] if amide else ["CA"]
fp=open(fullatom,'rU')
fullatom_lines=fp.readlines()
fp.close()
backbone_txt=''
for line in fullatom_lines:
if line.startswith("ATOM") and line[13:15] in atom_name_set:
backbone_txt+=line if not convertAA else \
line[:17]+convertAA+line[20:]
return backbone_txt
if __name__=="__main__":
convertAA=False
amide=True
argv=[]
for arg in sys.argv[1:]:
if arg.startswith("-convertAA="):
convertAA=arg[len("-convertAA="):]
elif arg.startswith("-amide="):
amide=(arg[len("-amide="):].lower()=="true")
elif arg.startswith('-'):
sys.stderr.write("ERROR! Unknown argument %s\n"%arg)
exit()
else:
argv.append(arg)
if len(argv)<1:
sys.stderr.write(docstring)
exit()
for arg in argv:
sys.stdout.write(strip_sidechain(arg,convertAA,amide))
Morty Proxy This is a proxified and sanitized view of the page, visit original site.