Ejemplo n.º 1
0
    def parseReference(self, fpdb, dry_out=None):
        flushPrint("parsing " + fpdb + "...")
        m = PDBModel(fpdb)

        solute_res = m.atom2resMask(logical_not(m.maskSolvent()))
        self.lenres = self.lenres or sum(solute_res)
        self.lenatoms = len(m) - sum(m.maskH2O())

        if dry_out:
            m.remove(m.maskH2O())
            m.writePdb(dry_out)
        flushPrint('done.\n')
Ejemplo n.º 2
0
    def parseReference(self, fpdb, dry_out=None ):
        flushPrint("parsing "+fpdb+"...")
        m = PDBModel( fpdb )
        
        solute_res = m.atom2resMask( logical_not( m.maskSolvent() )  )
        self.lenres = self.lenres or sum( solute_res )
        self.lenatoms = len( m ) - sum( m.maskH2O() )

        if dry_out:
            m.remove( m.maskH2O() )
            m.writePdb( dry_out )
        flushPrint('done.\n')
Ejemplo n.º 3
0
class Test(BT.BiskitTest):
    """Test class"""
    def test_reduce(self):
        """AtomCharger test"""
        if self.local: self.log.add('\nLoading PDB...')

        self.m1 = PDBModel(T.testRoot('lig/1A19_dry.model'))
        self.m2 = T.load(T.testRoot('com/ref.complex'))
        self.m2 = self.m2.model()

        if self.local: self.log.add('\nRunning Reduce...')
        self.x = Reduce(self.m1,
                        debug=self.DEBUG,
                        verbose=self.local,
                        log=self.log,
                        autocap=True)
        self.m1 = self.x.run()

        if self.local:
            self.log.add('\nReduce protein complex')
        self.x = Reduce(self.m2,
                        debug=self.DEBUG,
                        verbose=self.local,
                        log=self.log,
                        autocap=True)
        self.m2 = self.x.run()

        if self.local:
            self.log.add('\nSetup Residue Library\n')

        ac = AtomCharger(log=self.log, verbose=self.local)

        if self.local:
            self.log.add('match residues to Amber topology')

        ac.charge(self.m1)
        ac.charge(self.m2)

        self.assertAlmostEqual(N.sum(self.m1['partial_charge']), -6, 2)
        self.assertAlmostEqual(N.sum(self.m2['partial_charge']), -4, 2)
        self.assert_(N.all(self.m1['partial_charge'] != 0),
                     'unmatched atoms 1')
        self.assert_(N.all(self.m2['partial_charge'] != 0),
                     'unmatched atoms 2')

        if self.local:
            self.log.add('\nNow test handling of atom miss-matches:\n')

        self.m3 = PDBModel(self.m1.clone())
        self.m3.remove([0, 3, 100, 101, 102, 200])
        ac.charge(self.m3)

        self.assertAlmostEqual(N.sum(self.m3['partial_charge']), -8.21, 2)
Ejemplo n.º 4
0
class Test(BT.BiskitTest):
    """Test class"""

    def test_reduce( self ):
        """AtomCharger test"""
        if self.local: self.log.add('\nLoading PDB...')

        self.m1 = PDBModel( T.testRoot( 'lig/1A19_dry.model' ) )
        self.m2 = T.load( T.testRoot( 'com/ref.complex' ) )
        self.m2 = self.m2.model()

        if self.local: self.log.add('\nRunning Reduce...')
        self.x = Reduce( self.m1, debug=self.DEBUG, verbose=self.local,
                         log=self.log,
                         autocap=True )
        self.m1 = self.x.run()

        if self.local:
            self.log.add('\nReduce protein complex')
        self.x = Reduce( self.m2, debug=self.DEBUG, verbose=self.local,
                         log=self.log,
                         autocap=True )
        self.m2 = self.x.run()
        
        if self.local:
            self.log.add('\nSetup Residue Library\n')
        
        ac = AtomCharger(log=self.log, verbose=self.local)
        
        if self.local:
            self.log.add('match residues to Amber topology')
        
        ac.charge( self.m1 )
        ac.charge( self.m2 )

        self.assertAlmostEqual( N.sum(self.m1['partial_charge']), -6, 2 )
        self.assertAlmostEqual( N.sum(self.m2['partial_charge']), -4, 2 )
        self.assert_(N.all(self.m1['partial_charge'] != 0),'unmatched atoms 1')
        self.assert_(N.all(self.m2['partial_charge'] != 0),'unmatched atoms 2')

        if self.local:
            self.log.add('\nNow test handling of atom miss-matches:\n')
        
        self.m3 = PDBModel(self.m1.clone())
        self.m3.remove( [0,3,100,101,102,200] )
        ac.charge( self.m3 )
        
        self.assertAlmostEqual( N.sum(self.m3['partial_charge']),-8.21, 2)
Ejemplo n.º 5
0
    errWriteln("loading pdbs...")

    m1 = PDBModel(f1)
    m2 = PDBModel(f2)

    if options.has_key('c1'):
        m1 = m1.takeChains(toIntList(options['c1']))

    if options.has_key('c2'):
        m2 = m2.takeChains(toIntList(options['c2']))

    m1.removeRes('TIP3')
    m2.removeRes('TIP3')

    m1.sort()
    m2.sort()

    errWriteln("compare atoms of pdbs...")
    mask1, mask2 = m1.equalAtoms(m2)

    errWriteln("removing %i atoms from %s" % (sum(logical_not(mask1)), f1))
    m1.remove(logical_not(mask1))

    errWriteln("removing %i atoms from %s" % (sum(logical_not(mask2)), f2))
    m2.remove(logical_not(mask2))

    errWriteln("writing new pdbs...")
    m1.writePdb(o1)
    m2.writePdb(o2)
Ejemplo n.º 6
0
        
    sys.exit(0)

### MAIN ###
############

options = T.cmdDict( {'o':'ref.complex', 'lo':'lig.model', 'ro':'rec.model' } )

if len (sys.argv) < 3:
    _use( options )

## create a reference complex
print "Loading..."
ref_com =  PDBModel( options['c'] )
print "Removing water..."
ref_com.remove( lambda a: a['residue_name'] in ['TIP3','HOH','WAT'] )

## extract rec and lig chains
rec_chains = T.toIntList( options['r'] )
lig_chains = T.toIntList( options['l'] )

print "Extracting rec and lig..."
ref_rec = ref_com.takeChains( rec_chains )
ref_lig = ref_com.takeChains( lig_chains )

## create Protein complex
com = ProteinComplex( ref_rec, ref_lig )

print "Saving..."
ref_lig.saveAs( T.absfile( options['lo'] ) )
Ejemplo n.º 7
0
    errWriteln("loading pdbs...")
    
    m1 = PDBModel( f1 )
    m2 = PDBModel( f2 )

    if options.has_key('c1'):
        m1 = m1.takeChains( toIntList( options['c1'] ) )

    if options.has_key('c2'):
        m2 = m2.takeChains( toIntList( options['c2'] ) )

    m1.removeRes( 'TIP3' )
    m2.removeRes( 'TIP3' )

    m1.sort()
    m2.sort()

    errWriteln("compare atoms of pdbs...")
    mask1, mask2 = m1.equalAtoms( m2 )

    errWriteln("removing %i atoms from %s" % (sum( logical_not( mask1 ) ), f1))
    m1.remove( logical_not( mask1 ) )
    
    errWriteln("removing %i atoms from %s" % (sum( logical_not( mask2 ) ), f2))
    m2.remove( logical_not( mask2 ) )

    errWriteln("writing new pdbs..." )
    m1.writePdb( o1 )
    m2.writePdb( o2 )