_id stringlengths 2 7 | title stringlengths 1 88 | partition stringclasses 3
values | text stringlengths 31 13.1k | 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
# limit on row width which is equal to TTY_COLS (see printing)
rendered_cells = (begin + sep.join(padded_cells) + end).rstrip()
if len(rendered_cells) > TTY_COLS:
| python | {
"resource": ""
} |
q273101 | _build_line | test | def _build_line(colwidths, padding, begin, fill, sep, end):
"Return a string which represents a | 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"| ', | 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 and "lineabove" not in hidden:
lines.append(_build_line(colwidths, pad, *fmt.lineabove))
if headers:
lines.append(_build_row(headers, pad, *headerrow))
if fmt.linebelowheader and "linebelowheader" not in hidden:
begin, fill, sep, end = fmt.linebelowheader
if fmt.usecolons:
segs = [
_line_segment_with_colons(fmt.linebelowheader, a, w + 2 * pad)
for w, a in zip(colwidths, colaligns)]
lines.append(_build_row(segs, 0, begin, sep, end))
else:
lines.append(_build_line(colwidths, pad, *fmt.linebelowheader))
if rows and fmt.linebetweenrows and "linebetweenrows" not in hidden:
# initial rows with a line below
for row in rows[:-1]:
| 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']:
raise Exception(
'No source dataset ID found. '
'Please instantiate the Dataset '
'object with an 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
* If no vault, uses the current user's personal vault.
* If no path, uses '/' (vault root)
Returns a tuple containing:
* The validated full_path
* A dictionary with the components:
* domain: the domain of the vault
* vault: the name of the vault, without domain
* vault_full_path: domain:vault
* path: the object path within the vault
* parent_path: the parent path to the object
* filename: the object's filename (if any)
* full_path: the validated full path
The following components may be overridden using kwargs:
* vault
* path
Object paths (also known as "paths") must begin with a forward slash.
The following path formats are supported:
domain:vault:/path -> object "path" in the root of "domain:vault"
domain:vault/path -> object "path" in the root of "domain:vault"
vault:/path -> object "path" in the root of "vault"
vault/path -> object "path" in the root of "vault"
~/path -> object "path" in the root of personal vault
vault/ -> root of "vault"
~/ -> root of your personal vault
The following two formats are not supported:
path -> invalid/ambiguous path (exception)
vault:path -> invalid/ambiguous path (exception)
vault:path/path -> unsupported, interpreted as domain:vault/path
"""
from solvebio.resource.vault import Vault
_client = kwargs.pop('client', None) or cls._client or client
if not full_path:
raise Exception(
'Invalid path: ',
'Full | 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 and is accessible
vault = Vault.get_by_full_path(path_dict['vault_full_path'])
| 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:vault:/path
domain:vault/path
vault:/path
vault
~/
Invalid vault paths include:
/vault/
/path
/
:/
Does not allow overrides for any vault path components.
"""
_client = kwargs.pop('client', None) or cls._client or client
full_path = full_path.strip()
if not full_path:
raise Exception(
'Vault path "{0}" is invalid. Path must be in the format: '
'"domain:vault:/path" or "vault:/path".'.format(full_path)
)
match = cls.VAULT_PATH_RE.match(full_path)
if not match:
raise Exception(
'Vault path "{0}" is invalid. Path must be in the format: '
'"domain:vault:/path" or "vault:/path".'.format(full_path)
)
| 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']:
raise SolveError(
| 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)
return bool(p.scheme)
for path in args:
path = os.path.expanduser(path)
if _is_url(path):
self.add_url(path)
elif os.path.isfile(path):
self.add_file(path)
elif os.path.isdir(path):
for f in os.listdir(path):
self.add_file(f)
elif glob.glob(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 record at a time.
"""
| 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,
| 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:
| 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 preprocessors: The preprocessors to call before
formatting. | 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: An :term:`iterable` (e.g. list) of rows.
:param iterable headers: The column headers.
:param str format_name: The display format to use (optional, if the
:class:`TabularOutputFormatter` object has a default format set).
:param tuple preprocessors: Additional preprocessors to call before
any formatter preprocessors.
:param \*\*kwargs: Optional arguments for the formatter.
:return: The formatted data.
:rtype: str
:raises ValueError: If the *format_name* is not recognized.
"""
format_name = format_name or self._format_name
if format_name not in self.supported_formats:
raise ValueError('unrecognized format "{}"'.format(format_name))
| 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')
| 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 following folders could be returned:
macOS (non-XDG):
``~/Library/Application Support/My App``
Mac OS X (XDG):
``~/.config/my-app``
Unix:
``~/.config/my-app``
Windows 7 (roaming):
``C:\\Users\<user>\AppData\Roaming\Acme\My App``
Windows 7 (not roaming):
``C:\\Users\<user>\AppData\Local\Acme\My App``
:param app_name: the application name. This should be properly capitalized
and can contain whitespace.
:param app_author: The app author's name (or company). This should be
properly capitalized and can contain whitespace.
:param roaming: controls if the folder should be roaming or not on Windows.
Has no effect on non-Windows systems.
:param force_xdg: if this is set to `True`, then on macOS the XDG Base
| 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 Support/My App']``
Mac OS X (XDG):
``['/etc/xdg/my-app']``
Unix:
``['/etc/xdg/my-app']``
Windows 7:
``['C:\ProgramData\Acme\My App']``
:param app_name: the application name. This should be properly capitalized
and can contain whitespace.
:param app_author: The app author's name (or company). This should be
properly capitalized and can contain whitespace.
:param force_xdg: if this is set to `True`, then on macOS the XDG Base
Directory Specification will be followed. Has no effect
on non-macOS systems.
| 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.default_file,
list_values=False, _inspec=True,
encoding='utf8')
valid = self.default_config.validate(Validator(), copy=True,
preserve_errors=True)
if valid is not True:
for name, section in valid.items():
if section is True:
continue
| 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
| 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(
| python | {
"resource": ""
} |
q273121 | Config.system_config_files | test | def system_config_files(self):
"""Get a list of absolute paths to the system config files.""" | python | {
"resource": ""
} |
q273122 | Config.additional_files | test | def additional_files(self):
"""Get a list of absolute paths to the additional config files."""
| 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 | 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, | python | {
"resource": ""
} |
q273125 | truncate_string | test | def truncate_string(value, max_width=None):
"""Truncate string values."""
if isinstance(value, | python | {
"resource": ""
} |
q273126 | replace | test | def replace(s, replace):
"""Replace multiple values in a string"""
for r | 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:
| 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, | python | {
"resource": ""
} |
q273129 | BaseCommand.apply_option | test | def apply_option(self, cmd, option, active=True):
"""Apply a command-line option."""
return | python | {
"resource": ""
} |
q273130 | lint.initialize_options | test | def initialize_options(self):
"""Set the default options."""
self.branch = 'master'
| python | {
"resource": ""
} |
q273131 | lint.run | test | def run(self):
"""Run the linter."""
cmd = 'pep8radius {branch} {{fix: --in-place}}{{verbose: -vv}}'
| python | {
"resource": ""
} |
q273132 | docs.run | test | def run(self):
"""Generate and view the documentation."""
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.g. list) of rows.
:param iterable headers: The column headers.
:param int max_field_width: Width to truncate field for display
| 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:`float`, and
:class:`~decimal.Decimal`. See the :ref:`python:formatspec` for more
information about the format strings.
.. NOTE::
A column is only formatted if all of its values are the same type
(except for :data:`None`).
:param iterable data: An :term:`iterable` (e.g. list) of rows.
:param iterable headers: The column headers.
:param iterable column_types: The columns' type objects (e.g. int or float).
:param str integer_format: The format string to use for integer columns.
:param str float_format: The format string to use for float columns.
:return: The processed data and headers.
:rtype: | python | {
"resource": ""
} |
q273135 | _format_row | test | def _format_row(headers, row):
"""Format a row."""
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') | 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 | 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:
VAR1={{val1}}
VAR2={{val2}}
VAR3={{val3}}
render_template(template_file, output_file, val1="hello", val2="world")
| 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,
CKA_EXTRACTABLE,
CKA_HAS_RESET,
CKA_LOCAL,
CKA_MODIFIABLE,
CKA_NEVER_EXTRACTABLE,
CKA_PRIVATE,
CKA_RESET_ON_INIT,
CKA_SECONDARY_AUTH,
CKA_SENSITIVE,
| 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
| 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 = self._template2ckattrlist(template)
| 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
:return: a tuple of handles (pub, priv)
| 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
:rtype: list
"""
t = self._template2ckattrlist(template)
# we search for 10 objects by default. speed/memory tradeoff
result = PyKCS11.LowLevel.ckobjlist(10)
rv = self.lib.C_FindObjectsInit(self.session, t)
if rv != CKR_OK:
raise PyKCS11Error(rv)
res = []
while True:
rv = self.lib.C_FindObjects(self.session, result)
if rv != CKR_OK:
raise PyKCS11Error(rv)
for x in result:
# make a | 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
icon_fp = os.path.join(icon_img)
if static_dir:
# load icon from app's static dir
icon_fp = os.path.join(static_dir, icon_img)
if icon_img.split("://")[0] in ["http", "https", "ftp"]:
icon_fp = BytesIO(urlopen(icon_img).read()) # download icon
icon = Image.open(icon_fp)
except:
| 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
chromosomes_found = set()
if not panel:
LOG.warning("Please provide at least one gene panel")
context.abort()
LOG.info("Exporting panels: {}".format(', '.join(panel)))
if bed:
if version:
version = [version]
lines = export_panels(
| 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.
| 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, self.month, day)
except ValueError: # out of range day
return self.count
if self.count_first and d <= self.end_repeat:
self.count_it(d.day)
d += timedelta(days=self.num)
if self.end_on is not None:
| 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
try:
if date(self.year, self.month, day) <= self.end_repeat:
self.count_it(day)
# a value error likely means the event runs past the end of the month,
# like an event that ends on the 31st, but the month doesn't have that
# | 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, | 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 if we're not in it's start month
return
# add the events into an empty defaultdict. This is better than passing
# in self.count, which we don't want to make another copy of because it
# could be very large.
mycount = defaultdict(list)
r = Repeater(
mycount, self.year, self.month, day=event.l_start_date.day,
end_repeat=event.end_repeat, event=event, count_first=True,
end_on=event.l_end_date.day, num=1
| 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
Yields:
variant_obj(scout.Models.Variant): Variants marked as causative ordered by position.
"""
# Store the variants in a list for sorting
variants = []
if document_id:
yield adapter.variant(document_id)
return
variant_ids = adapter.get_causatives(
institute_id=collaborator,
case_id=case_id
)
##TODO add check so that same variant is not included more than once
for document_id in variant_ids:
variant_obj | 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 callers
Returns:
document_lines(list): list of lines to include in the document
"""
document_lines = []
for variant in aggregate_variants:
# get genotype and allele depth for each sample
samples = []
for sample in variant['samples']:
line = [] # line elements corespond to contants.variants_export.VERIFIED_VARIANTS_HEADER
line.append(variant['institute'])
line.append(variant['_id']) # variant database ID
line.append(variant['category'])
line.append(variant['variant_type'])
line.append(variant['display_name'][:30]) # variant display name
# Build local link to variant:
case_name = variant['case_obj']['display_name'] # case display name
local_link = '/'.join([ '', variant['institute'], case_name, variant['_id'] ])
line.append(local_link)
line.append(variant.get('validation'))
line.append(case_name)
case_individual = next(ind for | 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 to include in the document
"""
document_lines = []
for variant in variants:
line = []
position = variant.get('position')
change = '>'.join([variant.get('reference'),variant.get('alternative')])
line.append(position)
line.append(change)
line.append(str(position)+change)
genes = []
prot_effect = []
for gene in variant.get('genes'):
genes.append(gene.get('hgnc_symbol',''))
for transcript in gene.get('transcripts'):
| 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()
existing_roles = set(user_obj.get('roles',[]))
if update_role:
if not update_role in user_obj['roles']:
existing_roles = set(user_obj['roles'])
existing_roles.add(update_role)
LOG.info("Adding role %s to user", update_role)
else:
LOG.warning("User already have role %s", update_role)
if remove_admin:
try:
| 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)
query = form.data
query['variant_type'] = variant_type
variants_query = store.variants(case_obj['_id'], category='str',
query=query)
| python | {
"resource": ""
} |
q273157 | sv_variant | test | def sv_variant(institute_id, case_name, variant_id):
"""Display a specific | python | {
"resource": ""
} |
q273158 | str_variant | test | def str_variant(institute_id, case_name, variant_id):
"""Display a specific | 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)
comment = request.form.get('verification_comment')
try:
controllers.variant_verification(store=store, mail=mail, institute_obj=institute_obj, case_obj=case_obj, user_obj=user_obj, comment=comment,
| 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_objects = set_submission_objects(form_dict) # A tuple of submission objects (variants and casedata objects)
# Add submission data to an open clinvar submission object,
# or create a | python | {
"resource": ""
} |
q273161 | cancer_variants | test | def cancer_variants(institute_id, case_name):
"""Show cancer variants overview."""
| 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')
for term in criteria_terms:
criteria.append(dict(
term=term,
comment=request.form.get("comment-{}".format(term)),
links=[request.form.get("link-{}".format(term))],
))
acmg | 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 | 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().decode('utf-8'), newline=None)
except UnicodeDecodeError as error:
flash("Only text files are supported!", 'warning')
return redirect(request.referrer)
category = request.args.get('category')
if(category == 'sv'):
form = SvFiltersForm(request.args)
else:
form = FiltersForm(request.args)
hgnc_symbols = set(form.hgnc_symbols.data)
new_hgnc_symbols = controllers.upload_panel(store, institute_id, case_name, stream)
hgnc_symbols.update(new_hgnc_symbols)
form.hgnc_symbols.data = ','.join(hgnc_symbols)
# reset gene panels
form.gene_panels.data = | 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_files = controllers.verified_excel_file(store, user_institutes, temp_excel_dir)
if written_files:
today = datetime.datetime.now().strftime('%Y-%m-%d')
# zip the files on the fly and serve the archive to the user
data = io.BytesIO()
with zipfile.ZipFile(data, mode='w') as z:
for f_name in pathlib.Path(temp_excel_dir).iterdir():
zipfile.ZipFile
| 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_genes(dict): a dictionary with hgnc_id as key and gene info as value
Returns:
alias_genes(dict):
{
'hgnc_symbol':{
'true_id': int,
'ids': list(int)
}
}
"""
alias_genes = {}
for hgnc_id in hgnc_genes:
gene = hgnc_genes[hgnc_id]
# This is the primary symbol:
hgnc_symbol = gene['hgnc_symbol']
for alias in gene['previous_symbols']:
true_id = None
| 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):
| 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_id works as the primary symbol and it is from this source we gather
as much information as possible (hgnc_complete_set.txt)
Coordinates are gathered from ensemble and the entries are linked from hgnc
to ensembl via ENSGID.
From exac the gene intolerance scores are collected, genes are linked to hgnc
via hgnc symbol. This is a unstable symbol since they often change.
Args:
ensembl_lines(iterable(str)): Strings with ensembl gene information
hgnc_lines(iterable(str)): Strings with hgnc gene information
exac_lines(iterable(str)): Strings with exac PLi score info
mim2gene_lines(iterable(str))
genemap_lines(iterable(str))
hpo_lines(iterable(str)): Strings with hpo gene information
Yields:
gene(dict): A dictionary with gene information
"""
genes = {} | 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(str): MME request Content-Type
accept(str): accepted response
data(dict): eventual data to send in request
Returns:
json_response(dict): server response
"""
headers = Headers()
headers = { 'X-Auth-Token': token}
if content_type:
headers['Content-Type'] = content_type
if accept:
headers['Accept'] = accept
#sending data anyway so response will not be cached
req_data = data or {'timestamp' : datetime.datetime.now().timestamp()}
json_response = None
try:
LOG.info('Sending {} request to MME url {}. Data sent: {}'.format(
method, url, req_data))
resp = requests.request(
method = method,
url = url,
headers = headers,
data = json.dumps(req_data)
)
| 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:
return | 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: | 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)
| 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', 'indel', 'cancer'):
if ref_len == alt_len:
length = alt_len
else:
length = abs(ref_len - alt_len)
elif category == 'sv':
if | 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 be same as start
end = pos
# If variant is snv or indel we know that cyvcf2 can handle end pos
if category in ('snv', 'indel', 'cancer'):
end = snvend
# With SVs we have to be a bit more careful
elif category == 'sv':
# The END field from INFO usually works fine
end = svend
| 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>,
'sub_category':<str>,
'mate_id':<str>,
'cytoband_start':<str>,
'cytoband_end':<str>,
}
"""
ref = variant.REF
if variant.ALT:
alt = variant.ALT[0]
if category=="str" and not variant.ALT:
alt = '.'
chrom_match = CHR_PATTERN.match(variant.CHROM)
chrom = chrom_match.group(2)
svtype = variant.INFO.get('SVTYPE')
if svtype:
svtype = svtype.lower()
mate_id = variant.INFO.get('MATEID')
svlen = variant.INFO.get('SVLEN') | 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)
print(interval.end)
| 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', 'ignore').split('\n')
else:
lines = content.decode('windows-1252').split('\r')
except Exception as err:
flash('Something went wrong while parsing the panel CSV file! ({})'.format(err), 'danger')
return redirect(request.referrer)
new_panel_name = request.form.get('new_panel_name')
if new_panel_name: #create a new panel
new_panel_id = controllers.new_panel(
store=store,
institute_id=request.form['institute'],
panel_name=new_panel_name,
display_name=request.form['display_name'],
csv_lines=lines,
)
if new_panel_id is None:
flash('Something went wrong and the panel list was not updated!','warning')
return redirect(request.referrer)
else:
flash("new gene panel added, {}!".format(new_panel_name),'success')
return redirect(url_for('panels.panel', panel_id=new_panel_id))
else: # modify an existing panel
update_option = request.form['modify_option']
panel_obj= controllers.update_panel(
store=store,
panel_name=request.form['panel_name'],
csv_lines=lines,
option=update_option
)
if panel_obj is | 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 = | 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)
| 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 hgnc_gene['transcripts']:
if transcript.get('refseq_id'):
refseq_id = transcript.get('refseq_id')
transcript_choices.append((refseq_id, refseq_id))
form.disease_associated_transcripts.choices = transcript_choices
if form.validate_on_submit():
action = 'edit' if panel_gene else 'add'
info_data = form.data.copy()
if 'csrf_token' in info_data:
del info_data['csrf_token']
store.add_pending(panel_obj, hgnc_gene, action=action, info=info_data)
| 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,
| 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 (dict): the complete list of HPO | 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
| 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(
phenotype_id = str,
feature = str, # description of phenotype
)
"""
| 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['position'] = "{this[chromosome]}:{this[start]}-{this[end]}".format(this=record)
res['aliases'] = record['aliases']
res['hgnc_id'] = record['hgnc_id']
res['description'] = record['description']
res['builds'][build] = record
res['symbol'] = record['hgnc_symbol']
res['description'] = record['description']
res['entrez_id'] = record.get('entrez_id')
res['pli_score'] = record.get('pli_score')
add_gene_links(record, int(build))
res['omim_id'] = record.get('omim_id')
| 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'],
| 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 later!')
return redirect(url_for('cases.dahboard_general.html'))
LOG.debug('User accessible institutes: {}'.format(accessible_institutes))
institutes = [inst for inst in store.institutes(accessible_institutes)]
# Insert a entry that displays all institutes in the beginning of the array
institutes.insert(0, {'_id': None, 'display_name': 'All institutes'})
institute_id = None
slice_query = None
panel=1
if request.method=='POST':
institute_id = request.form.get('institute')
slice_query = request.form.get('query')
panel=request.form.get('pane_id')
elif request.method=='GET':
| 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.transcripts(build=build, hgnc_id=hgnc_id):
| 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(year, month, all_month_events).get_count()
pks = [x[1] for x in count[day]] # list of pks for events on given day
# List | 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')
if genome_build not in ['37','38']:
genome_build = '37'
return | 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?
| 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_information(dict): {
'institute': <institute_obj>,
'case': <case_obj>,
'variant': <variant_obj>,
'overlapping_snvs': <overlapping_snvs>,
'manual_rank_options': MANUAL_RANK_OPTIONS,
'dismiss_variant_options': DISMISS_VARIANT_OPTIONS
}
"""
institute_obj, case_obj = institute_and_case(store, institute_id, case_name)
variant_obj = store.variant(variant_id)
# fill in information for pilup view
variant_case(store, case_obj, variant_obj)
variant_obj['callers'] = callers(variant_obj, category='str')
# variant_obj['str_ru'] | 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)
case_name(str)
variant_id(str)
variant_obj(dcit)
add_case(bool): If information about case files should be added
Returns:
detailed_information(dict): {
'institute': <institute_obj>,
'case': <case_obj>,
'variant': <variant_obj>,
'overlapping_snvs': <overlapping_snvs>,
'manual_rank_options': MANUAL_RANK_OPTIONS,
'dismiss_variant_options': DISMISS_VARIANT_OPTIONS
}
"""
institute_obj, case_obj = institute_and_case(store, institute_id, case_name)
if not variant_obj:
variant_obj = store.variant(variant_id)
if add_case:
# fill in information for pilup view
variant_case(store, case_obj, variant_obj)
# frequencies
variant_obj['frequencies'] = [
('1000G', variant_obj.get('thousand_genomes_frequency')),
('1000G (left)', variant_obj.get('thousand_genomes_frequency_left')),
('1000G (right)', variant_obj.get('thousand_genomes_frequency_right')),
('ClinGen CGH (benign)', variant_obj.get('clingen_cgh_benign')),
('ClinGen CGH (pathogenic)', variant_obj.get('clingen_cgh_pathogenic')),
('ClinGen NGI', variant_obj.get('clingen_ngi')),
('SweGen', variant_obj.get('swegen')),
('Decipher', variant_obj.get('decipher')),
]
variant_obj['callers'] = callers(variant_obj, category='sv')
overlapping_snvs = []
if get_overlapping:
overlapping_snvs = (parse_variant(store, institute_obj, case_obj, variant) for variant in
store.overlapping(variant_obj))
# | 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(scout.adapter.MongoAdapter)
institute_obj(scout.models.Institute)
case_obj(scout.models.Case)
variant_obj(scout.models.Variant)
update(bool): If variant should be updated in database
genome_build(str)
"""
has_changed = False
compounds = variant_obj.get('compounds', [])
if compounds and get_compounds:
# Check if we need to add compound information
# If it is the first time the case is viewed we fill in some compound information
if 'not_loaded' not in compounds[0]:
new_compounds = store.update_variant_compounds(variant_obj)
variant_obj['compounds'] = new_compounds
has_changed = True
# sort compounds on combined rank score
variant_obj['compounds'] = sorted(variant_obj['compounds'],
key=lambda compound: -compound['combined_score'])
# Update the hgnc symbols if they are incorrect
variant_genes = variant_obj.get('genes')
| 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_reference, AD_alternate, GT_quality for each sample analysed for | 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', '-')
c_seq = tx.get('coding_sequence_name', '-')
else:
tx_id = gene_obj['canonical_transcripts']
exon = gene_obj.get('exon', '-')
c_seq = gene_obj.get('hgvs_identifier', '-')
if len(c_seq) > 20:
| 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[:-1]
if len(genes) == 1:
value = gene_obj.get(gene_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'] = []
case_obj['mt_bams'] = []
case_obj['bai_files'] = []
case_obj['mt_bais'] = []
case_obj['sample_names'] = []
for individual in case_obj['individuals']:
bam_path = individual.get('bam_file')
mt_bam = individual.get('mt_bam')
case_obj['sample_names'].append(individual.get('display_name'))
if bam_path and os.path.exists(bam_path):
case_obj['bam_files'].append(individual['bam_file'])
case_obj['bai_files'].append(find_bai_file(individual['bam_file']))
if mt_bam and os.path.exists(mt_bam):
case_obj['mt_bams'].append(individual['mt_bam'])
case_obj['mt_bais'].append(find_bai_file(individual['mt_bam']))
else:
LOG.debug("%s: no bam file found", individual['individual_id'])
try:
genes = variant_obj.get('genes', [])
if len(genes) == 1:
hgnc_gene_obj = store.hgnc_gene(variant_obj['genes'][0]['hgnc_id'])
if hgnc_gene_obj:
vcf_path = store.get_region_vcf(case_obj, gene_obj=hgnc_gene_obj)
| python | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.