diff options
-rwxr-xr-x | wqflask/base/data_set.py | 2 | ||||
-rwxr-xr-x | wqflask/base/trait.py | 12 | ||||
-rw-r--r-- | wqflask/wqflask/collect.py | 11 | ||||
-rw-r--r-- | wqflask/wqflask/static/new/javascript/get_traits_from_collection.coffee | 12 | ||||
-rw-r--r-- | wqflask/wqflask/static/new/javascript/get_traits_from_collection.js | 15 | ||||
-rw-r--r-- | wqflask/wqflask/static/new/javascript/scientific_notation.js | 13 |
6 files changed, 44 insertions, 21 deletions
diff --git a/wqflask/base/data_set.py b/wqflask/base/data_set.py index 8296adea..fbe78d5d 100755 --- a/wqflask/base/data_set.py +++ b/wqflask/base/data_set.py @@ -629,7 +629,7 @@ class PhenotypeDataSet(DataSet): description = this_trait.pre_publication_description - this_trait.description_display = description + this_trait.description_display = description.strip() if not this_trait.year.isdigit(): this_trait.pubmed_text = "N/A" diff --git a/wqflask/base/trait.py b/wqflask/base/trait.py index 74bc07bb..9e4f0944 100755 --- a/wqflask/base/trait.py +++ b/wqflask/base/trait.py @@ -43,7 +43,7 @@ class GeneralTrait(object): self.sequence = kw.get('sequence') # Blat sequence, available for ProbeSet self.data = kw.get('data', {}) - # Sets defaultst + # Sets defaults self.locus = None self.lrs = None self.pvalue = None @@ -63,6 +63,16 @@ class GeneralTrait(object): # So we could add a simple if statement to short-circuit this if necessary self.retrieve_info(get_qtl_info=get_qtl_info) self.retrieve_sample_data() + + + def jsonable(self): + """Return a dict suitable for using as json + + Actual turning into json doesn't happen here though""" + return dict(name=self.name, + description=self.description_display, + mean=self.mean) + def get_info(self): """For lots of traits just use get_trait_info in dataset instead...that will be way diff --git a/wqflask/wqflask/collect.py b/wqflask/wqflask/collect.py index 991d281c..48b4b4da 100644 --- a/wqflask/wqflask/collect.py +++ b/wqflask/wqflask/collect.py @@ -150,8 +150,15 @@ def view_collection(): trait_ob.get_info() trait_obs.append(trait_ob) - json_version.append(dict(name=trait_ob.name)) - #dis=trait_ob.description)) + json_version.append(trait_ob.jsonable()) + #json_version.append(dict(name=trait_ob.name, + # description=trait_ob.description_display, + # location=trait_ob.location_repr, + # mean=trait_ob.mean, + # lrs_score=trait_ob.LRS_score_repr, + # lrs_location=trait_ob.LRS_location_repr)) + # dis=trait_ob.description)) + #json_version.append(trait_ob.__dict__th) collection_info = dict(trait_obs=trait_obs, uc = uc) diff --git a/wqflask/wqflask/static/new/javascript/get_traits_from_collection.coffee b/wqflask/wqflask/static/new/javascript/get_traits_from_collection.coffee index 6854dda5..8566b804 100644 --- a/wqflask/wqflask/static/new/javascript/get_traits_from_collection.coffee +++ b/wqflask/wqflask/static/new/javascript/get_traits_from_collection.coffee @@ -7,9 +7,17 @@ collection_hover = () -> this_collection_url = $(this).find('.collection_name').prop("href") this_collection_url += "&json" console.log("this_collection_url", this_collection_url) + $.ajax( + dataType: "json", + url: this_collection_url, + success: process_traits + ) + +process_traits = (trait_data, textStatus, jqXHR) -> + console.log('in process_traits with trait_data:', trait_data) + html = "<table>" + $ -> console.log("inside get_traits_from_collection") $(document).on("mouseover", ".collection_line", collection_hover) - -
\ No newline at end of file diff --git a/wqflask/wqflask/static/new/javascript/get_traits_from_collection.js b/wqflask/wqflask/static/new/javascript/get_traits_from_collection.js index 9ef31088..57f42a38 100644 --- a/wqflask/wqflask/static/new/javascript/get_traits_from_collection.js +++ b/wqflask/wqflask/static/new/javascript/get_traits_from_collection.js @@ -1,6 +1,6 @@ // Generated by CoffeeScript 1.6.1 (function() { - var collection_hover; + var collection_hover, process_traits; console.log("before get_traits_from_collection"); @@ -9,7 +9,18 @@ console.log("Hovering over:", $(this)); this_collection_url = $(this).find('.collection_name').prop("href"); this_collection_url += "&json"; - return console.log("this_collection_url", this_collection_url); + console.log("this_collection_url", this_collection_url); + return $.ajax({ + dataType: "json", + url: this_collection_url, + success: process_traits + }); + }; + + process_traits = function(trait_data, textStatus, jqXHR) { + var html; + console.log('in process_traits with trait_data:', trait_data); + return html = "<table>"; }; $(function() { diff --git a/wqflask/wqflask/static/new/javascript/scientific_notation.js b/wqflask/wqflask/static/new/javascript/scientific_notation.js deleted file mode 100644 index 82c55fda..00000000 --- a/wqflask/wqflask/static/new/javascript/scientific_notation.js +++ /dev/null @@ -1,13 +0,0 @@ -jQuery.extend( jQuery.fn.dataTableExt.oSort, {
- "scientific-pre": function ( a ) {
- return parseFloat(a);
- },
-
- "scientific-asc": function ( a, b ) {
- return ((a < b) ? -1 : ((a > b) ? 1 : 0));
- },
-
- "scientific-desc": function ( a, b ) {
- return ((a < b) ? 1 : ((a > b) ? -1 : 0));
- }
-} );
\ No newline at end of file |