Exemple #1
0
def test_enm_1():
    '''Tests C2-C2 calculation'''
    
    # initialize class. Only PDB are accepted
    SBP_enm = enm.Enm(fname,sele_atoms=["C2","C1\'","P"])
    
    # print eigenvectors
    evecs = SBP_enm.print_evec(3)
    fh = open("%s/enm_01.test.dat" % outdir,'w')    
    fh.write(evecs)
    fh.close()

    # print eigenvalues 
    evals = SBP_enm.print_eval()
    fh = open("%s/enm_02.test.dat" % outdir,'w')    
    fh.write(evals)
    fh.close()

    # print mean square fluctuations
    fluc = SBP_enm.get_MSF()
    np.savetxt("%s/enm_03b.test.dat" % outdir,fluc,fmt='%.6e')
    
    # print C2'-C2' fluctuations
    fluc,res =  SBP_enm.c2_fluctuations()
    fh = open("%s/enm_03.test.dat" % outdir,'w')    
    stri = "# %19s %s \n" % ("Residues","Fluctuations")
    for i in range(len(fluc)):
        stri +=  "%10s/%-10s %.6e \n" % (res[i],res[i+1],fluc[i])
    fh.write(stri)
    fh.close()

    comp("%s/enm_01.test.dat" % refdir)
    comp("%s/enm_02.test.dat" % refdir)
    comp("%s/enm_03.test.dat" % refdir)
    comp("%s/enm_03b.test.dat" % refdir)
Exemple #2
0
def test_enm_3():
    '''Tests sparse diagonalization'''
    
    # initialize class. Only PDB are accepted
    AA_enm = enm.Enm(fname,sele_atoms="AA",sparse=True,cutoff=0.7)
    
    # print eigenvalues 
    evals = AA_enm.print_eval()
    fh = open("%s/enm_06.test.dat" % outdir,'w')    
    fh.write(evals)
    fh.close()

    # print eigenvectors
    evecs = AA_enm.print_evec(3)
    fh = open("%s/enm_07.test.dat" % outdir,'w')    
    fh.write(evecs)
    fh.close()

    # print C2'-C2' fluctuations
    fluc,res =  AA_enm.c2_fluctuations()
    fh = open("%s/enm_08.test.dat" % outdir,'w')    
    stri = "# %19s %s \n" % ("Residues","Fluctuations")
    for i in range(len(fluc)):
        stri +=  "%10s/%-10s %.6e \n" % (res[i],res[i+1],fluc[i])
    fh.write(stri)
    fh.close()
    
    comp("%s/enm_06.test.dat" % refdir)
    comp("%s/enm_07.test.dat" % refdir)
    comp("%s/enm_08.test.dat" % refdir)
Exemple #3
0
def test_enm_4():
    '''Tests RNA+protein complex'''

    # initialize class. Only PDB are accepted                                                                                                                                             
    SBP_enm = enm.Enm(fname_prot,sparse=False)

    # print eigenvalues
    evals = SBP_enm.print_eval()
    fh = open("%s/enm_09.test.dat" % outdir,'w')
    fh.write(evals)
    fh.close()

    # print eigenvectors
    evecs = SBP_enm.print_evec(3)
    fh = open("%s/enm_10.test.dat" % outdir,'w')
    fh.write(evecs)
    fh.close()

    # print C2'-C2' fluctuations
    fluc,res =  SBP_enm.c2_fluctuations()
    fh = open("%s/enm_11.test.dat" % outdir,'w')
    stri = "# %19s %s \n" % ("Residues","Fluctuations")
    for i in range(len(fluc)):
        stri +=  "%10s/%-10s %.6e \n" % (res[i],res[i+1],fluc[i])
    fh.write(stri)
    fh.close()
    comp("%s/enm_09.test.dat" % refdir)
    comp("%s/enm_10.test.dat" % refdir)
    comp("%s/enm_11.test.dat" % refdir)
Exemple #4
0
def test_enm_6():
    """Tests modes output"""
    # initialize class. Only PDB are accepted                                                                                                                                                          
    #SBP_enm = enm.Enm(fname,sparse=True)
    SBP_enm = enm.Enm(fname,sparse=True)

    import mdtraj as md
    traj_mode=SBP_enm.get_mode_traj(6)
    traj_mode.save_pdb("%s/enm_14.test.pdb" % outdir)
    
    comp("%s/enm_14.test.pdb" % refdir)
Exemple #5
0
def test_enm_2():
    '''Tests different bead choices'''
    
    # initialize class. Only PDB are accepted
    S_enm = enm.Enm(fname,sele_atoms=["C1\'"],cutoff=1.5)
    SB_enm = enm.Enm(fname,sele_atoms=["C2","C1\'"],cutoff=1.1)
    
    # print eigenvalues S-ENM 
    evals = S_enm.print_eval()
    fh = open("%s/enm_04.test.dat" % outdir,'w')    
    fh.write(evals)
    fh.close()

    # print eigenvalues SB-ENM
    evals = SB_enm.print_eval()
    fh = open("%s/enm_05.test.dat" % outdir,'w')    
    fh.write(evals)
    fh.close()
    
    comp("%s/enm_04.test.dat" % refdir)
    comp("%s/enm_05.test.dat" % refdir)
Exemple #6
0
def test_enm_5():
    '''Tests RNA+protein complex (sparse)'''

    # initialize class. Only PDB are accepted
    AA_enm = enm.Enm(fname,sele_atoms="AA",sparse=True,cutoff=0.7)

    # print eigenvalues
    evals = AA_enm.print_eval()
    fh = open("%s/enm_12.test.dat" % outdir,'w')
    fh.write(evals)
    fh.close()

    # print eigenvectors
    evecs = AA_enm.print_evec(3)
    fh = open("%s/enm_13.test.dat" % outdir,'w')
    fh.write(evecs)
    fh.close()
Exemple #7
0
def enm(args):
    
    import barnaba.enm as enm
    
    if(args.type=="AA"):
        sele = "AA"
    else:
        sele = []
        sele.append("CA")
        if("P" in args.type):
            sele.append("P")
        if("S" in args.type):
            sele.append("C1\'")
        if("B" in args.type):
            sele.append("C2")
        if(args.type=="SBP"):
            sele.append("CB")

    net = enm.Enm(args.pdbs,sele_atoms=sele,sparse=args.sparse,ntop=args.ntop,cutoff=args.cutoff)

    # print eigenvectors 
    eigvecs = net.print_evec(args.ntop)
    fh = open(args.name + ".eigvecs.out",'w')
    fh.write(eigvecs)
    fh.close()

    # print eigenvalues 
    eigvals = net.print_eval()
    fh = open(args.name + ".eigvals.out",'w')
    fh.write(eigvals)
    fh.close()

    if(args.shape):
        
        fluc,res =  net.c2_fluctuations()
        stri = "# %19s %s \n" % ("Residues","Fluctuations")
        stri +=  "".join(["%10s/%-10s %.6e \n" % (res[i],res[i+1],fluc[i]) for i in range(len(fluc)) ])
        fh = open(args.name + ".shape.out",'w')
        fh.write(stri)
        fh.close()