|
9 | 9 |
|
10 | 10 | class InvestigationXChem(InvestigationEngine): |
11 | 11 |
|
12 | | - def __init__(self, sqlite_path: str, deposit_path: str, cif_files: str, investigation_id: str, output_path: str) -> None: |
| 12 | + def __init__(self, sqlite_path: str, investigation_id: str, output_path: str, json_path: str, cif_type: str) -> None: |
13 | 13 | logging.info("Instantiating XChem Investigation subclass") |
14 | | - self.sqlite_reader= SqliteReader(sqlite_path) |
15 | | - self.pickle_reader = PickleReader(deposit_path).data |
16 | | - self.reader = CIFReader() |
17 | | - self.reader.read_files(cif_files) |
18 | | - self.operation_file_json = "./operations/xchem_operations.json" |
| 14 | + self.reader = SqliteReader(sqlite_path) |
| 15 | + self.operation_file_json = json_path |
19 | 16 | self.excluded_libraries = ["'Diffraction Test'","'Solvent'"] |
| 17 | + self.cif_type = cif_type |
20 | 18 | super().__init__(investigation_id, output_path) |
21 | 19 |
|
22 | 20 | def pre_run(self) -> None: |
23 | 21 | logging.info("Pre-running") |
24 | | - libraries=["XChem_Libraries_2024-02-01.csv"] |
25 | | - for library in libraries: |
26 | | - self.load_library_csv(f"./external_data/{library}") |
27 | | - self.create_experiment_table() |
28 | | - self.find_missing_compound_information() |
| 22 | + if self.cif_type == "investigation": |
| 23 | + libraries=["XChem_Libraries_2024-02-01.csv"] |
| 24 | + for library in libraries: |
| 25 | + self.load_library_csv(f"./external_data/{library}") |
| 26 | + self.create_experiment_table() |
| 27 | + self.find_missing_compound_information() |
29 | 28 | super().pre_run() |
30 | 29 |
|
31 | 30 | def find_missing_compound_information(self) -> None: |
@@ -193,27 +192,19 @@ def xchem_subparser(subparsers, parent_parser): |
193 | 192 | help="Path to the .sqlite file for each data set" |
194 | 193 | ) |
195 | 194 | parser_xchem.add_argument( |
196 | | - "--deposit", |
197 | | - help="Path for the deposition process via XCE" |
198 | | - ) |
199 | | - parser_xchem.add_argument( |
200 | | - "--txt", |
201 | | - help="Path to add additional information or overwrite in mmcifs" |
| 195 | + "--cif-type", |
| 196 | + help="Type of the CIF file that will be generated", |
| 197 | + default="model", |
| 198 | + choices=["model", "investigation"] |
202 | 199 | ) |
203 | 200 |
|
204 | | -def run(sqlite_path : str, deposit_path: str, txt_path: str, investigation_id: str, output_path: str) -> None: |
205 | | - cif_files = [] |
206 | | - if txt_path: |
207 | | - cif_files = get_cif_file_paths(txt_path) |
208 | | - print("List of CIF file paths:") |
209 | | - for file_path in cif_files: |
210 | | - print(file_path) |
211 | | - im = InvestigationXChem(sqlite_path, deposit_path, cif_files, investigation_id, output_path) |
| 201 | +def run(sqlite_path : str, investigation_id: str, output_path: str, json_path: str, cif_type: str) -> None: |
| 202 | + im = InvestigationXChem(sqlite_path, investigation_id, output_path, json_path, cif_type) |
212 | 203 | im.pre_run() |
213 | 204 | im.run() |
214 | 205 |
|
215 | 206 | def run_investigation_xchem(args): |
216 | 207 | if not args.sqlite: |
217 | 208 | logging.error("XChem facility requires path to --sqlite file") |
218 | 209 | return 1 |
219 | | - run(args.sqlite, args.deposit, args.txt, args.id, args.output_folder) |
| 210 | + run(args.sqlite, args.id, args.output_folder, args.json, args.cif_type) |
0 commit comments