Skip to content
This repository has been archived by the owner on Oct 22, 2022. It is now read-only.

Commit

Permalink
Merge pull request #201 from CanDIG/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
jimmyhli committed Sep 11, 2019
2 parents b7cf011 + 19cb150 commit 9f463ed
Show file tree
Hide file tree
Showing 8 changed files with 112 additions and 55 deletions.
92 changes: 50 additions & 42 deletions candig/server/cli/repomanager.py

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion candig/server/datamodel/__init__.py
Expand Up @@ -30,7 +30,7 @@ def __init__(self):
self._cache = collections.deque()
self._memoTable = dict()
# Initialize the value even if it will be set up by the config
self._maxCacheSize = 50
self._maxCacheSize = 500

def setMaxCacheSize(self, size):
"""
Expand Down
56 changes: 50 additions & 6 deletions candig/server/datarepo.py
Expand Up @@ -26,6 +26,8 @@

import candig.schemas.protocol as protocol

import peewee

MODE_READ = 'r'
MODE_WRITE = 'w'

Expand Down Expand Up @@ -793,6 +795,45 @@ def getPeers(self, offset=0, limit=1000):
models.Peer.url).limit(limit).offset(offset)
return [peers.Peer(p.url, record=p) for p in select]

def getSqlOntologyByName(self, name):
"""
Returns the ontology set with the specified name.
"""
select = list(models.Ontology.select().where(models.Ontology.name == name))

if len(select) == 0:
raise exceptions.OntologyNameNotFoundException(name)
else:
ontology = ontologies.Ontology(select[0].name)
ontology.populateFromRow(select[0])
return ontology

def getSqlReferenceSetByName(self, name):
"""
Returns the reference set with the specified name.
"""
select = list(models.Referenceset.select().where(models.Referenceset.name == name))

if len(select) == 0:
raise exceptions.ReferenceSetNameNotFoundException(name)
else:
referenceSet = references.HtslibReferenceSet(select[0].name)
referenceSet.populateFromRow(select[0])
return referenceSet

def getSqlDatasetByName(self, name):
"""
Returns the dataset with the specified name.
"""
select = list(models.Dataset.select().where(models.Dataset.name == name))

if len(select) == 0:
raise exceptions.DatasetNameNotFoundException(name)
else:
dataset = datasets.Dataset(select[0].name)
dataset.populateFromRow(select[0])
return dataset

def tableToTsv(self, model):
"""
Takes a model class and attempts to create a table in TSV format
Expand Down Expand Up @@ -1457,8 +1498,9 @@ def insertReadGroupSet(self, readGroupSet):
attributes=json.dumps(readGroupSet.getAttributes()))
for readGroup in readGroupSet.getReadGroups():
self.insertReadGroup(readGroup)
except Exception as e:
raise exceptions.RepoManagerException(e)
except peewee.IntegrityError as e:
raise exceptions.DuplicateNameException(readGroupSet.getLocalId(),
readGroupSet.getParentContainer().getLocalId())

def removeReferenceSet(self, referenceSet):
"""
Expand Down Expand Up @@ -1584,8 +1626,9 @@ def insertVariantSet(self, variantSet):
patientId = variantSet.getPatientId(),
sampleId = variantSet.getSampleId(),
attributes=json.dumps(variantSet.getAttributes()))
except Exception as e:
raise exceptions.RepoManagerException(e)
except peewee.IntegrityError as e:
raise exceptions.DuplicateNameException(variantSet.getLocalId(),
variantSet.getParentContainer().getLocalId())
for callSet in variantSet.getCallSets():
self.insertCallSet(callSet)

Expand Down Expand Up @@ -1619,8 +1662,9 @@ def insertFeatureSet(self, featureSet):
name=featureSet.getLocalId(),
dataurl=featureSet.getDataUrl(),
attributes=json.dumps(featureSet.getAttributes()))
except Exception as e:
raise exceptions.RepoManagerException(e)
except peewee.IntegrityError as e:
raise exceptions.DuplicateNameException(featureSet.getLocalId(),
featureSet.getParentContainer().getLocalId())

def _readFeatureSetTable(self):
for featureSetRecord in models.Featureset.select():
Expand Down
2 changes: 1 addition & 1 deletion candig/server/serverconfig.py
Expand Up @@ -33,7 +33,7 @@ class BaseConfig(object):
SIMULATED_BACKEND_NUM_RNA_QUANTIFICATION_SETS = 2
SIMULATED_BACKEND_NUM_EXPRESSION_LEVELS_PER_RNA_QUANT_SET = 2

FILE_HANDLE_CACHE_MAX_SIZE = 50
FILE_HANDLE_CACHE_MAX_SIZE = 500

LANDING_MESSAGE_HTML = "landing_message.html"

Expand Down
6 changes: 6 additions & 0 deletions candig/server/static/.babelrc
@@ -0,0 +1,6 @@
{
"presets": [["minify", {
"builtIns": false
}]],
"comments": false
}
2 changes: 1 addition & 1 deletion candig/server/static/dist/gene_search.js

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion candig/server/static/src/gene_search.js
Expand Up @@ -61,7 +61,6 @@ var statusCode = 0; // Initial value, table is empty
statusCode = 0;
}

document.getElementById("searchBtn").addEventListener("click", submit);
document.getElementById("confirmRG").addEventListener("click", rg_submit);

function submit() {
Expand Down
6 changes: 3 additions & 3 deletions candig/server/templates/gene_search.html
Expand Up @@ -19,10 +19,10 @@
<div class="container-fluid">
<h2 style="text-align: center; margin-bottom: 100px" class="title" id="title">Gene Search</h2>

<div class="wrapper" id="gene_search_parent">
<input type="text" id="request" name="search" placeholder="Search..">
<form class="wrapper" id="gene_search_parent" action="javascript:submit()">
<input type="text" id="request" name="search" placeholder="Search.."/>
<button id="searchBtn" class="btn btn-primary" name="submit">Submit</button>
</div>
</form>
<div class="loader mx-auto" id="loader" style="display: none"></div>
<div id="geneTable_wrap" style="overflow: scroll; display: none"><table id="geneTable" class="table table-striped table-bordered nowrap"></table></div>

Expand Down

0 comments on commit 9f463ed

Please sign in to comment.