_id
stringlengths
2
7
title
stringlengths
1
88
partition
stringclasses
3 values
text
stringlengths
75
19.8k
language
stringclasses
1 value
meta_information
dict
q273100
_build_row
test
def _build_row(cells, padding, begin, sep, end): "Return a string which represents a row of data cells." pad = " " * padding padded_cells = [pad + cell + pad for cell in cells] # SolveBio: we're only displaying Key-Value tuples (dimension of 2). # enforce that we don't wrap lines by setting a max...
python
{ "resource": "" }
q273101
_build_line
test
def _build_line(colwidths, padding, begin, fill, sep, end): "Return a string which represents a horizontal line." cells = [fill * (w + 2 * padding) for w in colwidths] return _build_row(cells, 0, begin, sep, end)
python
{ "resource": "" }
q273102
_mediawiki_cell_attrs
test
def _mediawiki_cell_attrs(row, colaligns): "Prefix every cell in a row with an HTML alignment attribute." alignment = {"left": '', "right": 'align="right"| ', "center": 'align="center"| ', "decimal": 'align="right"| '} row2 = [alignment[a] + c for c, a in z...
python
{ "resource": "" }
q273103
_format_table
test
def _format_table(fmt, headers, rows, colwidths, colaligns): """Produce a plain-text representation of the table.""" lines = [] hidden = fmt.with_header_hide if headers else fmt.without_header_hide pad = fmt.padding headerrow = fmt.headerrow if fmt.headerrow else fmt.datarow if fmt.lineabove an...
python
{ "resource": "" }
q273104
Dataset.migrate
test
def migrate(self, target, follow=True, **kwargs): """ Migrate the data from this dataset to a target dataset. Valid optional kwargs include: * source_params * target_fields * include_errors * commit_mode """ if 'id' not in self or not self['id']...
python
{ "resource": "" }
q273105
Object.validate_full_path
test
def validate_full_path(cls, full_path, **kwargs): """Helper method to parse a full or partial path and return a full path as well as a dict containing path parts. Uses the following rules when processing the path: * If no domain, uses the current user's account domain *...
python
{ "resource": "" }
q273106
upload
test
def upload(args): """ Given a folder or file, upload all the folders and files contained within it, skipping ones that already exist on the remote. """ base_remote_path, path_dict = Object.validate_full_path( args.full_path, vault=args.vault, path=args.path) # Assert the vault exists an...
python
{ "resource": "" }
q273107
Vault.validate_full_path
test
def validate_full_path(cls, full_path, **kwargs): """Helper method to return a full path from a full or partial path. If no domain, assumes user's account domain If the vault is "~", assumes personal vault. Valid vault paths include: domain:vault domain...
python
{ "resource": "" }
q273108
validate_api_host_url
test
def validate_api_host_url(url): """ Validate SolveBio API host url. Valid urls must not be empty and must contain either HTTP or HTTPS scheme. """ if not url: raise SolveError('No SolveBio API host is set') parsed = urlparse(url) if parsed.scheme not in ['http', 'https']: ...
python
{ "resource": "" }
q273109
Manifest.add
test
def add(self, *args): """ Add one or more files or URLs to the manifest. If files contains a glob, it is expanded. All files are uploaded to SolveBio. The Upload object is used to fill the manifest. """ def _is_url(path): p = urlparse(path) ...
python
{ "resource": "" }
q273110
Annotator.annotate
test
def annotate(self, records, **kwargs): """Annotate a set of records with stored fields. Args: records: A list or iterator (can be a Query object) chunk_size: The number of records to annotate at once (max 500). Returns: A generator that yields one annotated ...
python
{ "resource": "" }
q273111
Expression.evaluate
test
def evaluate(self, data=None, data_type='string', is_list=False): """Evaluates the expression with the provided context and format.""" payload = { 'data': data, 'expression': self.expr, 'data_type': data_type, 'is_list': is_list } res = sel...
python
{ "resource": "" }
q273112
TabularOutputFormatter.format_name
test
def format_name(self, format_name): """Set the default format name. :param str format_name: The display format name. :raises ValueError: if the format is not recognized. """ if format_name in self.supported_formats: self._format_name = format_name else: ...
python
{ "resource": "" }
q273113
TabularOutputFormatter.register_new_formatter
test
def register_new_formatter(cls, format_name, handler, preprocessors=(), kwargs=None): """Register a new output formatter. :param str format_name: The name of the format. :param callable handler: The function that formats the data. :param tuple preprocessor...
python
{ "resource": "" }
q273114
TabularOutputFormatter.format_output
test
def format_output(self, data, headers, format_name=None, preprocessors=(), column_types=None, **kwargs): """Format the headers and data using a specific formatter. *format_name* must be a supported formatter (see :attr:`supported_formats`). :param iterable data: A...
python
{ "resource": "" }
q273115
adapter
test
def adapter(data, headers, table_format=None, preserve_whitespace=False, **kwargs): """Wrap tabulate inside a function for TabularOutputFormatter.""" keys = ('floatfmt', 'numalign', 'stralign', 'showindex', 'disable_numparse') tkwargs = {'tablefmt': table_format} tkwargs.update(filter_dict_b...
python
{ "resource": "" }
q273116
get_user_config_dir
test
def get_user_config_dir(app_name, app_author, roaming=True, force_xdg=True): """Returns the config folder for the application. The default behavior is to return whatever is most appropriate for the operating system. For an example application called ``"My App"`` by ``"Acme"``, something like the follo...
python
{ "resource": "" }
q273117
get_system_config_dirs
test
def get_system_config_dirs(app_name, app_author, force_xdg=True): r"""Returns a list of system-wide config folders for the application. For an example application called ``"My App"`` by ``"Acme"``, something like the following folders could be returned: macOS (non-XDG): ``['/Library/Application ...
python
{ "resource": "" }
q273118
Config.read_default_config
test
def read_default_config(self): """Read the default config file. :raises DefaultConfigValidationError: There was a validation error with the *default* file. """ if self.validate: self.default_config = ConfigObj(configspec=self.def...
python
{ "resource": "" }
q273119
Config.read
test
def read(self): """Read the default, additional, system, and user config files. :raises DefaultConfigValidationError: There was a validation error with the *default* file. """ if self.default_file: self.read_default_config() ...
python
{ "resource": "" }
q273120
Config.user_config_file
test
def user_config_file(self): """Get the absolute path to the user config file.""" return os.path.join( get_user_config_dir(self.app_name, self.app_author), self.filename)
python
{ "resource": "" }
q273121
Config.system_config_files
test
def system_config_files(self): """Get a list of absolute paths to the system config files.""" return [os.path.join(f, self.filename) for f in get_system_config_dirs( self.app_name, self.app_author)]
python
{ "resource": "" }
q273122
Config.additional_files
test
def additional_files(self): """Get a list of absolute paths to the additional config files.""" return [os.path.join(f, self.filename) for f in self.additional_dirs]
python
{ "resource": "" }
q273123
Config.write_default_config
test
def write_default_config(self, overwrite=False): """Write the default config to the user's config file. :param bool overwrite: Write over an existing config if it exists. """ destination = self.user_config_file() if not overwrite and os.path.exists(destination): retu...
python
{ "resource": "" }
q273124
Config.read_config_files
test
def read_config_files(self, files): """Read a list of config files. :param iterable files: An iterable (e.g. list) of files to read. """ errors = {} for _file in files: config, valid = self.read_config_file(_file) self.update(config) if valid ...
python
{ "resource": "" }
q273125
truncate_string
test
def truncate_string(value, max_width=None): """Truncate string values.""" if isinstance(value, text_type) and max_width is not None and len(value) > max_width: return value[:max_width] return value
python
{ "resource": "" }
q273126
replace
test
def replace(s, replace): """Replace multiple values in a string""" for r in replace: s = s.replace(*r) return s
python
{ "resource": "" }
q273127
BaseCommand.call_in_sequence
test
def call_in_sequence(self, cmds, shell=True): """Run multiple commmands in a row, exiting if one fails.""" for cmd in cmds: if subprocess.call(cmd, shell=shell) == 1: sys.exit(1)
python
{ "resource": "" }
q273128
BaseCommand.apply_options
test
def apply_options(self, cmd, options=()): """Apply command-line options.""" for option in (self.default_cmd_options + options): cmd = self.apply_option(cmd, option, active=getattr(self, option, False)) return cmd
python
{ "resource": "" }
q273129
BaseCommand.apply_option
test
def apply_option(self, cmd, option, active=True): """Apply a command-line option.""" return re.sub(r'{{{}\:(?P<option>[^}}]*)}}'.format(option), '\g<option>' if active else '', cmd)
python
{ "resource": "" }
q273130
lint.initialize_options
test
def initialize_options(self): """Set the default options.""" self.branch = 'master' self.fix = False super(lint, self).initialize_options()
python
{ "resource": "" }
q273131
lint.run
test
def run(self): """Run the linter.""" cmd = 'pep8radius {branch} {{fix: --in-place}}{{verbose: -vv}}' cmd = cmd.format(branch=self.branch) self.call_and_exit(self.apply_options(cmd, ('fix', )))
python
{ "resource": "" }
q273132
docs.run
test
def run(self): """Generate and view the documentation.""" cmds = (self.clean_docs_cmd, self.html_docs_cmd, self.view_docs_cmd) self.call_in_sequence(cmds)
python
{ "resource": "" }
q273133
truncate_string
test
def truncate_string(data, headers, max_field_width=None, **_): """Truncate very long strings. Only needed for tabular representation, because trying to tabulate very long data is problematic in terms of performance, and does not make any sense visually. :param iterable data: An :term:`iterable` (e....
python
{ "resource": "" }
q273134
format_numbers
test
def format_numbers(data, headers, column_types=(), integer_format=None, float_format=None, **_): """Format numbers according to a format specification. This uses Python's format specification to format numbers of the following types: :class:`int`, :class:`py2:long` (Python 2), :class:`fl...
python
{ "resource": "" }
q273135
_format_row
test
def _format_row(headers, row): """Format a row.""" formatted_row = [' | '.join(field) for field in zip(headers, row)] return '\n'.join(formatted_row)
python
{ "resource": "" }
q273136
adapter
test
def adapter(data, headers, **kwargs): """Wrap vertical table in a function for TabularOutputFormatter.""" keys = ('sep_title', 'sep_character', 'sep_length') return vertical_table(data, headers, **filter_dict_by_key(kwargs, keys))
python
{ "resource": "" }
q273137
adapter
test
def adapter(data, headers, table_format=None, **kwargs): """Wrap terminaltables inside a function for TabularOutputFormatter.""" keys = ('title', ) table = table_format_handler[table_format] t = table([headers] + list(data), **filter_dict_by_key(kwargs, keys)) dimensions = terminaltables.width_an...
python
{ "resource": "" }
q273138
render_template
test
def render_template(template_file, dst_file, **kwargs): """Copy template and substitute template strings File `template_file` is copied to `dst_file`. Then, each template variable is replaced by a value. Template variables are of the form {{val}} Example: Contents of template_file: ...
python
{ "resource": "" }
q273139
Session.isNum
test
def isNum(self, type): """ is the type a numerical value? :param type: PKCS#11 type like `CKA_CERTIFICATE_TYPE` :rtype: bool """ if type in (CKA_CERTIFICATE_TYPE, CKA_CLASS, CKA_KEY_GEN_MECHANISM, CKA_KEY_TYPE, ...
python
{ "resource": "" }
q273140
Session.isBool
test
def isBool(self, type): """ is the type a boolean value? :param type: PKCS#11 type like `CKA_ALWAYS_SENSITIVE` :rtype: bool """ if type in (CKA_ALWAYS_SENSITIVE, CKA_DECRYPT, CKA_DERIVE, CKA_ENCRYPT, ...
python
{ "resource": "" }
q273141
Session.isBin
test
def isBin(self, type): """ is the type a byte array value? :param type: PKCS#11 type like `CKA_MODULUS` :rtype: bool """ return (not self.isBool(type)) \ and (not self.isString(type)) \ and (not self.isNum(type))
python
{ "resource": "" }
q273142
Session.generateKey
test
def generateKey(self, template, mecha=MechanismAESGENERATEKEY): """ generate a secret key :param template: template for the secret key :param mecha: mechanism to use :return: handle of the generated key :rtype: PyKCS11.LowLevel.CK_OBJECT_HANDLE """ t = se...
python
{ "resource": "" }
q273143
Session.generateKeyPair
test
def generateKeyPair(self, templatePub, templatePriv, mecha=MechanismRSAGENERATEKEYPAIR): """ generate a key pair :param templatePub: template for the public key :param templatePriv: template for the private key :param mecha: mechanism to use :ret...
python
{ "resource": "" }
q273144
Session.findObjects
test
def findObjects(self, template=()): """ find the objects matching the template pattern :param template: list of attributes tuples (attribute,value). The default value is () and all the objects are returned :type template: list :return: a list of object ids :rty...
python
{ "resource": "" }
q273145
QRcode._insert_img
test
def _insert_img(qr_img, icon_img=None, factor=4, icon_box=None, static_dir=None): """Inserts a small icon to QR Code image""" img_w, img_h = qr_img.size size_w = int(img_w) / int(factor) size_h = int(img_h) / int(factor) try: # load icon from current dir ...
python
{ "resource": "" }
q273146
panel
test
def panel(context, panel, build, bed, version): """Export gene panels to .bed like format. Specify any number of panels on the command line """ LOG.info("Running scout export panel") adapter = context.obj['adapter'] # Save all chromosomes found in the collection if panels chromosome...
python
{ "resource": "" }
q273147
_first_weekday
test
def _first_weekday(weekday, d): """ Given a weekday and a date, will increment the date until it's weekday matches that of the given weekday, then that date is returned. """ while weekday != d.weekday(): d += timedelta(days=1) return d
python
{ "resource": "" }
q273148
Repeater.repeat
test
def repeat(self, day=None): """ Add 'num' to the day and count that day until we reach end_repeat, or until we're outside of the current month, counting the days as we go along. """ if day is None: day = self.day try: d = date(self.year, s...
python
{ "resource": "" }
q273149
Repeater.repeat_reverse
test
def repeat_reverse(self, start, end): """ Starts from 'start' day and counts backwards until 'end' day. 'start' should be >= 'end'. If it's equal to, does nothing. If a day falls outside of end_repeat, it won't be counted. """ day = start diff = start - end ...
python
{ "resource": "" }
q273150
WeeklyRepeater._biweekly_helper
test
def _biweekly_helper(self): """Created to take some of the load off of _handle_weekly_repeat_out""" self.num = 14 mycount = self.repeat_biweekly() if mycount: if self.event.is_chunk() and min(mycount) not in xrange(1, 8): mycount = _chunk_fill_out_first_week( ...
python
{ "resource": "" }
q273151
CountHandler._handle_single_chunk
test
def _handle_single_chunk(self, event): """ This handles either a non-repeating event chunk, or the first month of a repeating event chunk. """ if not event.starts_same_month_as(self.month) and not \ event.repeats('NEVER'): # no repeating chunk events i...
python
{ "resource": "" }
q273152
export_variants
test
def export_variants(adapter, collaborator, document_id=None, case_id=None): """Export causative variants for a collaborator Args: adapter(MongoAdapter) collaborator(str) document_id(str): Search for a specific variant case_id(str): Search causative variants for a case Yield...
python
{ "resource": "" }
q273153
export_verified_variants
test
def export_verified_variants(aggregate_variants, unique_callers): """Create the lines for an excel file with verified variants for an institute Args: aggregate_variants(list): a list of variants with aggregates case data unique_callers(set): a unique list of available caller...
python
{ "resource": "" }
q273154
export_mt_variants
test
def export_mt_variants(variants, sample_id): """Export mitochondrial variants for a case to create a MT excel report Args: variants(list): all MT variants for a case, sorted by position sample_id(str) : the id of a sample within the case Returns: document_lines(list): list of lines...
python
{ "resource": "" }
q273155
user
test
def user(context, user_id, update_role, add_institute, remove_admin, remove_institute): """ Update a user in the database """ adapter = context.obj['adapter'] user_obj = adapter.user(user_id) if not user_obj: LOG.warning("User %s could not be found", user_id) context.abort() ...
python
{ "resource": "" }
q273156
str_variants
test
def str_variants(institute_id, case_name): """Display a list of STR variants.""" page = int(request.args.get('page', 1)) variant_type = request.args.get('variant_type', 'clinical') form = StrFiltersForm(request.args) institute_obj, case_obj = institute_and_case(store, institute_id, case_name) ...
python
{ "resource": "" }
q273157
sv_variant
test
def sv_variant(institute_id, case_name, variant_id): """Display a specific structural variant.""" data = controllers.sv_variant(store, institute_id, case_name, variant_id) return data
python
{ "resource": "" }
q273158
str_variant
test
def str_variant(institute_id, case_name, variant_id): """Display a specific STR variant.""" data = controllers.str_variant(store, institute_id, case_name, variant_id) return data
python
{ "resource": "" }
q273159
verify
test
def verify(institute_id, case_name, variant_id, variant_category, order): """Start procedure to validate variant using other techniques.""" 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) ...
python
{ "resource": "" }
q273160
clinvar
test
def clinvar(institute_id, case_name, variant_id): """Build a clinVar submission form for a variant.""" data = controllers.clinvar_export(store, institute_id, case_name, variant_id) if request.method == 'GET': return data else: #POST form_dict = request.form.to_dict() submission_o...
python
{ "resource": "" }
q273161
cancer_variants
test
def cancer_variants(institute_id, case_name): """Show cancer variants overview.""" data = controllers.cancer_variants(store, request.args, institute_id, case_name) return data
python
{ "resource": "" }
q273162
variant_acmg
test
def variant_acmg(institute_id, case_name, variant_id): """ACMG classification form.""" if request.method == 'GET': data = controllers.variant_acmg(store, institute_id, case_name, variant_id) return data else: criteria = [] criteria_terms = request.form.getlist('criteria') ...
python
{ "resource": "" }
q273163
evaluation
test
def evaluation(evaluation_id): """Show or delete an ACMG evaluation.""" evaluation_obj = store.get_evaluation(evaluation_id) controllers.evaluation(store, evaluation_obj) if request.method == 'POST': link = url_for('.variant', institute_id=evaluation_obj['institute']['_id'], ...
python
{ "resource": "" }
q273164
acmg
test
def acmg(): """Calculate an ACMG classification from submitted criteria.""" criteria = request.args.getlist('criterion') classification = get_acmg(criteria) return jsonify(dict(classification=classification))
python
{ "resource": "" }
q273165
upload_panel
test
def upload_panel(institute_id, case_name): """Parse gene panel file and fill in HGNC symbols for filter.""" file = form.symbol_file.data if file.filename == '': flash('No selected file', 'warning') return redirect(request.referrer) try: stream = io.StringIO(file.stream.read().d...
python
{ "resource": "" }
q273166
download_verified
test
def download_verified(): """Download all verified variants for user's cases""" user_obj = store.user(current_user.email) user_institutes = user_obj.get('institutes') temp_excel_dir = os.path.join(variants_bp.static_folder, 'verified_folder') os.makedirs(temp_excel_dir, exist_ok=True) written_fi...
python
{ "resource": "" }
q273167
genes_by_alias
test
def genes_by_alias(hgnc_genes): """Return a dictionary with hgnc symbols as keys Value of the dictionaries are information about the hgnc ids for a symbol. If the symbol is primary for a gene then 'true_id' will exist. A list of hgnc ids that the symbol points to is in ids. Args: hgnc_gene...
python
{ "resource": "" }
q273168
add_incomplete_penetrance
test
def add_incomplete_penetrance(genes, alias_genes, hpo_lines): """Add information of incomplete penetrance""" LOG.info("Add incomplete penetrance info") for hgnc_symbol in get_incomplete_penetrance_genes(hpo_lines): for hgnc_id in get_correct_ids(hgnc_symbol, alias_genes): genes[hgnc_id][...
python
{ "resource": "" }
q273169
link_genes
test
def link_genes(ensembl_lines, hgnc_lines, exac_lines, mim2gene_lines, genemap_lines, hpo_lines): """Gather information from different sources and return a gene dict Extract information collected from a number of sources and combine them into a gene dict with HGNC symbols as keys. hgnc_i...
python
{ "resource": "" }
q273170
matchmaker_request
test
def matchmaker_request(url, token, method, content_type=None, accept=None, data=None): """Send a request to MatchMaker and return its response Args: url(str): url to send request to token(str): MME server authorization token method(str): 'GET', 'POST' or 'DELETE' content_type(st...
python
{ "resource": "" }
q273171
mme_nodes
test
def mme_nodes(mme_base_url, token): """Return the available MatchMaker nodes Args: mme_base_url(str): base URL of MME service token(str): MME server authorization token Returns: nodes(list): a list of node disctionaries """ nodes = [] if not mme_base_url or not token: ...
python
{ "resource": "" }
q273172
get_cytoband_coordinates
test
def get_cytoband_coordinates(chrom, pos): """Get the cytoband coordinate for a position Args: chrom(str) pos(int) Returns: coordinate(str) """ coordinate = "" if chrom in CYTOBANDS: for interval in CYTOBANDS[chrom][pos]: coordinate = interval.data ...
python
{ "resource": "" }
q273173
get_sub_category
test
def get_sub_category(alt_len, ref_len, category, svtype=None): """Get the subcategory for a VCF variant The sub categories are: 'snv', 'indel', 'del', 'ins', 'dup', 'bnd', 'inv' Args: alt_len(int) ref_len(int) category(str) svtype(str) Returns: subcateg...
python
{ "resource": "" }
q273174
get_length
test
def get_length(alt_len, ref_len, category, pos, end, svtype=None, svlen=None): """Return the length of a variant Args: alt_len(int) ref_len(int) category(str) svtype(str) svlen(int) """ # -1 would indicate uncertain length length = -1 if category in ('snv...
python
{ "resource": "" }
q273175
get_end
test
def get_end(pos, alt, category, snvend=None, svend=None, svlen=None): """Return the end coordinate for a variant Args: pos(int) alt(str) category(str) snvend(str) svend(int) svlen(int) Returns: end(int) """ # If nothing is known we set end to...
python
{ "resource": "" }
q273176
parse_coordinates
test
def parse_coordinates(variant, category): """Find out the coordinates for a variant Args: variant(cyvcf2.Variant) Returns: coordinates(dict): A dictionary on the form: { 'position':<int>, 'end':<int>, 'end_chrom':<str>, 'length':<int>...
python
{ "resource": "" }
q273177
cli
test
def cli(infile): """docstring for cli""" lines = get_file_handle(infile) cytobands = parse_cytoband(lines) print("Check some coordinates:") print("checking chrom 1 pos 2") intervals = cytobands['1'][2] for interval in intervals: print(interval) print(interval.begin)...
python
{ "resource": "" }
q273178
panels
test
def panels(): """Show all panels for a case.""" if request.method == 'POST': # update an existing panel csv_file = request.files['csv_file'] content = csv_file.stream.read() lines = None try: if b'\n' in content: lines = content.decode('utf-8',...
python
{ "resource": "" }
q273179
panel_update
test
def panel_update(panel_id): """Update panel to a new version.""" panel_obj = store.panel(panel_id) update_version = request.form.get('version', None) new_panel_id = store.apply_pending(panel_obj, update_version) return redirect(url_for('panels.panel', panel_id=new_panel_id))
python
{ "resource": "" }
q273180
panel_export
test
def panel_export(panel_id): """Export panel to PDF file""" panel_obj = store.panel(panel_id) data = controllers.panel_export(store, panel_obj) data['report_created_at'] = datetime.datetime.now().strftime("%Y-%m-%d") html_report = render_template('panels/panel_pdf_simple.html', **data) return ren...
python
{ "resource": "" }
q273181
gene_edit
test
def gene_edit(panel_id, hgnc_id): """Edit additional information about a panel gene.""" panel_obj = store.panel(panel_id) hgnc_gene = store.hgnc_gene(hgnc_id) panel_gene = controllers.existing_gene(store, panel_obj, hgnc_id) form = PanelGeneForm() transcript_choices = [] for transcript in h...
python
{ "resource": "" }
q273182
delivery_report
test
def delivery_report(context, case_id, report_path, update): """Add delivery report to an existing case.""" adapter = context.obj['adapter'] try: load_delivery_report(adapter=adapter, case_id=case_id, report_path=report_path, update=update) L...
python
{ "resource": "" }
q273183
hpo_terms
test
def hpo_terms(store, query = None, limit = None): """Retrieves a list of HPO terms from scout database Args: store (obj): an adapter to the scout database query (str): the term to search in the database limit (str): the number of desired results Returns: hpo_phenotypes (dic...
python
{ "resource": "" }
q273184
whitelist
test
def whitelist(context): """Show all objects in the whitelist collection""" LOG.info("Running scout view users") adapter = context.obj['adapter'] ## TODO add a User interface to the adapter for whitelist_obj in adapter.whitelist_collection.find(): click.echo(whitelist_obj['_id'])
python
{ "resource": "" }
q273185
build_phenotype
test
def build_phenotype(phenotype_id, adapter): """Build a small phenotype object Build a dictionary with phenotype_id and description Args: phenotype_id (str): The phenotype id adapter (scout.adapter.MongoAdapter) Returns: phenotype_obj (dict): dict( phen...
python
{ "resource": "" }
q273186
gene
test
def gene(store, hgnc_id): """Parse information about a gene.""" res = {'builds': {'37': None, '38': None}, 'symbol': None, 'description': None, 'ensembl_id': None, 'record': None} for build in res['builds']: record = store.hgnc_gene(hgnc_id, build=build) if record: record['posi...
python
{ "resource": "" }
q273187
genes_to_json
test
def genes_to_json(store, query): """Fetch matching genes and convert to JSON.""" gene_query = store.hgnc_genes(query, search=True) json_terms = [{'name': "{} | {} ({})".format(gene['hgnc_id'], gene['hgnc_symbol'], ', '.join(gene['aliases'])), ...
python
{ "resource": "" }
q273188
index
test
def index(): """Display the Scout dashboard.""" accessible_institutes = current_user.institutes if not 'admin' in current_user.roles: accessible_institutes = current_user.institutes if not accessible_institutes: flash('Not allowed to see information - please visit the dashboard l...
python
{ "resource": "" }
q273189
transcripts
test
def transcripts(context, build, hgnc_id, json): """Show all transcripts in the database""" LOG.info("Running scout view transcripts") adapter = context.obj['adapter'] if not json: click.echo("Chromosome\tstart\tend\ttranscript_id\thgnc_id\trefseq\tis_primary") for tx_obj in adapter.transcri...
python
{ "resource": "" }
q273190
day_display
test
def day_display(year, month, all_month_events, day): """ Returns the events that occur on the given day. Works by getting all occurrences for the month, then drilling down to only those occurring on the given day. """ # Get a dict with all of the events for the month count = CountHandler(yea...
python
{ "resource": "" }
q273191
sv_variants
test
def sv_variants(store, institute_obj, case_obj, variants_query, page=1, per_page=50): """Pre-process list of SV variants.""" skip_count = (per_page * max(page - 1, 0)) more_variants = True if variants_query.count() > (skip_count + per_page) else False genome_build = case_obj.get('genome_build', '37') ...
python
{ "resource": "" }
q273192
str_variants
test
def str_variants(store, institute_obj, case_obj, variants_query, page=1, per_page=50): """Pre-process list of STR variants.""" # Nothing unique to STRs on this level. Inheritance? return variants(store, institute_obj, case_obj, variants_query, page, per_page)
python
{ "resource": "" }
q273193
str_variant
test
def str_variant(store, institute_id, case_name, variant_id): """Pre-process an STR variant entry for detail page. Adds information to display variant Args: store(scout.adapter.MongoAdapter) institute_id(str) case_name(str) variant_id(str) Returns: detailed_info...
python
{ "resource": "" }
q273194
sv_variant
test
def sv_variant(store, institute_id, case_name, variant_id=None, variant_obj=None, add_case=True, get_overlapping=True): """Pre-process an SV variant entry for detail page. Adds information to display variant Args: store(scout.adapter.MongoAdapter) institute_id(str) c...
python
{ "resource": "" }
q273195
parse_variant
test
def parse_variant(store, institute_obj, case_obj, variant_obj, update=False, genome_build='37', get_compounds = True): """Parse information about variants. - Adds information about compounds - Updates the information about compounds if necessary and 'update=True' Args: store(...
python
{ "resource": "" }
q273196
variants_export_header
test
def variants_export_header(case_obj): """Returns a header for the CSV file with the filtered variants to be exported. Args: case_obj(scout.models.Case) Returns: header: includes the fields defined in scout.constants.variants_export EXPORT_HEADER + AD_ref...
python
{ "resource": "" }
q273197
get_variant_info
test
def get_variant_info(genes): """Get variant information""" data = {'canonical_transcripts': []} for gene_obj in genes: if not gene_obj.get('canonical_transcripts'): tx = gene_obj['transcripts'][0] tx_id = tx['transcript_id'] exon = tx.get('exon', '-') ...
python
{ "resource": "" }
q273198
get_predictions
test
def get_predictions(genes): """Get sift predictions from genes.""" data = { 'sift_predictions': [], 'polyphen_predictions': [], 'region_annotations': [], 'functional_annotations': [] } for gene_obj in genes: for pred_key in data: gene_key = pred_key[:-...
python
{ "resource": "" }
q273199
variant_case
test
def variant_case(store, case_obj, variant_obj): """Pre-process case for the variant view. Adds information about files from case obj to variant Args: store(scout.adapter.MongoAdapter) case_obj(scout.models.Case) variant_obj(scout.models.Variant) """ case_obj['bam_files'] = ...
python
{ "resource": "" }