Exemple #1
0
    def test_AmberCrdParser(self):
        """AmberCrdParser test"""

        self.p = AmberCrdParser(self.finp,
                                self.fref,
                                box=True,
                                rnAmber=True,
                                log=self.log,
                                verbose=self.local)
        self.t = self.p.crd2traj()

        self.t.removeAtoms(
            lambda a: a['residue_name'] in ['WAT', 'Na+', 'Cl-'])
        self.t.removeAtoms(lambda a: a['element'] == 'H')

        if self.local:
            print("Dumping result to ", self.fout)

        T.dump(self.t, T.absfile(self.fout))

        if self.local:
            print("Dumped Trajectory with %i frames and %i atoms." % \
                  (len(self.t), self.t.lenAtoms() ))

        self.assertEqual(len(self.t), 10)
        self.assertEqual(self.t.lenAtoms(), 440)
Exemple #2
0
 def dump( self, o ):
     """
     Try to pickle an object to the currently valid path.
     
     :return: the absolute path to which o was pickled
     :rtype: str
     """
     try:
         f = self.local()
         T.dump( f, o )
         return f
     except:
         T.errWriteln("Couldn't dump to %s (constructed from %s)" %\
                      self.formatted(), self.local() )
         raise
Exemple #3
0
 def dump(self, o):
     """
     Try to pickle an object to the currently valid path.
     
     :return: the absolute path to which o was pickled
     :rtype: str
     """
     try:
         f = self.local()
         T.dump(f, o)
         return f
     except:
         T.errWriteln("Couldn't dump to %s (constructed from %s)" %\
                      self.formatted(), self.local() )
         raise
Exemple #4
0
    def test_AmberCrdParser(self):
        """AmberCrdParser test"""
        
        self.p = AmberCrdParser( self.finp, self.fref, box=True, rnAmber=True,
                                 log=self.log, verbose=self.local )
        self.t = self.p.crd2traj()

        self.t.removeAtoms(lambda a: a['residue_name'] in ['WAT','Na+','Cl-'] )
        self.t.removeAtoms(lambda a: a['element'] == 'H' )

        if self.local:
            print("Dumping result to ", self.fout)

        T.dump( self.t, T.absfile(self.fout) )

        if self.local:
            print("Dumped Trajectory with %i frames and %i atoms." % \
                  (len(self.t), self.t.lenAtoms() ))

        self.assertEqual( len(self.t), 10 )
        self.assertEqual( self.t.lenAtoms(), 440 )
Exemple #5
0
#!/usr/bin/env python
## re-generate binary test data in this folder

import biskit as B
import biskit.tools as T
from biskit.md import AmberCrdParser, EnsembleTraj, traj2ensemble

p = AmberCrdParser('raw/traj.crd', 'raw/traj_ref.pdb' )

## create standard trajectory object
t = p.crd2traj()
t.frameNames = T.load('raw/traj_framenames.list')

te = traj2ensemble(t, members=10)
te.fit(fit=0)  ## re-calculate profile 'rms' (all-atom fit to average structure)

T.dump(te, 'traj.dat')


Exemple #6
0
import biskit.tools as T

t = T.load('com_fake.etraj')

x = t.takeFrames(range(0, t.n_members * 5))

x.ref.disconnect()

T.dump(x, 'extract.etraj')
Exemple #7
0
import biskit as B
import biskit.tools as T
import biskit.dock.hexparser as H

rec = B.XplorModel(source='rec/1A2P_clean.pdb',
                   fPsf='1A2P.psf',
                   pdbCode='1A2P')
rec.saveAs('rec/1A2P.model')

rec_dic = {1: rec}
T.dump(rec_dic, 'rec/1A2P_model.dic')

lig = B.XplorModel(source='lig/1A19_clean.pdb',
                   fPsf='1A19.psf',
                   pdbCode='1A19')
lig.saveAs('lig/1A19.model')

lig_dic = {1: lig}
T.dump(lig_dic, 'lig/1A19_model.dic')

## generate complex list from Hex docking result for this rec and lig
h = H.HexParser('hex/1A2P-1A19_hex5.out', rec_dic, lig_dic)
c_lst = h.parseHex()

T.dump(c_lst, 'hex/complexes.cl')
Exemple #8
0
p = AmberCrdParser('rpa_com.crd', '0_com.pdb', box=1)

## create standard trajectory object
com = p.crd2traj()

##com = T.load( 'com.traj' )

# re-order frames into 4 parallel trajectories
frames = N.zeros(len(com), int)

for i in range(11):
    N.put(frames, range(i * 4, i * 4 + 4), N.arange(i, 44, 11))

etraj = EnsembleTraj(n_members=4)
etraj.frames = com.takeFrames(frames).frames
etraj.ref = com.ref
etraj.resetFrameNames()
etraj.ref.disconnect()

# separate protein and DNA into two chains
etraj.ref.chainIndex(breaks=True, force=True, cache=True)
etraj.ref.addChainId()

## extract only some residues for speed
t1 = etraj.takeAtoms(etraj.ref.res2atomIndices(range(10)))
t2 = etraj.takeChains([1])

etraj = t1.concatAtoms(t2)

T.dump(etraj, 'com_fake.etraj')
Exemple #9
0
## MAIN ##

use()

o = T.cmdDict( {'n':10} )

f_in  = T.absfile( o['i'] )
f_out = T.absfile( o.get('o', f_in) )
n = int( o['n'] )

T.flushPrint("Loading...")
t = T.load( f_in )

T.flushPrint("Converting %i frames..." % len(t) )

if isinstance(t, EnsembleTraj ):
    T.flushPrint( "Nothing to be done!\n")
    sys.exit(0)
    
t = traj2ensemble( t, n )
if 'pdb' in o:
    t.ref.pdbCode = o['pdb']

if f_in == f_out:
    os.rename( f_in, f_in + '_backup')

T.flushPrint("Saving...")
T.dump( t, f_out )

T.flushPrint("Done.\n")
Exemple #10
0
#!/usr/bin/env python
## re-generate binary test data in this folder

import biskit as B
import biskit.tools as T
from biskit.md import AmberCrdParser, EnsembleTraj, traj2ensemble

p = AmberCrdParser('raw/traj.crd', 'raw/traj_ref.pdb')

## create standard trajectory object
t = p.crd2traj()
t.frameNames = T.load('raw/traj_framenames.list')

te = traj2ensemble(t, members=10)
te.fit(
    fit=0)  ## re-calculate profile 'rms' (all-atom fit to average structure)

T.dump(te, 'traj.dat')
Exemple #11
0
#!/usr/bin/env python
## re-generate binary test data in this folder

import biskit as B
import biskit.tools as T

m1 = B.PDBModel('raw/rec.pdb')
m1.saveAs('rec.model')

m2 = B.PDBModel('raw/lig.pdb')
m2.saveAs('lig.model')

## not tested
import biskit.dock as D

com = D.Complex(m1, m2)
T.dump(com, 'ref.complex')
Exemple #12
0
p = AmberCrdParser('rpa_com.crd', '0_com.pdb', box=1 )

## create standard trajectory object
com = p.crd2traj()

##com = T.load( 'com.traj' )

# re-order frames into 4 parallel trajectories
frames = N.zeros( len(com), int )

for i in range( 11 ):
    N.put( frames, range(i*4,i*4+4), N.arange(i,44,11) )

etraj = EnsembleTraj( n_members=4 )
etraj.frames = com.takeFrames( frames ).frames
etraj.ref = com.ref
etraj.resetFrameNames()
etraj.ref.disconnect()

# separate protein and DNA into two chains
etraj.ref.chainIndex(breaks=True, force=True, cache=True)
etraj.ref.addChainId()

## extract only some residues for speed
t1 = etraj.takeAtoms( etraj.ref.res2atomIndices(range(10)) )
t2 = etraj.takeChains( [1] )

etraj = t1.concatAtoms( t2 )

T.dump( etraj, 'com_fake.etraj' )
Exemple #13
0
import biskit.tools as T

t = T.load( 'com_fake.etraj' )

x = t.takeFrames( range(0, t.n_members * 5) )

x.ref.disconnect()

T.dump( x, 'extract.etraj' )