Example #1
0
class Test(BT.BiskitTest):
    """Test AmberParmBuilder"""

    TAGS = [BT.EXE]

    def prepare(self):
        root = T.testRoot() + '/amber/'
        self.ref = PDBModel(T.testRoot() + '/amber/1HPT_0.pdb')
        self.refdry = root + '1HPT_0dry.pdb'

        self.dryparm = tempfile.mktemp('.parm', 'dry_')
        self.drycrd = tempfile.mktemp('.crd', 'dry_')
        self.drypdb = tempfile.mktemp('.pdb', 'dry_')
        self.wetparm = tempfile.mktemp('.parm', 'wet_')
        self.wetcrd = tempfile.mktemp('.crd', 'wet_')
        self.wetpdb = tempfile.mktemp('.pdb', 'wet_')
        self.leapout = tempfile.mktemp('.out', 'leap_')

    def cleanUp(self):
        if not self.DEBUG:
            T.tryRemove(self.dryparm)
            T.tryRemove(self.drycrd)
            T.tryRemove(self.drypdb)
            T.tryRemove(self.wetparm)
            T.tryRemove(self.wetcrd)
            T.tryRemove(self.wetpdb)
            T.tryRemove(self.leapout)

    def test_AmberParmMirror(self):
        """AmberParmBuilder.parmMirror test"""
        ref = self.ref
        mask = N.logical_not(ref.maskH2O())  ## keep protein and Na+ ion
        self.mdry = ref.compress(mask)

        self.a = AmberParmBuilder(self.mdry,
                                  verbose=self.local,
                                  leap_out=self.leapout,
                                  debug=self.DEBUG)

        self.a.parmMirror(f_out=self.dryparm, f_out_crd=self.drycrd)

        self.a.parm2pdb(self.dryparm, self.drycrd, self.drypdb)

        self.m1 = PDBModel(self.drypdb)
        self.m2 = PDBModel(self.refdry)

        eq = N.array(self.m1.xyz == self.m2.xyz)
        self.assert_(eq.all())

    def test_AmberParmSolvated(self):
        """AmberParmBuilder.parmSolvated test"""
        ## remove waters and hydrogens
        self.mdry = self.ref.compress(self.ref.maskProtein())
        self.mdry = self.mdry.compress(self.mdry.maskHeavy())

        self.a = AmberParmBuilder(self.mdry,
                                  leap_out=self.leapout,
                                  verbose=self.local,
                                  debug=self.DEBUG)

        self.a.parmSolvated(self.wetparm,
                            f_out_crd=self.wetcrd,
                            f_out_pdb=self.wetpdb,
                            box=2.5)

        self.m3 = PDBModel(self.wetpdb)

        m3prot = self.m3.compress(self.m3.maskProtein())
        refprot = self.ref.compress(self.ref.maskProtein())
        refprot.xplor2amber()

        self.assertEqual(self.ref.lenChains(), self.m3.lenChains())
        self.assertEqual(refprot.atomNames(), m3prot.atomNames())

    def test_capIrregular(self):
        """AmberParmBuilder.capNME & capACE test"""
        gfp = PDBModel('1GFL')
        normal = gfp.takeResidues([10, 11])
        chromo = gfp.takeResidues([64, 65])

        self.a = AmberParmBuilder(normal)
        self.m4 = self.a.capACE(normal, 0)

        self.assertEqual(len(self.m4), 17)

        ##        del chromo.residues['biomol']

        self.m5 = self.a.capACE(chromo, 0)
        self.m5 = self.a.capNME(self.m5, 0)

        self.assertEqual(self.m5.sequence(), 'XSYX')
Example #2
0
class Test( BT.BiskitTest ):
    """Test AmberParmBuilder"""

    TAGS = [ BT.EXE ]

    def prepare(self):
        root = T.testRoot() + '/amber/'
        self.ref = PDBModel( T.testRoot() + '/amber/1HPT_0.pdb')
        self.refdry = root + '1HPT_0dry.pdb'

        self.dryparm = tempfile.mktemp('.parm', 'dry_')
        self.drycrd  = tempfile.mktemp('.crd', 'dry_')
        self.drypdb  = tempfile.mktemp('.pdb', 'dry_')
        self.wetparm = tempfile.mktemp('.parm', 'wet_')
        self.wetcrd  = tempfile.mktemp('.crd', 'wet_')
        self.wetpdb  = tempfile.mktemp('.pdb', 'wet_')
        self.leapout = tempfile.mktemp('.out', 'leap_')

    def cleanUp(self):
        if not self.DEBUG:
            T.tryRemove( self.dryparm )
            T.tryRemove( self.drycrd )
            T.tryRemove( self.drypdb )
            T.tryRemove( self.wetparm )
            T.tryRemove( self.wetcrd )
            T.tryRemove( self.wetpdb )
            T.tryRemove( self.leapout )
        

    def test_AmberParmMirror(self):
        """AmberParmBuilder.parmMirror test"""
        ref = self.ref
        mask = N.logical_not( ref.maskH2O() ) ## keep protein and Na+ ion
        self.mdry = ref.compress( mask )

        self.a = AmberParmBuilder( self.mdry, verbose=self.local,
                                   leap_out=self.leapout,
                                   debug=self.DEBUG )

        self.a.parmMirror(f_out=self.dryparm,
                          f_out_crd=self.drycrd )

        self.a.parm2pdb( self.dryparm, self.drycrd, self.drypdb )

        self.m1 = PDBModel(self.drypdb)
        self.m2 = PDBModel(self.refdry)

        eq = N.array( self.m1.xyz == self.m2.xyz )
        self.assert_( eq.all() )


    def test_AmberParmSolvated( self ):
        """AmberParmBuilder.parmSolvated test"""
        ## remove waters and hydrogens
        self.mdry = self.ref.compress( self.ref.maskProtein() )
        self.mdry = self.mdry.compress( self.mdry.maskHeavy() )

        self.a = AmberParmBuilder( self.mdry,
                                   leap_out=self.leapout,
                                   verbose=self.local, debug=self.DEBUG)

        self.a.parmSolvated( self.wetparm, f_out_crd=self.wetcrd,
                             f_out_pdb=self.wetpdb,
                             box=2.5 )

        self.m3 = PDBModel( self.wetpdb )

        m3prot = self.m3.compress( self.m3.maskProtein() )
        refprot= self.ref.compress( self.ref.maskProtein() )
        refprot.xplor2amber()
        
        self.assertEqual( self.ref.lenChains(), self.m3.lenChains() )
        self.assertEqual( refprot.atomNames(), m3prot.atomNames() )


    def test_capIrregular( self ):
        """AmberParmBuilder.capNME & capACE test"""
        gfp = PDBModel('1GFL')
        normal = gfp.takeResidues([10,11])
        chromo = gfp.takeResidues([64,65])

        self.a = AmberParmBuilder( normal )
        self.m4 = self.a.capACE( normal, 0 )

        self.assertEqual( len(self.m4), 17 )
        
##        del chromo.residues['biomol']

        self.m5 = self.a.capACE( chromo, 0 )
        self.m5 = self.a.capNME( self.m5, 0 )
        
        self.assertEqual( self.m5.sequence(), 'XSYX' )
Example #3
0
class Test(BT.BiskitTest):
    """Test AmberParmBuilder"""

    TAGS = [BT.EXE]

    def prepare(self):
        root = T.testRoot() + '/amber/'
        self.ref = PDBModel(T.testRoot() + '/amber/1HPT_0.pdb')
        self.refdry = root + '1HPT_0dry.pdb'

        self.dryparm = tempfile.mktemp('.parm', 'dry_')
        self.drycrd = tempfile.mktemp('.crd', 'dry_')
        self.drypdb = tempfile.mktemp('.pdb', 'dry_')
        self.wetparm = tempfile.mktemp('.parm', 'wet_')
        self.wetcrd = tempfile.mktemp('.crd', 'wet_')
        self.wetpdb = tempfile.mktemp('.pdb', 'wet_')
        self.leapout = tempfile.mktemp('.out', 'leap_')

    def cleanUp(self):
        if not self.DEBUG:
            T.tryRemove(self.dryparm)
            T.tryRemove(self.drycrd)
            T.tryRemove(self.drypdb)
            T.tryRemove(self.wetparm)
            T.tryRemove(self.wetcrd)
            T.tryRemove(self.wetpdb)
            T.tryRemove(self.leapout)

    def test_AmberParmMirror(self):
        """AmberParmBuilder.parmMirror test"""
        ref = self.ref
        mask = N0.logical_not(ref.maskH2O())  ## keep protein and Na+ ion
        self.mdry = ref.compress(mask)

        self.a = AmberParmBuilder(self.mdry,
                                  verbose=self.local,
                                  leap_out=self.leapout,
                                  debug=self.DEBUG)

        self.a.parmMirror(f_out=self.dryparm, f_out_crd=self.drycrd)

        self.a.parm2pdb(self.dryparm, self.drycrd, self.drypdb)

        self.m1 = PDBModel(self.drypdb)
        self.m2 = PDBModel(self.refdry)

        eq = N0.array(self.m1.xyz == self.m2.xyz)
        self.assert_(eq.all())

    def test_AmberParmSolvated(self):
        """AmberParmBuilder.parmSolvated test"""
        ## remove waters and hydrogens
        self.mdry = self.ref.compress(self.ref.maskProtein())
        self.mdry = self.mdry.compress(self.mdry.maskHeavy())

        self.a = AmberParmBuilder(self.mdry,
                                  leap_out=self.leapout,
                                  verbose=self.local,
                                  debug=self.DEBUG)

        self.a.parmSolvated(self.wetparm,
                            f_out_crd=self.wetcrd,
                            f_out_pdb=self.wetpdb,
                            box=2.5)

        self.m3 = PDBModel(self.wetpdb)

        m3prot = self.m3.compress(self.m3.maskProtein())
        refprot = self.ref.compress(self.ref.maskProtein())
        refprot.xplor2amber()

        self.assertEqual(self.ref.lenChains(), self.m3.lenChains())
        self.assertEqual(refprot.atomNames(), m3prot.atomNames())