Mercurial > repos > petrn > repeatexplorer
comparison seqclust @ 2:94877d063270 draft
Uploaded
author | petrn |
---|---|
date | Fri, 20 Dec 2019 11:14:11 +0000 |
parents | 2d43ed150abe |
children | 8f7909cf86df |
comparison
equal
deleted
inserted
replaced
1:2d43ed150abe | 2:94877d063270 |
---|---|
25 | 25 |
26 LOGGER = logging.getLogger(__name__) | 26 LOGGER = logging.getLogger(__name__) |
27 | 27 |
28 | 28 |
29 def get_version(path, tarean_mode): | 29 def get_version(path, tarean_mode): |
30 # get git version | |
31 branch = "?" | |
32 shorthash = "?" | |
33 revcount = "?" | |
34 tag = "?" | |
30 try: | 35 try: |
31 branch = subprocess.check_output("git rev-parse --abbrev-ref HEAD", | 36 branch = subprocess.check_output("git rev-parse --abbrev-ref HEAD", |
32 shell=True, | 37 shell=True, |
33 cwd=path).decode('ascii').strip() | 38 cwd=path).decode('ascii').strip() |
34 shorthash = subprocess.check_output( | 39 shorthash = subprocess.check_output( |
36 shell=True, | 41 shell=True, |
37 cwd=path).decode('ascii').strip() | 42 cwd=path).decode('ascii').strip() |
38 revcount = len(subprocess.check_output( | 43 revcount = len(subprocess.check_output( |
39 "git log --oneline", shell=True, | 44 "git log --oneline", shell=True, |
40 cwd=path).decode('ascii').split()) | 45 cwd=path).decode('ascii').split()) |
41 try: | 46 tag = subprocess.check_output("git describe --tags --abbrev=0", |
42 tag = subprocess.check_output("git describe --tags --abbrev=0", | |
43 cwd=path, | 47 cwd=path, |
44 shell=True).decode('ascii').strip() | 48 shell=True).decode('ascii').strip() |
45 except subprocess.CalledProcessError: | 49 version_info = "{branch}-{tag}-{revcount}({shorthash})".format( |
46 tag = " " | 50 branch=branch, |
47 | 51 shorthash=shorthash, |
48 version_string = ( | 52 tag=tag, |
49 "-------------------------------------" | 53 revcount=revcount |
50 "-------------------------------------\n" | 54 ) |
51 "PIPELINE VERSION : " | 55 except subprocess.CalledProcessError: |
52 "{branch}-{tag}-{revcount}({shorthash})\n\n" | 56 # alernativelly - read it from file |
53 "PROTEIN DATABASE VERSION : {PD}\n" | 57 try: |
54 " md5 checksum : {PDmd5}\n\n" | 58 with open(path + "/version_info.txt", 'r') as f: |
55 "DNA DATABASE VERSION : {DD}\n" | 59 version_info = f.read() |
56 " md5 checksum : {DDmd5}\n" | 60 except FileNotFoundError: |
57 "-------------------------------------" | 61 version_info = "version of pipeline not available!" |
58 "-------------------------------------\n").format( | 62 |
59 branch=branch, | 63 ## get database versions: |
60 shorthash=shorthash, | 64 PD = "?" |
61 revcount=revcount, | 65 PDmd5 = "?" |
62 tag=tag, | 66 DD = "?" |
63 PD=os.path.basename(config.PROTEIN_DATABASE), | 67 DDmd5 = "?" |
64 PDmd5=utils.md5checksum(config.PROTEIN_DATABASE + ".psq", fail_if_missing = not tarean_mode), | 68 try: |
65 DD=os.path.basename(config.DNA_DATABASE), | 69 PD = os.path.basename(config.PROTEIN_DATABASE) |
66 DDmd5=utils.md5checksum(config.DNA_DATABASE + ".nsq")) | 70 PDmd5 = utils.md5checksum(config.PROTEIN_DATABASE + ".psq", |
67 | 71 fail_if_missing=not tarean_mode) |
72 DD = os.path.basename(config.DNA_DATABASE) | |
73 DDmd5 = utils.md5checksum(config.DNA_DATABASE + ".nsq") | |
68 except: | 74 except: |
69 version_string = "version of pipeline not available!" | 75 ## some problem with databases |
76 pass | |
77 version_string = ( | |
78 "-------------------------------------" | |
79 "-------------------------------------\n" | |
80 "PIPELINE VERSION : " | |
81 "{version_info}\n\n" | |
82 "PROTEIN DATABASE VERSION : {PD}\n" | |
83 " md5 checksum : {PDmd5}\n\n" | |
84 "DNA DATABASE VERSION : {DD}\n" | |
85 " md5 checksum : {DDmd5}\n" | |
86 "-------------------------------------" | |
87 "-------------------------------------\n").format( | |
88 | |
89 version_info=version_info, | |
90 PD=PD, | |
91 PDmd5=PDmd5, | |
92 DD=DD, | |
93 DDmd5=DDmd5 | |
94 ) | |
70 | 95 |
71 LOGGER.info(version_string) | 96 LOGGER.info(version_string) |
72 return version_string | 97 return version_string |
73 | 98 |
74 | 99 |