export_features_sign0.py 1.31 KB
Newer Older
nsoler's avatar
nsoler committed
1
2
3
4
5
## NS (08 Feb 2021), export the features from sign0
## So as 'sanitize' (i.e remove columns) identically as in the cc-rep when a custom dataset is made
## in A spaces

from chemicalchecker.core.chemcheck import ChemicalChecker
nsoler's avatar
nsoler committed
6
7
from get_repo_version import cc_repo_version
#VERSION= "2020_02"
nsoler's avatar
nsoler committed
8

nsoler's avatar
nsoler committed
9
def export_features_sign0(destination="/aloy/scratch/nsoler/CC_related/EXPORT_SIGN/sign0_features", cc_repo=None):
nsoler's avatar
nsoler committed
10

nsoler's avatar
nsoler committed
11
12
    if cc_repo is None:
    	cc_repo = cc_repo_version()
nsoler's avatar
nsoler committed
13

nsoler's avatar
nsoler committed
14
15
16
17
18
19
20
21
	    if cc_repo is None:
	        print("ERROR, cannot guess the latest cc repository path")
	        print("Please provide it as an argument")
	        print("ex: cc_repo='/aloy/web_checker/package_cc/2020_02'")
	        return
	    else:
	    	print("Working with cc_repo:",cc_repo)

nsoler's avatar
nsoler committed
22
23
24
25
26
27
28
29
30
	if not os.path.exists(destination):
		try:
			os.makedirs(destination)
		except Exception as e:
			print("ERROR while attempting to create destination folder", destination)
			print(e)
		else:
			print("Created directory", destination)

nsoler's avatar
nsoler committed
31
32
33
34
35
36
	cc = ChemicalChecker(cc_repo)

	for space in "ABCDE":
		for num in (1, 2, 3, 4, 5):
			ds= space+str(num)+'.001'
			sign0tmp = cc.get_signature('sign0', 'full', ds)
nsoler's avatar
nsoler committed
37
38
39
40
41
			sign0tmp.export_features(destination)

if __name__== '__main__':
	destination="/aloy/scratch/nsoler/CC_related/EXPORT_SIGN/sign0_features"
	export_features_sign0(destination=destination)