LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to plot a heatmap for occurence of strings in different groups

Solved!
Go to solution

This seems to be the same file as previously (same name&size). I cannot imagine a student name requiring 100s of characters. The first field on each line does not resemble names at all!

 

 

string,Group
"InChI=1S/C10H18ClN3O2/c1-8-2-4-9(5-3-8)12-10(15)14(13-16)7-6-11/h8-9H,2-7H2,1H3,(H,12,15)",0
"InChI=1S/C10H20N2S4/c1-5-11(6-2)9(13)15-16-10(14)12(7-3)8-4/h5-8H2,1-4H3",0
"InChI=1S/C11H10BrN5/c12-9-7(17-11-15-5-6-16-11)1-2-8-10(9)14-4-3-13-8/h1-4H,5-6H2,(H2,15,16,17)",0
"InChI=1S/C11H12N2O2/c1-2-4-9-8(3-1)14-7-10(15-9)11-12-5-6-13-11/h1-4,10H,5-7H2,(H,12,13)",0
InChI=1S/C11H7NS/c13-8-12-11-7-3-5-9-4-1-2-6-10(9)11/h1-7H,0
"InChI=1S/C12H6Cl4O2S/c13-5-1-7(15)11(17)9(3-5)19-10-4-6(14)2-8(16)12(10)18/h1-4,17-18H",0
"InChI=1S/C13H16N2/c1-9-5-4-6-12(10(9)2)11(3)13-7-14-8-15-13/h4-8,11H,1-3H3,(H,14,15)",0
"InChI=1S/C13H17N/c1-4-10-14(3)12(2)11-13-8-6-5-7-9-13/h1,5-9,12H,10-11H2,2-3H3",0
"InChI=1S/C13H6Cl6O2/c14-6-2-8(16)12(20)4(10(6)18)1-5-11(19)7(15)3-9(17)13(5)21/h2-3,20-21H,1H2",0
"InChI=1S/C14H10Cl4/c15-10-7-5-9(6-8-10)13(14(17)18)11-3-1-2-4-12(11)16/h1-8,13-14H",0
"InChI=1S/C14H12N2/c1-2-7-14-11(4-1)5-3-6-12(14)8-13-9-15-10-16-13/h1-7,9-10H,8H2,(H,15,16)",0
"InChI=1S/C14H12N2O/c17-14(13-8-15-9-16-13)12-7-3-5-10-4-1-2-6-11(10)12/h1-9,14,17H,(H,15,16)",0
"InChI=1S/C14H14ClNS/c15-13-4-2-1-3-11(13)9-16-7-5-14-12(10-16)6-8-17-14/h1-4,6,8H,5,7,9-10H2",0
"InChI=1S/C14H18N2O/c1-9(15)7-10-8-16-12-4-5-13-11(14(10)12)3-2-6-17-13/h4-5,8-9,16H,2-3,6-7,15H2,1H3",0
"InChI=1S/C14H19N3S/c1-16(2)9-10-17(12-13-6-5-11-18-13)14-7-3-4-8-15-14/h3-8,11H,9-10,12H2,1-2H3",0
"InChI=1S/C14H22ClN3O2/c1-4-18(5-2)7-6-17-14(19)10-8-11(15)12(16)9-13(10)20-3/h8-9H,4-7,16H2,1-3H3,(H,17,19)",0
"InChI=1S/C14H22O/c1-2-3-4-5-6-7-8-13-9-11-14(15)12-10-13/h9-12,15H,2-8H2,1H3",0
InChI=1S/C14H8N2S4/c1-3-7-11-9(5-1)15-13(17-11)19-20-14-16-10-6-2-4-8-12(10)18-14/h1-8H,0
"InChI=1S/C15H13NO/c1-10(17)16-13-6-7-15-12(9-13)8-11-4-2-3-5-14(11)15/h2-7,9H,8H2,1H3,(H,16,17)",0
"InChI=1S/C15H14N2/c1-11(15-9-16-10-17-15)13-8-4-6-12-5-2-3-7-14(12)13/h2-11H,1H3,(H,16,17)",0
"InChI=1S/C15H23N3O4S/c1-3-18-8-4-5-11(18)10-17-15(19)13-9-12(23(16,20)21)6-7-14(13)22-2/h6-7,9,11H,3-5,8,10H2,1-2H3,(H,17,19)(H2,16,20,21)",0
...

 

0 Kudos
Message 11 of 19
(1,347 Views)

I saved to file in xlsx format. Is it still not possible to use it.

In excel, I can read the string with no issue.

The first column contains the strings and the second is the group that each string belongs to.

It is actually a chemistry problem but you can just imagine that the strings are codes for students cards. 😉

0 Kudos
Message 12 of 19
(1,342 Views)

That seems to be the same file and we can read the csv just fine as with my example. Have you tried? All you need to do is change the set comparison based on your requirements. Do you understand my code?

 

You still might want to fix the lines where the name is not in quotes.

Message 13 of 19
(1,336 Views)

@ziedhosni wrote:

Let me put a real-life example. Let's imagine some students participating in the clubs of the university. Some of them decide to join one club each and some participate in different clubs.

The heat map will measure the proportion of each club i members in club j. The diagonal will be 1 obviously.

 


why don't you use an example from your data? your data reminds me of one of those condensed formulas in organic chemistry...

 

e.g. C10H18ClN3O2 = https://pubchem.ncbi.nlm.nih.gov/compound/Semustine

 


@ziedhosni wrote:

The diagonal will be 1 obviously.

If no member of the club of music is participating in theatre club then we have zero in that interesction (pair).

I keep forgetting the dataset.


regarding labview sets, there is a intersection methode: https://labviewwiki.org/wiki/Set_Intersection_function

 

It looks like you want to divide the 25x25 matrix by the diagonal element containing the maximum size of each row ...

 

alexderjuengere_0-1645829923475.png

 

I am not sure, if this makes any sense

Message 14 of 19
(1,321 Views)

It looks like what I am looking for in that picture.

Could you please share this code to test it?

 

There is a good reason why I use the strings as they are and not in that simplified way.

That format is InChi which is not relevant and simple to explain to people not in the field of cheminformatics.

The problem is ambiguous enough. 🙂

0 Kudos
Message 15 of 19
(1,315 Views)
Solution
Accepted by topic author ziedhosni

the attached .vi is just a slight modification/extension of altenbachs .vi from message Message 9

0 Kudos
Message 16 of 19
(1,282 Views)

That's great.

It is working for me now.

My only issue now is to change the colours map to the ratios table [0..1] which is called array 2 in the VI and not the table of occurences called array. I think it is a setting related to z scale marker value..

Thanks,

 

0 Kudos
Message 17 of 19
(1,250 Views)

@ziedhosni wrote:

 

My only issue now is to change the colours map to the ratios table [0..1] which is called array 2 in the VI and not the table of occurences called array. I think it is a setting related to z scale marker value..


 

ok...  delete the old intensity graph, drop a new one on the frontpanel, rightclick>create> reference,

wire the reference to a property node and run the .vi

alexderjuengere_3-1646146173044.png

 

setting up the intensity graph via property node like above, the Z Scale.Marker Values[] work like an lower bound

e.g. ratio table element [0,18] is rendered blue because

 0,5 > { ratio table element [0,18] = 0,204082 } >= 0,1

 

alexderjuengere_2-1646146150412.png

Message 18 of 19
(1,234 Views)

Thanks to both of you, Alex and Altenbach 🙂

0 Kudos
Message 19 of 19
(1,225 Views)