Esempio n. 1
0
def genPhiPsi(fileName):
    struc = getStructuresFromFile(fileName)[0]

    phiList = []
    psiList = []
    for chain in struc.chains:
        for residue in chain.residues[1:-1]:
            phi, psi = getPhiPsi(residue)
            phiList.append(phi)
            psiList.append(psi)

    return phiList, psiList

if __name__ == '__main__':

    import sys
    import time

    if len(sys.argv) != 3:
        print('need to specify database and PDB file')
        sys.exit(1)

    database = sys.argv[1]
    pdbFile = sys.argv[2]

    from Modelling import getStructuresFromFile
    structures = getStructuresFromFile(pdbFile)

    import MySQLdb
    import getpass
    user = getpass.getuser()
    pwd = getpass.getpass()
    connection = MySQLdb.connect(db=database, user=user, passwd=pwd)

    t0 = time.time()

    try:
        for structure in structures:
            addStructureToDb3(connection, structure)
    finally:
        connection.close()
Esempio n. 3
0
    raise e # re-raise original exception

if __name__ == '__main__':

  import sys
  import time

  if len(sys.argv) != 3:
    print('need to specify database and PDB file')
    sys.exit(1)

  database = sys.argv[1]
  pdbFile = sys.argv[2]

  from Modelling import getStructuresFromFile
  structures = getStructuresFromFile(pdbFile)

  import MySQLdb
  import getpass
  user = getpass.getuser()
  pwd = getpass.getpass()
  connection = MySQLdb.connect(db=database, user=user, passwd=pwd)
  placeHolder = '%s'

  t0 = time.time()

  try:
    for structure in structures:
      addStructureToDb(connection, structure, placeHolder)
  finally:
    connection.close()
Esempio n. 4
0
    boolArray = sumSquares < limit2
    indices = boolArray.nonzero()[0]

    closeAtoms = [atoms[i] for i in indices]

    return closeAtoms


if __name__ == '__main__':

    print('\nGet a PDB file')

    fileName = 'examples/1A12.pdb'

    print('\nMake structure object')
    strucObjs = getStructuresFromFile(fileName)

    print('\nGet centre of mass')
    struc = getStructuresFromFile(fileName)[0]
    print(getCenterOfMass(struc))

    print('\nStructure tranformations')
    rotateStructure(struc, (0, 1, 0), pi / 2)

    rotateStructureNumPy(struc, (0, 1, 0), pi / 2)

    mirrorTransform = array([[-1, 0, 0], [0, -1, 0], [0, 0, -1]])

    translate = array([10.0, 10.0, 0.0])

    affineTransformStructure(struc, mirrorTransform, translate)
Esempio n. 5
0
try:
    from urllib.request import urlopen
except ImportError:
    from urllib2 import urlopen

PDB_URL = 'http://www.rcsb.org/pdb/cgi/export.cgi/' \
          '%s.pdb?format=PDB&compression=None'


def downloadPDB(pdbId, fileName=None):
    if not fileName:
        fileName = '%s.pdb' % pdbId

    response = urlopen(PDB_URL % pdbId)
    data = response.read().decode('utf-8')

    fileObj = open(fileName, 'w')
    fileObj.write(data)
    fileObj.close()


downloadPDB('1A12')

from Modelling import getStructuresFromFile
strucObjs = getStructuresFromFile(fileName)
Esempio n. 6
0
  boolArray = sumSquares < limit2
  indices = boolArray.nonzero()[0]
  
  closeAtoms = [atoms[i] for i in indices]
   
  return closeAtoms


if __name__ == '__main__':

  print('\nGet a PDB file')

  fileName = 'examples/1A12.pdb'

  print('\nMake structure object')
  strucObjs = getStructuresFromFile(fileName)

  print('\nGet centre of mass')
  struc = getStructuresFromFile(fileName)[0]
  print(getCenterOfMass(struc))

  print('\nStructure tranformations')
  rotateStructure(struc, (0,1,0), pi/2)

  rotateStructureNumPy(struc, (0,1,0), pi/2)

  mirrorTransform = array([[-1,0,0], [0,-1,0], [0,0,-1]])

  translate = array([10.0,10.0,0.0])

  affineTransformStructure(struc, mirrorTransform, translate)