_id
stringlengths
2
7
title
stringlengths
1
88
partition
stringclasses
3 values
text
stringlengths
75
19.8k
language
stringclasses
1 value
meta_information
dict
q273200
find_bai_file
test
def find_bai_file(bam_file): """Find out BAI file by extension given the BAM file.""" bai_file = bam_file.replace('.bam', '.bai') if not os.path.exists(bai_file): # try the other convention bai_file = "{}.bai".format(bam_file) return bai_file
python
{ "resource": "" }
q273201
observations
test
def observations(store, loqusdb, case_obj, variant_obj): """Query observations for a variant.""" composite_id = ("{this[chromosome]}_{this[position]}_{this[reference]}_" "{this[alternative]}".format(this=variant_obj)) obs_data = loqusdb.get_variant({'_id': composite_id}) or {} obs_da...
python
{ "resource": "" }
q273202
parse_gene
test
def parse_gene(gene_obj, build=None): """Parse variant genes.""" build = build or 37 if gene_obj.get('common'): add_gene_links(gene_obj, build) refseq_transcripts = [] for tx_obj in gene_obj['transcripts']: parse_transcript(gene_obj, tx_obj, build) # select ...
python
{ "resource": "" }
q273203
transcript_str
test
def transcript_str(transcript_obj, gene_name=None): """Generate amino acid change as a string.""" if transcript_obj.get('exon'): gene_part, part_count_raw = 'exon', transcript_obj['exon'] elif transcript_obj.get('intron'): gene_part, part_count_raw = 'intron', transcript_obj['intron'] el...
python
{ "resource": "" }
q273204
end_position
test
def end_position(variant_obj): """Calculate end position for a variant.""" alt_bases = len(variant_obj['alternative']) num_bases = max(len(variant_obj['reference']), alt_bases) return variant_obj['position'] + (num_bases - 1)
python
{ "resource": "" }
q273205
frequency
test
def frequency(variant_obj): """Returns a judgement on the overall frequency of the variant. Combines multiple metrics into a single call. """ most_common_frequency = max(variant_obj.get('thousand_genomes_frequency') or 0, variant_obj.get('exac_frequency') or 0) if mo...
python
{ "resource": "" }
q273206
clinsig_human
test
def clinsig_human(variant_obj): """Convert to human readable version of CLINSIG evaluation.""" for clinsig_obj in variant_obj['clnsig']: # The clinsig objects allways have a accession if isinstance(clinsig_obj['accession'], int): # New version link = "https://www.ncbi.nlm...
python
{ "resource": "" }
q273207
thousandg_link
test
def thousandg_link(variant_obj, build=None): """Compose link to 1000G page for detailed information.""" dbsnp_id = variant_obj.get('dbsnp_id') build = build or 37 if not dbsnp_id: return None if build == 37: url_template = ("http://grch37.ensembl.org/Homo_sapiens/Variation/Explore"...
python
{ "resource": "" }
q273208
cosmic_link
test
def cosmic_link(variant_obj): """Compose link to COSMIC Database. Args: variant_obj(scout.models.Variant) Returns: url_template(str): Link to COSMIIC database if cosmic id is present """ cosmic_ids = variant_obj.get('cosmic_ids') if not cosmic_ids: return None els...
python
{ "resource": "" }
q273209
beacon_link
test
def beacon_link(variant_obj, build=None): """Compose link to Beacon Network.""" build = build or 37 url_template = ("https://beacon-network.org/#/search?pos={this[position]}&" "chrom={this[chromosome]}&allele={this[alternative]}&" "ref={this[reference]}&rs=GRCh37") ...
python
{ "resource": "" }
q273210
ucsc_link
test
def ucsc_link(variant_obj, build=None): """Compose link to UCSC.""" build = build or 37 url_template = ("http://genome.ucsc.edu/cgi-bin/hgTracks?db=hg19&" "position=chr{this[chromosome]}:{this[position]}" "-{this[position]}&dgv=pack&knownGene=pack&omimGene=pac...
python
{ "resource": "" }
q273211
spidex_human
test
def spidex_human(variant_obj): """Translate SPIDEX annotation to human readable string.""" if variant_obj.get('spidex') is None: return 'not_reported' elif abs(variant_obj['spidex']) < SPIDEX_HUMAN['low']['pos'][1]: return 'low' elif abs(variant_obj['spidex']) < SPIDEX_HUMAN['medium']['p...
python
{ "resource": "" }
q273212
expected_inheritance
test
def expected_inheritance(variant_obj): """Gather information from common gene information.""" manual_models = set() for gene in variant_obj.get('genes', []): manual_models.update(gene.get('manual_inheritance', [])) return list(manual_models)
python
{ "resource": "" }
q273213
callers
test
def callers(variant_obj, category='snv'): """Return info about callers.""" calls = set() for caller in CALLERS[category]: if variant_obj.get(caller['id']): calls.add((caller['name'], variant_obj[caller['id']])) return list(calls)
python
{ "resource": "" }
q273214
cancer_variants
test
def cancer_variants(store, request_args, institute_id, case_name): """Fetch data related to cancer variants for a case.""" institute_obj, case_obj = institute_and_case(store, institute_id, case_name) form = CancerFiltersForm(request_args) variants_query = store.variants(case_obj['_id'], category='cancer...
python
{ "resource": "" }
q273215
clinvar_export
test
def clinvar_export(store, institute_id, case_name, variant_id): """Gather the required data for creating the clinvar submission form Args: store(scout.adapter.MongoAdapter) institute_id(str): Institute ID case_name(str): case ID variant_id(str): variant._id ...
python
{ "resource": "" }
q273216
get_clinvar_submission
test
def get_clinvar_submission(store, institute_id, case_name, variant_id, submission_id): """Collects all variants from the clinvar submission collection with a specific submission_id Args: store(scout.adapter.MongoAdapter) institute_id(str): Institute ID case_name(str): ca...
python
{ "resource": "" }
q273217
variant_acmg
test
def variant_acmg(store, institute_id, case_name, variant_id): """Collect data relevant for rendering ACMG classification form.""" institute_obj, case_obj = institute_and_case(store, institute_id, case_name) variant_obj = store.variant(variant_id) return dict(institute=institute_obj, case=case_obj, varia...
python
{ "resource": "" }
q273218
variant_acmg_post
test
def variant_acmg_post(store, institute_id, case_name, variant_id, user_email, criteria): """Calculate an ACMG classification based on a list of criteria.""" institute_obj, case_obj = institute_and_case(store, institute_id, case_name) variant_obj = store.variant(variant_id) user_obj = store.user(user_ema...
python
{ "resource": "" }
q273219
evaluation
test
def evaluation(store, evaluation_obj): """Fetch and fill-in evaluation object.""" evaluation_obj['institute'] = store.institute(evaluation_obj['institute_id']) evaluation_obj['case'] = store.case(evaluation_obj['case_id']) evaluation_obj['variant'] = store.variant(evaluation_obj['variant_specific']) ...
python
{ "resource": "" }
q273220
upload_panel
test
def upload_panel(store, institute_id, case_name, stream): """Parse out HGNC symbols from a stream.""" institute_obj, case_obj = institute_and_case(store, institute_id, case_name) raw_symbols = [line.strip().split('\t')[0] for line in stream if line and not line.startswith('#')] # chec...
python
{ "resource": "" }
q273221
verified_excel_file
test
def verified_excel_file(store, institute_list, temp_excel_dir): """Collect all verified variants in a list on institutes and save them to file Args: store(adapter.MongoAdapter) institute_list(list): a list of institute ids temp_excel_dir(os.Path): folder where the temp excel files are w...
python
{ "resource": "" }
q273222
export_genes
test
def export_genes(adapter, build='37'): """Export all genes from the database""" LOG.info("Exporting all genes to .bed format") for gene_obj in adapter.all_genes(build=build): yield gene_obj
python
{ "resource": "" }
q273223
parse_clnsig
test
def parse_clnsig(acc, sig, revstat, transcripts): """Get the clnsig information Args: acc(str): The clnsig accession number, raw from vcf sig(str): The clnsig significance score, raw from vcf revstat(str): The clnsig revstat, raw from vcf transcripts(iterable(dict)) Returns...
python
{ "resource": "" }
q273224
parse_compounds
test
def parse_compounds(compound_info, case_id, variant_type): """Get a list with compounds objects for this variant. Arguments: compound_info(str): A Variant dictionary case_id (str): unique family id variant_type(str): 'research' or 'clinical' Returns: ...
python
{ "resource": "" }
q273225
genes
test
def genes(context, build, json): """Export all genes from a build""" LOG.info("Running scout export genes") adapter = context.obj['adapter'] result = adapter.all_genes(build=build) if json: click.echo(dumps(result)) return gene_string = ("{0}\t{1}\t{2}\t{3}\t{4}") c...
python
{ "resource": "" }
q273226
build_individual
test
def build_individual(ind): """Build a Individual object Args: ind (dict): A dictionary with individual information Returns: ind_obj (dict): A Individual object dict( individual_id = str, # required display_name = str, sex = str, ...
python
{ "resource": "" }
q273227
variants
test
def variants(context, case_id, institute, force, cancer, cancer_research, sv, sv_research, snv, snv_research, str_clinical, chrom, start, end, hgnc_id, hgnc_symbol, rank_treshold): """Upload variants to a case Note that the files has to be linked with the case, if they ...
python
{ "resource": "" }
q273228
case
test
def case(institute_id, case_name): """Return a variant.""" institute_obj, case_obj = institute_and_case(store, institute_id, case_name) if case_obj is None: return abort(404) return Response(json_util.dumps(case_obj), mimetype='application/json')
python
{ "resource": "" }
q273229
collections
test
def collections(context): """Show all collections in the database""" LOG.info("Running scout view collections") adapter = context.obj['adapter'] for collection_name in adapter.collections(): click.echo(collection_name)
python
{ "resource": "" }
q273230
institute
test
def institute(ctx, internal_id, display_name, sanger_recipients): """ Create a new institute and add it to the database """ adapter = ctx.obj['adapter'] if not internal_id: logger.warning("A institute has to have an internal id") ctx.abort() if not display_name: displa...
python
{ "resource": "" }
q273231
institute
test
def institute(context, institute_id, sanger_recipient, coverage_cutoff, frequency_cutoff, display_name, remove_sanger): """ Update an institute """ adapter = context.obj['adapter'] LOG.info("Running scout update institute") try: adapter.update_institute( i...
python
{ "resource": "" }
q273232
get_file_handle
test
def get_file_handle(file_path): """Return a opened file""" if file_path.endswith('.gz'): file_handle = getreader('utf-8')(gzip.open(file_path, 'r'), errors='replace') else: file_handle = open(file_path, 'r', encoding='utf-8') return file_handle
python
{ "resource": "" }
q273233
get_net
test
def get_net(req): """Get the net of any 'next' and 'prev' querystrings.""" try: nxt, prev = map( int, (req.GET.get('cal_next', 0), req.GET.get('cal_prev', 0)) ) net = nxt - prev except Exception: net = 0 return net
python
{ "resource": "" }
q273234
get_next_and_prev
test
def get_next_and_prev(net): """Returns what the next and prev querystrings should be.""" if net == 0: nxt = prev = 1 elif net > 0: nxt = net + 1 prev = -(net - 1) else: nxt = net + 1 prev = abs(net) + 1 return nxt, prev
python
{ "resource": "" }
q273235
_check_year
test
def _check_year(year, month, error, error_msg): """Checks that the year is within 50 years from now.""" if year not in xrange((now.year - 50), (now.year + 51)): year = now.year month = now.month error = error_msg return year, month, error
python
{ "resource": "" }
q273236
check_weekday
test
def check_weekday(year, month, day, reverse=False): """ Make sure any event day we send back for weekday repeating events is not a weekend. """ d = date(year, month, day) while d.weekday() in (5, 6): if reverse: d -= timedelta(days=1) else: d += timedelta(...
python
{ "resource": "" }
q273237
parse_case_data
test
def parse_case_data(config=None, ped=None, owner=None, vcf_snv=None, vcf_sv=None, vcf_cancer=None, vcf_str=None, peddy_ped=None, peddy_sex=None, peddy_check=None, delivery_report=None, multiqc=None): """Parse all data necessary for loading a case into scout This can be d...
python
{ "resource": "" }
q273238
add_peddy_information
test
def add_peddy_information(config_data): """Add information from peddy outfiles to the individuals""" ped_info = {} ped_check = {} sex_check = {} relations = [] if config_data.get('peddy_ped'): file_handle = open(config_data['peddy_ped'], 'r') for ind_info in parse_peddy_ped(file...
python
{ "resource": "" }
q273239
parse_individual
test
def parse_individual(sample): """Parse individual information Args: sample (dict) Returns: { 'individual_id': str, 'father': str, 'mother': str, 'display_name': str, 'sex': str, ...
python
{ "resource": "" }
q273240
parse_individuals
test
def parse_individuals(samples): """Parse the individual information Reformat sample information to proper individuals Args: samples(list(dict)) Returns: individuals(list(dict)) """ individuals = [] if len(samples) == 0: raise PedigreeError("No s...
python
{ "resource": "" }
q273241
parse_case
test
def parse_case(config): """Parse case information from config or PED files. Args: config (dict): case config with detailed information Returns: dict: parsed case data """ if 'owner' not in config: raise ConfigError("A case has to have a owner") if 'family' not in confi...
python
{ "resource": "" }
q273242
parse_ped
test
def parse_ped(ped_stream, family_type='ped'): """Parse out minimal family information from a PED file. Args: ped_stream(iterable(str)) family_type(str): Format of the pedigree information Returns: family_id(str), samples(list[dict]) """ pedigree = FamilyParser(ped_stream, f...
python
{ "resource": "" }
q273243
build_evaluation
test
def build_evaluation(variant_specific, variant_id, user_id, user_name, institute_id, case_id, classification, criteria): """Build a evaluation object ready to be inserted to database Args: variant_specific(str): md5 string for the specific variant variant_id(str): md5 strin...
python
{ "resource": "" }
q273244
mt_report
test
def mt_report(context, case_id, test, outpath=None): """Export all mitochondrial variants for each sample of a case and write them to an excel file Args: adapter(MongoAdapter) case_id(str) test(bool): True if the function is called for testing purposes ...
python
{ "resource": "" }
q273245
is_pathogenic
test
def is_pathogenic(pvs, ps_terms, pm_terms, pp_terms): """Check if the criterias for Pathogenic is fullfilled The following are descriptions of Pathogenic clasification from ACMG paper: Pathogenic (i) 1 Very strong (PVS1) AND (a) ≥1 Strong (PS1–PS4) OR (b) ≥2 Moderate (PM1–PM6) OR ...
python
{ "resource": "" }
q273246
is_likely_pathogenic
test
def is_likely_pathogenic(pvs, ps_terms, pm_terms, pp_terms): """Check if the criterias for Likely Pathogenic is fullfilled The following are descriptions of Likely Pathogenic clasification from ACMG paper: Likely pathogenic (i) 1 Very strong (PVS1) AND 1 moderate (PM1– PM6) OR (ii) 1 Strong (P...
python
{ "resource": "" }
q273247
is_likely_benign
test
def is_likely_benign(bs_terms, bp_terms): """Check if criterias for Likely Benign are fullfilled The following are descriptions of Likely Benign clasification from ACMG paper: Likely Benign (i) 1 Strong (BS1–BS4) and 1 supporting (BP1– BP7) OR (ii) ≥2 Supporting (BP1–BP7) Args: bs...
python
{ "resource": "" }
q273248
get_acmg
test
def get_acmg(acmg_terms): """Use the algorithm described in ACMG paper to get a ACMG calssification Args: acmg_terms(set(str)): A collection of prediction terms Returns: prediction(int): 0 - Uncertain Significanse 1 - Benign 2 - Likely Benign...
python
{ "resource": "" }
q273249
VariantHandler.add_gene_info
test
def add_gene_info(self, variant_obj, gene_panels=None): """Add extra information about genes from gene panels Args: variant_obj(dict): A variant from the database gene_panels(list(dict)): List of panels from database """ gene_panels = gene_panels or [] #...
python
{ "resource": "" }
q273250
VariantHandler.variants
test
def variants(self, case_id, query=None, variant_ids=None, category='snv', nr_of_variants=10, skip=0, sort_key='variant_rank'): """Returns variants specified in question for a specific case. If skip not equal to 0 skip the first n variants. Arguments: case_id(str): ...
python
{ "resource": "" }
q273251
VariantHandler.sanger_variants
test
def sanger_variants(self, institute_id=None, case_id=None): """Return all variants with sanger information Args: institute_id(str) case_id(str) Returns: res(pymongo.Cursor): A Cursor with all variants with sanger activity """ query = {'valida...
python
{ "resource": "" }
q273252
VariantHandler.variant
test
def variant(self, document_id, gene_panels=None, case_id=None): """Returns the specified variant. Arguments: document_id : A md5 key that represents the variant or "variant_id" gene_panels(List[GenePanel]) case_id (str): case id (will search with "variant...
python
{ "resource": "" }
q273253
VariantHandler.gene_variants
test
def gene_variants(self, query=None, category='snv', variant_type=['clinical'], nr_of_variants=50, skip=0): """Return all variants seen in a given gene. If skip not equal to 0 skip the first n variants. Arguments: query(dict): A dictionary with ...
python
{ "resource": "" }
q273254
VariantHandler.verified
test
def verified(self, institute_id): """Return all verified variants for a given institute Args: institute_id(str): institute id Returns: res(list): a list with validated variants """ query = { 'verb' : 'validate', 'institute' : inst...
python
{ "resource": "" }
q273255
VariantHandler.get_causatives
test
def get_causatives(self, institute_id, case_id=None): """Return all causative variants for an institute Args: institute_id(str) case_id(str) Yields: str: variant document id """ causatives = [] if case_id: ...
python
{ "resource": "" }
q273256
VariantHandler.check_causatives
test
def check_causatives(self, case_obj=None, institute_obj=None): """Check if there are any variants that are previously marked causative Loop through all variants that are marked 'causative' for an institute and check if any of the variants are present in the current case. ...
python
{ "resource": "" }
q273257
VariantHandler.other_causatives
test
def other_causatives(self, case_obj, variant_obj): """Find the same variant in other cases marked causative. Args: case_obj(dict) variant_obj(dict) Yields: other_variant(dict) """ # variant id without "*_[variant_type]" variant_id = v...
python
{ "resource": "" }
q273258
VariantHandler.delete_variants
test
def delete_variants(self, case_id, variant_type, category=None): """Delete variants of one type for a case This is used when a case is reanalyzed Args: case_id(str): The case id variant_type(str): 'research' or 'clinical' category(str): '...
python
{ "resource": "" }
q273259
VariantHandler.overlapping
test
def overlapping(self, variant_obj): """Return overlapping variants. Look at the genes that a variant overlaps to. Then return all variants that overlap these genes. If variant_obj is sv it will return the overlapping snvs and oposite There is a problem when SVs are huge since t...
python
{ "resource": "" }
q273260
VariantHandler.evaluated_variants
test
def evaluated_variants(self, case_id): """Returns variants that has been evaluated Return all variants, snvs/indels and svs from case case_id which have a entry for 'acmg_classification', 'manual_rank', 'dismiss_variant' or if they are commented. Args: case_id(str) ...
python
{ "resource": "" }
q273261
VariantHandler.get_region_vcf
test
def get_region_vcf(self, case_obj, chrom=None, start=None, end=None, gene_obj=None, variant_type='clinical', category='snv', rank_threshold=None): """Produce a reduced vcf with variants from the specified coordinates This is used for the alignment viewer....
python
{ "resource": "" }
q273262
VariantHandler.sample_variants
test
def sample_variants(self, variants, sample_name, category = 'snv'): """Given a list of variants get variant objects found in a specific patient Args: variants(list): a list of variant ids sample_name(str): a sample display name category(str): 'snv', 'sv' .. ...
python
{ "resource": "" }
q273263
get_connection
test
def get_connection(host='localhost', port=27017, username=None, password=None, uri=None, mongodb=None, authdb=None, timeout=20, *args, **kwargs): """Get a client to the mongo database host(str): Host of database port(int): Port of database username(str) password(s...
python
{ "resource": "" }
q273264
get_objects_from_form
test
def get_objects_from_form(variant_ids, form_fields, object_type): """Extract the objects to be saved in the clinvar database collection. object_type param specifies if these objects are variant or casedata objects Args: variant_ids(list): list of database variant ids form_fields(dict)...
python
{ "resource": "" }
q273265
clinvar_submission_header
test
def clinvar_submission_header(submission_objs, csv_type): """Determine which fields to include in csv header by checking a list of submission objects Args: submission_objs(list): a list of objects (variants or casedata) to include in a csv file csv_type(str) : 'variant_data' or 'cas...
python
{ "resource": "" }
q273266
clinvar_submission_lines
test
def clinvar_submission_lines(submission_objs, submission_header): """Create the lines to include in a Clinvar submission csv file from a list of submission objects and a custom document header Args: submission_objs(list): a list of objects (variants or casedata) to include in a csv file ...
python
{ "resource": "" }
q273267
load_transcripts
test
def load_transcripts(adapter, transcripts_lines=None, build='37', ensembl_genes=None): """Load all the transcripts Transcript information is from ensembl. Args: adapter(MongoAdapter) transcripts_lines(iterable): iterable with ensembl transcript lines build(str) ensembl_gene...
python
{ "resource": "" }
q273268
panel
test
def panel(context, path, date, display_name, version, panel_type, panel_id, institute, omim, api_key, panel_app): """Add a gene panel to the database.""" adapter = context.obj['adapter'] institute = institute or 'cust000' if omim: api_key = api_key or context.obj.get('omim_api_key') if...
python
{ "resource": "" }
q273269
build_exon
test
def build_exon(exon_info, build='37'): """Build a Exon object object Args: exon_info(dict): Exon information Returns: exon_obj(Exon) "exon_id": str, # str(chrom-start-end) "chrom": str, "start": int, "end": int, "trans...
python
{ "resource": "" }
q273270
panel
test
def panel(context, panel_id, version): """Delete a version of a gene panel or all versions of a gene panel""" LOG.info("Running scout delete panel") adapter = context.obj['adapter'] panel_objs = adapter.gene_panels(panel_id=panel_id, version=version) if panel_objs.count() == 0: LOG.info("No...
python
{ "resource": "" }
q273271
index
test
def index(context): """Delete all indexes in the database""" LOG.info("Running scout delete index") adapter = context.obj['adapter'] for collection in adapter.db.collection_names(): adapter.db[collection].drop_indexes() LOG.info("All indexes deleted")
python
{ "resource": "" }
q273272
user
test
def user(context, mail): """Delete a user from the database""" LOG.info("Running scout delete user") adapter = context.obj['adapter'] user_obj = adapter.user(mail) if not user_obj: LOG.warning("User {0} could not be found in database".format(mail)) else: adapter.delete_user(mail)
python
{ "resource": "" }
q273273
genes
test
def genes(context, build): """Delete all genes in the database""" LOG.info("Running scout delete genes") adapter = context.obj['adapter'] if build: LOG.info("Dropping genes collection for build: %s", build) else: LOG.info("Dropping genes collection") adapter.drop_genes()
python
{ "resource": "" }
q273274
exons
test
def exons(context, build): """Delete all exons in the database""" LOG.info("Running scout delete exons") adapter = context.obj['adapter'] adapter.drop_exons(build)
python
{ "resource": "" }
q273275
case
test
def case(context, institute, case_id, display_name): """Delete a case and it's variants from the database""" adapter = context.obj['adapter'] if not (case_id or display_name): click.echo("Please specify what case to delete") context.abort() if display_name: if not institute: ...
python
{ "resource": "" }
q273276
individuals
test
def individuals(context, institute, causatives, case_id): """Show all individuals from all cases in the database""" LOG.info("Running scout view individuals") adapter = context.obj['adapter'] individuals = [] if case_id: case = adapter.case(case_id=case_id) if case: case...
python
{ "resource": "" }
q273277
parse_matches
test
def parse_matches(patient_id, match_objs): """Parse a list of matchmaker matches objects and returns a readable list of matches to display in matchmaker matches view. Args: patient_id(str): id of a mme patient match_objs(list): list of match objs returned by MME server for the patient ...
python
{ "resource": "" }
q273278
cases
test
def cases(context, institute, display_name, case_id, nr_variants, variants_treshold): """Display cases from the database""" LOG.info("Running scout view institutes") adapter = context.obj['adapter'] models = [] if case_id: case_obj = adapter.case(case_id=case_id) if case_obj: ...
python
{ "resource": "" }
q273279
load_user
test
def load_user(user_email): """Returns the currently active user as an object.""" user_obj = store.user(user_email) user_inst = LoginUser(user_obj) if user_obj else None return user_inst
python
{ "resource": "" }
q273280
login
test
def login(): """Login a user if they have access.""" # store potential next param URL in the session if 'next' in request.args: session['next_url'] = request.args['next'] if current_app.config.get('GOOGLE'): callback_url = url_for('.authorized', _external=True) return google.aut...
python
{ "resource": "" }
q273281
build_institute
test
def build_institute(internal_id, display_name, sanger_recipients=None, coverage_cutoff=None, frequency_cutoff=None): """Build a institute object Args: internal_id(str) display_name(str) sanger_recipients(list(str)): List with email addresses Returns: ins...
python
{ "resource": "" }
q273282
EventHandler.delete_event
test
def delete_event(self, event_id): """Delete a event Arguments: event_id (str): The database key for the event """ LOG.info("Deleting event{0}".format(event_id)) if not isinstance(event_id, ObjectId): event_id = ObjectId(event_id) self.even...
python
{ "resource": "" }
q273283
EventHandler.create_event
test
def create_event(self, institute, case, user, link, category, verb, subject, level='specific', variant=None, content=None, panel=None): """Create a Event with the parameters given. Arguments: institute (dict): A institute case (dict): A ...
python
{ "resource": "" }
q273284
EventHandler.events
test
def events(self, institute, case=None, variant_id=None, level=None, comments=False, panel=None): """Fetch events from the database. Args: institute (dict): A institute case (dict): A case variant_id (str, optional): global variant id leve...
python
{ "resource": "" }
q273285
EventHandler.user_events
test
def user_events(self, user_obj=None): """Fetch all events by a specific user.""" query = dict(user_id=user_obj['_id']) if user_obj else dict() return self.event_collection.find(query)
python
{ "resource": "" }
q273286
EventHandler.add_phenotype
test
def add_phenotype(self, institute, case, user, link, hpo_term=None, omim_term=None, is_group=False): """Add a new phenotype term to a case Create a phenotype term and event with the given information Args: institute (Institute): A Institute object ...
python
{ "resource": "" }
q273287
EventHandler.remove_phenotype
test
def remove_phenotype(self, institute, case, user, link, phenotype_id, is_group=False): """Remove an existing phenotype from a case Args: institute (dict): A Institute object case (dict): Case object user (dict): A User object link...
python
{ "resource": "" }
q273288
EventHandler.comment
test
def comment(self, institute, case, user, link, variant=None, content="", comment_level="specific"): """Add a comment to a variant or a case. This function will create an Event to log that a user have commented on a variant. If a variant id is given it will be a variant comment. ...
python
{ "resource": "" }
q273289
parse_genotypes
test
def parse_genotypes(variant, individuals, individual_positions): """Parse the genotype calls for a variant Args: variant(cyvcf2.Variant) individuals: List[dict] individual_positions(dict) Returns: genotypes(list(dict)): A list of genotypes """ ...
python
{ "resource": "" }
q273290
check_coordinates
test
def check_coordinates(chromosome, pos, coordinates): """Check if the variant is in the interval given by the coordinates Args: chromosome(str): Variant chromosome pos(int): Variant position coordinates(dict): Dictionary with the region of interest """ chrom_match...
python
{ "resource": "" }
q273291
hpo_terms
test
def hpo_terms(): """Render search box and view for HPO phenotype terms""" if request.method == 'GET': data = controllers.hpo_terms(store= store, limit=100) return data else: # POST. user is searching for a specific term or phenotype search_term = request.form.get('hpo_term') ...
python
{ "resource": "" }
q273292
transcripts
test
def transcripts(context, build): """Export all transcripts to .bed like format""" LOG.info("Running scout export transcripts") adapter = context.obj['adapter'] header = ["#Chrom\tStart\tEnd\tTranscript\tRefSeq\tHgncID"] for line in header: click.echo(line) transcript_string = ("{0...
python
{ "resource": "" }
q273293
exons
test
def exons(context, build): """Load exons into the scout database""" adapter = context.obj['adapter'] start = datetime.now() # Test if there are any exons loaded nr_exons = adapter.exons(build=build).count() if nr_exons: LOG.warning("Dropping all exons ") adapter.dr...
python
{ "resource": "" }
q273294
region
test
def region(context, hgnc_id, case_id, chromosome, start, end): """Load all variants in a region to a existing case""" adapter = context.obj['adapter'] load_region( adapter=adapter, case_id=case_id, hgnc_id=hgnc_id, chrom=chromosome, start=start, end=end )
python
{ "resource": "" }
q273295
EventManager.all_month_events
test
def all_month_events(self, year, month, category=None, tag=None, loc=False, cncl=False): """ Returns all events that have an occurrence within the given month & year. """ kwargs = self._get_kwargs(category, tag) ym_first, ym_last = self.get_first_...
python
{ "resource": "" }
q273296
EventManager.live
test
def live(self, now): """ Returns a queryset of events that will occur again after 'now'. Used to help generate a list of upcoming events. """ return self.model.objects.filter( Q(end_repeat=None) | Q(end_repeat__gte=now) | Q(start_date__gte=now) | Q(end_dat...
python
{ "resource": "" }
q273297
parse_reqs
test
def parse_reqs(req_path='./requirements.txt'): """Recursively parse requirements from nested pip files.""" install_requires = [] with io.open(os.path.join(here, 'requirements.txt'), encoding='utf-8') as handle: # remove comments and empty lines lines = (line.strip() for line in handle ...
python
{ "resource": "" }
q273298
existing_gene
test
def existing_gene(store, panel_obj, hgnc_id): """Check if gene is already added to a panel.""" existing_genes = {gene['hgnc_id']: gene for gene in panel_obj['genes']} return existing_genes.get(hgnc_id)
python
{ "resource": "" }
q273299
update_panel
test
def update_panel(store, panel_name, csv_lines, option): """Update an existing gene panel with genes. Args: store(scout.adapter.MongoAdapter) panel_name(str) csv_lines(iterable(str)): Stream with genes option(str): 'add' or 'replace' Returns: panel_obj(dict) """ ...
python
{ "resource": "" }