Rosetta
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
contacts.py
Go to the documentation of this file.
1 #!/usr/bin/python
2 import sys
3 import string
4 import calccontacts
5 
6 Nargs = len(sys.argv)-1
7 
8 if Nargs < 1:
9  print 'Usage: contacts.py <pdb> parse=<parserule> mode=<mode> output=<output> <file>'
10  print "Any order of arguments is acceptable and most arguments are optional\n"
11  print 'pdb is mandatory\n'
12  print "parserule has several options (optional; default = 'all')"
13  print "'all': whole protein; all chains and all heteroatoms"
14  print "'A', 'AB', etc. - any chain(s) from the protein including heteroatoms of that chainID"
15  print "'A-B', 'AB-C': interface between chains separated by '-' "
16  print "'A-ligand', 'all-ligand' - a subset or the whole protein against ligand (binding sites)\n"
17  print "mode has several options (optional; default = 'fullatom')"
18  print "fullatom - all atom-atom contacts"
19  print "calpha - all CA-CA pairs within 7.0A"
20  print "sccentroid - all sidechain centroid-centroid pairs within 6.0A\n"
21  print "output can be either 'list' or 'profile' (optional; default = 'list')"
22  print "'list' is a list of individual contacts"
23  print "'profile' is table of total number of contacts for each residue"
24  print "'both' will output both forms; you should use this only if you turn on 'file'\n"
25  print "'file', if added to the arglist, will output a file for the type of output you specified"
26  print "'pdb.contactmap' for 'list' or 'pdb.contactprofile' for 'profile'"
27  sys.exit(0)
28 
29 #default arguments
30 parserule = 'all'
31 output = 'list'
32 mode = 'fullatom'
33 dest = 'print'
34 
35 arglist = sys.argv[1:Nargs+1]
36 for arg in arglist:
37  if arg[-3:] == 'pdb':
38  pdb = arg
39  continue
40  if arg[0:5] == 'parse':
41  parserule = string.split(arg, '=')[1]
42  continue
43  if arg[0:4] == 'mode':
44  mode = string.split(arg, '=')[1]
45  continue
46  if arg[0:6] == 'output':
47  output = string.split(arg, '=')[1]
48  continue
49  if arg == 'file':
50  dest = 'file'
51 
52 contactObject = calccontacts.contactProtein(mode)
53 contactObject.initializePDB(pdb)
54 contactObject.find_contacts(parserule)
55 
56 if output in ['list', 'both']:
57  contactObject.outputMap(dest, pdb)
58 if output in ['profile', 'both']:
59  contactObject.initContactProfile()
60  contactObject.outputProfile(dest, pdb)
Fstring::size_type len(Fstring const &s)
Length.
Definition: Fstring.hh:2207