Skip to content

Commit

Permalink
Swap deprecated method out. (#2566)
Browse files Browse the repository at this point in the history
* Swap deprecated method out.

* Remove solr_igv dependencies. (#2570)

* Remove solr_igv dependencies.

* Remove visualization_manager.

* Upgrade django storage. (#2571)

* Upgrade django storage.

* Remove post-css library, unused. (#2574)

* Update user/file facet/columns per user request. (#2577)

* Remove post-css library, unused.

* Update user/file facet/columns per user request.

* Remove typo ,

* Fix typo, double quotes.

* Remove space.

* Add cell_type to facets.

* Fix unit test.

* Add missing facets.

* Fix cypress test.

* Revert to 1.6.0 due to django 1.9 support.
  • Loading branch information
jkmarx committed Feb 9, 2018
1 parent 6801aa0 commit ca22e4c
Show file tree
Hide file tree
Showing 19 changed files with 12 additions and 815 deletions.
3 changes: 1 addition & 2 deletions .isort.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ known_first_party =
selenium_testing,
tool_manager,
user_files_manager,
visualization_manager,
workflow_manager

skip_glob = **/migrations/*
Expand All @@ -31,4 +30,4 @@ skip_glob = **/migrations/*
#import_heading_django = 'django'
#import_heading_thirdpary = 'thirdparty'
#import_heading_firstparty = 'firstparty'
#import_heading_localfolder = 'localfolder'
#import_heading_localfolder = 'localfolder'
2 changes: 1 addition & 1 deletion deployment/aws-config/config.yaml.template
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ REFINERY_GOOGLE_ANALYTICS_ID: ""

REFINERY_URL_SCHEME: "http"

USER_FILES_COLUMNS: "filename,organism,technology,antibody,date,genotype,experimenter"
USER_FILES_COLUMNS: "sample_name,local_path,filetype,organism,technology,genotype,cell_type,antibody,experimenter,date_submitted"

# == Rarely changed ==

Expand Down
82 changes: 0 additions & 82 deletions refinery/analysis_manager/utils.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
import json
import logging
import os
import re
import uuid

from django.conf import settings
from django.contrib.auth.models import User
from django.http import HttpResponseServerError
from django.utils import timezone

import jsonschema
import requests
from requests.packages.urllib3.exceptions import HTTPError

from core.models import Analysis, Study, Workflow, WorkflowDataInputMap
from core.utils import get_aware_local_time
Expand Down Expand Up @@ -102,84 +98,6 @@ def fetch_objects_required_for_analysis(validated_analysis_config):
}


def get_solr_results(query, facets=False, jsonp=False, annotation=False,
only_uuids=False, selected_mode=True,
selected_nodes=None):
"""Helper function for taking solr request url.
Removes facet requests, converts to json, from input solr query
:param query: solr http query string
:type query: string
:param facets: Removes facet query from solr query string
:type facets: boolean
:param jsonp: Removes JSONP query from solr query string
:type jsonp: boolean
:param only_uuids: Returns list of file_uuids from all solr results
:type only_uuids: boolean
:param selected_mode: UI selection mode (blacklist or whitelist)
:type selected_mode: boolean
:param selected_nodes: List of UUIDS to remove from the solr query
:type selected_nodes: array
:returns: dictionary of current solr results
"""
if not facets:
# replacing facets w/ false
query = query.replace('facet=true', 'facet=false')
if not jsonp:
# ensuring json not jsonp response
query = query.replace('&json.wrf=?', '')
if annotation:
# changing annotation
query = query.replace('is_annotation:false', 'is_annotation:true')
# Checks for limit on solr query
# replaces i.e. '&rows=20' to '&rows=10000'
m_obj = re.search(r"&rows=(\d+)", query)
if m_obj:
# TODO: replace 10000 with settings parameter for max solr results
replace_rows_str = '&rows=' + str(10000)
query = query.replace(m_obj.group(), replace_rows_str)

try:
# opening solr query results
results = requests.get(query, stream=True)
results.raise_for_status()
except HTTPError as e:
logger.error(e)
return HttpResponseServerError(e)

# converting results into json for python
results = json.loads(results.content)

# IF list of nodes to remove from query exists
if selected_nodes:
# need to iterate over list backwards to properly delete from a list
for i in xrange(len(results["response"]["docs"]) - 1, -1, -1):
node = results["response"]["docs"][i]

# blacklist mode (remove uuid's from solr query)
if selected_mode:
if 'uuid' in node:
# if the current node should be removed from the results
if node['uuid'] in selected_nodes:
del results["response"]["docs"][i]
# num_found -= 1
# whitelist mode (add's uuids from solr query)
else:
if 'uuid' in node:
# if the current node should be removed from the results
if node['uuid'] not in selected_nodes:
del results["response"]["docs"][i]
# num_found += 1
# Will return only list of file_uuids
if only_uuids:
ret_file_uuids = []
solr_results = results["response"]["docs"]
for res in solr_results:
ret_file_uuids.append(res["uuid"])
return ret_file_uuids

return results


def validate_analysis_config(analysis_config):
"""
Validate incoming Analysis Configurations
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,5 +116,5 @@ def handle(self, *args, **options):
taxon.save()
sys.stdout.write("%s created." % taxon)
except IntegrityError:
transaction.rollback_unless_managed()
transaction.rollback()
sys.stdout.write("Duplicate Value %s" % taxon)
4 changes: 2 additions & 2 deletions refinery/config/config.json.erb
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,6 @@
"TOKEN_DURATION": 3,
"USE_I18N": true,
"USE_L10N": true,
"USER_FILES_COLUMNS": "filename,organism,technology,antibody,date,genotype,experimenter",
"USER_FILES_FACETS": "organism,technology,antibody,genotype,experimenter"
"USER_FILES_COLUMNS": "sample_name,local_path,filetype,organism,technology,genotype,cell_type,antibody,experimenter,date_submitted",
"USER_FILES_FACETS": "filetype,organism,technology,genotype,cell_type,antibody,experimenter"
}
1 change: 0 additions & 1 deletion refinery/config/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,6 @@ def get_setting(name, settings=local_settings, default=None):
'workflow_manager',
'file_store',
'file_server',
'visualization_manager',
'annotation_server',
'selenium_testing',
'tool_manager',
Expand Down
1 change: 0 additions & 1 deletion refinery/config/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@
url(r'^workflow_manager/', include('workflow_manager.urls')),
url(r'^analysis_manager/', include('analysis_manager.urls')),
url(r'^data_set_manager/', include('data_set_manager.urls')),
url(r'^visualization_manager/', include('visualization_manager.urls')),
url(r'^file_server/', include('file_server.urls')),
url(r'^tasks/', include('djcelery.urls')),
url(r'^docs/', include('rest_framework_swagger.urls')),
Expand Down
1 change: 0 additions & 1 deletion refinery/core/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
'workflow_engine', name="workflow_engine"),
url(r'^visualize/genome/$', 'visualize_genome', name='visualize_genome'),

url(r'^solr/igv/$', 'solr_igv'),
url(r'^solr/core/select/$', 'solr_core_search', name="solr_core_search"),
url(r'^solr/(?P<core>.+)/select/$', 'solr_select', name="solr_select"),

Expand Down
60 changes: 0 additions & 60 deletions refinery/core/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,8 @@
from rest_framework.views import APIView
import xmltodict

from analysis_manager.utils import get_solr_results
from annotation_server.models import GenomeBuild
from data_set_manager.models import Node
from data_set_manager.utils import generate_solr_params_for_assay
from file_store.models import FileStoreItem
from visualization_manager.views import igv_multi_species

from .forms import ProjectForm, UserForm, UserProfileForm, WorkflowForm
from .models import (Analysis, CustomRegistrationProfile, DataSet,
Expand Down Expand Up @@ -580,62 +576,6 @@ def solr_select(request, core):
return JsonResponse(response_dict)


def solr_igv(request):
"""Function for taking solr request url.
Removes pagination, facets from input query to create multiple
:param request: Django HttpRequest object including solr query
:type source: HttpRequest object.
:returns:
"""

# copy querydict to make it editable
if request.is_ajax():
igv_config = json.loads(request.body)

logger.debug(json.dumps(igv_config, indent=4))

logger.debug('IGV data query: ' + str(igv_config['query']))
logger.debug('IGV annotation query: ' + str(igv_config['annotation']))

if igv_config['query'] is None:
# generate solr_query method
# assay uuid
solr_query = generate_solr_params_for_assay(
{},
igv_config['assay_uuid']
)
url_path = '/'.join(["data_set_manager", "select"])
url = urljoin(settings.REFINERY_SOLR_BASE_URL, url_path)
igv_config['query'] = ''.join([url, '/?', solr_query])

# attributes associated with node selection from interface
node_selection_blacklist_mode = igv_config[
'node_selection_blacklist_mode']
node_selection = igv_config['node_selection']

solr_results = get_solr_results(
igv_config['query'], selected_mode=node_selection_blacklist_mode,
selected_nodes=node_selection)

if igv_config['annotation'] is not None:
solr_annot = get_solr_results(igv_config['annotation'])
else:
solr_annot = None
# if solr query returns results
if solr_results:
try:
session_urls = igv_multi_species(solr_results, solr_annot)
except GenomeBuild.DoesNotExist:
logger.error(
"Provided genome build cannot be found in the database.")
session_urls = "Couldn't find the provided genome build."

logger.debug("session_urls")
logger.debug(json.dumps(session_urls, indent=4))

return JsonResponse(session_urls)


def samples_solr(request, ds_uuid, study_uuid, assay_uuid):
logger.debug("core.views.samples_solr called")
data_set = get_object_or_404(DataSet, uuid=ds_uuid)
Expand Down
30 changes: 0 additions & 30 deletions refinery/ui/Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,35 +129,6 @@ module.exports = function (grunt) {
};

grunt.initConfig({
/*
* Add vendor prefixes to out CSS to ensure better browser support.
*/
postcss: {
options: {
processors: [
require('autoprefixer')({ browsers: [
'> 5%',
'last 2 versions',
'Firefox ESR',
'Explorer >= 10',
'iOS >= 6',
'Opera >= 12',
'Safari >= 6'
] })
]
},
styles: {
files: [
{
expand: true,
cwd: '<%= cfg.basePath.ui.src %>/styles',
src: ['**/*.css'],
dest: '<%= cfg.basePath.ui.tmp %>/styles'
}
]
}
},

/*
* Read configs from `config.json`. Separating scripts and configs help
* to keep things readable.
Expand Down Expand Up @@ -851,7 +822,6 @@ module.exports = function (grunt) {
'clean:uiCompile',
'clean:staticCompile',
'less:compile',
'postcss',
// IMPORTANT:
// `concat-by-feature:compile` has to be called before `ngAnnotate` because
// it adds features to the `ngAnnotate` task.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ describe('Not logged in', function() {
cy.visit('/');
cy.visible_btn('List').click();

cy.visible('Filename');
cy.visible('Organism');
cy.visible('Technology');
cy.visible('Antibody');
Expand Down
1 change: 0 additions & 1 deletion refinery/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
"grunt-karma": "1.0.0",
"grunt-newer": "1.2.0",
"grunt-ng-annotate": "2.0.1",
"grunt-postcss": "0.8.0",
"hasbin": "1.1.1",
"isbinaryfile": "3.0.0",
"jasmine-core": "2.3.4",
Expand Down
8 changes: 6 additions & 2 deletions refinery/user_files_manager/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,18 @@ def test_generate_solr_params_for_user(self):
query = generate_solr_params_for_user(QueryDict({}), user.id)
self.assertEqual(str(query).split('&'), [
'fq=assay_uuid%3A%28{}%29'.format(assay_uuid),
'facet.field=filetype_Characteristics_generic_s',
'facet.field=filetype_Factor_Value_generic_s',
'facet.field=organism_Characteristics_generic_s',
'facet.field=organism_Factor_Value_generic_s',
'facet.field=technology_Characteristics_generic_s',
'facet.field=technology_Factor_Value_generic_s',
'facet.field=antibody_Characteristics_generic_s',
'facet.field=antibody_Factor_Value_generic_s',
'facet.field=genotype_Characteristics_generic_s',
'facet.field=genotype_Factor_Value_generic_s',
'facet.field=cell_type_Characteristics_generic_s',
'facet.field=cell_type_Factor_Value_generic_s',
'facet.field=antibody_Characteristics_generic_s',
'facet.field=antibody_Factor_Value_generic_s',
'facet.field=experimenter_Characteristics_generic_s',
'facet.field=experimenter_Factor_Value_generic_s',
'fl=%2A_generic_s'
Expand Down
Empty file.
Empty file.
Empty file.
14 changes: 0 additions & 14 deletions refinery/visualization_manager/urls.py

This file was deleted.

0 comments on commit ca22e4c

Please sign in to comment.