Your SlideShare is downloading. ×
0
Advanced Use of Properties and Scripts in TIBCO Spotfire <ul><li>C.R.E.A.Te  Community of Research Excellence & Advanced T...
Overview <ul><li>Examples of the use of properties </li></ul><ul><ul><li>Trellis Simulation </li></ul></ul><ul><ul><li>Usi...
Trellis Simulation Team, Player Name A t B a t s B i l l M u e l l e r E d g a r R e n t e r i a J o h n n y D a m o n M a...
Trellis Simulation B i l l M u e l l e r D a v i d O r t i z E d g a r R e n t e r i a J a s o n V a r i t e k J o h n n y...
Trellis Simulation <ul><li>Create document properties </li></ul><ul><ul><li>“ teamsPrPageProp ” (integer) </li></ul></ul><...
Using  $map  and  $csearch *run*
Using  $map  and  $csearch <ul><li>Create ‘Input Field’ in text area </li></ul><ul><li>Create associated document property...
Using  $map  and  $csearch <ul><li>Use custom expression on Y-axis </li></ul><ul><ul><li>$map(&quot; sum( $esc( $csearch([...
Comma separated tags column <ul><li>Data from a literature search (on next generation sequencing) </li></ul><ul><li>Comma ...
Comma separated tags column Detail on single paper 19 columns
Comma separated tags column <ul><li>Text area for parameters and scripts </li></ul><ul><ul><li>Drop-down list for column s...
Comma separated tags column <ul><li>GetTags  script: </li></ul>from System import Array from Spotfire.Dxp.Data import Inde...
Comma separated tags column <ul><li>Custom Expression on Y-axis: </li></ul><ul><ul><li>$map(&quot; Integer(Sum( if(find(&q...
Comma separated tags column <ul><li>Selection Problem </li></ul><ul><ul><li>because all data is derived from all records <...
Comma separated tags column <ul><li>MarkSelectedRow  script: </li></ul>from Spotfire.Dxp.Application.Visuals import Visual...
Expand marking
Expand marking
Expand Marking <ul><li>Expand marking to all other records with the same value for a chosen column (e.g. Position) </li></...
Expand Marking <ul><li>Script to re-apply a marking: </li></ul>from Spotfire.Dxp.Application.Visuals import VisualContent ...
Dynamic list box content <ul><li>Multi select list box in a text area </li></ul><ul><li>How do you dynamicaly change the c...
Dynamic list box content <ul><li>Define a tag column (e.g. ‘ SelectedGenes ’) </li></ul><ul><ul><li>Create a tag ‘ Selecte...
Dynamic list box content <ul><li>Script to set ‘tagValue’ in ‘tagColumn’ for marked records </li></ul>from Spotfire.Dxp.Da...
Advanced Use of Properties and Scripts in TIBCO Spotfire
Upcoming SlideShare
Loading in...5
×

Advanced Use of Properties and Scripts in TIBCO Spotfire

25,801

Published on

Published in: Technology, Education
0 Comments
5 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
25,801
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
323
Comments
0
Likes
5
Embeds 0
No embeds

No notes for slide

Transcript of "Advanced Use of Properties and Scripts in TIBCO Spotfire"

  1. 1. Advanced Use of Properties and Scripts in TIBCO Spotfire <ul><li>C.R.E.A.Te Community of Research Excellence & Advanced Technology </li></ul>Janssen Research & Development Herwig Van Marck
  2. 2. Overview <ul><li>Examples of the use of properties </li></ul><ul><ul><li>Trellis Simulation </li></ul></ul><ul><ul><li>Using $map and $csearch </li></ul></ul><ul><li>Examples of the use of scripts </li></ul><ul><ul><li>Using comma separated tag columns </li></ul></ul><ul><ul><li>Expand marking </li></ul></ul><ul><ul><li>Dynamic list box content </li></ul></ul>
  3. 3. Trellis Simulation Team, Player Name A t B a t s B i l l M u e l l e r E d g a r R e n t e r i a J o h n n y D a m o n M a n n y R a m i r e z A r a m i s R a m i r e z D e r r e k L e e J e r r y H a i r s t o n M i c h a e l B a r r e t t T o d d H o l l a n d s w … A . J . P i e r z y n s k i C a r l E v e r e t t J o e C r e d e P a u l K o n e r k o T a d a h i t o I g u c h i B o s t o n C h i C u b s C h i S o x B i l l M u e l l e r E d g a r R e n t e r i a J o h n n y D a m o n M a n n y R a m i r e z A r a m i s R a m i r e z D e r r e k L e e J e r r y H a i r s t o n M i c h a e l B a r r e t t T o d d H o l l a n d s w … A . J . P i e r z y n s k i C a r l E v e r e t t J o e C r e d e P a u l K o n e r k o T a d a h i t o I g u c h i B o s t o n C h i C u b s C h i S o x B i l l M u e l l e r E d g a r R e n t e r i a J o h n n y D a m o n M a n n y R a m i r e z A r a m i s R a m i r e z D e r r e k L e e J e r r y H a i r s t o n M i c h a e l B a r r e t t T o d d H o l l a n d s w … A . J . P i e r z y n s k i C a r l E v e r e t t J o e C r e d e P a u l K o n e r k o T a d a h i t o I g u c h i B o s t o n C h i C u b s C h i S o x 600 550 500 450 400 350 300 250 200 Boston Chi Cubs Chi Sox Color by Team Boston Chi Cubs Chi Sox
  4. 4. Trellis Simulation B i l l M u e l l e r D a v i d O r t i z E d g a r R e n t e r i a J a s o n V a r i t e k J o h n n y D a m o n K e v i n M i l l a r M a n n y R a m i r e z T r o t N i x o n A r a m i s R a m i r e z C o r e y P a t t e r s o n D e r r e k L e e J e r o m y B u r n i t z J e r r y H a i r s t o n J o s e M a c i a s M i c h a e l B a r r e t t N e i f i P e r e z T o d d H o l l a n d s w o r t h T o d d W a l k e r A . J . P i e r z y n s k i A a r o n R o w a n d C a r l E v e r e t t J e r m a i n e D y e J o e C r e d e J u a n U r i b e P a u l K o n e r k o S c o t t P o d s e d n i k T a d a h i t o I g u c h i B o s t o n C h i C u b s C h i S o x 600 550 500 450 400 350 300 250 200 Number of Teams/page  3 Select page 2 Legend Team Team Boston Chi Cubs Chi Sox   per Player per Team At Bats
  5. 5. Trellis Simulation <ul><li>Create document properties </li></ul><ul><ul><li>“ teamsPrPageProp ” (integer) </li></ul></ul><ul><ul><li>“ selectedPage ” (integer) </li></ul></ul><ul><ul><li>“ valueProp ” (column name) </li></ul></ul><ul><li>Create ‘Calculated column’ “ Page ”: </li></ul><ul><ul><li>Integer((DenseRank([Team])-1)/ ${teamsPrPageProp} +1) </li></ul></ul><ul><li>Custom expression on X-axis: </li></ul><ul><ul><li><if( [Page] = ${selectedPage} ,[Team],&quot;&quot;) as [Team] NEST if( [Page] = ${selectedPage} ,[Player Name],&quot;&quot;) as [Player Name]> </li></ul></ul><ul><li>Custom expression on Yaxis: </li></ul><ul><ul><li>if( [Page] = ${selectedPage} , $esc(${valueProp}),null) as $esc(${valueProp}) </li></ul></ul>Number of Teams/page  3 Select page 2   per Player per Team At Bats
  6. 6. Using $map and $csearch *run*
  7. 7. Using $map and $csearch <ul><li>Create ‘Input Field’ in text area </li></ul><ul><li>Create associated document property “ SearchProp ” </li></ul>Text Area Y - Axis property search: *run*
  8. 8. Using $map and $csearch <ul><li>Use custom expression on Y-axis </li></ul><ul><ul><li>$map(&quot; sum( $esc( $csearch([Baseball],&quot; ${SearchProp} &quot;) ) ) as $esc( $csearch([Baseball],&quot; ${SearchProp} &quot;) ) &quot;,&quot;, &quot;) </li></ul></ul><ul><ul><li>Search columns: </li></ul></ul><ul><ul><ul><li>$csearch([Baseball],&quot; ${SearchProp} &quot;) </li></ul></ul></ul><ul><ul><li>Escape columns: </li></ul></ul><ul><ul><ul><li>$esc(…) </li></ul></ul></ul><ul><ul><li>Summarization + renaming of the axis label: </li></ul></ul><ul><ul><ul><li>sum(…) as … </li></ul></ul></ul><ul><ul><li>Handle multiple columns: </li></ul></ul><ul><ul><ul><li>$map(&quot;…&quot;,&quot;, &quot;) </li></ul></ul></ul>
  9. 9. Comma separated tags column <ul><li>Data from a literature search (on next generation sequencing) </li></ul><ul><li>Comma separated tags column (“Tags”) </li></ul>Tags De novo Assembly Genome Annotation, Derivative technology, Multiple Analysis Steps Alignment Alignment Genome Annotation QC Analysis …
  10. 10. Comma separated tags column Detail on single paper 19 columns
  11. 11. Comma separated tags column <ul><li>Text area for parameters and scripts </li></ul><ul><ul><li>Drop-down list for column selection </li></ul></ul><ul><ul><ul><li>Document property “ TagColumn ” </li></ul></ul></ul><ul><ul><li>Create document property “ TagsList ” </li></ul></ul><ul><ul><ul><li>Via temporary “List box (multiple select)” </li></ul></ul></ul><ul><ul><ul><li>Fill with values with Iron Python script </li></ul></ul></ul>Tag processing     Tags Get tag values Mark selected row
  12. 12. Comma separated tags column <ul><li>GetTags script: </li></ul>from System import Array from Spotfire.Dxp.Data import IndexSet from Spotfire.Dxp.Data import DataValueCursor rowCount = Document.ActiveDataTableReference.RowCount rowsToInclude = IndexSet(rowCount,True) #Create a cursor to the Column we wish to get the values from cursor1 = DataValueCursor.CreateFormatted(Document.ActiveDataTableReference.Columns[ColumnName]) keys=dict() #Loop through all rows, retrieve value for specific column, and add value into array for row in Document.ActiveDataTableReference.GetRows(rowsToInclude,cursor1): value1 = cursor1.CurrentValue for tag in value1.split(', '): keys[tag]=1 strArray = Array.CreateInstance(str,len(keys)) idx=0 for key in keys: strArray[idx] = key idx=idx+1 #Set property to array created above Document.Properties.Item[ListProperty]=strArray Get unique tag values Put in “Tagslist” property     Tags Get tag values Mark selected row Script parameters Name Type Value ColumnName String “ ${TagColumn}” ListProperty String TagsList
  13. 13. Comma separated tags column <ul><li>Custom Expression on Y-axis: </li></ul><ul><ul><li>$map(&quot; Integer(Sum( if(find(&quot;&quot;, ${TagsList}, &quot;&quot;,&quot;&quot;, &quot;&quot;&[Tags]&&quot;&quot;, &quot;&quot;)>0,1,null) )) as $esc(${TagsList}) &quot;, &quot;,&quot;) </li></ul></ul><ul><ul><li>Search for for tag (caveat: quoting the quotes ) </li></ul></ul><ul><ul><ul><li>if(find(&quot;&quot;, ${TagsList}, &quot;&quot;,&quot;&quot;, &quot;&quot;&[Tags]&&quot;&quot;, &quot;&quot;)>0,1,null) </li></ul></ul></ul><ul><ul><li>Summarization + renaming of the axis label </li></ul></ul><ul><ul><ul><li>Integer(Sum(…)) as $esc(${TagsList}) </li></ul></ul></ul><ul><ul><li>Handle multiple tags </li></ul></ul><ul><ul><ul><li>$map(&quot;…&quot;, &quot;,&quot;) </li></ul></ul></ul>D a t a v o l u m e s A l i g n m e n t / A s s e m b l y V i e w e r s M u l t i p l e A n a l y s i s S t e p s G e n o m e A n n o t a t i o n S N P / D I P D e t e c t i o n D e r i v a t i v e t e c h n o l o g y D e n o v o A s s e m b l y D a t a s t o r a g e A l i g n m e n t T a r g e t e d R e s e q u e n c i n g D a t a i n t e g r a t i o n D a t a r e p r e s e n t a t i o n E r r o r C o r r e c t i o n Q C A n a l y s i s R a w D a t a A n a l y s i s S t r u c t u r a l V a r i a n t s D e t e c t i o n C o p y N u m b e r V a r i a t i o n G e n o t y p e C a l l i n g ( E m p t y ) 14 12 10 8 6 4 2 0 14 12 12 11 9 9 8 8 7 6 6 4 4 3 2 2 1 1 0
  14. 14. Comma separated tags column <ul><li>Selection Problem </li></ul><ul><ul><li>because all data is derived from all records </li></ul></ul><ul><li>Solution: </li></ul><ul><ul><li>“ horizontal bar chart” using cross table </li></ul></ul><ul><ul><ul><li>Repeat(&quot;&quot;|&quot;&quot;,Integer(Sum(…))) … </li></ul></ul></ul><ul><ul><li>Use column sorting as selector and Iron Python script </li></ul></ul>Tag count Data volumes Alignment/Assembly Viewers Multiple Analysis Steps Genome Annotation SNP/DIP Detection Derivative technology De novo Assembly Data storage Alignment Targeted Resequencing Data integration Data representation Error Correction QC Analysis Raw Data Analysis Structural Variants Detection Copy Number Variation Genotype Calling ||||||||||||||(14) ||||||||||||(12) ||||||||||||(12) |||||||||||(11) |||||||||(9) |||||||||(9) ||||||||(8) ||||||||(8) |||||||(7) ||||||(6) ||||||(6) ||||(4) ||||(4) |||(3) ||(2) ||(2) |(1) |(1)     Tags Get tag values Mark selected row
  15. 15. Comma separated tags column <ul><li>MarkSelectedRow script: </li></ul>from Spotfire.Dxp.Application.Visuals import VisualContent from Spotfire.Dxp.Data import IndexSet from Spotfire.Dxp.Data import RowSelection from Spotfire.Dxp.Data import DataValueCursor vc = vis.As[VisualContent]() dataTable=vc.Data.DataTableReference marking=vc.Data.MarkingReference selectRows = IndexSet(vc.Data.DataTableReference.RowCount, False); if (vc.SortColumnsCategory): selectedTag=vc.SortColumnsCategory.ToString() rowCount = dataTable.RowCount rowsToInclude = IndexSet(rowCount,True) #Create a cursor to the Column we wish to get the values from cursor1 = DataValueCursor.CreateFormatted(dataTable.Columns[TagsColumn]) #Loop through all rows and check for tag idx=0 for row in dataTable.GetRows(rowsToInclude,cursor1): value1 = cursor1.CurrentValue found=False for tag in value1.split(', '): if (tag==selectedTag): found=True break if found: selectRows[idx]=True idx=idx+1 marking.SetSelection(RowSelection(selectRows), dataTable) Get “selected” tag Set marking Find records with “selected” tag Script parameters Name Type Value vis Visualization Tagging>HBar TagsColumn String “ ${TagColumn}”
  16. 16. Expand marking
  17. 17. Expand marking
  18. 18. Expand Marking <ul><li>Expand marking to all other records with the same value for a chosen column (e.g. Position) </li></ul><ul><li>Solution: </li></ul><ul><ul><li>Add a second data table containing the unique values </li></ul></ul><ul><ul><li>Define relation between the 2 tables on the chosen column </li></ul></ul><ul><ul><li>Marking something in data table 1 changes the marking in data table 2 due to the relation between the data tables </li></ul></ul><ul><ul><li>Re-applying the marking in data table 2 changes the marking in data table 1 (effectively expanding it) </li></ul></ul><ul><ul><li>Iron Python script to re-apply a marking </li></ul></ul>
  19. 19. Expand Marking <ul><li>Script to re-apply a marking: </li></ul>from Spotfire.Dxp.Application.Visuals import VisualContent vc = vis.As[VisualContent]() dataTable=vc.Data.DataTableReference marking=vc.Data.MarkingReference marking.SetSelection(marking.GetSelection(dataTable),dataTable) Get data table and marking from visualization Re-apply marking Script parameters Name Type Value vis Visualization Page>Table
  20. 20. Dynamic list box content <ul><li>Multi select list box in a text area </li></ul><ul><li>How do you dynamicaly change the contents? </li></ul><ul><ul><li>Subset of unique values from a column, selected by marking </li></ul></ul>Select symbols for list Approve … A1BG A1CF A2LD1 A2M A2ML1 A4GALT A4GNT AAAS AACS AADAC AADACL2 AADACL3 AADACL4 AADAT AAGAB AAK1   Load marked symbols A2LD1 A2M A4GALT AAAS AADAC AADACL3 AADACL4 AADAT AAK1 Cross Table S e l e c t e d G e n e S y m b o l s Selected Gene Symbols Chromosome AAAS AADACL3 (Empty) 12q13 1p36.21
  21. 21. Dynamic list box content <ul><li>Define a tag column (e.g. ‘ SelectedGenes ’) </li></ul><ul><ul><li>Create a tag ‘ Selected ’ </li></ul></ul><ul><li>Create a calculated column (e.g. ‘ Selected Gene Symbols ’) </li></ul><ul><ul><li>if( [SelectedGenes] =&quot; Selected &quot;,[Approved Symbol],null) </li></ul></ul><ul><li>Fill list box with unique values from [Selected Gene Symbols] </li></ul><ul><li>Use Iron Python script to modify tag column </li></ul>
  22. 22. Dynamic list box content <ul><li>Script to set ‘tagValue’ in ‘tagColumn’ for marked records </li></ul>from Spotfire.Dxp.Data import DataManager,TagsColumn,IndexSet,RowSelection selection=Application.GetService[DataManager]().Markings[markingName].GetSelection(dataTable) col=dataTable.Columns[tagColumn].As[TagsColumn]() # remove tag in tagColumn for all rows in dataTable idx=IndexSet(selection.TotalRowCount,True) col.Tag(&quot;&quot;,RowSelection(idx)) # tag marked rows in tagColumn with tagValue col.Tag(tagValue,selection) Remove all tags in ‘tagColumn’ Set ‘tagValue’ tag in ‘tagColumn’ for records marked in ‘markingName’ Script parameters Name Type Value dataTable DataTable Data Table markingName String Select Marking tagColumn String SelectedGenes tagValue String Selected
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×