betastructures_graph.py

Shows how to use BetaStructuresGraph class from Python
USAGE:
python3 betastructures_graph.py 5edw.pdb

Keywords:

Categories:

  • core/calc/structural/ProteinArchitecture

Program source:

 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
import sys
sys.path.append('../../../../../bin/')
from pybioshell.core.data.io import find_pdb
from pybioshell.core.calc.structural import ProteinArchitecture


if len(sys.argv) < 2 :
    print("""

    Shows how to use BetaStructuresGraph class from Python
    
    
USAGE:
    python3 betastructures_graph.py 5edw.pdb

    CATEGORIES: core/calc/structural/ProteinArchitecture
    KEYWORDS:   PDB input; Beta Structures Graph

  """)
    sys.exit()

pdb_fname = sys.argv[1]
structure = find_pdb(pdb_fname, "./").create_structure(0)
architecture = ProteinArchitecture(structure)
beta_graph = architecture.create_strand_graph()
strands = beta_graph.get_strands()

print("    ",end ="")
for i in range(len(strands)) :  print(" S%2d " % (i),end ="")
print()

for i in range(len(strands)) :
  pairings = []
  print("S%2d: " % (i),end ="")
  for j in range(len(strands)) :
    are_paired = False
    try :
      p = beta_graph.get_strand_pairing(strands[i],strands[j])
      are_paired = True
    except:  pass
    if are_paired : 
      print("  X  ",end ="")
      pairings.append(j)
    else : print("     ",end ="")
  print("| %-45s paired with %d" % (str(strands[i]),pairings[0]),end ="")
  for pi in range(1,len(pairings)) :
    print(", %d" % (pairings[pi]),end ="")
  print()
../_images/file_icon.png