当前位置: 首页>>代码示例>>Python>>正文


Python Network.read_netmatrix方法代码示例

本文整理汇总了Python中Network.read_netmatrix方法的典型用法代码示例。如果您正苦于以下问题:Python Network.read_netmatrix方法的具体用法?Python Network.read_netmatrix怎么用?Python Network.read_netmatrix使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Network的用法示例。


在下文中一共展示了Network.read_netmatrix方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: read_output

# 需要导入模块: import Network [as 别名]
# 或者: from Network import read_netmatrix [as 别名]
    def read_output(self, settings):
        # output_file = open(self.output_dir + "/output/banjo/top.graph.txt", 'r')

        output_file = open(self.output_dir + "./output/banjo/top.graph.txt", "r")

        import re

        network = []
        for i in range(len(self.gene_list)):
            row = []
            for j in range(len(self.gene_list)):
                row.append(0)
            network.append(row)

        lines = output_file.readlines()

        for i, line in enumerate(lines):
            line = line.strip()
            if line != "" and line[0] == '"':
                line = re.sub(r"\(.*?\)", "", line).replace('"', "").replace(";", "").strip().replace("->", "")
                # print line

                ls = line.split()
                edge = ls[1]
                gene = ls[0]
                network[int(gene)][int(edge)] = 1
                network[int(edge)][int(gene)] = 1
        net = Network()
        net.read_netmatrix(network, self.gene_list)
        self.network = net
开发者ID:remtcs,项目名称:Network-Inference-Workspace,代码行数:32,代码来源:banjo.py

示例2: read_output

# 需要导入模块: import Network [as 别名]
# 或者: from Network import read_netmatrix [as 别名]
    def read_output(self,settings):
      import scipy
      # Code to write for collecting the output files from the algorithm, writes to the
      # output list in the object
      # What we want to do here is get the prediction rate on the last time
      # point and the network so we can compare it against a gold std.
      # This file is a bunch of zscores, so we have to load the cutoff we want
      co_output = scipy.io.loadmat(self.output_dir + "/output/" + \
              "/convex_optimization_output.mat")

      self.raw_network = co_output["A"].tolist()


      net = Network()
      net.read_netmatrix(self.raw_network, self.gene_list)
      self.network = net

      return self.network
开发者ID:remtcs,项目名称:Network-Inference-Workspace,代码行数:20,代码来源:convex_optimization.py

示例3: open

# 需要导入模块: import Network [as 别名]
# 或者: from Network import read_netmatrix [as 别名]
print jobman.queue
jobman.runQueue()
jobman.waitToClear()

accs = []
out = open("output_runs.txt", 'w')
csv_out = open("MastersThesis.csv", 'w')
header = 'k,n_models,lambda_w,eta_z,tau,tp,tn,fp,fn,sensitivity,specificity,accuracy,fanins_correct,fanins_incorrect,fanouts_correct,fanouts_incorrect,cascades_correct,cascades_incorrect,feedforward_loops_correct,feedforward_loops_incorrect\n'
csv_out.write(header)
for i, job in enumerate(jobman.finished):
    print job.alg.gene_list
    print job.alg.gather_output(settings)
    jobnet = Network()
    for k in xrange(len(job.alg.gene_list) * len(job.alg.gene_list) + 1):
        jobnet.read_netmatrix(job.alg.network, job.alg.gene_list, "timeseries")
        jobnet.cutoff_network(k)
        #print "\n\n\n\n\n\n"+"dfg4grn-small-net-test_ETAZ=" + str(p[0]) + "_LW="+str(p[1])+"_TAU="+str(p[2])
        MastersThesis = jobnet.calculateAccuracy(goldnet)
        report = jobnet.analyzeMotifs(goldnet)
        print report.ToString()
        out.write("dfg4grn-small-net-test_ETAZ-" + str(p[0]) + "_LW-"+str(p[1])+"_TAU-"+ str(p[2]) + "\n")
        out.write(str(jobnet.calculateAccuracy(goldnet)))
        out.write(report.ToString())
        out.write("\n\n\n")

        cstr = "{0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12},{13},{14},{15},{16},{17},{18},{19},{20},{21}\n".format(
        k,
        job.alg.n_models,
        job.alg.lambda_w,
        job.alg.eta_z,
开发者ID:remtcs,项目名称:Network-Inference-Workspace,代码行数:32,代码来源:RunSmallNetDFG.py

示例4: range

# 需要导入模块: import Network [as 别名]
# 或者: from Network import read_netmatrix [as 别名]
goldnet = []
v = 1.0
counter = 0
for i in range(len(gene_list)):
    curvenet.append([])
    goldnet.append([])
    for j in range(len(gene_list)):
        counter += 1
        curvenet[i].append(v)
        if random.random() > prop_correct:
        #if counter > 7000 and random.random() > prop_correct / 2.0:
            goldnet[i].append(0)
        #elif random.random() > prop_correct * (1.0 / (counter / 30.0) ):
            #goldnet[i].append(0)
        else:
            goldnet[i].append(1)
        v -= 0.0001
goldnet[i][j] = 0

cnet = Network()
print goldnet
cnet.read_netmatrix(curvenet, gene_list)

gnet = Network()
gnet.read_netmatrix(goldnet, gene_list)



ps, rs, precs = GenerateMultiPRList([cnet], gnet, False, "./" + sys.argv[1] + "_pr.png")
print ps, rs, precs
开发者ID:remtcs,项目名称:Network-Inference-Workspace,代码行数:32,代码来源:make_fake_pr.py

示例5: open

# 需要导入模块: import Network [as 别名]
# 或者: from Network import read_netmatrix [as 别名]
jobman.waitToClear()

accs = []
out = open("output_runs.txt", 'w')
csv_out = open("results.csv", 'w')
header = 'k,n_models,lambda_w,eta_z,tau,tp,tn,fp,fn,sensitivity,specificity,accuracy,fanins_correct,fanins_incorrect,fanouts_correct,fanouts_incorrect,cascades_correct,cascades_incorrect,feedforward_loops_correct,feedforward_loops_incorrect\n'
csv_out.write(header)
max_n_genes = 500
print "Gathering results into results.csv..."
for i, job in enumerate(jobman.finished):
    #print job.alg.gene_list
    #print job.alg.gather_output(settings)
    jobnet = Network()
    for k in xrange(max_n_genes):
        print "On iteration ", k+1, " of ", max_n_genes
        jobnet.read_netmatrix(job.alg.network, job.alg.gene_list, True)
        jobnet.cutoff_network(k)
        #print "\n\n\n\n\n\n"+"dfg4grn-small-net-test_ETAZ=" + str(p[0]) + "_LW="+str(p[1])+"_TAU="+str(p[2])
        results = jobnet.calculateAccuracy(goldnet)
        report = jobnet.analyzeMotifs(goldnet)
        #print report.ToString()
        out.write("dfg4grn-small-net-test_ETAZ-" + str(p[0]) + "_LW-"+str(p[1])+"_TAU-"+ str(p[2]) + "\n")
        out.write(str(jobnet.calculateAccuracy(goldnet)))
        out.write(report.ToString())
        out.write("\n\n\n")

        cstr = "{0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12},{13},{14},{15},{16},{17},{18},{19},{20},{21}\n".format(
        k,
        job.alg.n_models,
        job.alg.lambda_w,
        job.alg.eta_z,
开发者ID:remtcs,项目名称:Network-Inference-Workspace,代码行数:33,代码来源:RunLargeNetDFG.py

示例6: generate_random_network

# 需要导入模块: import Network [as 别名]
# 或者: from Network import read_netmatrix [as 别名]
def generate_random_network(gene_list):
    mat = numpy.random.randn(len(gene_list), len(gene_list))
    mat = mat / numpy.sqrt(len(gene_list))
    net = Network()
    net.read_netmatrix(mat.tolist(), gene_list, True)
    return net
开发者ID:ylyhlh,项目名称:Network-Inference-Workspace,代码行数:8,代码来源:Helpers.py


注:本文中的Network.read_netmatrix方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。