Skip to content

Commit e84213c

Browse files
author
Dzmitry Ashkinadze
committed
removed potential for multiple copies of README
1 parent 91fa90a commit e84213c

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

correlationExtraction.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,6 @@ def __init__(self,
4343
self.resid = []
4444
self.aaS = 0
4545
self.aaF = 0
46-
try:
47-
os.mkdir(self.savePath)
48-
except:
49-
pass
5046
self.nstates = nstates # number of states
5147
# CREATE CORRELATION ESTIMATORS WITH STRUCTURE ANG CLUSTERING MODEL
5248
self.structure = PDBParser().get_structure('test', path)
@@ -89,6 +85,9 @@ def calc_ami(self, clusters, banres):
8985
return ami_list, ami_matrix
9086

9187
def calc_cor(self, graphics=True):
88+
# write readme file
89+
shutil.copyfile(os.path.join(os.path.dirname(os.path.realpath(__file__)), 'README.txt'),
90+
os.path.join(self.savePath, 'README.txt'))
9291
for chain in self.chains:
9392
chainPath = os.path.join(self.savePath, 'chain' + chain)
9493
try:
@@ -165,9 +164,6 @@ def calc_cor_chain(self, chain, chainPath, resid, graphics):
165164
self.write_correlations(dist_ami, ang_ami, best_clust, chainPath)
166165
# create a chimera executable
167166
self.color_pdb(best_clust, chainPath)
168-
# write readme file
169-
shutil.copyfile(os.path.join(os.path.dirname(os.path.realpath(__file__)), 'README.txt'),
170-
os.path.join(chainPath, 'README.txt'))
171167
# plot everything
172168
if graphics:
173169
print('PLOTTING')
@@ -503,8 +499,15 @@ def clust_cor(self, chain, resid):
503499
default=-1,
504500
help='End of the loop')
505501
args = parser.parse_args()
502+
# create correlations folder
503+
corPath = os.path.join(os.path.dirname(args.bundle), 'correlations')
504+
try:
505+
os.mkdir(corPath)
506+
except:
507+
pass
508+
# write parameters of the correlation extraction
506509
args_dict = vars(args)
507-
args_path = os.path.join(os.path.dirname(args.bundle), 'args.json')
510+
args_path = os.path.join(corPath, 'args.json')
508511
with open(args_path, 'w') as outfile:
509512
json.dump(args_dict, outfile)
510513
# correlation mode

0 commit comments

Comments
 (0)