Skip to content

QDESCP: Error due to mixing of list and float: #226

@SHAE0

Description

@SHAE0

Hello, I have been using this as a very useful open-source software and have been paying close attention to it.
I am reaching out regarding an error I encountered.

The following error occurred during the execution of QDESCP.
The target was the SDF generated with CSEARCH from the dataset used (https://deepchemdata.s3-us-west-1.amazonaws.com/datasets/Lipophilicity.csv).
I confirmed that it runs without problems on another dataset.
Is this an expected error?


TypeError Traceback (most recent call last)
Cell In[4], line 2
1 sdf_rdkit_files = glob.glob(f'CSEARCH/*.sdf')
----> 2 qdescp(
3 program='xtb',
4 files=sdf_rdkit_files,
5 robert=False,
6 nprocs=12,
7 boltz=True,
8 qdescp_temp=300,
9 )

File ~/miniconda3/envs/aqme/lib/python3.10/site-packages/aqme/qdescp.py:164, in qdescp.init(self, **kwargs)
162 # full xTB workflow in QDESCP for descriptor generation and collection
163 if self.args.program.lower() == "xtb":
--> 164 _ = self.qdescp_xtb_workflow(boltz_dir,destination,smarts_targets)
166 # full NMR workflow in QDESCP for NMR prediction
167 elif self.args.program.lower() == "nmr":

File ~/miniconda3/envs/aqme/lib/python3.10/site-packages/aqme/qdescp.py:224, in qdescp.qdescp_xtb_workflow(self, boltz_dir, destination, smarts_targets)
221 bar.finish()
223 if self.args.boltz:
--> 224 folder_raw = self.get_boltz_n_save_csv(destination,qdescp_files,descp_dict,boltz_dir,smarts_targets)
226 #AQME-ROBERT workflow: Combines the descriptor data from qdescp CSVs with the input CSV and saves the result.
227 _ = self.combine_and_save_csvs(descp_dict['qdescp_csv'], descp_dict['qdescp_denovo_csv'], descp_dict['qdescp_interpret_csv'], folder_raw)

File ~/miniconda3/envs/aqme/lib/python3.10/site-packages/aqme/qdescp.py:317, in qdescp.get_boltz_n_save_csv(self, destination, qdescp_files, descp_dict, boltz_dir, smarts_targets)
314 json_files = [x for x in glob.glob(f"{destination}/*.json") if os.path.basename(x).startswith(f'{name}conf')]
316 # Generating the JSON files
--> 317 all_prefixes_atoms = self.get_boltz_props(json_files, name, boltz_dir, "xtb", descp_dict_indiv, smarts_targets, mol, all_prefixes_atoms)
319 # Create the CSV files from the JSON files
320 folder_raw = Path(destination).joinpath(f'raw_csv_databases')

File ~/miniconda3/envs/aqme/lib/python3.10/site-packages/aqme/qdescp.py:353, in qdescp.get_boltz_props(self, json_files, name, boltz_dir, calc_type, descp_dict_indiv, smarts_targets, mol, all_prefixes_atoms)
350 descp_dict_indiv['atom_props'],descp_dict_indiv['interpret_atoms'],descp_dict_indiv['denovo_atoms'] = assign_prefix_atom_props(json_data['prefixes_atom_prop'],descp_dict_indiv['atom_props'],descp_dict_indiv['interpret_atoms'],descp_dict_indiv['denovo_atoms'])
352 # get all the properties (full level)
--> 353 full_json_data,atomic_props = full_level_boltz(descp_dict_indiv,json_files,energy,smarts_targets,full_json_data)
355 # Get denovo atomic properties
356 for prop in descp_dict_indiv['denovo_atoms']:

File ~/miniconda3/envs/aqme/lib/python3.10/site-packages/aqme/qdescp_utils.py:1192, in full_level_boltz(descp_dict, json_files, energy, smarts_targets, full_json_data)
1190 try:
1191 prop_list = [read_json(json_file)[prop] for json_file in json_files]
-> 1192 avg_prop = average_properties(boltz, prop_list)
1193 except KeyError:
1194 full_json_data[prop] = np.nan

File ~/miniconda3/envs/aqme/lib/python3.10/site-packages/aqme/qdescp_utils.py:1361, in average_properties(boltz, prop_list, is_atom_prop)
1359 def average_properties(boltz, prop_list, is_atom_prop=True):
1360 """Calculate average properties based on Boltzmann weights."""
-> 1361 return average_prop_atom(boltz, prop_list) if is_atom_prop else average_prop_mol(boltz, prop_list)

File ~/miniconda3/envs/aqme/lib/python3.10/site-packages/aqme/qdescp_utils.py:220, in average_prop_atom(weights, prop)
217 boltz_res = np.round(boltz_res, 4)
218 else:
219 # Otherwise, sum all the weighted values as a scalar and round to 4 decimal places
--> 220 boltz_res = round(sum(boltz_avg), 4)
221 except (ValueError,IndexError): # in some cases, there are atoms that are missing properties because of xTB calculation errors
222 boltz_res = np.nan

TypeError: unsupported operand type(s) for +: 'float' and 'list'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions