INSTRUCTION stringlengths 1 8.43k | RESPONSE stringlengths 75 104k |
|---|---|
Parsing of some custom sv frequencies These are very specific at the moment this will hopefully get better over time when the field of structural variants is more developed. | def parse_sv_frequencies(variant):
"""Parsing of some custom sv frequencies
These are very specific at the moment, this will hopefully get better over time when the
field of structural variants is more developed.
Args:
variant(cyvcf2.Variant)
Returns:
sv_frequencies(dict)
... |
Show all users in the database | def users(context):
"""Show all users in the database"""
LOG.info("Running scout view users")
adapter = context.obj['adapter']
user_objs = adapter.users()
if user_objs.count() == 0:
LOG.info("No users found")
context.abort()
click.echo("#name\temail\troles\tinstitutes")
for... |
Load a case into the database | def load_case(adapter, case_obj, update=False):
"""Load a case into the database
If the case already exists the function will exit.
If the user want to load a case that is already in the database
'update' has to be 'True'
Args:
adapter (MongoAdapter): connection to the database
cas... |
Build a hgnc_gene object | def build_hgnc_gene(gene_info, build='37'):
"""Build a hgnc_gene object
Args:
gene_info(dict): Gene information
Returns:
gene_obj(dict)
{
'_id': ObjectId(),
# This is the hgnc id, required:
'hgnc_id': int,
... |
Load a gene panel based on the info sent A panel object is built and integrity checks are made. The panel object is then loaded into the database. | def load_panel(self, parsed_panel):
"""Load a gene panel based on the info sent
A panel object is built and integrity checks are made.
The panel object is then loaded into the database.
Args:
path(str): Path to panel file
institute(str): Name of institute that ow... |
Create and load the OMIM - AUTO panel | def load_omim_panel(self, api_key, institute=None):
"""Create and load the OMIM-AUTO panel"""
existing_panel = self.gene_panel(panel_id='OMIM-AUTO')
if not existing_panel:
LOG.warning("OMIM-AUTO does not exists in database")
LOG.info('Creating a first version')
... |
Check if the latest version of OMIM differs from the most recent in database Return all genes that where not in the previous version. | def compare_mim_panels(self, existing_panel, new_panel):
"""Check if the latest version of OMIM differs from the most recent in database
Return all genes that where not in the previous version.
Args:
existing_panel(dict)
new_panel(dict)
Returns:
n... |
Set the correct version for each gene Loop over the genes in the new panel | def update_mim_version(self, new_genes, new_panel, old_version):
"""Set the correct version for each gene
Loop over the genes in the new panel
Args:
new_genes(set(str)): Set with the new gene symbols
new_panel(dict)
"""
LOG.info('Updating versions for ne... |
Add a gene panel to the database | def add_gene_panel(self, panel_obj):
"""Add a gene panel to the database
Args:
panel_obj(dict)
"""
panel_name = panel_obj['panel_name']
panel_version = panel_obj['version']
display_name = panel_obj.get('display_name', panel_name)
if self.gene... |
Fetch a gene panel by _id. | def panel(self, panel_id):
"""Fetch a gene panel by '_id'.
Args:
panel_id (str, ObjectId): str or ObjectId of document ObjectId
Returns:
dict: panel object or `None` if panel not found
"""
if not isinstance(panel_id, ObjectId):
panel_id = Obj... |
Delete a panel by _id. | def delete_panel(self, panel_obj):
"""Delete a panel by '_id'.
Args:
panel_obj(dict)
Returns:
res(pymongo.DeleteResult)
"""
res = self.panel_collection.delete_one({'_id': panel_obj['_id']})
LOG.warning("Deleting panel %s, version %s" % (panel_obj... |
Fetch a gene panel. | def gene_panel(self, panel_id, version=None):
"""Fetch a gene panel.
If no panel is sent return all panels
Args:
panel_id (str): unique id for the panel
version (str): version of the panel. If 'None' latest version will be returned
Returns:
gene_pan... |
Return all gene panels | def gene_panels(self, panel_id=None, institute_id=None, version=None):
"""Return all gene panels
If panel_id return all versions of panels by that panel name
Args:
panel_id(str)
Returns:
cursor(pymongo.cursor)
"""
query = {}
if panel_id:... |
Fetch all gene panels and group them by gene | def gene_to_panels(self, case_obj):
"""Fetch all gene panels and group them by gene
Args:
case_obj(scout.models.Case)
Returns:
gene_dict(dict): A dictionary with gene as keys and a set of
panel names as value
"""
... |
Replace a existing gene panel with a new one | def update_panel(self, panel_obj, version=None, date_obj=None):
"""Replace a existing gene panel with a new one
Keeps the object id
Args:
panel_obj(dict)
version(float)
date_obj(datetime.datetime)
Returns:
updated_panel(dict)
"""... |
Add a pending action to a gene panel | def add_pending(self, panel_obj, hgnc_gene, action, info=None):
"""Add a pending action to a gene panel
Store the pending actions in panel.pending
Args:
panel_obj(dict): The panel that is about to be updated
hgnc_gene(dict)
action(str): choices=['add','delet... |
Apply the pending changes to an existing gene panel or create a new version of the same panel. | def apply_pending(self, panel_obj, version):
"""Apply the pending changes to an existing gene panel or create a new version of the same panel.
Args:
panel_obj(dict): panel in database to update
version(double): panel version to update
Returns:
inserted_id(st... |
Return all the clinical gene symbols for a case. | def clinical_symbols(self, case_obj):
"""Return all the clinical gene symbols for a case."""
panel_ids = [panel['panel_id'] for panel in case_obj['panels']]
query = self.panel_collection.aggregate([
{'$match': {'_id': {'$in': panel_ids}}},
{'$unwind': '$genes'},
... |
Interact with cases existing in the database. | def cases(context, case_id, institute, reruns, finished, causatives, research_requested,
is_research, status, json):
"""Interact with cases existing in the database."""
adapter = context.obj['adapter']
models = []
if case_id:
case_obj = adapter.case(case_id=case_id)
if case_ob... |
Emit a record. Format the record and send it to the specified addressees. | def emit(self, record):
"""Emit a record.
Format the record and send it to the specified addressees.
"""
try:
import smtplib
try:
from email.utils import formatdate
except ImportError:
formatdate = self.date_time
... |
Return a list with the current indexes Skip the mandatory _id_ indexes Args: collection ( str ) | def indexes(self, collection=None):
"""Return a list with the current indexes
Skip the mandatory _id_ indexes
Args:
collection(str)
Returns:
indexes(list)
"""
indexes = []
for collection_name in self.collections... |
Add the proper indexes to the scout instance. | def load_indexes(self):
"""Add the proper indexes to the scout instance.
All indexes are specified in scout/constants/indexes.py
If this method is utilised when new indexes are defined those should be added
"""
for collection_name in INDEXES:
existing_indexes = sel... |
Update the indexes If there are any indexes that are not added to the database add those. | def update_indexes(self):
"""Update the indexes
If there are any indexes that are not added to the database, add those.
"""
LOG.info("Updating indexes...")
nr_updated = 0
for collection_name in INDEXES:
existing_indexes = self.indexes(collection_name... |
Delete all indexes for the database | def drop_indexes(self):
"""Delete all indexes for the database"""
LOG.warning("Dropping all indexe")
for collection_name in INDEXES:
LOG.warning("Dropping all indexes for collection name %s", collection_name)
self.db[collection_name].drop_indexes() |
Build a mongo query across multiple cases. Translate query options from a form into a complete mongo query dictionary. | def build_variant_query(self, query=None, category='snv', variant_type=['clinical']):
"""Build a mongo query across multiple cases.
Translate query options from a form into a complete mongo query dictionary.
Beware that unindexed queries against a large variant collection will
be extrem... |
Build a mongo query | def build_query(self, case_id, query=None, variant_ids=None, category='snv'):
"""Build a mongo query
These are the different query options:
{
'genetic_models': list,
'chrom': str,
'thousand_genomes_frequency': float,
'exac_freq... |
Add clinsig filter values to the mongo query object | def clinsig_query(self, query, mongo_query):
""" Add clinsig filter values to the mongo query object
Args:
query(dict): a dictionary of query filters specified by the users
mongo_query(dict): the query that is going to be submitted to the database
Return... |
Adds genomic coordinated - related filters to the query object | def coordinate_filter(self, query, mongo_query):
""" Adds genomic coordinated-related filters to the query object
Args:
query(dict): a dictionary of query filters specified by the users
mongo_query(dict): the query that is going to be submitted to the database
Returns:
... |
Adds gene - related filters to the query object | def gene_filter(self, query, mongo_query):
""" Adds gene-related filters to the query object
Args:
query(dict): a dictionary of query filters specified by the users
mongo_query(dict): the query that is going to be submitted to the database
Returns:
mongo_que... |
Creates a secondary query object based on secondary parameters specified by user | def secondary_query(self, query, mongo_query, secondary_filter=None):
"""Creates a secondary query object based on secondary parameters specified by user
Args:
query(dict): a dictionary of query filters specified by the users
mongo_query(dict): the query that is goin... |
Drop the mongo database given. | def wipe(ctx):
"""Drop the mongo database given."""
LOG.info("Running scout wipe")
db_name = ctx.obj['mongodb']
LOG.info("Dropping database %s", db_name)
try:
ctx.obj['client'].drop_database(db_name)
except Exception as err:
LOG.warning(err)
ctx.abort()
LOG.info("Drop... |
Parse user submitted panel. | def parse_panel(csv_stream):
"""Parse user submitted panel."""
reader = csv.DictReader(csv_stream, delimiter=';', quoting=csv.QUOTE_NONE)
genes = []
for gene_row in reader:
if not gene_row['HGNC_IDnumber'].strip().isdigit():
continue
transcripts_raw = gene_row.get('Disease_as... |
docstring for build_clnsig | def build_clnsig(clnsig_info):
"""docstring for build_clnsig"""
clnsig_obj = dict(
value = clnsig_info['value'],
accession = clnsig_info.get('accession'),
revstat = clnsig_info.get('revstat')
)
return clnsig_obj |
Load a bulk of hgnc gene objects Raises IntegrityError if there are any write concerns | def load_hgnc_bulk(self, gene_objs):
"""Load a bulk of hgnc gene objects
Raises IntegrityError if there are any write concerns
Args:
gene_objs(iterable(scout.models.hgnc_gene))
Returns:
result (pymongo.results.InsertManyResult)
"""
LOG.... |
Load a bulk of transcript objects to the database | def load_transcript_bulk(self, transcript_objs):
"""Load a bulk of transcript objects to the database
Arguments:
transcript_objs(iterable(scout.models.hgnc_transcript))
"""
LOG.info("Loading transcript bulk")
try:
result = self.transcript_collection.inse... |
Load a bulk of exon objects to the database | def load_exon_bulk(self, exon_objs):
"""Load a bulk of exon objects to the database
Arguments:
exon_objs(iterable(scout.models.hgnc_exon))
"""
try:
result = self.exon_collection.insert_many(transcript_objs)
except (DuplicateKeyError, BulkWriteError) as e... |
Fetch a hgnc gene | def hgnc_gene(self, hgnc_identifier, build='37'):
"""Fetch a hgnc gene
Args:
hgnc_identifier(int)
Returns:
gene_obj(HgncGene)
"""
if not build in ['37', '38']:
build = '37'
query = {}
try:
# If the ... |
Query the genes with a hgnc symbol and return the hgnc id | def hgnc_id(self, hgnc_symbol, build='37'):
"""Query the genes with a hgnc symbol and return the hgnc id
Args:
hgnc_symbol(str)
build(str)
Returns:
hgnc_id(int)
"""
#LOG.debug("Fetching gene %s", hgnc_symbol)
query = {'hgnc_symbol':hg... |
Fetch all hgnc genes that match a hgnc symbol | def hgnc_genes(self, hgnc_symbol, build='37', search=False):
"""Fetch all hgnc genes that match a hgnc symbol
Check both hgnc_symbol and aliases
Args:
hgnc_symbol(str)
build(str): The build in which to search
search(bool): if partial sear... |
Fetch all hgnc genes | def all_genes(self, build='37'):
"""Fetch all hgnc genes
Returns:
result()
"""
LOG.info("Fetching all genes")
return self.hgnc_collection.find({'build': build}).sort('chromosome', 1) |
Return the number of hgnc genes in collection | def nr_genes(self, build=None):
"""Return the number of hgnc genes in collection
If build is used, return the number of genes of a certain build
Returns:
result()
"""
if build:
LOG.info("Fetching all genes from build %s", build)
else:
... |
Delete the genes collection | def drop_genes(self, build=None):
"""Delete the genes collection"""
if build:
LOG.info("Dropping the hgnc_gene collection, build %s", build)
self.hgnc_collection.delete_many({'build': build})
else:
LOG.info("Dropping the hgnc_gene collection")
self... |
Delete the transcripts collection | def drop_transcripts(self, build=None):
"""Delete the transcripts collection"""
if build:
LOG.info("Dropping the transcripts collection, build %s", build)
self.transcript_collection.delete_many({'build': build})
else:
LOG.info("Dropping the transcripts collect... |
Delete the exons collection | def drop_exons(self, build=None):
"""Delete the exons collection"""
if build:
LOG.info("Dropping the exons collection, build %s", build)
self.exon_collection.delete_many({'build': build})
else:
LOG.info("Dropping the exons collection")
self.exon_co... |
Return a dictionary with ensembl ids as keys and transcripts as value. | def ensembl_transcripts(self, build='37'):
"""Return a dictionary with ensembl ids as keys and transcripts as value.
Args:
build(str)
Returns:
ensembl_transcripts(dict): {<enst_id>: transcripts_obj, ...}
"""
ensembl_transcripts = {}
LOG.i... |
Return a dictionary with hgnc_symbol as key and gene_obj as value | def hgncsymbol_to_gene(self, build='37', genes=None):
"""Return a dictionary with hgnc_symbol as key and gene_obj as value
The result will have ONE entry for each gene in the database.
(For a specific build)
Args:
build(str)
genes(iterable(scout.models.HgncGene)... |
Return a iterable with hgnc_genes. | def gene_by_alias(self, symbol, build='37'):
"""Return a iterable with hgnc_genes.
If the gene symbol is listed as primary the iterable will only have
one result. If not the iterable will include all hgnc genes that have
the symbol as an alias.
Args:
symbol(str)
... |
Return a dictionary with hgnc symbols as keys and a list of hgnc ids as value. | def genes_by_alias(self, build='37', genes=None):
"""Return a dictionary with hgnc symbols as keys and a list of hgnc ids
as value.
If a gene symbol is listed as primary the list of ids will only consist
of that entry if not the gene can not be determined so the result is a list
... |
Return a set with identifier transcript ( s ) | def get_id_transcripts(self, hgnc_id, build='37'):
"""Return a set with identifier transcript(s)
Choose all refseq transcripts with NM symbols, if none where found choose ONE with NR,
if no NR choose ONE with XM. If there are no RefSeq transcripts identifiers choose the
longest ensembl... |
Return a dictionary with hgnc_id as keys and a list of transcripts as value Args: build ( str ) Returns: hgnc_transcripts ( dict ) | def transcripts_by_gene(self, build='37'):
"""Return a dictionary with hgnc_id as keys and a list of transcripts as value
Args:
build(str)
Returns:
hgnc_transcripts(dict)
"""
hgnc_transcripts = {}
LOG.info("Fetchi... |
Return a dictionary with hgnc_id as keys and a set of id transcripts as value Args: build ( str ) Returns: hgnc_id_transcripts ( dict ) | def id_transcripts_by_gene(self, build='37'):
"""Return a dictionary with hgnc_id as keys and a set of id transcripts as value
Args:
build(str)
Returns:
hgnc_id_transcripts(dict)
"""
hgnc_id_transcripts = {}
LOG.info("Fetching all... |
Return a dictionary with ensembl ids as keys and gene objects as value. | def ensembl_genes(self, build='37'):
"""Return a dictionary with ensembl ids as keys and gene objects as value.
Args:
build(str)
Returns:
genes(dict): {<ensg_id>: gene_obj, ...}
"""
genes = {}
LOG.info("Fetching all genes")
... |
Return all transcripts. If a gene is specified return all transcripts for the gene Args: build ( str ) hgnc_id ( int ) Returns: iterable ( transcript ) | def transcripts(self, build='37', hgnc_id=None):
"""Return all transcripts.
If a gene is specified return all transcripts for the gene
Args:
build(str)
hgnc_id(int)
Returns:
iterable(transcript)
"""
... |
Check if a hgnc symbol is an alias | def to_hgnc(self, hgnc_alias, build='37'):
"""Check if a hgnc symbol is an alias
Return the correct hgnc symbol, if not existing return None
Args:
hgnc_alias(str)
Returns:
hgnc_symbol(str)
"""
result = self.hgnc_genes(hgnc_sy... |
Add the correct hgnc id to a set of genes with hgnc symbols | def add_hgnc_id(self, genes):
"""Add the correct hgnc id to a set of genes with hgnc symbols
Args:
genes(list(dict)): A set of genes with hgnc symbols only
"""
genes_by_alias = self.genes_by_alias()
for gene in genes:
id_info = genes_by_alias.get(gene['... |
Return a dictionary with chromosomes as keys and interval trees as values | def get_coding_intervals(self, build='37', genes=None):
"""Return a dictionary with chromosomes as keys and interval trees as values
Each interval represents a coding region of overlapping genes.
Args:
build(str): The genome build
genes(iterable(scout.models.HgncGene)):... |
Create exon objects and insert them into the database Args: exons ( iterable ( dict )) | def load_exons(self, exons, genes=None, build='37'):
"""Create exon objects and insert them into the database
Args:
exons(iterable(dict))
"""
genes = genes or self.ensembl_genes(build)
for exon in exons:
exon_obj = build_exon(exon, genes)
... |
Return all exons Args: hgnc_id ( int ) transcript_id ( str ) build ( str ) Returns: exons ( iterable ( dict )) | def exons(self, hgnc_id=None, transcript_id=None, build=None):
"""Return all exons
Args:
hgnc_id(int)
transcript_id(str)
build(str)
Returns:
exons(iterable(dict))
"""
query = {}
if build:
query... |
Update the automate generated omim gene panel in the database. | def omim(context, api_key, institute):
"""
Update the automate generated omim gene panel in the database.
"""
LOG.info("Running scout update omim")
adapter = context.obj['adapter']
api_key = api_key or context.obj.get('omim_api_key')
if not api_key:
LOG.warning("Please provide a... |
Display a list of all user institutes. | def index():
"""Display a list of all user institutes."""
institute_objs = user_institutes(store, current_user)
institutes_count = ((institute_obj, store.cases(collaborator=institute_obj['_id']).count())
for institute_obj in institute_objs if institute_obj)
return dict(institutes... |
Display a list of cases for an institute. | def cases(institute_id):
"""Display a list of cases for an institute."""
institute_obj = institute_and_case(store, institute_id)
query = request.args.get('query')
limit = 100
if request.args.get('limit'):
limit = int(request.args.get('limit'))
skip_assigned = request.args.get('skip_ass... |
Display one case. | def case(institute_id, case_name):
"""Display one case."""
institute_obj, case_obj = institute_and_case(store, institute_id, case_name)
data = controllers.case(store, institute_obj, case_obj)
return dict(institute=institute_obj, case=case_obj, **data) |
Show all MatchMaker matches for a given case | def matchmaker_matches(institute_id, case_name):
"""Show all MatchMaker matches for a given case"""
# check that only authorized users can access MME patients matches
user_obj = store.user(current_user.email)
if 'mme_submitter' not in user_obj['roles']:
flash('unauthorized request', 'warning')
... |
Starts an internal match or a match against one or all MME external nodes | def matchmaker_match(institute_id, case_name, target):
"""Starts an internal match or a match against one or all MME external nodes"""
institute_obj, case_obj = institute_and_case(store, institute_id, case_name)
# check that only authorized users can run matches
user_obj = store.user(current_user.email... |
Add or update a case in MatchMaker | def matchmaker_add(institute_id, case_name):
"""Add or update a case in MatchMaker"""
# check that only authorized users can add patients to MME
user_obj = store.user(current_user.email)
if 'mme_submitter' not in user_obj['roles']:
flash('unauthorized request', 'warning')
return redirec... |
Remove a case from MatchMaker | def matchmaker_delete(institute_id, case_name):
"""Remove a case from MatchMaker"""
# check that only authorized users can delete patients from MME
user_obj = store.user(current_user.email)
if 'mme_submitter' not in user_obj['roles']:
flash('unauthorized request', 'warning')
return redi... |
Display a list of SNV variants. | def gene_variants(institute_id):
"""Display a list of SNV variants."""
page = int(request.form.get('page', 1))
institute_obj = institute_and_case(store, institute_id)
# populate form, conditional on request method
if(request.method == "POST"):
form = GeneVariantFiltersForm(request.form... |
Update ( PUT ) synopsis of a specific case. | def case_synopsis(institute_id, case_name):
"""Update (PUT) synopsis of a specific case."""
institute_obj, case_obj = institute_and_case(store, institute_id, case_name)
user_obj = store.user(current_user.email)
new_synopsis = request.form.get('synopsis')
controllers.update_synopsis(store, institute_... |
Visualize case report | def case_report(institute_id, case_name):
"""Visualize case report"""
institute_obj, case_obj = institute_and_case(store, institute_id, case_name)
data = controllers.case_report_content(store, institute_obj, case_obj)
return dict(institute=institute_obj, case=case_obj, format='html', **data) |
Download a pdf report for a case | def pdf_case_report(institute_id, case_name):
"""Download a pdf report for a case"""
institute_obj, case_obj = institute_and_case(store, institute_id, case_name)
data = controllers.case_report_content(store, institute_obj, case_obj)
# add coverage report on the bottom of this report
if current_app... |
Add or remove a diagnosis for a case. | def case_diagnosis(institute_id, case_name):
"""Add or remove a diagnosis for a case."""
institute_obj, case_obj = institute_and_case(store, institute_id, case_name)
user_obj = store.user(current_user.email)
link = url_for('.case', institute_id=institute_id, case_name=case_name)
level = 'phenotype' ... |
Handle phenotypes. | def phenotypes(institute_id, case_name, phenotype_id=None):
"""Handle phenotypes."""
institute_obj, case_obj = institute_and_case(store, institute_id, case_name)
case_url = url_for('.case', institute_id=institute_id, case_name=case_name)
is_group = request.args.get('is_group') == 'yes'
user_obj = st... |
Perform actions on multiple phenotypes. | def phenotypes_actions(institute_id, case_name):
"""Perform actions on multiple phenotypes."""
institute_obj, case_obj = institute_and_case(store, institute_id, case_name)
case_url = url_for('.case', institute_id=institute_id, case_name=case_name)
action = request.form['action']
hpo_ids = request.fo... |
Handle events. | def events(institute_id, case_name, event_id=None):
"""Handle events."""
institute_obj, case_obj = institute_and_case(store, institute_id, case_name)
link = request.form.get('link')
content = request.form.get('content')
variant_id = request.args.get('variant_id')
user_obj = store.user(current_us... |
Update status of a specific case. | def status(institute_id, case_name):
"""Update status of a specific case."""
institute_obj, case_obj = institute_and_case(store, institute_id, case_name)
user_obj = store.user(current_user.email)
status = request.form.get('status', case_obj['status'])
link = url_for('.case', institute_id=institute_... |
Assign and unassign a user from a case. | def assign(institute_id, case_name, user_id=None):
"""Assign and unassign a user from a case."""
institute_obj, case_obj = institute_and_case(store, institute_id, case_name)
link = url_for('.case', institute_id=institute_id, case_name=case_name)
if user_id:
user_obj = store.user(user_id)
els... |
Search for HPO terms. | def hpoterms():
"""Search for HPO terms."""
query = request.args.get('query')
if query is None:
return abort(500)
terms = sorted(store.hpo_terms(query=query), key=itemgetter('hpo_number'))
json_terms = [
{'name': '{} | {}'.format(term['_id'], term['description']),
'id': term... |
Pin and unpin variants to/ from the list of suspects. | def pin_variant(institute_id, case_name, variant_id):
"""Pin and unpin variants to/from the list of suspects."""
institute_obj, case_obj = institute_and_case(store, institute_id, case_name)
variant_obj = store.variant(variant_id)
user_obj = store.user(current_user.email)
link = url_for('variants.var... |
Mark a variant as sanger validated. | def mark_validation(institute_id, case_name, variant_id):
"""Mark a variant as sanger validated."""
institute_obj, case_obj = institute_and_case(store, institute_id, case_name)
variant_obj = store.variant(variant_id)
user_obj = store.user(current_user.email)
validate_type = request.form['type'] or N... |
Mark a variant as confirmed causative. | def mark_causative(institute_id, case_name, variant_id):
"""Mark a variant as confirmed causative."""
institute_obj, case_obj = institute_and_case(store, institute_id, case_name)
variant_obj = store.variant(variant_id)
user_obj = store.user(current_user.email)
link = url_for('variants.variant', inst... |
Mark a case that is has been checked. This means to set case [ needs_check ] to False | def check_case(institute_id, case_name):
"""Mark a case that is has been checked.
This means to set case['needs_check'] to False
"""
institute_obj, case_obj = institute_and_case(store, institute_id, case_name)
store.case_collection.find_one_and_update({'_id':case_obj['_id']}, {'$set': {'needs_che... |
Display delivery report. | def delivery_report(institute_id, case_name):
"""Display delivery report."""
institute_obj, case_obj = institute_and_case(store, institute_id, case_name)
if case_obj.get('delivery_report') is None:
return abort(404)
date_str = request.args.get('date')
if date_str:
delivery_report = ... |
Share a case with a different institute. | def share(institute_id, case_name):
"""Share a case with a different institute."""
institute_obj, case_obj = institute_and_case(store, institute_id, case_name)
user_obj = store.user(current_user.email)
collaborator_id = request.form['collaborator']
revoke_access = 'revoke' in request.form
link =... |
Request a case to be rerun. | def rerun(institute_id, case_name):
"""Request a case to be rerun."""
sender = current_app.config['MAIL_USERNAME']
recipient = current_app.config['TICKET_SYSTEM_EMAIL']
controllers.rerun(store, mail, current_user, institute_id, case_name, sender,
recipient)
return redirect(requ... |
Open the research list for a case. | def research(institute_id, case_name):
"""Open the research list for a case."""
institute_obj, case_obj = institute_and_case(store, institute_id, case_name)
user_obj = store.user(current_user.email)
link = url_for('.case', institute_id=institute_id, case_name=case_name)
store.open_research(institute... |
Add/ remove institute tags. | def cohorts(institute_id, case_name):
"""Add/remove institute tags."""
institute_obj, case_obj = institute_and_case(store, institute_id, case_name)
user_obj = store.user(current_user.email)
link = url_for('.case', institute_id=institute_id, case_name=case_name)
cohort_tag = request.form['cohort_tag'... |
Update default panels for a case. | def default_panels(institute_id, case_name):
"""Update default panels for a case."""
panel_ids = request.form.getlist('panel_ids')
controllers.update_default_panels(store, current_user, institute_id, case_name, panel_ids)
return redirect(request.referrer) |
Download vcf2cytosure file for individual. | def vcf2cytosure(institute_id, case_name, individual_id):
"""Download vcf2cytosure file for individual."""
(display_name, vcf2cytosure) = controllers.vcf2cytosure(store,
institute_id, case_name, individual_id)
outdir = os.path.abspath(os.path.dirname(vcf2cytosure))
filename = os.path.basename(... |
Load multiqc report for the case. | def multiqc(institute_id, case_name):
"""Load multiqc report for the case."""
data = controllers.multiqc(store, institute_id, case_name)
if data['case'].get('multiqc') is None:
return abort(404)
out_dir = os.path.abspath(os.path.dirname(data['case']['multiqc']))
filename = os.path.basename(d... |
scout: manage interactions with a scout instance. | def update_panels(context, mongodb, username, password, authdb, host, port, loglevel, config):
"""scout: manage interactions with a scout instance."""
coloredlogs.install(level=loglevel)
LOG.info("Running scout version %s", __version__)
LOG.debug("Debug logging enabled.")
mongo_config = {}
... |
Preprocess case objects. | def cases(store, case_query, limit=100):
"""Preprocess case objects.
Add the necessary information to display the 'cases' view
Args:
store(adapter.MongoAdapter)
case_query(pymongo.Cursor)
limit(int): Maximum number of cases to display
Returns:
data(dict): includes the ... |
Preprocess a single case. | def case(store, institute_obj, case_obj):
"""Preprocess a single case.
Prepare the case to be displayed in the case view.
Args:
store(adapter.MongoAdapter)
institute_obj(models.Institute)
case_obj(models.Case)
Returns:
data(dict): includes the cases, how many there are... |
Gather contents to be visualized in a case report | def case_report_content(store, institute_obj, case_obj):
"""Gather contents to be visualized in a case report
Args:
store(adapter.MongoAdapter)
institute_obj(models.Institute)
case_obj(models.Case)
Returns:
data(dict)
"""
variant_types = {
'causatives_detai... |
Posts a request to chanjo - report and capture the body of the returned response to include it in case report | def coverage_report_contents(store, institute_obj, case_obj, base_url):
"""Posts a request to chanjo-report and capture the body of the returned response to include it in case report
Args:
store(adapter.MongoAdapter)
institute_obj(models.Institute)
case_obj(models.Case)
base_url... |
Get all Clinvar submissions for a user and an institute | def clinvar_submissions(store, user_id, institute_id):
"""Get all Clinvar submissions for a user and an institute"""
submissions = list(store.clinvar_submissions(user_id, institute_id))
return submissions |
Collect MT variants and format line of a MT variant report to be exported in excel format | def mt_excel_files(store, case_obj, temp_excel_dir):
"""Collect MT variants and format line of a MT variant report
to be exported in excel format
Args:
store(adapter.MongoAdapter)
case_obj(models.Case)
temp_excel_dir(os.Path): folder where the temp excel files are written to
Re... |
Update synopsis. | def update_synopsis(store, institute_obj, case_obj, user_obj, new_synopsis):
"""Update synopsis."""
# create event only if synopsis was actually changed
if case_obj['synopsis'] != new_synopsis:
link = url_for('cases.case', institute_id=institute_obj['_id'],
case_name=case_obj[... |
Return the list of HGNC symbols that match annotated HPO terms. | def hpo_diseases(username, password, hpo_ids, p_value_treshold=1):
"""Return the list of HGNC symbols that match annotated HPO terms.
Args:
username (str): username to use for phenomizer connection
password (str): password to use for phenomizer connection
Returns:
query_result: a g... |
Request a rerun by email. | def rerun(store, mail, current_user, institute_id, case_name, sender, recipient):
"""Request a rerun by email."""
institute_obj, case_obj = institute_and_case(store, institute_id, case_name)
user_obj = store.user(current_user.email)
link = url_for('cases.case', institute_id=institute_id, case_name=case_... |
Update default panels for a case. | def update_default_panels(store, current_user, institute_id, case_name, panel_ids):
"""Update default panels for a case."""
institute_obj, case_obj = institute_and_case(store, institute_id, case_name)
user_obj = store.user(current_user.email)
link = url_for('cases.case', institute_id=institute_id, case_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.