def __ssBonds( self, model, cutoff=4. ): """ Identify disulfide bonds. @param model: model @type model: PDBModel @param cutoff: distance cutoff for S-S distance (default: 4.0) @type cutoff: float @return: list with numbers of residue pairs forming S-S @rtype: [(int, int)] """ m = model.compress( model.mask( ['SG'] ) ) if len( m ) < 2: return [] pw = MU.pairwiseDistances( m.xyz, m.xyz ) pw = N.less( pw, cutoff ) r = [] for i in range( len( pw ) ): for j in range( i+1, len(pw) ): if pw[i,j]: r += [ (m.atoms['residue_number'][i], m.atoms['residue_number'][j]) ] return r
def __ssBonds(self, model, cutoff=4.): """ Identify disulfide bonds. @param model: model @type model: PDBModel @param cutoff: distance cutoff for S-S distance (default: 4.0) @type cutoff: float @return: list with numbers of residue pairs forming S-S @rtype: [(int, int)] """ m = model.compress(model.mask(['SG'])) if len(m) < 2: return [] pw = MU.pairwiseDistances(m.xyz, m.xyz) pw = N.less(pw, cutoff) r = [] for i in range(len(pw)): for j in range(i + 1, len(pw)): if pw[i, j]: r += [(m.atoms['residue_number'][i], m.atoms['residue_number'][j])] return r
def getSS( model, cutoff=4.0 ): cys_mask = model.mask( lambda a: a['residue_name'] in ['CYS', 'CYX']\ and a['name'] == 'SG') model = model.compress( cys_mask ) diff = MU.pairwiseDistances( model.xyz, model.xyz ) count = N.sum( N.sum( N.less( diff, cutoff ) ) ) - model.lenAtoms() return count / 2
def getSS(model, cutoff=4.0): cys_mask = model.mask( lambda a: a['residue_name'] in ['CYS', 'CYX']\ and a['name'] == 'SG') model = model.compress(cys_mask) diff = MU.pairwiseDistances(model.xyz, model.xyz) count = N.sum(N.sum(N.less(diff, cutoff))) - model.lenAtoms() return count / 2
## extract single copy m0.report() m = m0.takeChains( [0, 2, 3 ] ) ## quick and dirty 2D-view # G.plot( zip( m.xyz[:,0], m.xyz[:,1] ) ) m.gnuplot() m0.report( plot=1 ) #------------------------------------- ## distance/contact matrix import Biskit.mathUtils as MU pw = MU.pairwiseDistances( m.xyz, m.xyz ) ## nicer graphics with Matrixplot p = MatrixPlot( pw, step=25 ) p.show() ## simple binary contact plot with gnuplot ## cont = pw * N.less( pw, 10 ) cont = N.less( pw, 10 ) G.scatter( zip( *N.nonzero( cont ) ) ) # ## inter-molecular contacts only #