Louis BECQUEY

More command line options

...@@ -210,7 +210,7 @@ class Chain: ...@@ -210,7 +210,7 @@ class Chain:
210 notify(status) 210 notify(status)
211 211
212 @trace_unhandled_exceptions 212 @trace_unhandled_exceptions
213 - def extract_3D_data(self): 213 + def extract_3D_data(self, save_logs=True):
214 """ Maps DSSR annotations to the chain. """ 214 """ Maps DSSR annotations to the chain. """
215 215
216 ############################################ 216 ############################################
...@@ -513,7 +513,7 @@ class Chain: ...@@ -513,7 +513,7 @@ class Chain:
513 return None 513 return None
514 514
515 # Log chain info to file 515 # Log chain info to file
516 - if self.mapping is not None: 516 + if save_logs and self.mapping is not None:
517 self.mapping.to_file(self.chain_label+".log") 517 self.mapping.to_file(self.chain_label+".log")
518 518
519 return df 519 return df
...@@ -982,6 +982,7 @@ class Pipeline: ...@@ -982,6 +982,7 @@ class Pipeline:
982 self.REUSE_ALL = False 982 self.REUSE_ALL = False
983 self.SELECT_ONLY = None 983 self.SELECT_ONLY = None
984 self.ARCHIVE = False 984 self.ARCHIVE = False
985 + self.SAVELOGS = True
985 986
986 def process_options(self): 987 def process_options(self):
987 """Sets the paths and options of the pipeline""" 988 """Sets the paths and options of the pipeline"""
...@@ -992,7 +993,7 @@ class Pipeline: ...@@ -992,7 +993,7 @@ class Pipeline:
992 opts, _ = getopt.getopt( sys.argv[1:], "r:hs", 993 opts, _ = getopt.getopt( sys.argv[1:], "r:hs",
993 [ "help", "resolution=", "keep-hetatm=", "from-scratch", 994 [ "help", "resolution=", "keep-hetatm=", "from-scratch",
994 "fill-gaps=", "3d-folder=", "seq-folder=", 995 "fill-gaps=", "3d-folder=", "seq-folder=",
995 - "no-homology", "ignore-issues", "extract", "only=", "all", 996 + "no-homology", "ignore-issues", "extract", "only=", "all", "no-logs",
996 "archive", "update-homologous" ]) 997 "archive", "update-homologous" ])
997 except getopt.GetoptError as err: 998 except getopt.GetoptError as err:
998 print(err) 999 print(err)
...@@ -1035,6 +1036,7 @@ class Pipeline: ...@@ -1035,6 +1036,7 @@ class Pipeline:
1035 print("--update-homologous\t\tRe-download Rfam and SILVA databases, realign all families, and recompute all CSV files") 1036 print("--update-homologous\t\tRe-download Rfam and SILVA databases, realign all families, and recompute all CSV files")
1036 print("--from-scratch\t\t\tDelete database, local 3D and sequence files, and known issues, and recompute.") 1037 print("--from-scratch\t\t\tDelete database, local 3D and sequence files, and known issues, and recompute.")
1037 print("--archive\t\t\tCreate a tar.gz archive of the datapoints text files, and update the link to the latest archive") 1038 print("--archive\t\t\tCreate a tar.gz archive of the datapoints text files, and update the link to the latest archive")
1039 + print("--no-logs\t\t\tDo not save per-chain logs of the numbering modifications")
1038 print() 1040 print()
1039 print("Typical usage:") 1041 print("Typical usage:")
1040 print(f"nohup bash -c 'time {runDir}/RNAnet.py --3d-folder ~/Data/RNA/3D/ --seq-folder ~/Data/RNA/sequences -s --archive' &") 1042 print(f"nohup bash -c 'time {runDir}/RNAnet.py --3d-folder ~/Data/RNA/3D/ --seq-folder ~/Data/RNA/sequences -s --archive' &")
...@@ -1096,6 +1098,8 @@ class Pipeline: ...@@ -1096,6 +1098,8 @@ class Pipeline:
1096 self.EXTRACT_CHAINS = True 1098 self.EXTRACT_CHAINS = True
1097 elif opt == "--archive": 1099 elif opt == "--archive":
1098 self.ARCHIVE = True 1100 self.ARCHIVE = True
1101 + elif opt == "--no-logs":
1102 + self.SAVELOGS = False
1099 1103
1100 if self.HOMOLOGY and "tobedefinedbyoptions" in [path_to_3D_data, path_to_seq_data] or path_to_3D_data == "tobedefinedbyoptions": 1104 if self.HOMOLOGY and "tobedefinedbyoptions" in [path_to_3D_data, path_to_seq_data] or path_to_3D_data == "tobedefinedbyoptions":
1101 print("usage: RNANet.py --3d-folder path/where/to/store/chains --seq-folder path/where/to/store/alignments") 1105 print("usage: RNANet.py --3d-folder path/where/to/store/chains --seq-folder path/where/to/store/alignments")
...@@ -1227,7 +1231,7 @@ class Pipeline: ...@@ -1227,7 +1231,7 @@ class Pipeline:
1227 c.delete_me = False # give a second chance 1231 c.delete_me = False # give a second chance
1228 if (c.chain_label not in self.known_issues) or not self.USE_KNOWN_ISSUES: 1232 if (c.chain_label not in self.known_issues) or not self.USE_KNOWN_ISSUES:
1229 joblist.append(Job(function=work_build_chain, how_many_in_parallel=int(coeff_ncores*ncores), 1233 joblist.append(Job(function=work_build_chain, how_many_in_parallel=int(coeff_ncores*ncores),
1230 - args=[c, self.EXTRACT_CHAINS, self.KEEP_HETATM, retry])) 1234 + args=[c, self.EXTRACT_CHAINS, self.KEEP_HETATM, retry, self.SAVELOGS]))
1231 try: 1235 try:
1232 results = execute_joblist(joblist) 1236 results = execute_joblist(joblist)
1233 except: 1237 except:
...@@ -1957,7 +1961,7 @@ def work_mmcif(pdb_id): ...@@ -1957,7 +1961,7 @@ def work_mmcif(pdb_id):
1957 return 0 1961 return 0
1958 1962
1959 @trace_unhandled_exceptions 1963 @trace_unhandled_exceptions
1960 -def work_build_chain(c, extract, khetatm, retrying=False): 1964 +def work_build_chain(c, extract, khetatm, retrying=False, save_logs=True):
1961 """Reads information from JSON and save it to database. 1965 """Reads information from JSON and save it to database.
1962 If asked, also extracts the 3D chains from their original structure files. 1966 If asked, also extracts the 3D chains from their original structure files.
1963 1967
...@@ -1969,7 +1973,7 @@ def work_build_chain(c, extract, khetatm, retrying=False): ...@@ -1969,7 +1973,7 @@ def work_build_chain(c, extract, khetatm, retrying=False):
1969 1973
1970 # extract the 3D descriptors 1974 # extract the 3D descriptors
1971 if not c.delete_me: 1975 if not c.delete_me:
1972 - df = c.extract_3D_data() 1976 + df = c.extract_3D_data(save_logs)
1973 c.register_chain(df) 1977 c.register_chain(df)
1974 1978
1975 # Small check 1979 # Small check
......
This diff is collapsed. Click to expand it.