Exemplo n.º 1
0
def makePolymerMultiSys(Seq, cfg, NSys=None, MasterPrefix=None, TempSet=None):
    print Preamble()
    # parse all lists
    if NSys is None: NSys = len(Seq)
    else:
        if not isinstance(Seq, list):
            Seq = [Seq] * NSys
    if not isinstance(cfg, list): cfg = [cfg] * NSys
    if not isinstance(TempSet, list):
        if TempSet is None: TempSet = [RoomTemp] * NSys
        else: TempSet = [TempSet] * NSys
    # ensure that sidechains are referenced according to residue name
    for i in range(NSys):
        cfg[i].SSRefType = 'name'
    print 'Creating %d-system polymer ensemble...' % NSys
    # create the systems
    pList = []
    SysList = []
    for i in range(NSys):
        print '\nENSEMBLE SYSTEM: %d' % i
        print '==================='
        # set Prefix
        Prefix = MasterPrefix + '_%d' % i
        # create system topology
        p = topo.ProteinNCOS(Seq=Seq[i], cfg=cfg[i], Prefix=Prefix)
        pList.append(p)
        # create Sys object
        Sys = topo.MakeSys(p=p, cfg=cfg[i])
        ff = []
        # create backbone potentials
        BB = bb.P_Backbone(p, Sys, cfg=cfg[i])
        ff.extend(BB.BB_0())
        # create backbone-sidechain potentials
        BB_S = bb_s.P_Backbone_Sidechain(p, Sys, cfg=cfg[i])
        # 1-alphabet bonded potentials
        if cfg[i].Bonded_NCOSType == 0:
            print 'ERROR: Multi-alphabet models not implemented yet'
            exit()
        if cfg[i].Bonded_NCOSType == 1: ff.extend(BB_S.BB_S_Bonded_1())
        # 1-alphabet or constant repulsive nonbonded potentials
        if cfg[i].NCOSType == 0:
            print 'ERROR: Multi-alphabet models not implemented yet'
            exit()
        if cfg[i].NCOSType == 1: ff.extend(BB_S.BB_S_1())
        if cfg[i].NCOSType == 2: ff.extend(BB_S.BB_S_2())
        # create sidechain-sidechain potentials (1-alphabet)
        SS = ss.P_Sidechain(p, Sys, cfg[i])
        ff.extend(SS.SS_1())
        # populate forcefield
        Sys.ForceField.extend(ff)
        # set up other system properties
        PrepSys(Sys, TempSet=TempSet[i])
        SysList.append(Sys)
    # compile
    if Verbose: print '\nCompiling extended ensemble model...'
    for i, Sys in enumerate(SysList):
        print '\nSystem: %d' % i
        Sys.Load()
    return pList, SysList
Exemplo n.º 2
0
def makeMJGoSys(NativePdb, cfg, Prefix=None, TempSet=RoomTemp, Sigma=None):
    print Preamble()
    # ensure that sidechains are referenced according to residue number
    cfg.SSRefType = 'number'
    # create system topology
    p = topo.ProteinNCOS(Pdb=NativePdb, cfg=cfg, Prefix=Prefix)
    # parse native struct for native contacts in given pdb
    print '\n'
    ContactDict = ps.ParsePdb(p)
    # create Sys object
    print '\n'
    Sys = topo.MakeSys(p=p, cfg=cfg)
    ff = []
    # create backbone potentials
    BB = bb.P_Backbone(p, Sys, cfg=cfg)
    print '\n'
    ff.extend(BB.BB_0())
    # create backbone-sidechain potentials
    BB_S = bb_s.P_Backbone_Sidechain(p, Sys, cfg=cfg)
    # 1-alphabet bonded potentials
    print '\n'
    if cfg.Bonded_NCOSType == 0:
        print 'Multi-alphabet models not implemented yet'
        exit()
    if cfg.Bonded_NCOSType == 1: ff.extend(BB_S.BB_S_Bonded_1())
    # 1-alphabet or constant repulsive nonbonded potentials
    print '\n'
    if cfg.NCOSType == 0:
        print 'Multi-alphabet models not implemented yet'
        exit()
    if cfg.NCOSType == 1: ff.extend(BB_S.BB_S_1())
    if cfg.NCOSType == 2: ff.extend(BB_S.BB_S_2())
    # create sidechain-sidechain potentials
    print '\n'
    SS = ss.P_Sidechain(p, Sys, cfg=cfg, ContactDict=ContactDict)
    # native contacts
    print '\n'
    ff.extend(SS.Go_native_MJ(Cut=cfg.NativeCut, Sigma=Sigma))
    # non-native contacts
    # Note: the non-native cutoff needs to be supplied carefully to be compatible
    # as a WCA with the supplied sigma
    print '\n'
    if not cfg.NonNativeType == -1:
        cfg.NonNativeType = 0
        ff.extend(SS.Go_nonnative_0())
    # populate forcefield
    Sys.ForceField.extend(ff)
    # set up other system properties
    PrepSys(Sys, TempSet=TempSet)
    # compile
    if Verbose: print '\nCompiling model...'
    Sys.Load()
    return p, Sys
Exemplo n.º 3
0
def makePolymerSys(Seq, cfg, Prefix=None, TempSet=RoomTemp, NChains=1):
    print Preamble()
    # create system topology
    print '\n'
    p = topo.ProteinNCOS(Seq=Seq, cfg=cfg, Prefix=Prefix)
    # ensure that siechains are referenced according to residue name
    cfg.SSRefType = 'name'
    print '\n'
    Sys = topo.MakeSys(p=p, cfg=cfg, NChains=NChains)
    ff = []
    # create backbone potentials
    BB = bb.P_Backbone(p, Sys, cfg)
    print '\n'
    ff.extend(BB.BB_0())
    # create backbone-sidechain potentials
    BB_S = bb_s.P_Backbone_Sidechain(p, Sys, cfg)
    # 1-alphabet bonded potentials
    print '\n'
    if cfg.Bonded_NCOSType == 0:
        print 'Error: Multi-alphabet models not implemented yet'
        exit()
    if cfg.Bonded_NCOSType == 1: ff.extend(BB_S.BB_S_Bonded_1())
    # 1-alphabet or constant repulsive nonbonded potentials
    print '\n'
    if cfg.NCOSType == 0:
        print 'Error: Multi-alphabet models not implemented yet'
        exit()
    if cfg.NCOSType == 1: ff.extend(BB_S.BB_S_1())
    if cfg.NCOSType == 2: ff.extend(BB_S.BB_S_2())
    # create sidechain-sidechain potentials (1-alphabet)
    SS = ss.P_Sidechain(p, Sys, cfg)
    print '\n'
    ff.extend(SS.SS_1())
    # populate forcefield
    Sys.ForceField.extend(ff)
    # set up other system properties
    PrepSys(Sys, TempSet=TempSet)
    # compile
    if Verbose: print '\nCompiling model...'
    Sys.Load()
    return p, Sys
Exemplo n.º 4
0
def makeSplineGoMultiSys(NativePdb,
                         cfg,
                         NSys=None,
                         MasterPrefix=None,
                         TempSet=None):
    print Preamble()
    # parse all lists
    if NSys is None: NSys = len(NativePdb)
    else:
        if not isinstance(NativePdb, list):
            NativePdb = [NativePdb] * NSys
    if not isinstance(cfg, list): cfg = [cfg] * NSys
    if not isinstance(TempSet, list):
        if TempSet is None: TempSet = [RoomTemp] * NSys
        else: TempSet = [TempSet] * NSys
    # ensure that sidechains are referenced according to residue number
    for i in range(NSys):
        cfg[i].SSRefType = 'number'
    print 'Creating %d-system Go model ensemble...' % NSys
    # create the systems
    pList = []
    SysList = []
    for i in range(NSys):
        print '\nENSEMBLE SYSTEM: %d' % i
        print '==================='
        # set Prefix
        Prefix = MasterPrefix + '_%d' % i
        # create system topology
        p = topo.ProteinNCOS(Pdb=NativePdb[i], cfg=cfg[i], Prefix=Prefix)
        pList.append(p)
        # parse native struct for native contacts in given pdb
        ps.Verbose = False
        ContactDict = ps.ParsePdb(p)
        # create Sys object
        Sys = topo.MakeSys(p=p, cfg=cfg[i])
        ff = []
        # create backbone potentials
        BB = bb.P_Backbone(p, Sys, cfg=cfg[i])
        ff.extend(BB.BB_0())
        # create backbone-sidechain potentials
        BB_S = bb_s.P_Backbone_Sidechain(p, Sys, cfg=cfg[i])
        # 1-alphabet bonded potentials
        if cfg[i].Bonded_NCOSType == 0:
            print 'ERROR: Multi-alphabet models not implemented yet'
            exit()
        if cfg[i].Bonded_NCOSType == 1: ff.extend(BB_S.BB_S_Bonded_1())
        # 1-alphabet or constant repulsive nonbonded potentials
        if cfg[i].NCOSType == 0:
            print 'ERROR: Multi-alphabet models not implemented yet'
            exit()
        if cfg[i].NCOSType == 1: ff.extend(BB_S.BB_S_1())
        if cfg[i].NCOSType == 2: ff.extend(BB_S.BB_S_2())
        # create sidechain-sidechain potentials
        SS = ss.P_Sidechain(p, Sys, cfg=cfg[i], ContactDict=ContactDict)
        # native contacts
        cfg[i].NativeType = 1
        ff.extend(SS.Go_native_1(Cut=cfg[i].NativeCut))
        # non-native contacts
        # Note: the non-native cutoff needs to be supplied carefully to be compatible
        # as a WCA with the supplied sigma
        if not cfg[i].NonNativeType == -1:
            cfg[i].NonNativeType = 0
            ff.extend(SS.Go_nonnative_0())
        # populate forcefield
        Sys.ForceField.extend(ff)
        # set up other system properties
        PrepSys(Sys, TempSet=TempSet[i])
        SysList.append(Sys)
    # compile
    if Verbose: print '\nCompiling extended ensemble model...'
    for i, Sys in enumerate(SysList):
        print '\nSystem: %d' % i
        Sys.Load()
    return pList, SysList
Exemplo n.º 5
0
def makeHarmonicGoSys(NativePdb, cfg, Prefix=None, TempSet=RoomTemp):
    print Preamble()
    # map NativePdb to polymer
    if cfg.Map2Polymer:
        print '\n'
        PdbName = NativePdb.split('/')[-1].split('.pdb')[0]
        AAPdb = os.path.join(NATIVEPATH['Unmapped'], PdbName + '.pdb')
        MappedPdb = mapNCOS.Map2Polymer(Pdb=NativePdb,
                                        PolyName=cfg.PolyName,
                                        AAPdb=AAPdb,
                                        hasPseudoGLY=cfg.hasPseudoGLY())
    # ensure that sidechains are referenced according to residue number
    cfg.SSRefType = 'number'
    # create system topology
    print '\n'
    p = topo.ProteinNCOS(Pdb=NativePdb, cfg=cfg, Prefix=Prefix)
    # parse native struct for native contacts in given pdb
    print '\n'
    ContactDict = ps.ParsePdb(p)
    # using these native contacts get distances between contact sidechains in the polymer-mapped Pdb
    if cfg.Map2Polymer:
        print '\n'
        print 'Repopulating native contact database with intra-sidechain distances from %s mapped sequence' % cfg.PolyName.upper(
        )
        p_Mapped = topo.ProteinNCOS(Pdb=MappedPdb,
                                    cfg=cfg,
                                    Prefix=Prefix +
                                    '_map2%s' % cfg.PolyName.lower())
        MappedContactDict = ps.ParsePdb(
            p_Mapped, ResContactList=ContactDict['ResContactList'])
        ContactDict = MappedContactDict
    # bond sidechains of native contacts for harmonic restraints
    # must be done prior to creating the Sys object
    print '\n'
    p.BondNativeContacts(ContactDict)
    # create Sys object
    print '\n'
    Sys = topo.MakeSys(p=p, cfg=cfg)
    ff = []
    # create backbone potentials
    BB = bb.P_Backbone(p, Sys, cfg=cfg)
    print '\n'
    ff.extend(BB.BB_0())
    # create backbone-sidechain potentials
    BB_S = bb_s.P_Backbone_Sidechain(p, Sys, cfg=cfg)
    # 1-alphabet bonded potentials
    print '\n'
    if cfg.Bonded_NCOSType == 0:
        print 'Error: Multi-alphabet models not implemented yet'
        exit()
    if cfg.Bonded_NCOSType == 1: ff.extend(BB_S.BB_S_Bonded_1())
    # constant repulsive nonbonded potentials
    print '\n'
    if cfg.NCOSType == 0:
        print 'Error: Multi-alphabet models not implemented yet'
        exit()
    if cfg.NCOSType == 1: ff.extend(BB_S.BB_S_1())
    if cfg.NCOSType == 2: ff.extend(BB_S.BB_S_2())
    # create sidechain-sidechain potentials
    print '\n'
    SS = ss.P_Sidechain(p, Sys, cfg=cfg, ContactDict=ContactDict)
    # harmonic restraints between native contacts
    print '\n'
    cfg.NativeType = 2
    ff.extend(
        SS.Go_native_2(FConst=cfg.NativeFConst,
                       HarmonicFluct=cfg.NativeHarmonicFluct))
    # populate forcefield
    Sys.ForceField.extend(ff)
    # set up other system properties
    PrepSys(Sys, TempSet=TempSet)
    # compile
    if Verbose: print '\nCompiling model...'
    Sys.Load()
    return p, Sys