Commit 5e37c5dd authored by nsoler's avatar nsoler
Browse files

admin cc scripts

parent 5d0e1a7c
Pipeline #2394 failed with stages
in 1 minute and 58 seconds
...@@ -9,33 +9,33 @@ from get_repo_version import cc_repo_version ...@@ -9,33 +9,33 @@ from get_repo_version import cc_repo_version
def export_features_sign0(destination="/aloy/scratch/nsoler/CC_related/EXPORT_SIGN/sign0_features", cc_repo=None): def export_features_sign0(destination="/aloy/scratch/nsoler/CC_related/EXPORT_SIGN/sign0_features", cc_repo=None):
if cc_repo is None: if cc_repo is None:
cc_repo = cc_repo_version() cc_repo = cc_repo_version()
if cc_repo is None: if cc_repo is None:
print("ERROR, cannot guess the latest cc repository path") print("ERROR, cannot guess the latest cc repository path")
print("Please provide it as an argument") print("Please provide it as an argument")
print("ex: cc_repo='/aloy/web_checker/package_cc/2020_02'") print("ex: cc_repo='/aloy/web_checker/package_cc/2020_02'")
return return
else: else:
print("Working with cc_repo:",cc_repo) print("Working with cc_repo:",cc_repo)
if not os.path.exists(destination): if not os.path.exists(destination):
try: try:
os.makedirs(destination) os.makedirs(destination)
except Exception as e: except Exception as e:
print("ERROR while attempting to create destination folder", destination) print("ERROR while attempting to create destination folder", destination)
print(e) print(e)
else: else:
print("Created directory", destination) print("Created directory", destination)
cc = ChemicalChecker(cc_repo) cc = ChemicalChecker(cc_repo)
for space in "ABCDE": for space in "ABCDE":
for num in (1, 2, 3, 4, 5): for num in (1, 2, 3, 4, 5):
ds= space+str(num)+'.001' ds= space+str(num)+'.001'
sign0tmp = cc.get_signature('sign0', 'full', ds) sign0tmp = cc.get_signature('sign0', 'full', ds)
sign0tmp.export_features(destination) sign0tmp.export_features(destination)
if __name__== '__main__': if __name__== '__main__':
destination="/aloy/scratch/nsoler/CC_related/EXPORT_SIGN/sign0_features" destination="/aloy/scratch/nsoler/CC_related/EXPORT_SIGN/sign0_features"
export_features_sign0(destination=destination) export_features_sign0(destination=destination)
\ No newline at end of file \ No newline at end of file
...@@ -5,54 +5,54 @@ import os, sys ...@@ -5,54 +5,54 @@ import os, sys
from get_repo_version import cc_repo_version from get_repo_version import cc_repo_version
def make_symlinks(destination = "/aloy/scratch/nsoler/CC_related/EXPORT_SIGN", cc_repo=None): def make_symlinks(destination = "/aloy/scratch/nsoler/CC_related/EXPORT_SIGN", cc_repo=None):
""" """
Creates symlinks for all signatures in a single folder Creates symlinks for all signatures in a single folder
""" """
if cc_repo is None: if cc_repo is None:
cc_repo = cc_repo_version() cc_repo = cc_repo_version()
if cc_repo is None: if cc_repo is None:
print("ERROR, cannot guess the latest cc repository path") print("ERROR, cannot guess the latest cc repository path")
print("Please provide it as an argument") print("Please provide it as an argument")
print("ex: cc_repo='/aloy/web_checker/package_cc/2020_02'") print("ex: cc_repo='/aloy/web_checker/package_cc/2020_02'")
return return
else: else:
print("Working with cc_repo:",cc_repo) print("Working with cc_repo:",cc_repo)
if not os.path.exists(destination): if not os.path.exists(destination):
try: try:
os.makedirs(destination) os.makedirs(destination)
except Exception as e: except Exception as e:
print("ERROR while attempting to create destination folder", destination) print("ERROR while attempting to create destination folder", destination)
print(e) print(e)
else: else:
print("Created directory", destination) print("Created directory", destination)
for molset in ('full', 'reference'): for molset in ('full', 'reference'):
for space in "ABCDE": for space in "ABCDE":
for num in (1, 2, 3, 4, 5): for num in (1, 2, 3, 4, 5):
for sign in ('sign0', 'sign1','sign2','sign3'): for sign in ('sign0', 'sign1','sign2','sign3'):
subsp= space+str(num) subsp= space+str(num)
ds = subsp+'.001' ds = subsp+'.001'
signFile= os.path.join(cc_repo, molset,space, subsp, ds, sign, sign+'_BACKUP.h5') signFile= os.path.join(cc_repo, molset,space, subsp, ds, sign, sign+'_BACKUP.h5')
if os.path.exists(signFile): if os.path.exists(signFile):
# Make a symlink into the destination # Make a symlink into the destination
symlink = os.path.join(destination, sign+'_'+subsp+'_'+molset+'.h5') symlink = os.path.join(destination, sign+'_'+subsp+'_'+molset+'.h5')
try: try:
os.symlink(signFile, symlink) os.symlink(signFile, symlink)
except Exception as e: except Exception as e:
print("Error for creating", symlink) print("Error for creating", symlink)
print(e) print(e)
else: else:
print("Created symlink:",symlink) print("Created symlink:",symlink)
else: else:
print("File not found: ",signFile) print("File not found: ",signFile)
if __name__== '__main__': if __name__== '__main__':
destination = "/aloy/web_checker/package_cc/2020_02/sign_links" destination = "/aloy/web_checker/package_cc/2020_02/sign_links"
make symlinks(destination=destination) make symlinks(destination=destination)
\ No newline at end of file \ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment