Skip to content

Instantly share code, notes, and snippets.

View guyjacks's full-sized avatar

Guy L Jacks guyjacks

View GitHub Profile
$ surge list
/Users/guyjacks/.config/yarn/global/node_modules/surge/lib/middleware/list.js:44
project.timeAgoInWords.grey,
^
TypeError: Cannot read property 'grey' of undefined
at /Users/guyjacks/.config/yarn/global/node_modules/surge/lib/middleware/list.js:44:34
at Array.forEach (<anonymous>)
at Request._callback (/Users/guyjacks/.config/yarn/global/node_modules/surge/lib/middleware/list.js:33:12)
Tried: docker-compose run --rm web py.test
WARNING: The DJANGO_CORS_ORIGIN_WHITELIST variable is not set. Defaulting to a blank string.
Starting one_raft_conventions_backend_postgres_1 ... done
============================================================================ test session starts ============================================================================
platform linux -- Python 3.7.0, pytest-4.0.2, py-1.7.0, pluggy-0.8.0
Django settings: config.settings.test (from ini file)
rootdir: /code, inifile: pytest.ini
plugins: mock-1.10.0, django-3.4.4, cov-2.6.0
collected 3 items / 1 errors
{
"pk": "82cbb5f1-ea98-44b4-bf78-4106460430e4",
"label": "KMT2C mut",
"saved": true,
"filters": [
{
"type": "intersection",
"filters": [
{
"type": "gene",
@guyjacks
guyjacks / help.py
Last active September 24, 2018 00:40
# WHAT I HAVE TRIED
def parse_intersection(self, filters):
# each of these two filters are uuids
first_filter = filters[0]['gene']
second_filter = filters[1]['gene']
# Doesn't work - seems to ignore one of the Qs
# This seems to be the ideal way to do this, but it doesn't work.
#qs = Rule.objects.filter(Q(gene_traits__pk=first_filter) and Q(gene_traits__pk=second_filter))
-- qs = Rule.objects.filter(Q(gene_traits__pk=first_filter) and Q(gene_traits__pk=second_filter))
SELECT "datasets_rules"."id",
"datasets_rules"."created",
"datasets_rules"."modified",
"datasets_rules"."label",
"datasets_rules"."biopsy_batch_id"
FROM "datasets_rules"
INNER JOIN "datasets_rules_gene_traits"
ON ( "datasets_rules"."id" =
"datasets_rules_gene_traits"."rule_id" )
def parse_intersection(self, filters):
first_filter = filters[0]['gene']
second_filter = filters[1]['gene']
print('filters', first_filter, second_filter)
# Doesn't work - seems to ignore one of the Qs
#qs = Rule.objects.filter(Q(gene_traits__pk=first_filter) and Q(gene_traits__pk=second_filter))
# Doesn't work - seems to ignore one of the filters. This should be the same as the query below.
#qs = Rule.objects.filter(gene_traits__pk=first_filter)
{
"rule-restraints": {
"stength": {
"min": null,
"max": null
}
},
"match-restraints": {
"min-rules-matched": null,
"max-rules-matched": null
"""
# /filters/?q=thrap3
- GET
- Return the trait filters matching the search
- also return a count of rules matching each possible filter
# /queries/
- POST
- Apply a filter and return the new query
- PUT /queries/<id>/
{
"rule-restraints": {
"stength": {
"min": null,
"max": null
}
},
"match-restraints": {
"min-rules-matched": null,
"max-rules-matched": null
# Gene Trait Rule Filter
{
"rule-restraints": {
"stength": {
"min": null,
"max": null
}
},