Beispiel #1
0
def makeChainCopy(chain):
  """Descrn: Make a duplicate of a molSystem chain, using the same underlying molecule
     Inputs: Ccp.MolSystem.Chain
     Output: Ccp.MolSystem.Chain
  """

  code = nextChainCode(chain.molSystem)
  newChain = MolSystem.Chain(chain.molSystem, code=code, molecule=chain.molecule)
  newChain.setDetails(chain.details)
  
  return newChain
Beispiel #2
0
def deleteChainFragment(chainFragment):
    """Descrn: Remove a molSystem chain fragment by recreating the parent chain with fewer residues
     Inputs: Ccp.MolSystem.ChainFragment
     Output: None
  """

    # delete residues, molResidues, molResLinks and anything else?
    chain = chainFragment.chain
    code = chain.code
    molecule = chain.molecule
    details = chain.details
    molSystem = chain.molSystem
    molResidues = [r.molResidue for r in chainFragment.residues]
    chain.delete()

    for molResidue in molResidues:
        for linkEnd in molResidue.molResLinkEnds:
            if linkEnd.molResLink:
                linkEnd.molResLink.delete()
        molResidue.delete()

    chain = MolSystem.Chain(molSystem, code=code, molecule=molecule)
    chain.setDetails(details)
Beispiel #3
0
def makeChain(molSystem,molecule,code=None):
  """Descrn: Make a molSystem chain based upon an input molecule template
     Inputs: Ccp.MolSystem.MolSystem, Ccp.Molecule.Molecule, Word
     Output: Ccp.MolSystem.Chain
  """

  if code is None:
    code = nextChainCode(molSystem)
  
  chain = MolSystem.Chain(molSystem, code=code, molecule=molecule)
    
  if len(molecule.molResidues) == 1:
    details = molecule.findFirstMolResidue().chemComp.name
  else:
    details = molecule.seqString
  
  if details:
    if len(details) > 10:
      details = details[:10] + '...'
 
    chain.setDetails(details)
  
  return chain
Beispiel #4
0
    #
    # Now that the Molecule information is set, creation a molecular system with chains
    # is very straightforward. All the residue and atom information for these chains is
    # taken from the reference Molecule and ChemComp information and set automatically...
    #

    molSystem = MolSystem.MolSystem(project,
                                    code='myMolecularSystemCode',
                                    name='My molecular system name')

    #
    # Now create a homodimer - two chains referring to the same Molecule
    #

    chainA = MolSystem.Chain(molSystem, code='A', molecule=molecule)
    chainB = MolSystem.Chain(molSystem, code='B', molecule=molecule)

    #
    # Now we can navigate the system... you can also go back to all the reference information to
    # get info on bonds, angles, ... . Refer to the CCPN data model documentation to see which
    # attributes and links you can access from here. For example for residues, see:
    #
    # http://www.ccpn.ac.uk/ccpnmr/ccpnmr/python/ccp/api/doc/MolSystem/Residue/index.html
    #
    # (or even better the local html files that come with the distribution)
    #

    for residue in chainA.residues:
        print residue.ccpCode, residue.seqCode
        print "  ",