-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
64 lines (53 loc) · 1.89 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# -*- coding: utf-8 -*-
"""
EdgeClipper Algorithm
Author: Andrew P. Hodges
Created on Mon Apr 25 16:54:46 2011
Note: translated from php code in MARIMBA
"""
#Open system variables
from sys import argv
import os
import re
#Major steps:
"""###Main function###"""
"""global variables"""
timestamp = "20101105124824";
maindir = "F:\\SomeDirectory\\";
scriptDir = maindir + "scripts\\";
workingDir = maindir + "reportFiles\\";
outputDir = maindir + "outputFiles\\";
"""1) first import dependencies"""
os.chdir(scriptDir);
#if 1:
import funsEC;
#else:
# reload(funsEC);
os.chdir(workingDir);
"""#2) Next get list of nodes"""
#Note: may need additional function to reverse the index->gene to gene->index
file_nodes = timestamp+".probelist.txt";
nodes = funsEC.getNodes(file_nodes);
"""#3) Next get set of networks from the BANJO analyses"""
#directory = diry + 'testReports\\';
#Note: this section should be adjusted for your particular file naming strategy!
filenames = funsEC.generateFileNames(timestamp,range(0,20));
#networks = funsEC.getNetworks(filenames);
"""#4) generate the condensed network information file with sorted scores"""
netfile1 = "tempNetFile.txt";
netfile2 = "tempNetFile2.txt";
"""#5 rewrite the networks into a parsable format"""
networkScores = funsEC.getNetsAll(filenames,netfile1,os,re);
#Next reformat the testNetOut temporary file so that networks are ordered by score
scoresUniq = networkScores[2].keys();
scoresUniq.sort();
funsEC.rewriteScoresFile(netfile1,netfile2,scoresUniq,re);
#"""#6 get b-value information"""
outputBvals = funsEC.bvalCalculator(netfile2,e);
#"""#7 write b-value info and corresponding consensus networks to file"""
edgePercent = 1.0;
bvalFile = "bvalEdgeInfo.txt";
funsEC.bvalWrapper(outputBvals, bvalFile, netfile2,edgePercent);
#"""finally, generate c-values for edges and store to file"""
cvalFile = "cvalEdgeInfo.txt";
funsEC.cvalWrapper(bvalFile, cvalFile, nodes);