INSTRUCTION
stringlengths
1
8.43k
RESPONSE
stringlengths
75
104k
vcf2cytosure CGH file for inidividual.
def vcf2cytosure(store, institute_id, case_name, individual_id): """vcf2cytosure CGH file for inidividual.""" institute_obj, case_obj = institute_and_case(store, institute_id, case_name) for individual in case_obj['individuals']: if individual['individual_id'] == individual_id: individu...
Pre - process list of variants.
def gene_variants(store, variants_query, page=1, per_page=50): """Pre-process list of variants.""" variant_count = variants_query.count() skip_count = per_page * max(page - 1, 0) more_variants = True if variant_count > (skip_count + per_page) else False variant_res = variants_query.skip(skip_count)....
Find MultiQC report for the case.
def multiqc(store, institute_id, case_name): """Find MultiQC report for the case.""" institute_obj, case_obj = institute_and_case(store, institute_id, case_name) return dict( institute=institute_obj, case=case_obj, )
Get all variants for an institute having Sanger validations ordered but still not evaluated
def get_sanger_unevaluated(store, institute_id, user_id): """Get all variants for an institute having Sanger validations ordered but still not evaluated Args: store(scout.adapter.MongoAdapter) institute_id(str) Returns: unevaluated: a list that looks like this: ...
Add a patient to MatchMaker server
def mme_add(store, user_obj, case_obj, add_gender, add_features, add_disorders, genes_only, mme_base_url, mme_accepts, mme_token): """Add a patient to MatchMaker server Args: store(adapter.MongoAdapter) user_obj(dict) a scout user object (to be added as matchmaker contact) case_obj(...
Delete all affected samples for a case from MatchMaker
def mme_delete(case_obj, mme_base_url, mme_token): """Delete all affected samples for a case from MatchMaker Args: case_obj(dict) a scout case object mme_base_url(str) base url of the MME server mme_token(str) auth token of the MME server Returns: server_responses(list): a...
Show Matchmaker submission data for a sample and eventual matches.
def mme_matches(case_obj, institute_obj, mme_base_url, mme_token): """Show Matchmaker submission data for a sample and eventual matches. Args: case_obj(dict): a scout case object institute_obj(dict): an institute object mme_base_url(str) base url of the MME server mme_token(str)...
Initiate a MatchMaker match against either other Scout patients or external nodes
def mme_match(case_obj, match_type, mme_base_url, mme_token, nodes=None, mme_accepts=None): """Initiate a MatchMaker match against either other Scout patients or external nodes Args: case_obj(dict): a scout case object already submitted to MME match_type(str): 'internal' or 'external' m...
Build a variant object based on parsed information
def build_variant(variant, institute_id, gene_to_panels = None, hgncid_to_gene=None, sample_info=None): """Build a variant object based on parsed information Args: variant(dict) institute_id(str) gene_to_panels(dict): A dictionary with {...
Load the hgnc aliases to the mongo database.
def genes(context, build, api_key): """ Load the hgnc aliases to the mongo database. """ LOG.info("Running scout update genes") adapter = context.obj['adapter'] # Fetch the omim information api_key = api_key or context.obj.get('omim_api_key') if not api_key: LOG.warning("Please ...
Parse how the different variant callers have performed
def parse_callers(variant, category='snv'): """Parse how the different variant callers have performed Args: variant (cyvcf2.Variant): A variant object Returns: callers (dict): A dictionary on the format {'gatk': <filter>,'freebayes': <filter>,'samtools': <filter...
Get the format from a vcf header line description If format begins with white space it will be stripped Args: description ( str ): Description from a vcf header line Return: format ( str ): The format information from description
def parse_header_format(description): """Get the format from a vcf header line description If format begins with white space it will be stripped Args: description(str): Description from a vcf header line Return: format(str): The format information from description """ ...
Return a list with the VEP header The vep header is collected from CSQ in the vcf file All keys are capitalized Args: vcf_obj ( cyvcf2. VCF ) Returns: vep_header ( list )
def parse_vep_header(vcf_obj): """Return a list with the VEP header The vep header is collected from CSQ in the vcf file All keys are capitalized Args: vcf_obj(cyvcf2.VCF) Returns: vep_header(list) """ vep_header = [] if 'CSQ' in vcf_obj: # Thi...
Build a hgnc_transcript object
def build_transcript(transcript_info, build='37'): """Build a hgnc_transcript object Args: transcript_info(dict): Transcript information Returns: transcript_obj(HgncTranscript) { transcript_id: str, required hgnc_id: int, required...
Load a institute into the database
def load_institute(adapter, internal_id, display_name, sanger_recipients=None): """Load a institute into the database Args: adapter(MongoAdapter) internal_id(str) display_name(str) sanger_recipients(list(email)) """ institute_obj = build_institute( ...
Check if the cadd phred score is annotated
def parse_cadd(variant, transcripts): """Check if the cadd phred score is annotated""" cadd = 0 cadd_keys = ['CADD', 'CADD_PHRED'] for key in cadd_keys: cadd = variant.INFO.get(key, 0) if cadd: return float(cadd) for transcript in transcripts: cadd_entry = tr...
Load a case into the database.
def case(context, vcf, vcf_sv, vcf_cancer, vcf_str, owner, ped, update, config, no_variants, peddy_ped, peddy_sex, peddy_check): """Load a case into the database. A case can be loaded without specifying vcf files and/or bam files """ adapter = context.obj['adapter'] if config is None and ...
Update one variant document in the database.
def update_variant(self, variant_obj): """Update one variant document in the database. This means that the variant in the database will be replaced by variant_obj. Args: variant_obj(dict) Returns: new_variant(dict) """ LOG.debug('Updating varian...
Updates the manual rank for all variants in a case
def update_variant_rank(self, case_obj, variant_type='clinical', category='snv'): """Updates the manual rank for all variants in a case Add a variant rank based on the rank score Whenever variants are added or removed from a case we need to update the variant rank Args: cas...
Update compounds for a variant.
def update_variant_compounds(self, variant, variant_objs = None): """Update compounds for a variant. This will add all the necessary information of a variant on a compound object. Args: variant(scout.models.Variant) variant_objs(dict): A dictionary with _ids as keys and...
Update the compounds for a set of variants.
def update_compounds(self, variants): """Update the compounds for a set of variants. Args: variants(dict): A dictionary with _ids as keys and variant objs as values """ LOG.debug("Updating compound objects") for var_id in variants: variant_obj = variant...
Update the compound information for a bulk of variants in the database
def update_mongo_compound_variants(self, bulk): """Update the compound information for a bulk of variants in the database Args: bulk(dict): {'_id': scout.models.Variant} """ requests = [] for var_id in bulk: var_obj = bulk[var_id] if ...
Update the compounds for a case
def update_case_compounds(self, case_obj, build='37'): """Update the compounds for a case Loop over all coding intervals to get coordinates for all potential compound positions. Update all variants within a gene with a bulk operation. """ case_id = case_obj['_id'] # Pos...
Load a variant object
def load_variant(self, variant_obj): """Load a variant object Args: variant_obj(dict) Returns: inserted_id """ # LOG.debug("Loading variant %s", variant_obj['_id']) try: result = self.variant_collection.insert_one(variant_obj) ...
Load a variant object if the object already exists update compounds.
def upsert_variant(self, variant_obj): """Load a variant object, if the object already exists update compounds. Args: variant_obj(dict) Returns: result """ LOG.debug("Upserting variant %s", variant_obj['_id']) try: result = self.varia...
Load a bulk of variants
def load_variant_bulk(self, variants): """Load a bulk of variants Args: variants(iterable(scout.models.Variant)) Returns: object_ids """ if not len(variants) > 0: return LOG.debug("Loading variant bulk") try: resu...
Perform the loading of variants
def _load_variants(self, variants, variant_type, case_obj, individual_positions, rank_threshold, institute_id, build=None, rank_results_header=None, vep_header=None, category='snv', sample_info = None): """Perform the loading of variants This is the functio...
Load variants for a case into scout.
def load_variants(self, case_obj, variant_type='clinical', category='snv', rank_threshold=None, chrom=None, start=None, end=None, gene_obj=None, build='37'): """Load variants for a case into scout. Load the variants for a specific analysis type and category i...
Assign a user to a case.
def assign(self, institute, case, user, link): """Assign a user to a case. This function will create an Event to log that a person has been assigned to a case. Also the user will be added to case "assignees". Arguments: institute (dict): A institute case (dict):...
Share a case with a new institute.
def share(self, institute, case, collaborator_id, user, link): """Share a case with a new institute. Arguments: institute (dict): A Institute object case (dict): Case object collaborator_id (str): A instute id user (dict): A User object link (...
Diagnose a case using OMIM ids.
def diagnose(self, institute, case, user, link, level, omim_id, remove=False): """Diagnose a case using OMIM ids. Arguments: institute (dict): A Institute object case (dict): Case object user (dict): A User object link (str): The url to be used in the eve...
Mark a case as checked from an analysis point of view.
def mark_checked(self, institute, case, user, link, unmark=False): """Mark a case as checked from an analysis point of view. Arguments: institute (dict): A Institute object case (dict): Case object user (dict): A User object link (str...
Update default panels for a case.
def update_default_panels(self, institute_obj, case_obj, user_obj, link, panel_objs): """Update default panels for a case. Arguments: institute_obj (dict): A Institute object case_obj (dict): Case object user_obj (dict): A User object link (str): The url ...
Create an event for a variant verification for a variant and an event for a variant verification for a case
def order_verification(self, institute, case, user, link, variant): """Create an event for a variant verification for a variant and an event for a variant verification for a case Arguments: institute (dict): A Institute object case (dict): Case object user (d...
Get all variants with validations ever ordered.
def sanger_ordered(self, institute_id=None, user_id=None): """Get all variants with validations ever ordered. Args: institute_id(str) : The id of an institute user_id(str) : The id of an user Returns: sanger_ordered(list) : a list of dictionaries, each with ...
Mark validation status for a variant.
def validate(self, institute, case, user, link, variant, validate_type): """Mark validation status for a variant. Arguments: institute (dict): A Institute object case (dict): Case object user (dict): A User object link (str): The url to be used in the eve...
Create an event for marking a variant causative.
def mark_causative(self, institute, case, user, link, variant): """Create an event for marking a variant causative. Arguments: institute (dict): A Institute object case (dict): Case object user (dict): A User object link (str): The url to be used in the event ...
Create an event for updating the manual dismiss variant entry
def update_dismiss_variant(self, institute, case, user, link, variant, dismiss_variant): """Create an event for updating the manual dismiss variant entry This function will create a event and update the dismiss variant field of the variant. Arguments:...
Create an event for updating the ACMG classification of a variant.
def update_acmg(self, institute_obj, case_obj, user_obj, link, variant_obj, acmg_str): """Create an event for updating the ACMG classification of a variant. Arguments: institute_obj (dict): A Institute object case_obj (dict): Case object user_obj (dict): A User objec...
Construct the necessary ids for a variant
def parse_ids(chrom, pos, ref, alt, case_id, variant_type): """Construct the necessary ids for a variant Args: chrom(str): Variant chromosome pos(int): Variant position ref(str): Variant reference alt(str): Variant alternative case_id(str): Unique case id variant...
Parse the simple id for a variant
def parse_simple_id(chrom, pos, ref, alt): """Parse the simple id for a variant Simple id is used as a human readable reference for a position, it is in no way unique. Args: chrom(str) pos(str) ref(str) alt(str) Returns: simple_id(str): The simple human rea...
Parse the variant id for a variant
def parse_variant_id(chrom, pos, ref, alt, variant_type): """Parse the variant id for a variant variant_id is used to identify variants within a certain type of analysis. It is not human readable since it is a md5 key. Args: chrom(str) pos(str) ref(str) alt(str) ...
Parse the variant id for a variant
def parse_display_name(chrom, pos, ref, alt, variant_type): """Parse the variant id for a variant This is used to display the variant in scout. Args: chrom(str) pos(str) ref(str) alt(str) variant_type(str): 'clinical' or 'research' Returns: variant_id(s...
Parse the unique document id for a variant.
def parse_document_id(chrom, pos, ref, alt, variant_type, case_id): """Parse the unique document id for a variant. This will always be unique in the database. Args: chrom(str) pos(str) ref(str) alt(str) variant_type(str): 'clinical' or 'research' case_id(str...
Convert a gene panel with hgnc symbols to a new one with hgnc ids.
def convert(context, panel): """Convert a gene panel with hgnc symbols to a new one with hgnc ids.""" adapter = context.obj['adapter'] new_header = ["hgnc_id","hgnc_symbol","disease_associated_transcripts", "reduced_penetrance", "genetic_disease_models", "mosaicism", "datab...
Create a new variant id.
def get_variantid(variant_obj, family_id): """Create a new variant id. Args: variant_obj(dict) family_id(str) Returns: new_id(str): The new variant id """ new_id = parse_document_id( chrom=variant_obj['chromosome'], pos=str(variant_obj['position']), ...
Fetches all cases from the backend.
def cases(self, owner=None, collaborator=None, query=None, skip_assigned=False, has_causatives=False, reruns=False, finished=False, research_requested=False, is_research=False, status=None, phenotype_terms=False, pinned=False, cohort=False, name_query=None, yield_...
Return the number of cases
def nr_cases(self, institute_id=None): """Return the number of cases This function will change when we migrate to 3.7.1 Args: collaborator(str): Institute id Returns: nr_cases(int) """ query = {} if institute_id: query['coll...
Update the dynamic gene list for a case
def update_dynamic_gene_list(self, case, hgnc_symbols=None, hgnc_ids=None, phenotype_ids=None, build='37'): """Update the dynamic gene list for a case Adds a list of dictionaries to case['dynamic_gene_list'] that looks like { hgnc_symbol: str, ...
Fetches a single case from database
def case(self, case_id=None, institute_id=None, display_name=None): """Fetches a single case from database Use either the _id or combination of institute_id and display_name Args: case_id(str): _id for a caes institute_id(str): display_name(str) Yie...
Delete a single case from database
def delete_case(self, case_id=None, institute_id=None, display_name=None): """Delete a single case from database Args: institute_id(str) case_id(str) Returns: case_obj(dict): The case that was deleted """ query = {} if case_id: ...
Load a case into the database
def load_case(self, config_data, update=False): """Load a case into the database Check if the owner and the institute exists. Args: config_data(dict): A dictionary with all the necessary information update(bool): If existing case should be updated Returns: ...
Add a case to the database If the case already exists exception is raised
def _add_case(self, case_obj): """Add a case to the database If the case already exists exception is raised Args: case_obj(Case) """ if self.case(case_obj['_id']): raise IntegrityError("Case %s already exists in database" % case_obj['_id']) ...
Update a case in the database
def update_case(self, case_obj): """Update a case in the database The following will be updated: - collaborators: If new collaborators these will be added to the old ones - analysis_date: Is updated to the new date - analyses: The new analysis date will be added to o...
Replace a existing case with a new one
def replace_case(self, case_obj): """Replace a existing case with a new one Keeps the object id Args: case_obj(dict) Returns: updated_case(dict) """ # Todo: Figure out and describe when this method destroys a case if invoked instead of #...
Update case id for a case across the database.
def update_caseid(self, case_obj, family_id): """Update case id for a case across the database. This function is used when a case is a rerun or updated for another reason. Args: case_obj(dict) family_id(str): The new family id Returns: new_case(dict...
Submit an evaluation to the database
def submit_evaluation(self, variant_obj, user_obj, institute_obj, case_obj, link, criteria): """Submit an evaluation to the database Get all the relevant information, build a evaluation_obj Args: variant_obj(dict) user_obj(dict) institute_obj(dict) ...
Return all evaluations for a certain variant.
def get_evaluations(self, variant_obj): """Return all evaluations for a certain variant. Args: variant_obj (dict): variant dict from the database Returns: pymongo.cursor: database cursor """ query = dict(variant_id=variant_obj['variant_id']) res ...
Parse and massage the transcript information
def parse_transcripts(transcript_lines): """Parse and massage the transcript information There could be multiple lines with information about the same transcript. This is why it is necessary to parse the transcripts first and then return a dictionary where all information has been merged. Args: ...
Parse a dataframe with ensembl gene information
def parse_ensembl_gene_request(result): """Parse a dataframe with ensembl gene information Args: res(pandas.DataFrame) Yields: gene_info(dict) """ LOG.info("Parsing genes from request") for index, row in result.iterrows(): # print(index, row) ensembl_info = {} ...
Parse a dataframe with ensembl transcript information
def parse_ensembl_transcript_request(result): """Parse a dataframe with ensembl transcript information Args: res(pandas.DataFrame) Yields: transcript_info(dict) """ LOG.info("Parsing transcripts from request") keys = [ 'chrom', 'ensembl_gene_id', 'ensem...
Parse an ensembl formated line
def parse_ensembl_line(line, header): """Parse an ensembl formated line Args: line(list): A list with ensembl gene info header(list): A list with the header info Returns: ensembl_info(dict): A dictionary with the relevant info """ line = line.rstrip().sp...
Parse lines with ensembl formated genes
def parse_ensembl_genes(lines): """Parse lines with ensembl formated genes This is designed to take a biomart dump with genes from ensembl. Mandatory columns are: 'Gene ID' 'Chromosome' 'Gene Start' 'Gene End' 'HGNC symbol Args: lines(iterable(str)): An iterable with en...
Parse lines with ensembl formated exons
def parse_ensembl_exons(lines): """Parse lines with ensembl formated exons This is designed to take a biomart dump with exons from ensembl. Check documentation for spec for download Args: lines(iterable(str)): An iterable with ensembl formated exons Yields: ...
Parse a dataframe with ensembl exon information
def parse_ensembl_exon_request(result): """Parse a dataframe with ensembl exon information Args: res(pandas.DataFrame) Yields: gene_info(dict) """ keys = [ 'chrom', 'gene', 'transcript', 'exon_id', 'exon_chrom_start', 'exon_chrom_end'...
Initializes the log file in the proper format.
def init_log(logger, filename=None, loglevel=None): """ Initializes the log file in the proper format. Arguments: filename (str): Path to a file. Or None if logging is to be disabled. loglevel (str): Determines the level of the log output. """ template = '[...
docstring for parse_omim_2_line
def parse_omim_line(line, header): """docstring for parse_omim_2_line""" omim_info = dict(zip(header, line.split('\t'))) return omim_info
Parse the omim source file called genemap2. txt Explanation of Phenotype field: Brackets [ ] indicate nondiseases mainly genetic variations that lead to apparently abnormal laboratory test values.
def parse_genemap2(lines): """Parse the omim source file called genemap2.txt Explanation of Phenotype field: Brackets, "[ ]", indicate "nondiseases," mainly genetic variations that lead to apparently abnormal laboratory test values. Braces, "{ }", indicate mutations that contribute to suscept...
Parse the file called mim2gene This file describes what type ( s ) the different mim numbers have. The different entry types are: gene gene/ phenotype moved/ removed phenotype predominantly phenotypes Where: gene: Is a gene entry gene/ phenotype: This entry describes both a phenotype and a gene moved/ removed: No expla...
def parse_mim2gene(lines): """Parse the file called mim2gene This file describes what type(s) the different mim numbers have. The different entry types are: 'gene', 'gene/phenotype', 'moved/removed', 'phenotype', 'predominantly phenotypes' Where: gene: Is a gene entry gene/pheno...
docstring for parse_omim_morbid
def parse_omim_morbid(lines): """docstring for parse_omim_morbid""" header = [] for i,line in enumerate(lines): line = line.rstrip() if line.startswith('#'): if i < 10: if line.startswith('# Phenotype'): header = line[2:].split('\t') el...
Parse the mimTitles. txt file This file hold information about the description for each entry in omim. There is not information about entry type. parse_mim_titles collects the preferred title and maps it to the mim number. Args: lines ( iterable ): lines from mimTitles file Yields: parsed_entry ( dict ) { mim_number: i...
def parse_mim_titles(lines): """Parse the mimTitles.txt file This file hold information about the description for each entry in omim. There is not information about entry type. parse_mim_titles collects the preferred title and maps it to the mim number. Args: lines(iterable): lines...
Get a dictionary with genes and their omim information Args: genemap_lines ( iterable ( str )) mim2gene_lines ( iterable ( str )) Returns. hgnc_genes ( dict ): A dictionary with hgnc_symbol as keys
def get_mim_genes(genemap_lines, mim2gene_lines): """Get a dictionary with genes and their omim information Args: genemap_lines(iterable(str)) mim2gene_lines(iterable(str)) Returns. hgnc_genes(dict): A dictionary with hgnc_symbol as keys """ LOG.info("Get the m...
Get a dictionary with phenotypes Use the mim numbers for phenotypes as keys and phenotype information as values.
def get_mim_phenotypes(genemap_lines): """Get a dictionary with phenotypes Use the mim numbers for phenotypes as keys and phenotype information as values. Args: genemap_lines(iterable(str)) Returns: phenotypes_found(dict): A dictionary with mim_numbers as keys and ...
Parse the omim files
def cli(context, morbid, genemap, mim2gene, mim_titles, phenotypes): """Parse the omim files""" # if not (morbid and genemap and mim2gene, mim_titles): # print("Please provide all files") # context.abort() from scout.utils.handle import get_file_handle from pprint import pprint as pp ...
Convert a string to number If int convert to int otherwise float If not possible return None
def convert_number(string): """Convert a string to number If int convert to int otherwise float If not possible return None """ res = None if isint(string): res = int(string) elif isfloat(string): res = float(string) return res
Update a case in the database
def case(context, case_id, case_name, institute, collaborator, vcf, vcf_sv, vcf_cancer, vcf_research, vcf_sv_research, vcf_cancer_research, peddy_ped, reupload_sv, rankscore_treshold, rankmodel_version): """ Update a case in the database """ adapter = context.obj['adapter'] if not ...
docstring for setup_scout
def setup_scout(adapter, institute_id='cust000', user_name='Clark Kent', user_mail='clark.kent@mail.com', api_key=None, demo=False): """docstring for setup_scout""" ########################## Delete previous information ########################## LOG.info("Deleting previous database") fo...
Export all transcripts from the database Args: adapter ( scout. adapter. MongoAdapter ) build ( str ) Yields: transcript ( scout. models. Transcript )
def export_transcripts(adapter, build='37'): """Export all transcripts from the database Args: adapter(scout.adapter.MongoAdapter) build(str) Yields: transcript(scout.models.Transcript) """ LOG.info("Exporting all transcripts") for tx_obj in adapter.transcripts...
Return a formatted month as a table.
def formatmonth(self, theyear, themonth, withyear=True, net=None, qs=None, template='happenings/partials/calendar/month_table.html'): """Return a formatted month as a table.""" context = self.get_context() context['month_start_date'] = date(self.yr, self.mo, 1) context['week_rows'] = [] ...
Return a day as a table cell.
def formatday( self, day, weekday, day_template='happenings/partials/calendar/day_cell.html', noday_template='happenings/partials/calendar/day_noday_cell.html', popover_template='happenings/partials/calendar/popover.html', ): """Return a day as a table...
Return a day as a table cell.
def formatday(self, day, weekday): """Return a day as a table cell.""" return super(MiniEventCalendar, self).formatday( day, weekday, day_template='happenings/partials/calendar/mini_day_cell.html', popover_template='happenings/partials/calendar/mini_popover.html', ...
Set some commonly used variables.
def formatday(self, day, weekday): """Set some commonly used variables.""" self.wkday_not_today = '<td class="%s"><div class="td-inner">' % ( self.cssclasses[weekday]) self.wkday_today = ( '<td class="%s calendar-today"><div class="td-inner">' % ( self.cs...
Change colspan to 5 add today button and return a month name as a table row.
def formatmonthname(self, theyear, themonth, withyear=True): """ Change colspan to "5", add "today" button, and return a month name as a table row. """ display_month = month_name[themonth] if isinstance(display_month, six.binary_type) and self.encoding: displ...
Populate variables used to build popovers.
def popover_helper(self): """Populate variables used to build popovers.""" # when display_month = month_name[self.mo] if isinstance(display_month, six.binary_type) and self.encoding: display_month = display_month.decode('utf-8') self.when = ('<p><b>When:</b> ' + dis...
Return a day as a table cell.
def formatday(self, day, weekday): """Return a day as a table cell.""" super(EventCalendar, self).formatday(day, weekday) now = get_now() self.day = day out = '' if day == 0: return '<td class="noday">&nbsp;</td>' # day outside month elif now.month =...
Return a day as a table cell.
def formatday(self, day, weekday): """Return a day as a table cell.""" super(MiniEventCalendar, self).formatday(day, weekday) now = get_now() self.day = day if day == 0: return '<td class="noday">&nbsp;</td>' # day outside month elif now.month == self.mo and...
Parse metadata for a gene panel
def get_panel_info(panel_lines=None, panel_id=None, institute=None, version=None, date=None, display_name=None): """Parse metadata for a gene panel For historical reasons it is possible to include all information about a gene panel in the header of a panel file. This function parses the ...
Parse a gene line with information from a panel file
def parse_gene(gene_info): """Parse a gene line with information from a panel file Args: gene_info(dict): dictionary with gene info Returns: gene(dict): A dictionary with the gene information { 'hgnc_id': int, 'hgnc_symbol': s...
Parse a file with genes and return the hgnc ids
def parse_genes(gene_lines): """Parse a file with genes and return the hgnc ids Args: gene_lines(iterable(str)): Stream with genes Returns: genes(list(dict)): Dictionaries with relevant gene info """ genes = [] header = [] hgnc_identifiers = set() delimiter = '\t' #...
Parse the panel info and return a gene panel
def parse_gene_panel(path, institute='cust000', panel_id='test', panel_type='clinical', date=datetime.now(), version=1.0, display_name=None, genes = None): """Parse the panel info and return a gene panel Args: path(str): Path to panel file institute(str): Name ...
Parse a panel app formated gene Args: app_gene ( dict ): Dict with panel app info hgnc_map ( dict ): Map from hgnc_symbol to hgnc_id Returns: gene_info ( dict ): Scout infromation
def parse_panel_app_gene(app_gene, hgnc_map): """Parse a panel app formated gene Args: app_gene(dict): Dict with panel app info hgnc_map(dict): Map from hgnc_symbol to hgnc_id Returns: gene_info(dict): Scout infromation """ gene_info = {} confidence_level = app_...
Parse a PanelApp panel Args: panel_info ( dict ) hgnc_map ( dict ): Map from symbol to hgnc ids institute ( str ) panel_type ( str ) Returns: gene_panel ( dict )
def parse_panel_app_panel(panel_info, hgnc_map, institute='cust000', panel_type='clinical'): """Parse a PanelApp panel Args: panel_info(dict) hgnc_map(dict): Map from symbol to hgnc ids institute(str) panel_type(str) Returns: gene_panel(dict) """ dat...
Return all genes that should be included in the OMIM - AUTO panel Return the hgnc symbols Genes that have at least one established or provisional phenotype connection are included in the gene panel Args: genemap2_lines ( iterable ) mim2gene_lines ( iterable ) alias_genes ( dict ): A dictionary that maps hgnc_symbol to ...
def get_omim_panel_genes(genemap2_lines, mim2gene_lines, alias_genes): """Return all genes that should be included in the OMIM-AUTO panel Return the hgnc symbols Genes that have at least one 'established' or 'provisional' phenotype connection are included in the gene panel Args: ge...
Show all diseases in the database
def diseases(context): """Show all diseases in the database""" LOG.info("Running scout view diseases") adapter = context.obj['adapter'] disease_objs = adapter.disease_terms() nr_diseases = disease_objs.count() if nr_diseases == 0: click.echo("No diseases found") else: click...
Update the hpo terms in the database. Fetch the latest release and update terms.
def hpo(context): """ Update the hpo terms in the database. Fetch the latest release and update terms. """ LOG.info("Running scout update hpo") adapter = context.obj['adapter'] LOG.info("Dropping HPO terms") adapter.hpo_term_collection.drop() LOG.debug("HPO terms dropped") load_hpo...
Repeats an event and returns num ( or fewer ) upcoming events from now.
def get_upcoming_events(self): """ Repeats an event and returns 'num' (or fewer) upcoming events from 'now'. """ if self.event.repeats('NEVER'): has_ended = False now_gt_start = self.now > self.event.l_start_date now_gt_end = self.now > self.ev...
Checks start to see if we should stop collecting upcoming events. start should be a datetime. datetime start_ should be the same as start but it should be a datetime. date to allow comparison w/ end_repeat.
def we_should_stop(self, start, start_): """ Checks 'start' to see if we should stop collecting upcoming events. 'start' should be a datetime.datetime, 'start_' should be the same as 'start', but it should be a datetime.date to allow comparison w/ end_repeat. """ ...
Display a list of all users and which institutes they belong to.
def users(store): """Display a list of all users and which institutes they belong to.""" user_objs = list(store.users()) total_events = store.user_events().count() for user_obj in user_objs: if user_obj.get('institutes'): user_obj['institutes'] = [store.institute(inst_id) for inst_id...
Parse the conservation predictors
def parse_conservations(variant): """Parse the conservation predictors Args: variant(dict): A variant dictionary Returns: conservations(dict): A dictionary with the conservations """ conservations = {} conservations['gerp'] = parse_conservation( ...
Get the conservation prediction
def parse_conservation(variant, info_key): """Get the conservation prediction Args: variant(dict): A variant dictionary info_key(str) Returns: conservations(list): List of censervation terms """ raw_score = variant.INFO.get(info_key) conservations = ...