Skip to content

Defective SMILES strings in pcqm4mv2 #510

Description

@0xnurl

When loading pcqm4mv2 using the provided dataloader, the following error occurs because of defective SMILES strings: (see #498)

'NoneType' object has no attribute 'GetAtoms'

Using RDKit 2025.9.2.

It seems that newer versions of RDKit enforces things more strictly.

These are the defective strings and their index in the CSV:

51128, O[Si]123O[Si]3(O1)(O2)O
142541, C1[SiH2]2[SiH2]1C2
155174, Cl[SiH]12C[SiH2]2C1
155175, Cl[SiH]12C[SiH]2(C1)Cl
155176, Cl[Si]12(Cl)C[SiH]2(C1)Cl
155180, c1ccc(cc1)[SiH]12C[SiH]2(C1)c1ccccc1
155181, Br[SiH]12C[SiH2]2C1
193600, C[Si]1234C[Si]564C42[Si]23(C1)[Si]54(C2)(C6)C
411357, CO[Si]12(C)O[Si]2(O1)(C)OC
505556, CC1(C)[Si]2[Si]1(C2)(C)C
1756391, CCO[Si]12(C)C[Si]2(C1)(C)OCC
1756392, CC1[Si]2([Si]1(C2)(Cl)Cl)(Cl)Cl
2064546, c1ccc(cc1)[Si]12(C[Si]2C1)c1ccccc1
2100882, CO[Si]1(OC)(OC)N(C)[C](N1C)N(C)C
2119947, C[Si]123O[Si]3(O1)(O2)C
2539039, CN1[C](O[P]1(F)(F)(F)F)c1ccccc1
2620153, [O]N1O[Si]2(O1)([O])ON(O2)[O]
2661113, F[Si](F)(F)(F)(F)F
2690488, Cl[C]1C=CC=C2N1C[Si](O2)(C)(C)Cl
2690489, C[C]1C=CC=C2N1C[Si](O2)(C)(C)Cl
2885109, CO[Si]12(C)C[Si]2(C1)(OC)OC
2885110, CO[Si]12(OC)C[Si]2(C1)(OC)OC
2980839, F[P](F)(F)(F)(F)F
2992920, F[Si]12(F)C[Si]2(C1)(F)F
3003839, C[Si]1(C)(Cl)OC2=CC=C[CH]N2C1
3006497, C[Si]12(C[Si]2(C1)(C)C)c1ccccc1
3096168, C[Si]12(C)C[Si]2C1
3132431, C[Si]12(C)C[Si]2(C1)(Cl)Cl
3132432, C[Si]12(Cl)C[Si]2(C1)(C)Cl
3143920, Fc1ccc(cc1)[C]1OC[Si](O1)(F)(F)F
3143921, Cc1ccc(cc1)[C]1OC[Si](O1)(F)(F)F
3208535, C=C[Si]12(C)C[Si]2(C1)(C)C
3318575, ClC1=CC=C2N([CH]1)C[Si](O2)(C)(C)Cl
3407347, C[Si]12(Cl)C[Si]2(C1)(C)C
3432361, O[Si]1(O)O[Si]23([Si](O1)(O2)(O3)O)O
3562751, Cl[Si]12(Cl)C[Si]2(C1)(Cl)Cl
3648958, C=C[Si]12(C)C[Si]2(C1)(C)C=C
3694349, CO[Si]12(OC)O[Si]2(O1)(OC)OC
3714998, [O]P123OP45([Si]3(O1)(O2)(O4)O5)[O]

To (temporarily) fix the issue, you can run the following script:

import pandas as pd
from rdkit import Chem
from tqdm import tqdm

filename = "data.csv"
df = pd.read_csv(filename)

idxs_to_remove = []

for index, row in tqdm(df.iterrows()):
    mol_generated = Chem.MolFromSmiles(row["smiles"])
    if mol_generated is None:
        idxs_to_remove.append(row["idx"])
        print(f'{row["idx"]}, {row["smiles"]}')


df_cleaned = df[~df["idx"].isin(idxs_to_remove)]

df_cleaned.to_csv("data_clean.csv", index=False)

Then run:

cp data_clean.csv data.csv # Overwrites the original file
gzip data.csv 

And copy data.csv.gz to dataset/pcqm4m-v2/raw.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions