about summary refs log tree commit diff
path: root/wqflask
diff options
context:
space:
mode:
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/base/data_set.py6
-rw-r--r--wqflask/wqflask/correlation/show_corr_results.py21
-rw-r--r--wqflask/wqflask/gsearch.py9
-rw-r--r--wqflask/wqflask/jupyter_notebooks.py16
-rw-r--r--wqflask/wqflask/templates/base.html4
-rw-r--r--wqflask/wqflask/templates/show_trait_details.html2
6 files changed, 19 insertions, 39 deletions
diff --git a/wqflask/base/data_set.py b/wqflask/base/data_set.py
index 70c58136..768ad49b 100644
--- a/wqflask/base/data_set.py
+++ b/wqflask/base/data_set.py
@@ -754,8 +754,8 @@ class DataSet:
         # Postgres doesn't have that limit, so we can get rid of this after we transition
         chunk_size = 50
         number_chunks = int(math.ceil(len(sample_ids) / chunk_size))
-        cached_results = fetch_cached_results(self.name, self.type)
-        # cached_results =    None
+        # cached_results = fetch_cached_results(self.name, self.type)
+        cached_results =  None
         if cached_results is None:
             trait_sample_data = []
             for sample_ids_step in chunks.divide_into_chunks(sample_ids, number_chunks):
@@ -800,8 +800,6 @@ class DataSet:
                 results = g.db.execute(query).fetchall()
                 trait_sample_data.append([list(result) for result in results])
 
-            cache_dataset_results(
-                self.name, self.type, trait_sample_data)
 
         else:
             trait_sample_data = cached_results
diff --git a/wqflask/wqflask/correlation/show_corr_results.py b/wqflask/wqflask/correlation/show_corr_results.py
index 42010a1e..55915a74 100644
--- a/wqflask/wqflask/correlation/show_corr_results.py
+++ b/wqflask/wqflask/correlation/show_corr_results.py
@@ -86,30 +86,17 @@ def correlation_json_for_table(correlation_data, this_trait, this_dataset, targe
     corr_results = correlation_data['correlation_results']
     results_list = []
 
-    file_name = f"{target_dataset['name']}_metadata.json"
-
-    file_path = os.path.join(TMPDIR, file_name)
-    new_traits_metadata = {}
-
-    try:
-        with open(file_path,"r+") as file_handler:
-            dataset_metadata = json.load(file_handler)
-
-    except FileNotFoundError:
-        Path(file_path).touch(exist_ok=True)
-        dataset_metadata = {}
 
     for i, trait_dict in enumerate(corr_results):
         trait_name = list(trait_dict.keys())[0]
         trait = trait_dict[trait_name]
 
-        target_trait = dataset_metadata.get(trait_name)
+        target_trait = None
         if  target_trait is None: 
             target_trait_ob = create_trait(dataset=target_dataset_ob,
                                            name=trait_name,
                                            get_qtl_info=True)
             target_trait = jsonable(target_trait_ob, target_dataset_ob)
-            new_traits_metadata[trait_name] = target_trait
         if target_trait['view'] == False:
             continue
         results_dict = {}
@@ -184,12 +171,6 @@ def correlation_json_for_table(correlation_data, this_trait, this_dataset, targe
 
         results_list.append(results_dict)
 
-
-    if bool(new_traits_metadata):
-        # that means new traits exists
-        dataset_metadata.update(new_traits_metadata)
-        with open(file_path,"w+") as file_handler:
-            json.dump(dataset_metadata, file_handler)
     return json.dumps(results_list)
 
 
diff --git a/wqflask/wqflask/gsearch.py b/wqflask/wqflask/gsearch.py
index 2516e4fb..31f3305c 100644
--- a/wqflask/wqflask/gsearch.py
+++ b/wqflask/wqflask/gsearch.py
@@ -82,13 +82,14 @@ class GSearch:
                     this_trait['species'] = line[0]
                     this_trait['group'] = line[1]
                     this_trait['tissue'] = line[2]
-                    this_trait['symbol'] = line[6]
+                    this_trait['symbol'] = "N/A"
+                    if line[6]:
+                        this_trait['symbol'] = line[6]
+                    this_trait['description'] = "N/A"
                     if line[7]:
                         this_trait['description'] = line[7].decode(
                             'utf-8', 'replace')
-                    else:
-                        this_trait['description'] = "N/A"
-                    this_trait['location_repr'] = 'N/A'
+                    this_trait['location_repr'] = "N/A"
                     if (line[8] != "NULL" and line[8] != "") and (line[9] != 0):
                         this_trait['location_repr'] = 'Chr%s: %.6f' % (
                             line[8], float(line[9]))
diff --git a/wqflask/wqflask/jupyter_notebooks.py b/wqflask/wqflask/jupyter_notebooks.py
index dbea04dd..7d76828e 100644
--- a/wqflask/wqflask/jupyter_notebooks.py
+++ b/wqflask/wqflask/jupyter_notebooks.py
@@ -6,16 +6,12 @@ jupyter_notebooks = Blueprint('jupyter_notebooks', __name__)
 def launcher():
     links = (
     {
-        "main_url": "http://notebook.genenetwork.org/51091/tree?",
-        "notebook_name": "COVID-19 in mybinder.org federation",
-        "src_link_url": "https://github.com/jgarte/covid19_in_binder"},
+        "main_url": "http://notebook.genenetwork.org/34301/notebooks/genenetwork-api-using-r.ipynb",
+        "notebook_name": "R notebook showing how to query the GeneNetwork API.",
+        "src_link_url": "https://github.com/jgarte/genenetwork-api-r-jupyter-notebook"},
     {
-        "main_url": "http://notebook.genenetwork.org/35639/tree?",
-        "notebook_name": "Simple requirements.txt based example",
-        "src_link_url": "https://github.com/jgarte/requirements"},
-    {
-        "main_url": "http://notebook.genenetwork.org/40733/tree?",
-        "notebook_name": "Guile Jupyter Notebook Querying GeneNetwork API",
-        "src_link_url": "https://github.com/jgarte/guile-notebook-genenetwork-api"})
+        "main_url": "http://notebook.genenetwork.org/57675/notebooks/genenetwork.ipynb",
+        "notebook_name": "Querying the GeneNetwork API declaratively with python.",
+        "src_link_url": "https://github.com/jgarte/genenetwork-jupyter-notebook-example"})
 
     return render_template("jupyter_notebooks.html", links=links)
diff --git a/wqflask/wqflask/templates/base.html b/wqflask/wqflask/templates/base.html
index a231c48c..e037246a 100644
--- a/wqflask/wqflask/templates/base.html
+++ b/wqflask/wqflask/templates/base.html
@@ -93,7 +93,11 @@
                                   <li><a href="https://systems-genetics.org/">Systems Genetics PheWAS</a></li>
                                   <li><a href="http://ucscbrowser.genenetwork.org/">Genome Browser</a></li>
                                   <li><a href="http://power.genenetwork.org">BXD Power Calculator</a></li>
+<<<<<<< HEAD
                                   <li><a href="http://notebook.genenetwork.org/">Jupyter Notebook Launcher</a></li>
+=======
+                                  <li><a href="{{url_for('jupyter_notebooks.launcher')}}">Jupyter Notebooks</a></li>
+>>>>>>> dea1afa01025026a0754de60615b974a5cb3fd24
                                   <li><a href="http://datafiles.genenetwork.org">Interplanetary File System</a></li>
                                 </ul>
                         </li>
diff --git a/wqflask/wqflask/templates/show_trait_details.html b/wqflask/wqflask/templates/show_trait_details.html
index 6b125221..4e9ea0fb 100644
--- a/wqflask/wqflask/templates/show_trait_details.html
+++ b/wqflask/wqflask/templates/show_trait_details.html
@@ -236,7 +236,7 @@
         <button type="button" id="view_in_gn1" class="btn btn-primary" title="View Trait in GN1" onclick="window.open('http://gn1.genenetwork.org/webqtl/main.py?cmd=show&db={{ this_trait.dataset.name }}&probeset={{ this_trait.name }}', '_blank')">Go to GN1</button>
         {% if admin_status != None and admin_status.get('metadata', DataRole.VIEW) > DataRole.VIEW %}
         {% if this_trait.dataset.type == 'Publish' %}
-        <button type="button" id="edit_resource" class="btn btn-success" title="Edit Resource" onclick="window.open('/datasets/{{ this_trait.dataset.id }}/traits/{{ this_trait.name }}?resource-id={{ resource_id }}', '_blank')">Edit</button>
+        <button type="button" id="edit_resource" class="btn btn-success" title="Edit Resource" onclick="window.open('/datasets/{{ this_trait.dataset.group.id }}/traits/{{ this_trait.name }}?resource-id={{ resource_id }}', '_blank')">Edit</button>
         {% endif %}
 
         {% if this_trait.dataset.type == 'ProbeSet' %}