0
$\begingroup$

I have a list of molecule SMILES, I want to double check if I have repeated elements in my list. How do I check that, using the function "if"? When I try the function "if" for two different lists, it works, but not if I use the same list with two different names.

$\endgroup$
4
  • 2
    $\begingroup$ Can't fully answer without some code or some sample data, but... I'm assuming that a SMILES representation is a string. I'm also assuming that a SMILES representation has a canonical form so that we don't have to worry about semantic interpretation of the entry--we only need to look at the string representation to determine duplicates. Give these assumptions, you probably want to start with DuplicatesFreeQ, DeleteDuplicates, and maybe some string-pattern-matching like StringMatchQ. $\endgroup$
    – lericr
    Jun 21 at 21:04
  • 2
    $\begingroup$ It would be helpful to see how your if-based solution worked and how it didn't. $\endgroup$
    – lericr
    Jun 21 at 21:04
  • $\begingroup$ You should be able to use MoleculeValue[mol, "CanonicalSMILES"] or MoleculeValue[mol, "IsomericSMILES"] to canonicalize your molecules before using Union[] or DeleteDuplicates[]. See also MoleculeMatchQ[]. $\endgroup$ Jun 21 at 21:10
  • $\begingroup$ The title of the post can be modified/improved. $\endgroup$
    – Syed
    Jun 22 at 7:58

0

Browse other questions tagged or ask your own question.