openmolecules.org

 
Home » DataWarrior » Functionality » Category Filter logic
Category Filter logic [message #1123] Wed, 18 November 2020 21:01 Go to next message
chemtv is currently offline  chemtv
Messages: 26
Registered: February 2015
Location: Indianapolis
Junior Member
From the behavior of using several category filters together it seems the combination of filters uses AND logic? Can this be switched to OR logic?

ie. I get the union of the exact match of filters rather than all the rows with at least one filter being met.

Thanks for the hard work keeping datawarrior running so well!
Greg
Re: Category Filter logic [message #1124 is a reply to message #1123] Wed, 18 November 2020 21:55 Go to previous messageGo to next message
nbehrnd is currently offline  nbehrnd
Messages: 224
Registered: June 2019
Senior Member
Hello Greg,

once the properties are stored in DW's main table, both Boolean .or. and .and. may be used for further analysis. In the example below, I extended the initial query for molecular weights greater than 110 (yielding mesitylene) to one that would accept molecules with a molecular weight of either less than 80 .or. greater than 110 by the instruction

if((TotalMolweight<80) || (TotalMolweight>110), "True", "False")

in an additional column (Data -> Add Calculated Values). As expected, the second query yields both benzene and mesitylene now.

index.php?t=getfile&id=290&private=0

It is possible to use multiple properties of different columns, too. DW's mathematics, including logic expressions, which may be used are presented on

http://www.openmolecules.org/help/jep.html

Norwid

[Updated on: Wed, 18 November 2020 21:58]

Report message to a moderator

Re: Category Filter logic [message #1130 is a reply to message #1124] Fri, 20 November 2020 22:51 Go to previous messageGo to next message
thomas is currently offline  thomas
Messages: 715
Registered: June 2014
Senior Member
Multiple filters are always AND, which means that a row to be shown must meat all filter's criteria.
Nevertheless, logical OR filtering often can be achieved by one of these ways:
- Use a single filters for logical OR, e.g.
- a text filter with multiple comma separated items
- an 'ALL COLUMNS' text filter that searches all columns at once
- category filters use a natural OR
- use a multi structure filter hitting if at least one of the provided query structures match
- Using multiple filters with 'inverse' settings allows to model OR to some extend
Re: Category Filter logic [message #1998 is a reply to message #1130] Mon, 04 September 2023 17:33 Go to previous messageGo to next message
jeusamio is currently offline  jeusamio
Messages: 5
Registered: July 2023
Location: University of Barcelona
Junior Member
Hi, is there a way of applying an OR filter that matches a given structure for a specified set of columns?

i.e. Columns 1, 2, and 3 contain chemical structures. I would like to apply a filter to return any row which contains the specified structure in any of the three columns.

Would this kind of behavior be possible?

Thanks,

Javier
Re: Category Filter logic [message #1999 is a reply to message #1998] Mon, 04 September 2023 21:36 Go to previous messageGo to next message
nbehrnd is currently offline  nbehrnd
Messages: 224
Registered: June 2019
Senior Member
Dear Javier,

the program's internal documentation, chapter «working with data» briefly describes `chemsim(descriptor, idcode)` and `chemsim(descriptor1, descriptor2)` as if one could run build a new column of computed (Boolean) values line of `chemsim(PP3DMM2_of_Structure,"gFx@@eJf`@@@")` «check if column PP3DMM2_of_Structure contains the 3D motif of pyridine. I'm not aware if there either is a sketcher/converter to yield the DW's (2D) idcodes other than by access of a .dwar file with a text editor, or if/how e.g., a SMILES/SMARTS string could serve for a (sub) structure search. (Possibly, «descriptor» refers to the ones via Chemistry -> From Chemical Structure -> Calculate Descriptor.) Once identified, an extension to logical .and. and .or. would a next consequent step.

Norwid

[Updated on: Mon, 04 September 2023 21:37]

Report message to a moderator

Re: Category Filter logic [message #2000 is a reply to message #1998] Thu, 07 September 2023 15:10 Go to previous messageGo to next message
thomas is currently offline  thomas
Messages: 715
Registered: June 2014
Senior Member
Dear Javier and Norvid,

another way would be to merge your three structure columns into one new column and use a sub-structure-filter on the new column.

Norvid's suggestion reminds me to add a new chemsss() function, which would be more useful in this context than the chemsim() function.

Thomas

[Updated on: Thu, 07 September 2023 15:10]

Report message to a moderator

Re: Category Filter logic [message #2001 is a reply to message #2000] Thu, 07 September 2023 22:31 Go to previous message
nbehrnd is currently offline  nbehrnd
Messages: 224
Registered: June 2019
Senior Member
Dear Thomas,

chemsim() attracted attention because of a recent find that openbabel's not only can retrieve molecules sharing a structural motif as a filter criterion, yet equally can highlight substructures, e.g. (discounting the backticks / accents graves) `obabel -:"c1ccncc1CCOC" -O example.png -s "c1ccncc1 blue"` in visual outputs.

Thank you,

Norwid
Previous Topic: thresholds and weights of toxicity risk
Next Topic: Tab delimited txt / open special
Goto Forum:
  


Current Time: Fri Nov 22 05:24:50 CET 2024

Total time taken to generate the page: 0.03656 seconds