File: assignNMRShifts.py

package info (click to toggle)
ball 1.5.0%2Bgit20180813.37fc53c-11
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 239,924 kB
  • sloc: cpp: 326,149; ansic: 4,208; python: 2,303; yacc: 1,778; lex: 1,099; xml: 958; sh: 322; javascript: 164; makefile: 88
file content (63 lines) | stat: -rw-r--r-- 1,924 bytes parent folder | download | duplicates (8)
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#
# Anna Dehof 2010-09-15
#   read a NMR and assign the shifts to a proteins' atoms
#
import sys
from BALL import *

#### for use in BALLView
#system = getSystems()[0]

#### for command line use	
# issue a usage hint if called without parameters
#if (len(sys.argv) != 3 ):
#  print"Usage: ", sys.argv[0] , "<NMR file> <PDB file>" 
#  exit()

# read the NMRStar file
nmr_file = NMRStarFile("../../../TEST/data/NMRStarFile_test_1z0r.bmr", File.MODE_IN)
#nmr_file = NMRStarFile(sys.argv[1], File.MODE_IN)
if not nmr_file:
  print "Could not open given file, aborting"
  exit(-1)

print "File contains ", nmr_file.getNumberOfAtoms(), " chemcial shifts"

# read the corresponding PDB file
p = PDBFile("../../../TEST/data/NMRStarFile_test_1z0r.pdb", File.MODE_IN)
#p = PDBFile(sys.argv[2], File.MODE_IN)
if not p:
  print "Could not open given file, aborting"
  exit(-1)

S = System()
p.read(S)

# get the sequences to compute an alignment
print Peptides.GetSequence(chains(S)[0])
print nmr_file.getResidueSequence(0)

# get a chemical unit of this file
chem_unit = nmr_file.getMolecularInformation().getChemicalUnit(0).label 
print "Label of chemical unit: ", chem_unit
print "Molecular systems name: ", nmr_file.getMolecularInformation().system_name

# create a mapping based on an alignment
mapper = NMRStarFile.BALLToBMRBMapper(chains(S)[0], nmr_file, chem_unit)
mapper.createMapping("MKSTGIVRKVDELGR-VVIPIELRRTLGIAEKDALEIYVDDEKIILKKYKPNMT", "MKSTGIVRKVDELGRVV-IPIELRRTLGIAEKDALEIYVDDEKIILKKYKPNMT")

print "Number of mismatches: ", mapper.getNumberOfMismatches()
print "Number of gaps: ", mapper.getNumberOfGaps()

# assign the shifts
nmr_file.assignShifts(mapper)

# get some print outs
for a in atoms(S):
  if a.hasProperty("ExperimentalChemicalShift"):
#    print a.getProperty("ExperimentalChemicalShift").getFloat()
    print a.getProperty(ShiftModule.PROPERTY__EXPERIMENTAL__SHIFT).getFloat()

p.close()

# we are done