Beispiel #1
0
        
        """ Define Deep reinforcement learning network """
        self.mainQN = SSDnetwork(param.h_size,self.env,"main",param.beta,param.n_step)
        self.targetQN = SSDnetwork(param.h_size,self.env,"target",param.alpha,param.n_step)
        self.trainables = tf.trainable_variables()
        self.copyOps = copyGraphOp(self.trainables)
        self.copyOps2 = copyGraphOp2(self.trainables)

        self.init = tf.global_variables_initializer()
        self.saver = tf.train.Saver()

train_model = model()
init = train_model.init
saver = train_model.saver

seq1 = readseq.readseq('lib/Ecoli_31.txt')
seq2 = readseq.readseq('lib/Ecoli_42.txt')

if not os.path.exists(game_env().path):
    os.makedirs(game_env().path)

if np.size(os.listdir(game_env().path)) > 0:
    resume = FLAGS.resume
else:
    resume = False

seq = readseq.readseqs('lib/HEV.txt')

""" Main training step """
with tf.Session() as sess:
    if FLAGS.use_GPU:
Beispiel #2
0
            self.mainQN = SSDnetwork(self.param.h_size, self.env, "main",
                                     self.LEARNING_RATE, self.param.n_step)
            self.targetQN = SSDnetwork(self.param.h_size, self.env, "target",
                                       self.LEARNING_RATE, self.param.n_step)
            self.trainables = tf.trainable_variables()
            self.targetOps = updateTargetGraph(self.trainables, self.param.tau)

        self.init = tf.global_variables_initializer()
        self.saver = tf.train.Saver()


train_model = model()
init = train_model.init
saver = train_model.saver

seq = readseq.readseqs('lib/HEV.txt')

if not os.path.exists(train_env.path):
    os.makedirs(train_env.path)

if np.size(os.listdir(train_env.path)) > 0:
    resume = FLAGS.resume
else:
    resume = False
""" Main training step """
with tf.Session() as sess:
    if FLAGS.use_GPU:
        sess = tf.Session(config=tf.ConfigProto(device_count={'GPU': 0}))
    else:
        sess = tf.Session(config=tf.ConfigProto(device_count={'CPU': 0}))
Beispiel #3
0
            self.mainQN = SSDnetwork(self.param.h_size, self.env, "main",
                                     self.LEARNING_RATE, self.param.n_step)
            self.targetQN = SSDnetwork(self.param.h_size, self.env, "target",
                                       self.LEARNING_RATE, self.param.n_step)
            self.trainables = tf.trainable_variables()
            self.targetOps = updateTargetGraph(self.trainables, self.param.tau)

        self.init = tf.global_variables_initializer()
        self.saver = tf.train.Saver()


train_model = model()
init = train_model.init
saver = train_model.saver

seq1 = readseq.readseq('lib/Rattus_norvegicus.Rnor_6.0.dna_rm.chromosome.X.fa')
seq2 = readseq.readseq('lib/Mus_musculus.GRCm38.dna_rm.chromosome.X.fa')

if not os.path.exists(train_env.path):
    os.makedirs(train_env.path)

if np.size(os.listdir(train_env.path)) > 0:
    resume = FLAGS.resume
else:
    resume = False
""" Main test step """
with tf.Session() as sess:
    if FLAGS.use_GPU:
        sess = tf.Session(config=tf.ConfigProto(device_count={'GPU': 0}))
    else:
        sess = tf.Session(config=tf.ConfigProto(device_count={'CPU': 0}))
Beispiel #4
0
            self.trainables = tf.trainable_variables()
            self.targetOps = updateTargetGraph(self.trainables, self.param.tau)
        elif FLAGS.model_name == "SSD":
            self.mainQN = SSDnetwork(self.param.h_size,self.env,"main",self.LEARNING_RATE,self.param.n_step)
            self.targetQN = SSDnetwork(self.param.h_size,self.env,"target",self.LEARNING_RATE,self.param.n_step)
            self.trainables = tf.trainable_variables()
            self.targetOps = updateTargetGraph(self.trainables, self.param.tau)

        self.init = tf.global_variables_initializer()
        self.saver = tf.train.Saver()

train_model = model()
init = train_model.init
saver = train_model.saver

seq1 = readseq.readseq('lib/Ecoli_1.txt')
seq2 = readseq.readseq('lib/Ecoli_2.txt')

if not os.path.exists(train_env.path):
    os.makedirs(train_env.path)

if np.size(os.listdir(train_env.path)) > 0:
    resume = FLAGS.resume
else:
    resume = False

""" Main test step """
with tf.Session() as sess:
    if FLAGS.use_GPU:
        sess = tf.Session(config=tf.ConfigProto(device_count={'GPU': 0}))
    else:
Beispiel #5
0
    start = time.time()
    startdate = time.localtime()

    for pairs in [["Homo_sapiens_BRCA", "Mus_musculus_BRCA"],
                  ["Mus_musculus_BRCA", "Rattus_norvegicus_BRCA"],
                  ["Rattus_norvegicus_BRCA", "Homo_sapiens_BRCA"],
                  ["Homo_sapiens_ELK1", "Mus_musculus_ELK1"],
                  ["Mus_musculus_ELK1", "Rattus_norvegicus_ELK1"],
                  ["Rattus_norvegicus_ELK1", "Homo_sapiens_ELK1"],
                  ["Homo_sapiens_CCDC91", "Mus_musculus_CCDC91"],
                  ["Mus_musculus_CCDC91", "Rattus_norvegicus_CCDC91"],
                  ["Rattus_norvegicus_CCDC91", "Homo_sapiens_CCDC91"],
                  ["Homo_sapiens_FOXP2", "Mus_musculus_FOXP2"],
                  ["Mus_musculus_FOXP2", "Rattus_norvegicus_FOXP2"],
                  ["Rattus_norvegicus_FOXP2", "Homo_sapiens_FOXP2"]]:
        seq1 = readseq.readseq('lib/Mammal/' + pairs[0] + '.txt')
        seq2 = readseq.readseq('lib/Mammal/' + pairs[1] + '.txt')
        #print(_)
        past = time.time()

        agent.set(seq1 + "A", seq2 + "A")
        rT1, rT2, processingtime, j = agent.Global(sess)

        now = time.time()
        #NWresult = np.max(NW.match(alignment.HEVseq[_],alignment.HEVseq[__]))
        print(pairs, len(seq1), len(seq2), rT2, "time",
              str(processingtime) + "s",
              str(now - start) + "s")

        filename = "result/" + FLAGS.model_name + "/result%04d%02d%02d%02d%02d%02d_%d_%d.txt" % (
            startdate.tm_year, startdate.tm_mon, startdate.tm_mday,
Beispiel #6
0
    
filename = "img/MUMmer/result%04d%02d%02d%02d%02d%02d_Ecoli" % (
    startdate.tm_year, startdate.tm_mon, startdate.tm_mday, startdate.tm_hour, startdate.tm_min,
    startdate.tm_sec)

if FLAGS.print_align:
    filename = "align/MUMmer/result%04d%02d%02d%02d%02d%02d" % (
        startdate.tm_year, startdate.tm_mon, startdate.tm_mday, startdate.tm_hour, startdate.tm_min,
        startdate.tm_sec)
    m.print(filename+"_Ecoli.txt")

if FLAGS.show_align:
    m.display(filename+".jpg")

'''
seq = readseq.splitseqs('lib/HEV.txt')

for _ in range(47):
    #print(_)
    for __ in range(_ + 1, 47):
        seq1 = "lib/HEV/HEV_" + str(_) + ".fasta"
        seq2 = "lib/HEV/HEV_" + str(__) + ".fasta"
        past = time.time()
        b = conventional.BLAST(
            True, seq1, seq2, [seq[_], seq[__]],
            "result/BLAST/result%04d%02d%02d%02d%02d%02d" %
            (startdate.tm_year, startdate.tm_mon, startdate.tm_mday,
             startdate.tm_hour, startdate.tm_min, startdate.tm_sec))
        b.align()
        #coords1, coords2, aligns1, aligns2, score = m.export_info()
        now = time.time()
Beispiel #7
0
import numpy as np
import DQNalign.tool.Bio.NW as NW
import DQNalign.tool.util.ReadSeq as readseq
import time

start = time.time()
startdate = time.localtime()

rawseq = readseq.readseqs('lib/HEV.txt')
seq = []
for _ in range(47):
    seq.append(readseq.seqtoint(rawseq[_]))

for _ in range(47):
    #print(_)
    for __ in range(_+1,47):
        seq1 = seq[_]
        seq2 = seq[__]
        past = time.time()
        score, match = NW.align(seq1,seq2)
        now = time.time()
        
        print("test",_,__)
        print("result", score, match, "time", str(now-past)+"s", str(now-start)+"s")
    
        filename = "result/NW/result%04d%02d%02d%02d%02d%02d.txt" % (
            startdate.tm_year, startdate.tm_mon, startdate.tm_mday, startdate.tm_hour, startdate.tm_min,
            startdate.tm_sec)

        file = open(filename,"a")
        file.write(str(match)+" "+str(now-past)+" "+str(now-start)+"\n")
Beispiel #8
0
    #print(_)
    for __ in range(_+1,47):
        seq1 = seq[_]
        seq2 = seq[__]
        
        print("test",_,__)
        print("result", len(seq1), len(seq2))
    
        filename = "result/NW/result%04d%02d%02d%02d%02d%02d.txt" % (
            startdate.tm_year, startdate.tm_mon, startdate.tm_mday, startdate.tm_hour, startdate.tm_min,
            startdate.tm_sec)

        file = open(filename,"a")
        file.write(str(_)+"_"+str(__)+" "+str(len(seq1))+" "+str(len(seq2))+"\n")
        file.close()
'''

for _ in range(34685):
    len1 = len(readseq.readseq2('lib/Rat/'+str(_)+'.txt'))
    len2 = len(readseq.readseq2('lib/Mouse/'+str(_)+'.txt'))
    print('Rat_'+str(_)+' : '+str(len1))
    print('Mouse_'+str(_)+' : '+str(len2))
    
    filename = "result/NW/result%04d%02d%02d%02d%02d%02d.txt" % (
        startdate.tm_year, startdate.tm_mon, startdate.tm_mday, startdate.tm_hour, startdate.tm_min,
        startdate.tm_sec)

    file = open(filename,"a")
    file.write(str(_)+" "+str(len1)+" "+str(len2)+"\n")
    file.close()
Beispiel #9
0
import numpy as np
import DQNalign.tool.Bio.conventional as conventional
import DQNalign.tool.util.ReadSeq as readseq
import time
import tensorflow as tf
import DQNalign.flags as flags
FLAGS = tf.app.flags.FLAGS

start = time.time()
startdate = time.localtime()

seq1 = readseq.readseq('lib/Prochlorococcus_1.fna')
seq2 = readseq.readseq('lib/Prochlorococcus_2.fna')

past = time.time()
c = conventional.Clustal(True, seq1, seq2)
match = c.pair_align()
now = time.time()

print("Ecoli test")
print("result", match, "time", str(now - past) + "s", str(now - start) + "s")

filename = "result/Clustal/result%04d%02d%02d%02d%02d%02d_Ecoli.txt" % (
    startdate.tm_year, startdate.tm_mon, startdate.tm_mday, startdate.tm_hour,
    startdate.tm_min, startdate.tm_sec)

file = open(filename, "a")
file.write(str(match) + " " + str(now - past) + " " + str(now - start) + "\n")
file.close()

filename = "img/Clustal/result%04d%02d%02d%02d%02d%02d_Ecoli" % (