Esempio n. 1
0
def annotate(args):


    stri_p = "# %s \n" % (" ".join(sys.argv[:]))
    stri_p += "#%-10s %-10s %4s \n" % ("RES1","RES2","ANNO")
    
    stri_s = "# %s \n" % (" ".join(sys.argv[:]))
    stri_s += "#%-10s %-10s %4s \n" % ("RES1","RES2","ANNO")

    stri_dot = "# %s \n" % (" ".join(sys.argv[:]))
    
    if(args.top==None):
        for i in range(len(args.pdbs)):
            st, pair, res = bb.annotate(args.pdbs[i])
            stri_p += "# PDB %s \n" % args.pdbs[i].split("/")[-1]
            stri_s += "# sequence %s\n" % "-".join(res)
            stri_p += "# sequence %s\n" % "-".join(res)
            stri_p += "".join([ "%-10s %-10s %4s \n" % (res[pair[0][0][e][0]],res[pair[0][0][e][1]],pair[0][1][e]) for e in range(len(pair[0][0]))])
            
            stri_s += "# PDB %s \n" % args.pdbs[i].split("/")[-1]
            stri_s += "".join([ "%-10s %-10s %4s \n" % (res[st[0][0][e][0]],res[st[0][0][e][1]],st[0][1][e]) for e in range(len(st[0][0]))])

            if(args.dotbr):
                dotbr,ss = bb.dot_bracket(pair,res)
                stri_dot += "# sequence %s\n" % "-".join(res)
                stri_dot += "# SEQ %s" % ss
                stri_dot += "%-20s %s\n" %(args.pdbs[i].split("/")[-1],dotbr[0])

            
    else:
        st,pair,res = bb.annotate(args.trj,topology=args.top)
        stri_s += "# sequence %s\n" % "-".join(res)
        stri_p += "# sequence %s\n" % "-".join(res)
        stri_dot += "# sequence %s\n" % "-".join(res)

        if(args.dotbr):
            dotbr,ss = bb.dot_bracket(pair,res)
            stri_dot += "# SEQ %s" % ss
            stri_dot += " ".join(["%-10d %s\n" %(k,dotbr[k]) for k in range(len(pair))])
            
        for k in range(len(st)):
            stri_p += "# Frame %d \n" % k
            stri_p += "".join([ "%-10s %-10s %4s \n" % (res[pair[k][0][e][0]],res[pair[k][0][e][1]],pair[k][1][e]) for e in range(len(pair[k][0]))])
        
            stri_s += "# Frame %d \n" % k
            stri_s += "".join([ "%-10s %-10s %4s \n" % (res[st[k][0][e][0]],res[st[k][0][e][1]],st[k][1][e]) for e in range(len(st[k][0]))])
            
            
    fh1 = open(args.name + ".pairing.out",'w')
    fh1.write(stri_p)
    fh1.close()
    
    fh2 = open(args.name + ".stacking.out",'w')
    fh2.write(stri_s)
    fh2.close()

    if(args.dotbr):
        fh3 = open(args.name + ".dotbracket.out",'w')
        fh3.write(stri_dot)
        fh3.close()
Esempio n. 2
0
def annotate(args):

    stri_p = "# %s \n" % (" ".join(sys.argv[:]))
    stri_p += "#%-10s %-10s %4s \n" % ("RES1","RES2","ANNO")
    
    stri_s = "# %s \n" % (" ".join(sys.argv[:]))
    stri_s += "#%-10s %-10s %4s \n" % ("RES1","RES2","ANNO")

    stri_dot = "# %s \n" % (" ".join(sys.argv[:]))

    if(args.top==None):
        for i in range(len(args.pdbs)):
            st, pair, res = bb.annotate(args.pdbs[i])
            stri_p += "# PDB %s \n" % args.pdbs[i].split("/")[-1]
            stri_p += "".join([ "%-10s %-10s %4s \n" % (res[pair[0][0][e][0]],res[pair[0][0][e][1]],pair[0][1][e]) for e in range(len(pair[0][0]))])
            
            stri_s += "# PDB %s \n" % args.pdbs[i].split("/")[-1]
            stri_s += "".join([ "%-10s %-10s %4s \n" % (res[st[0][0][e][0]],res[st[0][0][e][1]],st[0][1][e]) for e in range(len(st[0][0]))])

            if(args.dotbr):
                dotbr = bb.dot_bracket(pair,res)
                stri_dot += "%-20s %s\n" %(args.pdbs[i].split("/")[-1],dotbr[0])

            
    else:
        st,pair,res = bb.annotate(args.trj,topology=args.top)
        if(args.dotbr):
            dotbr = bb.dot_bracket(pair,res)
            stri_dot += "".join(["%-10d %s\n" %(k,dotbr[k]) for k in range(len(pair))])
            
        for k in range(len(st)):
            stri_p += "# Frame %d \n" % k
            stri_p += "".join([ "%-10s %-10s %4s \n" % (res[pair[k][0][e][0]],res[pair[k][0][e][1]],pair[k][1][e]) for e in range(len(pair[k][0]))])
        
            stri_s += "# Frame %d \n" % k
            stri_s += "".join([ "%-10s %-10s %4s \n" % (res[st[k][0][e][0]],res[st[k][0][e][1]],st[k][1][e]) for e in range(len(st[k][0]))])
            
            
        
    fh1 = open(args.name + ".pairing.out",'w')
    fh1.write(stri_p)
    fh1.close()
    
    fh2 = open(args.name + ".stacking.out",'w')
    fh2.write(stri_s)
    fh2.close()

    if(args.dotbr):
        fh3 = open(args.name + ".dotbracket.out",'w')
        fh3.write(stri_dot)
        fh3.close()
Esempio n. 3
0
def test_annotate_2():

    fname = "%s/test/data/1S72.pdb" % cwd
    stackings, pairings, res = bb.annotate(fname)
    dotbr, ss = bb.dot_bracket(pairings, res)
    fh = open("%s/stackings_02.test.dat" % outdir, 'w')
    stri = "# STACKING \n"
    for e in range(len(stackings[0][0])):
        stri += "%15s " % (res[stackings[0][0][e][0]])
        stri += "%15s " % (res[stackings[0][0][e][1]])
        stri += " %4s \n" % (stackings[0][1][e])
    fh.write(stri)
    fh.close()

    fh = open("%s/pairings_02.test.dat" % outdir, 'w')
    stri = "# PAIRING \n"
    for e in range(len(pairings[0][0])):
        stri += "%15s " % (res[pairings[0][0][e][0]])
        stri += "%15s " % (res[pairings[0][0][e][1]])
        stri += " %4s \n" % (pairings[0][1][e])
    fh.write(stri)
    fh.close()

    fh = open("%s/dotbracket_02.test.dat" % outdir, 'w')
    fh.write(str(dotbr[0]))
    fh.close()

    comp("%s/stackings_02.test.dat" % refdir)
    comp("%s/pairings_02.test.dat" % refdir)
    comp("%s/dotbracket_02.test.dat" % refdir)
Esempio n. 4
0
def test_annotate_2():
    
    fname = "%s/test/data/1S72.pdb" % cwd
    stackings, pairings, res = bb.annotate(fname)
    dotbr,ss = bb.dot_bracket(pairings,res)
    fh = open("%s/stackings_02.test.dat" % outdir,'w')
    stri = "# STACKING \n"
    for e in range(len(stackings[0][0])):
        stri += "%15s " % (res[stackings[0][0][e][0]])
        stri += "%15s " % (res[stackings[0][0][e][1]])
        stri += " %4s \n" % (stackings[0][1][e])
    fh.write(stri)
    fh.close()

    fh = open("%s/pairings_02.test.dat" % outdir,'w')
    stri = "# PAIRING \n"
    for e in range(len(pairings[0][0])):
        stri += "%15s " % (res[pairings[0][0][e][0]])
        stri += "%15s " % (res[pairings[0][0][e][1]])
        stri += " %4s \n" % (pairings[0][1][e])
    fh.write(stri)
    fh.close()

    fh = open("%s/dotbracket_02.test.dat" % outdir,'w')        
    fh.write(str(dotbr[0]))
    fh.close()

    comp("%s/stackings_02.test.dat" % refdir)
    comp("%s/pairings_02.test.dat" % refdir)
    comp("%s/dotbracket_02.test.dat" % refdir)
Esempio n. 5
0
def test_annotate_1():
    
    stackings, pairings, res = bb.annotate(fname1,topology=fname)
    dotbr,ss = bb.dot_bracket(pairings,res)

    fh = open("%s/stackings_01.test.dat" % outdir,'w')    
    stri = "# STACKING \n"
    for k in range(len(stackings)):
        stri += "# frame %d \n" % k
        for e in range(len(stackings[k][0])):
            stri += "%15s " % (res[stackings[k][0][e][0]])
            stri += "%15s " % (res[stackings[k][0][e][1]])
            stri += " %4s \n" % (stackings[k][1][e])
        stri += "\n"
    fh.write(stri)
    fh.close()

    
    fh = open("%s/pairings_01.test.dat" % outdir,'w')
    stri = "# PAIRING \n"
    for k in range(len(pairings)):
        stri += "# frame %d \n" % k
        for e in range(len(pairings[k][0])):
            stri += "%15s " % (res[pairings[k][0][e][0]])
            stri += "%15s " % (res[pairings[k][0][e][1]])
            stri += " %4s \n" % (pairings[k][1][e])
    fh.write(stri)
    fh.close()



    
    fh = open("%s/dotbracket_01.test.dat" % outdir,'w')        
    stri = ""
    for k in range(len(pairings)):
        stri += " %06d " % k
        stri += "%s \n" % dotbr[k]
    fh.write(stri)
    fh.close()
    
    comp("%s/stackings_01.test.dat" % refdir)
    comp("%s/pairings_01.test.dat" % refdir)
    comp("%s/dotbracket_01.test.dat" % refdir)
Esempio n. 6
0
def test_annotate_1():

    stackings, pairings, res = bb.annotate(fname1, topology=fname)
    dotbr, ss = bb.dot_bracket(pairings, res)

    fh = open("%s/stackings_01.test.dat" % outdir, 'w')
    stri = "# STACKING \n"
    for k in range(len(stackings)):
        stri += "# frame %d \n" % k
        for e in range(len(stackings[k][0])):
            stri += "%15s " % (res[stackings[k][0][e][0]])
            stri += "%15s " % (res[stackings[k][0][e][1]])
            stri += " %4s \n" % (stackings[k][1][e])
        stri += "\n"
    fh.write(stri)
    fh.close()

    fh = open("%s/pairings_01.test.dat" % outdir, 'w')
    stri = "# PAIRING \n"
    for k in range(len(pairings)):
        stri += "# frame %d \n" % k
        for e in range(len(pairings[k][0])):
            stri += "%15s " % (res[pairings[k][0][e][0]])
            stri += "%15s " % (res[pairings[k][0][e][1]])
            stri += " %4s \n" % (pairings[k][1][e])
    fh.write(stri)
    fh.close()

    fh = open("%s/dotbracket_01.test.dat" % outdir, 'w')
    stri = ""
    for k in range(len(pairings)):
        stri += " %06d " % k
        stri += "%s \n" % dotbr[k]
    fh.write(stri)
    fh.close()

    comp("%s/stackings_01.test.dat" % refdir)
    comp("%s/pairings_01.test.dat" % refdir)
    comp("%s/dotbracket_01.test.dat" % refdir)