6f5408b67c1b4534efa4d795bc3776c6c667d586
braney
  Fri Dec 22 18:29:07 2017 -0800
implement missing data handling in mathWigs

diff --git src/hg/js/hgCollection.js src/hg/js/hgCollection.js
index 3f24679..0414485 100644
--- src/hg/js/hgCollection.js
+++ src/hg/js/hgCollection.js
@@ -54,57 +54,64 @@
 
         // can't delete root
         //if ($(node).attr('parent') === '#')
             //delete items.deleteItem;
 
         return items;
         }
 
     function changeCollection() {
         $( "#newCollectionDialog" ).dialog("close");
         selectedNode.li_attr.class = "folder";
         selectedNode.li_attr.shortlabel = $("#customName").val();
         selectedNode.li_attr.longlabel = $("#customDescription").val();
         selectedNode.li_attr.visibility = $("#customVis").val();
         selectedNode.li_attr.color = $("#customColorInput").val();
-        selectedNode.li_attr.missingMethod = $("input:radio[name ='missingData']:checked").val();
+        selectedNode.li_attr.missingmethod = $("input:radio[name ='missingData']:checked").val();
         selectedNode.li_attr.viewfunc = $("#viewFunc").val();
         //newNode.li_attr.viewtype = "view";
         rebuildLabel();
     }
 
     function doubleClickNode(tree) {
         var node = $(selectedTree).jstree("get_node", tree.id);
         var color = node.li_attr.color;
         var name =  node.li_attr.shortlabel;
         var description = node.li_attr.longlabel;
         var visibility = node.li_attr.visibility;
         var type = node.li_attr.viewtype;
         var viewFunc = node.li_attr.viewfunc;
 
         if (type == 'collection') 
             $("#viewFuncDiv").show();
         else
             $("#viewFuncDiv").hide();
 
         $("#CustomTrackOptions").show();
         $("#viewFunc").val(viewFunc);
         $("#customName").val(name);
         $("#customDescription").val(description);
         $("#customVis").val(visibility);
         $("#customColorInput").val(color);
         $("#customColorPicker").spectrum("set", color);
+        if ( node.li_attr.missingmethod === 'zero') {
+            $("input[name='missingData'][value='zero']").prop("checked",true);
+            $("input[name='missingData'][value='missing']").prop("checked",false);
+        } else {
+            $("input[name='missingData'][value='zero']").prop("checked",false);
+            $("input[name='missingData'][value='missing']").prop("checked",true);
+        }
 
         $("#doNewCollection").off ( "click" );
         $("#doNewCollection").click ( changeCollection );
         $( "#newCollectionDialog" ).dialog("open");
     }
 
     function selectNode(tree, node) {
         // called when a node in the currentCollection tree is selected
         selectedNode = node;
         selectedTree = tree;
         $(selectedTree).jstree("toggle_node", selectedNode);
    }
 
     function doubleClickTreeNode(evt, data)             {
         doubleClickNode(evt.target);
@@ -127,50 +134,51 @@
             }
         }
         return true;
     }
 
     function dialogCollection() {
         $("#doNewCollection").off ( "click" );
         $("#doNewCollection").click ( newCollection );
         $("#viewFuncDiv").show();
         $("#customName").val("A New Collection");
         $("#customDescription").val("A New Collection Description");
         $("#customVis").val("full");
         $("#customColorInput").val("#0");
         //$("input:radio[name ='missingData']:checked").val();
         $("#viewFunc").val("show all");
+        $( "#customName" ).select();
         $( "#newCollectionDialog" ).dialog("open");
     } 
 
     function newCollection() {
         $( "#newCollectionDialog" ).dialog("close");
         var ourCollectionName = getUniqueName("coll");
         var newName = $("#customName").val();
         var newDescription = $("#customDescription").val();
         var parent = $(selectedTree).find("li").first();
 
         var newId = $(selectedTree).jstree("create_node", "#", newName + " (" + newDescription + ")");
         var newNode = $(selectedTree).jstree("get_node", newId);
         isDirty = true;
         newNode.li_attr.class = "folder";
         newNode.li_attr.name = ourCollectionName;
         newNode.li_attr.shortlabel = $("#customName").val();
         newNode.li_attr.longlabel = $("#customDescription").val();
         newNode.li_attr.visibility = $("#customVis").val();
         newNode.li_attr.color = $("#customColorInput").val();
-        newNode.li_attr.missingMethod = $("input:radio[name ='missingData']:checked").val();
+        newNode.li_attr.missingmethod = $("input:radio[name ='missingData']:checked").val();
         newNode.li_attr.viewfunc = $("#viewFunc").val();
         newNode.li_attr.viewtype = "collection";
         //selectedNode = newNode;
         $(selectedTree).jstree("set_icon", newNode, '../images/folderC.png');
         $(selectedTree).jstree("deselect_node", selectedNode);
         $(selectedTree).jstree("select_node", newNode.id);
         rebuildLabel();
     }
 
     function addCollection(trees, list) {
         // called when outputting JSON of all the collectionList
         var collectTree = trees[list.id];
         var v = collectTree.jstree(true).get_json('#', {flat:true, no_data:true, no_state:true, no_a_attr:true});
         var mytext = JSON.stringify(v);
         return mytext;