-
Notifications
You must be signed in to change notification settings - Fork 0
/
p.py
executable file
·86 lines (65 loc) · 2.41 KB
/
p.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#! /usr/bin/python
import os, subprocess
import networkx as nx
def main():
g = nx.read_weighted_edgelist("/home/xzhu/BR/1DZE/hydro/def/lj01/hb.txt")
allNodes = nx.node_connected_component(g, "GLUA0194")
#print allNodes
#print
for eachPath in nx.all_simple_paths(g, "ASPA0085", "GLUA0194"):
if len(eachPath) == nx.shortest_path_length(g, "ASPA0085", "GLUA0194") + 2:
print eachPath
accRes = {}
for line in open("/home/xzhu/BR/1DZE/hydro/def/raw/acc.res"):
fields = line.split()
resName = fields[1] + fields[2]
acc = float(fields[4])
accRes[resName] = acc
#for eachNode in allNodes:
# print eachNode, accRes[eachNode]
#print lines[0]
def fun():
import subprocess, os
p = subprocess.Popen(["qstat", "-u", "xzhu"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out, err = p.communicate()
allLines = out.split('\n')[2:-1]
for eachLine in allLines:
jobid = eachLine.split()[0]
subp = subprocess.Popen(["qstat", "-j", jobid], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
subout, suberr = subp.communicate()
print jobid
for line in subout.split('\n'):
if line.startswith("cwd:"):
subdir = line.split()[1]
if line.startswith("script_file:"):
subscript = line.split()[1]
print subdir
#os.system("qdel " + jobid)
#os.system("qsub " + os.path.join(subdir, subscript))
def getRunTypeAbbreviation(pdbT, runT, scaleT):
firstLetter = '' # for pdbT, "crystal" = 'c', "hydro" = 'h'
secondLetter = '' # for runT, "quick" = 'q', "def' = 'd'
thirdLetter = '' # for scaleT, "raw" = 'r', "lj01" = 'l'
if pdbT == "crystal":
firstLetter = 'c'
elif pdbT == "hydro":
firstLetter = 'h'
if runT == "quick":
secondLetter = 'q'
elif runT == "def":
secondLetter = 'd'
if scaleT == "raw":
thirdLetter = 'r'
elif scaleT == "lj01":
thirdLetter = 'l'
return firstLetter + secondLetter + thirdLetter
def foo():
print getRunTypeAbbreviation("crysta", "quick", "raw")
if __name__ == "__main__":
a = [1,2,3]
for eachA in a:
print eachA
if eachA == 1:
a.remove(eachA)
print a
# a comment