openmolecules.org

 
Home » DataWarrior » Cheminformatics » cumlativeSumInCategory
cumlativeSumInCategory [message #1294] Wed, 19 May 2021 15:56 Go to next message
chemtv is currently offline  chemtv
Messages: 24
Registered: February 2015
Location: Indianapolis
Junior Member
I am trying to use a calculated column to sum the values per a text category but I keep getting "NaN" as the result. Can you tell what the problem is?
Attached is an example table...

The formula that gives NAN is:
cumulativeSumInCategory(plateID,"penalties")

I am expecting a new column that has the sum 14 for the first 3 entries and 7 for the second 3 entries, (same number for each of 3 rows).

BTW, I have no success with frequencyInCategory either. Can the frequency count unique text strings (eg. SMILES) as well as numbers?

Thanks,
Greg
  • Attachment: Example.dwar
    (Size: 1.19KB, Downloaded 222 times)

[Updated on: Wed, 19 May 2021 15:58]

Report message to a moderator

Re: cumlativeSumInCategory [message #1296 is a reply to message #1294] Fri, 21 May 2021 00:40 Go to previous messageGo to next message
nbehrnd is currently offline  nbehrnd
Messages: 208
Registered: June 2019
Senior Member
Dear Greg,

the computation fails because the instruction contains an error in the syntax. In your example, plateID and penalties are not variables, but label-like column headers. For this reason both are to be enclosed in quotes. To enable a computation, the formula thus shall be written as
cumulativeSumInCategory("plateID", "penalties")
Note, `cumulativeSumInCategory` adds line by line the penalties for the plateIDs, and accounts for all lines already scrutinized. This pattern is used in column «freq3» in the example attached below.

Your description of the anticipated results differs from this, though. It is better described by the formula
categorySum("plateID", "penalties")
This pattern is used in column «freq4»:

/forum/index.php?t=getfile&id=323&private=0

Norwid
  • Attachment: summation.png
    (Size: 48.13KB, Downloaded 373 times)
  • Attachment: probe.dwar
    (Size: 1.86KB, Downloaded 196 times)
Re: cumlativeSumInCategory [message #1298 is a reply to message #1296] Fri, 21 May 2021 14:18 Go to previous message
chemtv is currently offline  chemtv
Messages: 24
Registered: February 2015
Location: Indianapolis
Junior Member
Thanks so much this fixes my problem with several of these functions.

regards,
Greg
Previous Topic: Count # scaffolds by plate ID
Next Topic: mean from 'n' in pKaInWater.dwar
Goto Forum:
  


Current Time: Sat Apr 20 10:30:46 CEST 2024

Total time taken to generate the page: 0.04041 seconds