Skip to content
Jasmine Dumas edited this page May 31, 2015 · 17 revisions

Pre-GSoC work

Here are my tasks from the proposal for week 1:

Task: Improve phenotypic parameter selection method of clicking groups and adding to a input field for group comparison, which is similar to how GEO2R creates groups for comparison.

Method: Utilize DataTables plugin for jQuery and its API for row highlighting and accessing data contained in the table; enable HTML tags within the ui.r script, JavaScript I() functions, and CSS to complete and “send” selections to the control panel group boxes based on their class (unselected versus selected rows). This feature will offer a more intuitive sample group selection and customization that they may already be accustomed to if coming from the GEO2R tool.


May 16th

  • Currently the callback functions in the server-output.R script enable a user to select and highlight their group for analysis but once another group (row) is clicked on, the original selection is still highlighted in the drop-down box and doesn't update with the current selection for both the clinical summary and the full clinical datatable.

         callback = "function(table) {               # passing the table as the input
         table.on('click.dt', 'tr', function() {     # ... once a row is clicked
         $(this).toggleClass('selected');            # the class of the current clicked row is changed to 'selected
         Shiny.onInputChange('rows', table.rows('.selected').indexes().toArray()); 
                                      });}" 
    
  • callback's are a JavaScript function to be applied to the DataTable object. This is useful for DataTables plug-ins, which often require the DataTable instance to be available (http://datatables.net/extensions/).

  • The table is passed to the function and on the table click that current selection has its class changed to 'selected' (http://api.jquery.com/toggleClass/)

  • The goal is to enable the user to select a group (row) for analysis, but if they need to choose (click) another group the original selection will be moved and the drop-down box in the sidebar will be updated.

  • I'm learning and reviewing jQuery via Codecademy.com to get a better understanding of how to modify the callback function for group selection.

  • I also performed an inspect element (via Google Chrome browser) on the GEO2R tool to reveals the code structure for there jquery.tableselector.js (https://www.dropbox.com/sc/hnfviah9pgq90y3/AAAXxuo-o6KM33PZZ1aobLy9a). In this format the user has the ability to select one row for analysis and add multiple row selections to a group by holding down the shift button.

  • I found a great solution example. I had been experimenting with including a .off() method to stop listening to when a user would click another row, after several attempts to place it in the callback function I got either no highlighting or the rows would not being returned. From my research into the individual lines of the original callback it was clear that the rows were be accessed by toggling their class to 'selected' and that if they were toggled/or had there class removed that would give our desired effect. The solution to this tasks makes use of the method .removeClass('selected'). This solution is proof of the strong community bonds and knowledge base of Shiny and R and leaves more time for me this summer to dive deep into the core functionality of this web app.

         callback = "function(table) {
         table.on('click.dt', 'tr', function() {
         $(this).closest('table').find('.selected').each(function(){  # This is the new addition
            $(this).removeClass('selected');                          # removes the class if another is clicked
         });
         $(this).toggleClass('selected');
         Shiny.onInputChange('rows',
         table.rows('.selected').indexes().toArray());
         });
         }"
    

Commit: https://github.com/jasdumas/GEO-AWS/commit/7a343d7041f85bf5dbc4da03e0c5c0020513bd38

May 17th

  • After implementing the one-click selection on the clinical data summary table to select groups to compare gene expression, it makes sense to still have the multi-select for the full clinical data table.

  • Our goal for the full clinical data table is to have a user select an individual patient(s) with survival information to have a drill-down analysis paired with gene expression info. A Kaplan-Meir plot can assist in finding biomarkers signaling from historical data, if this patient who survived X years and Y levels of gene expression, thus if a current patient exhibits Y levels of the same gene expression, the prognosis of survival X years could be very similar.

  • The current multi-selection (original) only accesses how ever many columns of characteristics there are. ie if there are only 4 (rows) characteristics listed on the summary page, then the full data table only returns the first 4 rows and displays an error, if the 5th row is clicked. In addition to that the column name that is returned to the ui because the clinical summary table is NOT in columnar format and the full table is. That error response makes sense, since we are accessing the rows via there index and need a different method for group selection in the full table.

Error in (function (choice, name) : All sub-lists in "choices" must be named.


Week 1

May 25th

  • Today is the official start of the program, and I made a "house keeping" commit, to clean up spacing, comments, and removed table tools on the full clinical table. I'm taking a page from Trey Causey's recent blog post Software Development Skills for Data Scientists and including good comments throughout the scripts to inform anyone about functionality and my thought process. This will be an ongoing effort for the summer

  • I'm also watching a RStudio webinar: How to start with Shiny – Part 1 by Garrett Grolemund. Its the first official instruction video I've watched which nicely explains some architectural concepts.

May 29

  • I've been researching a lot into the capabilities of the RStudio DT package and it has become clear that this "nice to have" tasks in the proposal is going to need to be infused with the current state of the GEO-AWS tool sooner rather than later. The DT package has some for lack of a better word slick features that I'm going to take advantage of for the full clinical table when it comes to selecting multiple groups of rows (patients) such as appending a row of check boxes and excel-like navigation features. Also as planned for this week I don't think I'll be making any use of the original data tables API but I hope this change makes for a smooth transition for enabling survival analysis and the editable tables portion.

May 31

  • To test out some of the functionality of the DT app, I have a small test app using the mtcars dataset. There are a lot of cool features that would have been more difficult to implement with the original data table function from shiny. Here are some nice features that I can see using on the GEO-AWS tool:

    1. Filters: These can be easily positioned, and having those filter boxes for the the individual columns at the top of the page is user friendly.

    2. colReorder: Having the ability to move the columns around will be a helpful feature to align pertinent information together next to each other to easy viewing

    3. row selection: The original data table capability for row selection came from the callback function for the literal jQuery. This is a default feature in the DT package!

  • I'm trying to merge the DT package to the GEO-AWS app now, but there is an issue getting the selected rows to read back as a singular selection (as the jQuery currently does). All I have to do is add selection = 'single' within the datatable widget to have the single row selection (with the purple highlighting). The current output is a verbaitemTextOutput, but it displays all of the rows selected. I'm able to access the rows by using the info about the current state of the table (ie: input$cars_rows_selected)...I'm thinking that I need to access another state like input$cars_rows_current_selected. The DT table has a lot of documentation but it seems that the package is still generating enhancements every few days. It also looks like they maybe launching on CRAN this upcoming week which will hopefully provide some stabilization. I have also comment on a issue #78 to see about granting access to the current state of singular row selections.

  • Also on the issues page people are making a lot of noise for editable tables, without the need for the editor tools from the datatables.net library, which is not free. Someone posted about the An htmlwidgets implementation of Handsontable.js as an alternative. They have a shiny version which I tested out and it looks promising for when I have to tackle editable tables for week 2!

Clone this wiki locally