Example #1
0
 def actionLoadSequence(self, event=None):
     filename = tkinter.filedialog.askopenfilename()
     if filename:
         seq = sequenceIO.readFile(filename)
         self.textSourceSeq.delete("1.0", "end")
         self.textSourceSeq.insert("end", seq)            
         self.textSourceSeq.edit_modified(True)
 def actionLoadSequence(self, event=None):
     filename = tkinter.filedialog.askopenfilename()
     if filename:
         seq = sequenceIO.readFile(filename)
         self.textSourceSeq.delete("1.0", "end")
         self.textSourceSeq.insert("end", seq)
         self.textSourceSeq.edit_modified(True)
Example #3
0
def main(argv):

    if (len(argv) != 4):
        print(
            "Usage: optimize.py [sequence file] [source taxid] [target taxid]")
        sys.exit()

    seqfile = argv[1]
    src_taxid = argv[2]
    trg_taxid = argv[3]

    seq = sequenceIO.readFile(seqfile)
    seqr = sequenceIO.D2R(seq)
    print("== INPUT SEQUENCE, GC: ", round(seqstats.getGC(seq) * 100), "%")
    # print(seq)

    cuSrc = kazusaIO.getCU(src_taxid)
    cuTrg = kazusaIO.getCU(trg_taxid)
    opt = optimizing.RelativeUsageCodonOptimizer(cuSrc, cuTrg)

    inCodons = re.findall('...', seqr)  # list of codons
    outCodons = list()

    for c in inCodons:
        outCodons.append(opt.optimize(c))

    for i in range(0, len(outCodons)):
        if outCodons[i] == inCodons[i]:
            print(sequenceIO.R2D(inCodons[i]), end="")
        else:
            print(bcolors.OKGREEN,
                  sequenceIO.R2D(inCodons[i]),
                  bcolors.ENDC,
                  end="",
                  sep="")

    print("")  #newline

    res = "".join(outCodons)
    resd = sequenceIO.R2D(res)
    print("== OPTIMIZED SEQUENCE, GC: ", round(seqstats.getGC(resd) * 100),
          "%")

    for i in range(0, len(outCodons)):
        if outCodons[i] == inCodons[i]:
            print(sequenceIO.R2D(outCodons[i]), end="")
        else:
            print(bcolors.WARNING,
                  sequenceIO.R2D(outCodons[i]),
                  bcolors.ENDC,
                  end="",
                  sep="")

    print("")  #newline

    print("== STATS: CHANGED CODONS: ",
          seqstats.getChanged(seq, resd)[0], "/",
          seqstats.getChanged(seq, resd)[1])
Example #4
0
def main(argv):

    if (len(argv) != 4):
        print("Usage: optimize.py [sequence file] [source taxid] [target taxid]")
        sys.exit()

    seqfile = argv[1]
    src_taxid = argv[2]
    trg_taxid = argv[3]

    seq = sequenceIO.readFile(seqfile)
    seqr = sequenceIO.D2R(seq)
    print("== INPUT SEQUENCE, GC: ", round(seqstats.getGC(seq)*100), "%")
    # print(seq)

    cuSrc = kazusaIO.getCU(src_taxid)
    cuTrg = kazusaIO.getCU(trg_taxid)
    opt = optimizing.RelativeUsageCodonOptimizer(cuSrc, cuTrg)

    inCodons = re.findall('...', seqr) # list of codons
    outCodons = list()

    for c in inCodons:
        outCodons.append(opt.optimize(c))

    for i in range(0, len(outCodons)):
        if outCodons[i] == inCodons[i]:
            print(sequenceIO.R2D(inCodons[i]), end="")
        else:
            print(bcolors.OKGREEN, sequenceIO.R2D(inCodons[i]), bcolors.ENDC, end="", sep="")

    print("") #newline

    res = "".join(outCodons)
    resd = sequenceIO.R2D(res)
    print("== OPTIMIZED SEQUENCE, GC: ", round(seqstats.getGC(resd)*100), "%")

    for i in range(0, len(outCodons)):
        if outCodons[i] == inCodons[i]:
            print(sequenceIO.R2D(outCodons[i]), end="")
        else:
            print(bcolors.WARNING, sequenceIO.R2D(outCodons[i]), bcolors.ENDC, end="", sep="")

    print("") #newline

    print("== STATS: CHANGED CODONS: ", seqstats.getChanged(seq, resd)[0], "/", seqstats.getChanged(seq, resd)[1])