partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
test | index | Show all indexes in the database | scout/commands/view/index.py | def index(context, collection_name):
"""Show all indexes in the database"""
LOG.info("Running scout view index")
adapter = context.obj['adapter']
i = 0
click.echo("collection\tindex")
for collection_name in adapter.collections():
for index in adapter.indexes(collection_name):
... | def index(context, collection_name):
"""Show all indexes in the database"""
LOG.info("Running scout view index")
adapter = context.obj['adapter']
i = 0
click.echo("collection\tindex")
for collection_name in adapter.collections():
for index in adapter.indexes(collection_name):
... | [
"Show",
"all",
"indexes",
"in",
"the",
"database"
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/commands/view/index.py#L10-L23 | [
"def",
"index",
"(",
"context",
",",
"collection_name",
")",
":",
"LOG",
".",
"info",
"(",
"\"Running scout view index\"",
")",
"adapter",
"=",
"context",
".",
"obj",
"[",
"'adapter'",
"]",
"i",
"=",
"0",
"click",
".",
"echo",
"(",
"\"collection\\tindex\"",
... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | groups | Update the phenotype for a institute.
If --add the groups will be added to the default groups. Else the groups will be replaced. | scout/commands/update/phenotype_groups.py | def groups(context, institute_id, phenotype_group, group_abbreviation, group_file, add):
"""
Update the phenotype for a institute.
If --add the groups will be added to the default groups. Else the groups will be replaced.
"""
adapter = context.obj['adapter']
LOG.info("Running scout update instit... | def groups(context, institute_id, phenotype_group, group_abbreviation, group_file, add):
"""
Update the phenotype for a institute.
If --add the groups will be added to the default groups. Else the groups will be replaced.
"""
adapter = context.obj['adapter']
LOG.info("Running scout update instit... | [
"Update",
"the",
"phenotype",
"for",
"a",
"institute",
".",
"If",
"--",
"add",
"the",
"groups",
"will",
"be",
"added",
"to",
"the",
"default",
"groups",
".",
"Else",
"the",
"groups",
"will",
"be",
"replaced",
"."
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/commands/update/phenotype_groups.py#L29-L64 | [
"def",
"groups",
"(",
"context",
",",
"institute_id",
",",
"phenotype_group",
",",
"group_abbreviation",
",",
"group_file",
",",
"add",
")",
":",
"adapter",
"=",
"context",
".",
"obj",
"[",
"'adapter'",
"]",
"LOG",
".",
"info",
"(",
"\"Running scout update ins... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | parse_compounds | 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:
compounds(list(dict)): A list of compounds | scout/parse/variant/compound.py | 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:
... | 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:
... | [
"Get",
"a",
"list",
"with",
"compounds",
"objects",
"for",
"this",
"variant",
"."
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/parse/variant/compound.py#L7-L42 | [
"def",
"parse_compounds",
"(",
"compound_info",
",",
"case_id",
",",
"variant_type",
")",
":",
"# We need the case to construct the correct id",
"compounds",
"=",
"[",
"]",
"if",
"compound_info",
":",
"for",
"family_info",
"in",
"compound_info",
".",
"split",
"(",
"... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | genes | Export all genes from a build | scout/commands/export/gene.py | 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... | 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... | [
"Export",
"all",
"genes",
"from",
"a",
"build"
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/commands/export/gene.py#L19-L38 | [
"def",
"genes",
"(",
"context",
",",
"build",
",",
"json",
")",
":",
"LOG",
".",
"info",
"(",
"\"Running scout export genes\"",
")",
"adapter",
"=",
"context",
".",
"obj",
"[",
"'adapter'",
"]",
"result",
"=",
"adapter",
".",
"all_genes",
"(",
"build",
"... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | build_individual | 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,
phenotype = int,
... | scout/build/individual.py | 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,
... | 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,
... | [
"Build",
"a",
"Individual",
"object"
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/build/individual.py#L9-L95 | [
"def",
"build_individual",
"(",
"ind",
")",
":",
"try",
":",
"ind_obj",
"=",
"dict",
"(",
"individual_id",
"=",
"ind",
"[",
"'individual_id'",
"]",
")",
"log",
".",
"info",
"(",
"\"Building Individual with id:{0}\"",
".",
"format",
"(",
"ind",
"[",
"'individ... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | variants | Upload variants to a case
Note that the files has to be linked with the case,
if they are not use 'scout update case'. | scout/commands/load/variants.py | 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 ... | 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 ... | [
"Upload",
"variants",
"to",
"a",
"case"
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/commands/load/variants.py#L27-L104 | [
"def",
"variants",
"(",
"context",
",",
"case_id",
",",
"institute",
",",
"force",
",",
"cancer",
",",
"cancer_research",
",",
"sv",
",",
"sv_research",
",",
"snv",
",",
"snv_research",
",",
"str_clinical",
",",
"chrom",
",",
"start",
",",
"end",
",",
"h... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | case | Return a variant. | scout/server/blueprints/api/views.py | 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') | 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') | [
"Return",
"a",
"variant",
"."
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/server/blueprints/api/views.py#L11-L16 | [
"def",
"case",
"(",
"institute_id",
",",
"case_name",
")",
":",
"institute_obj",
",",
"case_obj",
"=",
"institute_and_case",
"(",
"store",
",",
"institute_id",
",",
"case_name",
")",
"if",
"case_obj",
"is",
"None",
":",
"return",
"abort",
"(",
"404",
")",
... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | variant | Display a specific SNV variant. | scout/server/blueprints/api/views.py | def variant(institute_id, case_name, variant_id):
"""Display a specific SNV variant."""
institute_obj, case_obj = institute_and_case(store, institute_id, case_name)
variant_obj = store.variant(variant_id)
return Response(json_util.dumps(variant_obj), mimetype='application/json') | def variant(institute_id, case_name, variant_id):
"""Display a specific SNV variant."""
institute_obj, case_obj = institute_and_case(store, institute_id, case_name)
variant_obj = store.variant(variant_id)
return Response(json_util.dumps(variant_obj), mimetype='application/json') | [
"Display",
"a",
"specific",
"SNV",
"variant",
"."
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/server/blueprints/api/views.py#L20-L24 | [
"def",
"variant",
"(",
"institute_id",
",",
"case_name",
",",
"variant_id",
")",
":",
"institute_obj",
",",
"case_obj",
"=",
"institute_and_case",
"(",
"store",
",",
"institute_id",
",",
"case_name",
")",
"variant_obj",
"=",
"store",
".",
"variant",
"(",
"vari... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | collections | Show all collections in the database | scout/commands/view/collections.py | 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) | 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) | [
"Show",
"all",
"collections",
"in",
"the",
"database"
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/commands/view/collections.py#L10-L17 | [
"def",
"collections",
"(",
"context",
")",
":",
"LOG",
".",
"info",
"(",
"\"Running scout view collections\"",
")",
"adapter",
"=",
"context",
".",
"obj",
"[",
"'adapter'",
"]",
"for",
"collection_name",
"in",
"adapter",
".",
"collections",
"(",
")",
":",
"c... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | institute | Create a new institute and add it to the database | scout/commands/load/institute.py | 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... | 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... | [
"Create",
"a",
"new",
"institute",
"and",
"add",
"it",
"to",
"the",
"database"
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/commands/load/institute.py#L16-L42 | [
"def",
"institute",
"(",
"ctx",
",",
"internal_id",
",",
"display_name",
",",
"sanger_recipients",
")",
":",
"adapter",
"=",
"ctx",
".",
"obj",
"[",
"'adapter'",
"]",
"if",
"not",
"internal_id",
":",
"logger",
".",
"warning",
"(",
"\"A institute has to have an... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | institute | Update an institute | scout/commands/update/institute.py | 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... | 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... | [
"Update",
"an",
"institute"
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/commands/update/institute.py#L30-L49 | [
"def",
"institute",
"(",
"context",
",",
"institute_id",
",",
"sanger_recipient",
",",
"coverage_cutoff",
",",
"frequency_cutoff",
",",
"display_name",
",",
"remove_sanger",
")",
":",
"adapter",
"=",
"context",
".",
"obj",
"[",
"'adapter'",
"]",
"LOG",
".",
"i... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | get_file_handle | Return a opened file | scout/utils/handle.py | 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 | 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 | [
"Return",
"a",
"opened",
"file"
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/utils/handle.py#L5-L13 | [
"def",
"get_file_handle",
"(",
"file_path",
")",
":",
"if",
"file_path",
".",
"endswith",
"(",
"'.gz'",
")",
":",
"file_handle",
"=",
"getreader",
"(",
"'utf-8'",
")",
"(",
"gzip",
".",
"open",
"(",
"file_path",
",",
"'r'",
")",
",",
"errors",
"=",
"'r... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | _inc_day | Increments the day by converting to a datetime.date(). | happenings/utils/common.py | def _inc_day(year, month, day, net):
"""Increments the day by converting to a datetime.date()."""
d = date(year, month, day)
new_d = d + timezone.timedelta(days=net)
return new_d.year, new_d.month, new_d.day | def _inc_day(year, month, day, net):
"""Increments the day by converting to a datetime.date()."""
d = date(year, month, day)
new_d = d + timezone.timedelta(days=net)
return new_d.year, new_d.month, new_d.day | [
"Increments",
"the",
"day",
"by",
"converting",
"to",
"a",
"datetime",
".",
"date",
"()",
"."
] | wreckage/django-happenings | python | https://github.com/wreckage/django-happenings/blob/7bca5576efa6cd4c4e87356bf9e5b8cd538ae91d/happenings/utils/common.py#L30-L34 | [
"def",
"_inc_day",
"(",
"year",
",",
"month",
",",
"day",
",",
"net",
")",
":",
"d",
"=",
"date",
"(",
"year",
",",
"month",
",",
"day",
")",
"new_d",
"=",
"d",
"+",
"timezone",
".",
"timedelta",
"(",
"days",
"=",
"net",
")",
"return",
"new_d",
... | 7bca5576efa6cd4c4e87356bf9e5b8cd538ae91d |
test | get_net | Get the net of any 'next' and 'prev' querystrings. | happenings/utils/common.py | 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 | 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 | [
"Get",
"the",
"net",
"of",
"any",
"next",
"and",
"prev",
"querystrings",
"."
] | wreckage/django-happenings | python | https://github.com/wreckage/django-happenings/blob/7bca5576efa6cd4c4e87356bf9e5b8cd538ae91d/happenings/utils/common.py#L48-L57 | [
"def",
"get_net",
"(",
"req",
")",
":",
"try",
":",
"nxt",
",",
"prev",
"=",
"map",
"(",
"int",
",",
"(",
"req",
".",
"GET",
".",
"get",
"(",
"'cal_next'",
",",
"0",
")",
",",
"req",
".",
"GET",
".",
"get",
"(",
"'cal_prev'",
",",
"0",
")",
... | 7bca5576efa6cd4c4e87356bf9e5b8cd538ae91d |
test | order_events | Group events that occur on the same day, then sort them alphabetically
by title, then sort by day. Returns a list of tuples that looks like
[(day: [events])], where day is the day of the event(s), and [events]
is an alphabetically sorted list of the events for the day. | happenings/utils/common.py | def order_events(events, d=False):
"""
Group events that occur on the same day, then sort them alphabetically
by title, then sort by day. Returns a list of tuples that looks like
[(day: [events])], where day is the day of the event(s), and [events]
is an alphabetically sorted list of the events for ... | def order_events(events, d=False):
"""
Group events that occur on the same day, then sort them alphabetically
by title, then sort by day. Returns a list of tuples that looks like
[(day: [events])], where day is the day of the event(s), and [events]
is an alphabetically sorted list of the events for ... | [
"Group",
"events",
"that",
"occur",
"on",
"the",
"same",
"day",
"then",
"sort",
"them",
"alphabetically",
"by",
"title",
"then",
"sort",
"by",
"day",
".",
"Returns",
"a",
"list",
"of",
"tuples",
"that",
"looks",
"like",
"[",
"(",
"day",
":",
"[",
"even... | wreckage/django-happenings | python | https://github.com/wreckage/django-happenings/blob/7bca5576efa6cd4c4e87356bf9e5b8cd538ae91d/happenings/utils/common.py#L73-L99 | [
"def",
"order_events",
"(",
"events",
",",
"d",
"=",
"False",
")",
":",
"ordered_events",
"=",
"{",
"}",
"for",
"event",
"in",
"events",
":",
"try",
":",
"for",
"occ",
"in",
"event",
".",
"occurrence",
":",
"try",
":",
"ordered_events",
"[",
"occ",
"... | 7bca5576efa6cd4c4e87356bf9e5b8cd538ae91d |
test | get_next_and_prev | Returns what the next and prev querystrings should be. | happenings/utils/common.py | 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 | 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 | [
"Returns",
"what",
"the",
"next",
"and",
"prev",
"querystrings",
"should",
"be",
"."
] | wreckage/django-happenings | python | https://github.com/wreckage/django-happenings/blob/7bca5576efa6cd4c4e87356bf9e5b8cd538ae91d/happenings/utils/common.py#L102-L112 | [
"def",
"get_next_and_prev",
"(",
"net",
")",
":",
"if",
"net",
"==",
"0",
":",
"nxt",
"=",
"prev",
"=",
"1",
"elif",
"net",
">",
"0",
":",
"nxt",
"=",
"net",
"+",
"1",
"prev",
"=",
"-",
"(",
"net",
"-",
"1",
")",
"else",
":",
"nxt",
"=",
"n... | 7bca5576efa6cd4c4e87356bf9e5b8cd538ae91d |
test | _check_year | Checks that the year is within 50 years from now. | happenings/utils/common.py | 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 | 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 | [
"Checks",
"that",
"the",
"year",
"is",
"within",
"50",
"years",
"from",
"now",
"."
] | wreckage/django-happenings | python | https://github.com/wreckage/django-happenings/blob/7bca5576efa6cd4c4e87356bf9e5b8cd538ae91d/happenings/utils/common.py#L115-L121 | [
"def",
"_check_year",
"(",
"year",
",",
"month",
",",
"error",
",",
"error_msg",
")",
":",
"if",
"year",
"not",
"in",
"xrange",
"(",
"(",
"now",
".",
"year",
"-",
"50",
")",
",",
"(",
"now",
".",
"year",
"+",
"51",
")",
")",
":",
"year",
"=",
... | 7bca5576efa6cd4c4e87356bf9e5b8cd538ae91d |
test | clean_year_month | If 'month_orig', which is the month given in the url BEFORE any next/prev
query strings have been applied, is out of range, sets month to the
current month and returns an error message. Also Returns an error
message if the year given is +/- 50 years from now.
If 'month', which is the month given in the ... | happenings/utils/common.py | def clean_year_month(year, month, month_orig):
"""
If 'month_orig', which is the month given in the url BEFORE any next/prev
query strings have been applied, is out of range, sets month to the
current month and returns an error message. Also Returns an error
message if the year given is +/- 50 years... | def clean_year_month(year, month, month_orig):
"""
If 'month_orig', which is the month given in the url BEFORE any next/prev
query strings have been applied, is out of range, sets month to the
current month and returns an error message. Also Returns an error
message if the year given is +/- 50 years... | [
"If",
"month_orig",
"which",
"is",
"the",
"month",
"given",
"in",
"the",
"url",
"BEFORE",
"any",
"next",
"/",
"prev",
"query",
"strings",
"have",
"been",
"applied",
"is",
"out",
"of",
"range",
"sets",
"month",
"to",
"the",
"current",
"month",
"and",
"ret... | wreckage/django-happenings | python | https://github.com/wreckage/django-happenings/blob/7bca5576efa6cd4c4e87356bf9e5b8cd538ae91d/happenings/utils/common.py#L142-L166 | [
"def",
"clean_year_month",
"(",
"year",
",",
"month",
",",
"month_orig",
")",
":",
"error",
"=",
"False",
"error_msg",
"=",
"\"The date given was invalid.\"",
"if",
"month_orig",
"not",
"in",
"xrange",
"(",
"1",
",",
"13",
")",
"and",
"month_orig",
"is",
"no... | 7bca5576efa6cd4c4e87356bf9e5b8cd538ae91d |
test | check_weekday | Make sure any event day we send back for weekday repeating
events is not a weekend. | happenings/utils/common.py | 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(... | 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(... | [
"Make",
"sure",
"any",
"event",
"day",
"we",
"send",
"back",
"for",
"weekday",
"repeating",
"events",
"is",
"not",
"a",
"weekend",
"."
] | wreckage/django-happenings | python | https://github.com/wreckage/django-happenings/blob/7bca5576efa6cd4c4e87356bf9e5b8cd538ae91d/happenings/utils/common.py#L169-L180 | [
"def",
"check_weekday",
"(",
"year",
",",
"month",
",",
"day",
",",
"reverse",
"=",
"False",
")",
":",
"d",
"=",
"date",
"(",
"year",
",",
"month",
",",
"day",
")",
"while",
"d",
".",
"weekday",
"(",
")",
"in",
"(",
"5",
",",
"6",
")",
":",
"... | 7bca5576efa6cd4c4e87356bf9e5b8cd538ae91d |
test | parse_case_data | Parse all data necessary for loading a case into scout
This can be done either by providing a VCF file and other information
on the command line. Or all the information can be specified in a config file.
Please see Scout documentation for further instructions.
Args:
config(dict): A yaml format... | scout/parse/case.py | 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... | 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... | [
"Parse",
"all",
"data",
"necessary",
"for",
"loading",
"a",
"case",
"into",
"scout"
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/parse/case.py#L20-L97 | [
"def",
"parse_case_data",
"(",
"config",
"=",
"None",
",",
"ped",
"=",
"None",
",",
"owner",
"=",
"None",
",",
"vcf_snv",
"=",
"None",
",",
"vcf_sv",
"=",
"None",
",",
"vcf_cancer",
"=",
"None",
",",
"vcf_str",
"=",
"None",
",",
"peddy_ped",
"=",
"No... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | add_peddy_information | Add information from peddy outfiles to the individuals | scout/parse/case.py | 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... | 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... | [
"Add",
"information",
"from",
"peddy",
"outfiles",
"to",
"the",
"individuals"
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/parse/case.py#L100-L156 | [
"def",
"add_peddy_information",
"(",
"config_data",
")",
":",
"ped_info",
"=",
"{",
"}",
"ped_check",
"=",
"{",
"}",
"sex_check",
"=",
"{",
"}",
"relations",
"=",
"[",
"]",
"if",
"config_data",
".",
"get",
"(",
"'peddy_ped'",
")",
":",
"file_handle",
"="... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | parse_individual | Parse individual information
Args:
sample (dict)
Returns:
{
'individual_id': str,
'father': str,
'mother': str,
'display_name': str,
'sex': str,
'phenotype': str,
'ba... | scout/parse/case.py | def parse_individual(sample):
"""Parse individual information
Args:
sample (dict)
Returns:
{
'individual_id': str,
'father': str,
'mother': str,
'display_name': str,
'sex': str,
... | def parse_individual(sample):
"""Parse individual information
Args:
sample (dict)
Returns:
{
'individual_id': str,
'father': str,
'mother': str,
'display_name': str,
'sex': str,
... | [
"Parse",
"individual",
"information"
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/parse/case.py#L158-L252 | [
"def",
"parse_individual",
"(",
"sample",
")",
":",
"ind_info",
"=",
"{",
"}",
"if",
"'sample_id'",
"not",
"in",
"sample",
":",
"raise",
"PedigreeError",
"(",
"\"One sample is missing 'sample_id'\"",
")",
"sample_id",
"=",
"sample",
"[",
"'sample_id'",
"]",
"# C... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | parse_individuals | Parse the individual information
Reformat sample information to proper individuals
Args:
samples(list(dict))
Returns:
individuals(list(dict)) | scout/parse/case.py | 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... | 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... | [
"Parse",
"the",
"individual",
"information"
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/parse/case.py#L255-L287 | [
"def",
"parse_individuals",
"(",
"samples",
")",
":",
"individuals",
"=",
"[",
"]",
"if",
"len",
"(",
"samples",
")",
"==",
"0",
":",
"raise",
"PedigreeError",
"(",
"\"No samples could be found\"",
")",
"ind_ids",
"=",
"set",
"(",
")",
"for",
"sample_info",
... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | parse_case | Parse case information from config or PED files.
Args:
config (dict): case config with detailed information
Returns:
dict: parsed case data | scout/parse/case.py | 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... | 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... | [
"Parse",
"case",
"information",
"from",
"config",
"or",
"PED",
"files",
"."
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/parse/case.py#L290-L347 | [
"def",
"parse_case",
"(",
"config",
")",
":",
"if",
"'owner'",
"not",
"in",
"config",
":",
"raise",
"ConfigError",
"(",
"\"A case has to have a owner\"",
")",
"if",
"'family'",
"not",
"in",
"config",
":",
"raise",
"ConfigError",
"(",
"\"A case has to have a 'famil... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | parse_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]) | scout/parse/case.py | 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... | 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... | [
"Parse",
"out",
"minimal",
"family",
"information",
"from",
"a",
"PED",
"file",
"."
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/parse/case.py#L350-L377 | [
"def",
"parse_ped",
"(",
"ped_stream",
",",
"family_type",
"=",
"'ped'",
")",
":",
"pedigree",
"=",
"FamilyParser",
"(",
"ped_stream",
",",
"family_type",
"=",
"family_type",
")",
"if",
"len",
"(",
"pedigree",
".",
"families",
")",
"!=",
"1",
":",
"raise",... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | build_evaluation | Build a evaluation object ready to be inserted to database
Args:
variant_specific(str): md5 string for the specific variant
variant_id(str): md5 string for the common variant
user_id(str)
user_name(str)
institute_id(str)
case_id(str)
classification(str): The ... | scout/build/acmg.py | 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... | 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... | [
"Build",
"a",
"evaluation",
"object",
"ready",
"to",
"be",
"inserted",
"to",
"database"
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/build/acmg.py#L3-L46 | [
"def",
"build_evaluation",
"(",
"variant_specific",
",",
"variant_id",
",",
"user_id",
",",
"user_name",
",",
"institute_id",
",",
"case_id",
",",
"classification",
",",
"criteria",
")",
":",
"criteria",
"=",
"criteria",
"or",
"[",
"]",
"evaluation_obj",
"=",
... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | mt_report | 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
outpath(str): path to output file
Returns:
... | scout/commands/export/mitochondrial_report.py | 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
... | 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
... | [
"Export",
"all",
"mitochondrial",
"variants",
"for",
"each",
"sample",
"of",
"a",
"case",
"and",
"write",
"them",
"to",
"an",
"excel",
"file"
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/commands/export/mitochondrial_report.py#L26-L97 | [
"def",
"mt_report",
"(",
"context",
",",
"case_id",
",",
"test",
",",
"outpath",
"=",
"None",
")",
":",
"LOG",
".",
"info",
"(",
"'exporting mitochondrial variants for case \"{}\"'",
".",
"format",
"(",
"case_id",
")",
")",
"adapter",
"=",
"context",
".",
"o... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | build_genotype | Build a genotype call
Args:
gt_call(dict)
Returns:
gt_obj(dict)
gt_call = dict(
sample_id = str,
display_name = str,
genotype_call = str,
allele_depths = list, # int
read_depth = int,
genotype_quality = int,
) | scout/build/variant/genotype.py | def build_genotype(gt_call):
"""Build a genotype call
Args:
gt_call(dict)
Returns:
gt_obj(dict)
gt_call = dict(
sample_id = str,
display_name = str,
genotype_call = str,
allele_depths = list, # int
read_depth = int,
genotype_... | def build_genotype(gt_call):
"""Build a genotype call
Args:
gt_call(dict)
Returns:
gt_obj(dict)
gt_call = dict(
sample_id = str,
display_name = str,
genotype_call = str,
allele_depths = list, # int
read_depth = int,
genotype_... | [
"Build",
"a",
"genotype",
"call",
"Args",
":",
"gt_call",
"(",
"dict",
")",
"Returns",
":",
"gt_obj",
"(",
"dict",
")",
"gt_call",
"=",
"dict",
"(",
"sample_id",
"=",
"str",
"display_name",
"=",
"str",
"genotype_call",
"=",
"str",
"allele_depths",
"=",
"... | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/build/variant/genotype.py#L2-L31 | [
"def",
"build_genotype",
"(",
"gt_call",
")",
":",
"gt_obj",
"=",
"dict",
"(",
"sample_id",
"=",
"gt_call",
"[",
"'individual_id'",
"]",
",",
"display_name",
"=",
"gt_call",
"[",
"'display_name'",
"]",
",",
"genotype_call",
"=",
"gt_call",
"[",
"'genotype_call... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | is_pathogenic | 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
(c) 1 Moderate (PM1–PM6) and 1 supporting (PP1–PP5) OR
... | scout/utils/acmg.py | 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
... | 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
... | [
"Check",
"if",
"the",
"criterias",
"for",
"Pathogenic",
"is",
"fullfilled"
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/utils/acmg.py#L2-L55 | [
"def",
"is_pathogenic",
"(",
"pvs",
",",
"ps_terms",
",",
"pm_terms",
",",
"pp_terms",
")",
":",
"if",
"pvs",
":",
"# Pathogenic (i)(a):",
"if",
"ps_terms",
":",
"return",
"True",
"if",
"pm_terms",
":",
"# Pathogenic (i)(c):",
"if",
"pp_terms",
":",
"return",
... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | is_likely_pathogenic | 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 (PS1–PS4) AND 1–2 moderate (PM1–PM6) OR
(iii) 1 Strong (PS1–PS4)... | scout/utils/acmg.py | 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... | 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... | [
"Check",
"if",
"the",
"criterias",
"for",
"Likely",
"Pathogenic",
"is",
"fullfilled"
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/utils/acmg.py#L57-L104 | [
"def",
"is_likely_pathogenic",
"(",
"pvs",
",",
"ps_terms",
",",
"pm_terms",
",",
"pp_terms",
")",
":",
"if",
"pvs",
":",
"# Likely Pathogenic (i):",
"if",
"pm_terms",
":",
"return",
"True",
"if",
"ps_terms",
":",
"# Likely Pathogenic (ii):",
"if",
"pm_terms",
"... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | is_likely_benign | 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_terms(list(str)): Terms that indicate strong evi... | scout/utils/acmg.py | 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... | 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... | [
"Check",
"if",
"criterias",
"for",
"Likely",
"Benign",
"are",
"fullfilled"
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/utils/acmg.py#L130-L154 | [
"def",
"is_likely_benign",
"(",
"bs_terms",
",",
"bp_terms",
")",
":",
"if",
"bs_terms",
":",
"# Likely Benign (i)",
"if",
"bp_terms",
":",
"return",
"True",
"# Likely Benign (ii)",
"if",
"len",
"(",
"bp_terms",
")",
">=",
"2",
":",
"return",
"True",
"return",... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | get_acmg | 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
3 - Likely Patho... | scout/utils/acmg.py | 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... | 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... | [
"Use",
"the",
"algorithm",
"described",
"in",
"ACMG",
"paper",
"to",
"get",
"a",
"ACMG",
"calssification"
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/utils/acmg.py#L156-L220 | [
"def",
"get_acmg",
"(",
"acmg_terms",
")",
":",
"prediction",
"=",
"'uncertain_significance'",
"# This variable indicates if Pathogenecity Very Strong exists",
"pvs",
"=",
"False",
"# Collection of terms with Pathogenecity Strong",
"ps_terms",
"=",
"[",
"]",
"# Collection of term... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | VariantHandler.add_gene_info | 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 | scout/adapter/mongo/variant.py | 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 []
#... | 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 []
#... | [
"Add",
"extra",
"information",
"about",
"genes",
"from",
"gene",
"panels"
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/adapter/mongo/variant.py#L39-L157 | [
"def",
"add_gene_info",
"(",
"self",
",",
"variant_obj",
",",
"gene_panels",
"=",
"None",
")",
":",
"gene_panels",
"=",
"gene_panels",
"or",
"[",
"]",
"# Add a variable that checks if there are any refseq transcripts",
"variant_obj",
"[",
"'has_refseq'",
"]",
"=",
"Fa... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | VariantHandler.variants | Returns variants specified in question for a specific case.
If skip not equal to 0 skip the first n variants.
Arguments:
case_id(str): A string that represents the case
query(dict): A dictionary with querys for the database
variant_ids(List[str])
categor... | scout/adapter/mongo/variant.py | 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): ... | 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): ... | [
"Returns",
"variants",
"specified",
"in",
"question",
"for",
"a",
"specific",
"case",
"."
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/adapter/mongo/variant.py#L159-L205 | [
"def",
"variants",
"(",
"self",
",",
"case_id",
",",
"query",
"=",
"None",
",",
"variant_ids",
"=",
"None",
",",
"category",
"=",
"'snv'",
",",
"nr_of_variants",
"=",
"10",
",",
"skip",
"=",
"0",
",",
"sort_key",
"=",
"'variant_rank'",
")",
":",
"LOG",... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | VariantHandler.sanger_variants | 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 | scout/adapter/mongo/variant.py | 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... | 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... | [
"Return",
"all",
"variants",
"with",
"sanger",
"information"
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/adapter/mongo/variant.py#L207-L223 | [
"def",
"sanger_variants",
"(",
"self",
",",
"institute_id",
"=",
"None",
",",
"case_id",
"=",
"None",
")",
":",
"query",
"=",
"{",
"'validation'",
":",
"{",
"'$exists'",
":",
"True",
"}",
"}",
"if",
"institute_id",
":",
"query",
"[",
"'institute_id'",
"]... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | VariantHandler.variant | 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_id")
Returns:
variant_object(Variant): A odm va... | scout/adapter/mongo/variant.py | 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... | 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... | [
"Returns",
"the",
"specified",
"variant",
"."
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/adapter/mongo/variant.py#L225-L252 | [
"def",
"variant",
"(",
"self",
",",
"document_id",
",",
"gene_panels",
"=",
"None",
",",
"case_id",
"=",
"None",
")",
":",
"query",
"=",
"{",
"}",
"if",
"case_id",
":",
"# search for a variant in a case",
"query",
"[",
"'case_id'",
"]",
"=",
"case_id",
"qu... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | VariantHandler.gene_variants | 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 querys for the database, including
variant_type: 'clinical', 'research'
category(str): 'sv', 'str', 'snv' or 'cancer'
nr... | scout/adapter/mongo/variant.py | 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 ... | 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 ... | [
"Return",
"all",
"variants",
"seen",
"in",
"a",
"given",
"gene",
"."
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/adapter/mongo/variant.py#L254-L283 | [
"def",
"gene_variants",
"(",
"self",
",",
"query",
"=",
"None",
",",
"category",
"=",
"'snv'",
",",
"variant_type",
"=",
"[",
"'clinical'",
"]",
",",
"nr_of_variants",
"=",
"50",
",",
"skip",
"=",
"0",
")",
":",
"mongo_variant_query",
"=",
"self",
".",
... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | VariantHandler.verified | Return all verified variants for a given institute
Args:
institute_id(str): institute id
Returns:
res(list): a list with validated variants | scout/adapter/mongo/variant.py | 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... | 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... | [
"Return",
"all",
"verified",
"variants",
"for",
"a",
"given",
"institute"
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/adapter/mongo/variant.py#L285-L312 | [
"def",
"verified",
"(",
"self",
",",
"institute_id",
")",
":",
"query",
"=",
"{",
"'verb'",
":",
"'validate'",
",",
"'institute'",
":",
"institute_id",
",",
"}",
"res",
"=",
"[",
"]",
"validate_events",
"=",
"self",
".",
"event_collection",
".",
"find",
... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | VariantHandler.get_causatives | Return all causative variants for an institute
Args:
institute_id(str)
case_id(str)
Yields:
str: variant document id | scout/adapter/mongo/variant.py | 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:
... | 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:
... | [
"Return",
"all",
"causative",
"variants",
"for",
"an",
"institute"
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/adapter/mongo/variant.py#L314-L343 | [
"def",
"get_causatives",
"(",
"self",
",",
"institute_id",
",",
"case_id",
"=",
"None",
")",
":",
"causatives",
"=",
"[",
"]",
"if",
"case_id",
":",
"case_obj",
"=",
"self",
".",
"case_collection",
".",
"find_one",
"(",
"{",
"\"_id\"",
":",
"case_id",
"}... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | VariantHandler.check_causatives | 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.
Args:
case_obj (dict): A Case object
... | scout/adapter/mongo/variant.py | 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.
... | 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.
... | [
"Check",
"if",
"there",
"are",
"any",
"variants",
"that",
"are",
"previously",
"marked",
"causative"
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/adapter/mongo/variant.py#L346-L384 | [
"def",
"check_causatives",
"(",
"self",
",",
"case_obj",
"=",
"None",
",",
"institute_obj",
"=",
"None",
")",
":",
"institute_id",
"=",
"case_obj",
"[",
"'owner'",
"]",
"if",
"case_obj",
"else",
"institute_obj",
"[",
"'_id'",
"]",
"institute_causative_variant_id... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | VariantHandler.other_causatives | Find the same variant in other cases marked causative.
Args:
case_obj(dict)
variant_obj(dict)
Yields:
other_variant(dict) | scout/adapter/mongo/variant.py | 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... | 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... | [
"Find",
"the",
"same",
"variant",
"in",
"other",
"cases",
"marked",
"causative",
"."
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/adapter/mongo/variant.py#L387-L408 | [
"def",
"other_causatives",
"(",
"self",
",",
"case_obj",
",",
"variant_obj",
")",
":",
"# variant id without \"*_[variant_type]\"",
"variant_id",
"=",
"variant_obj",
"[",
"'display_name'",
"]",
".",
"rsplit",
"(",
"'_'",
",",
"1",
")",
"[",
"0",
"]",
"institute_... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | VariantHandler.delete_variants | 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): 'snv', 'sv' or 'cancer' | scout/adapter/mongo/variant.py | 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): '... | 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): '... | [
"Delete",
"variants",
"of",
"one",
"type",
"for",
"a",
"case"
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/adapter/mongo/variant.py#L410-L427 | [
"def",
"delete_variants",
"(",
"self",
",",
"case_id",
",",
"variant_type",
",",
"category",
"=",
"None",
")",
":",
"category",
"=",
"category",
"or",
"''",
"LOG",
".",
"info",
"(",
"\"Deleting old {0} {1} variants for case {2}\"",
".",
"format",
"(",
"variant_t... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | VariantHandler.overlapping | 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 there are to many overlapping variants.
... | scout/adapter/mongo/variant.py | 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... | 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... | [
"Return",
"overlapping",
"variants",
"."
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/adapter/mongo/variant.py#L429-L459 | [
"def",
"overlapping",
"(",
"self",
",",
"variant_obj",
")",
":",
"#This is the category of the variants that we want to collect",
"category",
"=",
"'snv'",
"if",
"variant_obj",
"[",
"'category'",
"]",
"==",
"'sv'",
"else",
"'sv'",
"query",
"=",
"{",
"'$and'",
":",
... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | VariantHandler.evaluated_variants | 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)
Returns:
variants(iterable(Va... | scout/adapter/mongo/variant.py | 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)
... | 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)
... | [
"Returns",
"variants",
"that",
"has",
"been",
"evaluated"
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/adapter/mongo/variant.py#L461-L522 | [
"def",
"evaluated_variants",
"(",
"self",
",",
"case_id",
")",
":",
"# Get all variants that have been evaluated in some way for a case",
"query",
"=",
"{",
"'$and'",
":",
"[",
"{",
"'case_id'",
":",
"case_id",
"}",
",",
"{",
"'$or'",
":",
"[",
"{",
"'acmg_classif... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | VariantHandler.get_region_vcf | Produce a reduced vcf with variants from the specified coordinates
This is used for the alignment viewer.
Args:
case_obj(dict): A case from the scout database
variant_type(str): 'clinical' or 'research'. Default: 'clinical'
category(str): 'snv' or 'sv'. Default: '... | scout/adapter/mongo/variant.py | 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.... | 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.... | [
"Produce",
"a",
"reduced",
"vcf",
"with",
"variants",
"from",
"the",
"specified",
"coordinates",
"This",
"is",
"used",
"for",
"the",
"alignment",
"viewer",
"."
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/adapter/mongo/variant.py#L525-L588 | [
"def",
"get_region_vcf",
"(",
"self",
",",
"case_obj",
",",
"chrom",
"=",
"None",
",",
"start",
"=",
"None",
",",
"end",
"=",
"None",
",",
"gene_obj",
"=",
"None",
",",
"variant_type",
"=",
"'clinical'",
",",
"category",
"=",
"'snv'",
",",
"rank_threshol... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | VariantHandler.sample_variants | 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' ..
Returns:
result(iterable(Variant)) | scout/adapter/mongo/variant.py | 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' ..
... | 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' ..
... | [
"Given",
"a",
"list",
"of",
"variants",
"get",
"variant",
"objects",
"found",
"in",
"a",
"specific",
"patient"
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/adapter/mongo/variant.py#L591-L616 | [
"def",
"sample_variants",
"(",
"self",
",",
"variants",
",",
"sample_name",
",",
"category",
"=",
"'snv'",
")",
":",
"LOG",
".",
"info",
"(",
"'Retrieving variants for subject : {0}'",
".",
"format",
"(",
"sample_name",
")",
")",
"has_allele",
"=",
"re",
".",
... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | get_connection | Get a client to the mongo database
host(str): Host of database
port(int): Port of database
username(str)
password(str)
uri(str)
authdb (str): database to use for authentication
timeout(int): How long should the client try to connect | scout/adapter/client.py | 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... | 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... | [
"Get",
"a",
"client",
"to",
"the",
"mongo",
"database"
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/adapter/client.py#L23-L55 | [
"def",
"get_connection",
"(",
"host",
"=",
"'localhost'",
",",
"port",
"=",
"27017",
",",
"username",
"=",
"None",
",",
"password",
"=",
"None",
",",
"uri",
"=",
"None",
",",
"mongodb",
"=",
"None",
",",
"authdb",
"=",
"None",
",",
"timeout",
"=",
"2... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | set_submission_objects | Creates a list of submission objects (variant and case-data) from the clinvar submission form in blueprints/variants/clinvar.html.
Args:
form_fields(dict): it's the submission form dictionary. Keys have the same names as CLINVAR_HEADER and CASEDATA_HEADER
Returns:
submission_... | scout/parse/clinvar.py | def set_submission_objects(form_fields):
"""Creates a list of submission objects (variant and case-data) from the clinvar submission form in blueprints/variants/clinvar.html.
Args:
form_fields(dict): it's the submission form dictionary. Keys have the same names as CLINVAR_HEADER and CASEDATA_H... | def set_submission_objects(form_fields):
"""Creates a list of submission objects (variant and case-data) from the clinvar submission form in blueprints/variants/clinvar.html.
Args:
form_fields(dict): it's the submission form dictionary. Keys have the same names as CLINVAR_HEADER and CASEDATA_H... | [
"Creates",
"a",
"list",
"of",
"submission",
"objects",
"(",
"variant",
"and",
"case",
"-",
"data",
")",
"from",
"the",
"clinvar",
"submission",
"form",
"in",
"blueprints",
"/",
"variants",
"/",
"clinvar",
".",
"html",
"."
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/parse/clinvar.py#L3-L20 | [
"def",
"set_submission_objects",
"(",
"form_fields",
")",
":",
"variant_ids",
"=",
"get_submission_variants",
"(",
"form_fields",
")",
"# A list of variant IDs present in the submitted form",
"# Extract list of variant objects to be submitted",
"variant_objs",
"=",
"get_objects_from_... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | get_objects_from_form | 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): it's the submission form dictionary. Keys have the same names as CLINVA... | scout/parse/clinvar.py | 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)... | 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)... | [
"Extract",
"the",
"objects",
"to",
"be",
"saved",
"in",
"the",
"clinvar",
"database",
"collection",
".",
"object_type",
"param",
"specifies",
"if",
"these",
"objects",
"are",
"variant",
"or",
"casedata",
"objects"
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/parse/clinvar.py#L23-L77 | [
"def",
"get_objects_from_form",
"(",
"variant_ids",
",",
"form_fields",
",",
"object_type",
")",
":",
"submission_fields",
"=",
"[",
"]",
"if",
"object_type",
"==",
"'variant'",
":",
"submission_fields",
"=",
"CLINVAR_HEADER",
"else",
":",
"#collect casedata objects",... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | get_submission_variants | Extracts a list of variant ids from the clinvar submission form in blueprints/variants/clinvar.html (creation of a new clinvar submission).
Args:
form_fields(dict): it's the submission form dictionary. Keys have the same names as CLINVAR_HEADER and CASEDATA_HEADER
Returns:
cl... | scout/parse/clinvar.py | def get_submission_variants(form_fields):
"""Extracts a list of variant ids from the clinvar submission form in blueprints/variants/clinvar.html (creation of a new clinvar submission).
Args:
form_fields(dict): it's the submission form dictionary. Keys have the same names as CLINVAR_HEADER and ... | def get_submission_variants(form_fields):
"""Extracts a list of variant ids from the clinvar submission form in blueprints/variants/clinvar.html (creation of a new clinvar submission).
Args:
form_fields(dict): it's the submission form dictionary. Keys have the same names as CLINVAR_HEADER and ... | [
"Extracts",
"a",
"list",
"of",
"variant",
"ids",
"from",
"the",
"clinvar",
"submission",
"form",
"in",
"blueprints",
"/",
"variants",
"/",
"clinvar",
".",
"html",
"(",
"creation",
"of",
"a",
"new",
"clinvar",
"submission",
")",
"."
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/parse/clinvar.py#L80-L101 | [
"def",
"get_submission_variants",
"(",
"form_fields",
")",
":",
"clinvars",
"=",
"[",
"]",
"# if the html checkbox named 'all_vars' is checked in the html form, then all pinned variants from a case should be included in the clinvar submission file,",
"# otherwise just the selected one.",
"if... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | clinvar_submission_header | 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 'case_data'
Returns:
custom_header(dict): A dict... | scout/parse/clinvar.py | 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... | 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... | [
"Determine",
"which",
"fields",
"to",
"include",
"in",
"csv",
"header",
"by",
"checking",
"a",
"list",
"of",
"submission",
"objects"
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/parse/clinvar.py#L104-L130 | [
"def",
"clinvar_submission_header",
"(",
"submission_objs",
",",
"csv_type",
")",
":",
"complete_header",
"=",
"{",
"}",
"# header containing all available fields",
"custom_header",
"=",
"{",
"}",
"# header reflecting the real data included in the submission objects",
"if",
"cs... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | clinvar_submission_lines | 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
submission_header(dict) : as in constants CLINVAR_HEADER and CASEDAT... | scout/parse/clinvar.py | 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
... | 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
... | [
"Create",
"the",
"lines",
"to",
"include",
"in",
"a",
"Clinvar",
"submission",
"csv",
"file",
"from",
"a",
"list",
"of",
"submission",
"objects",
"and",
"a",
"custom",
"document",
"header"
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/parse/clinvar.py#L133-L154 | [
"def",
"clinvar_submission_lines",
"(",
"submission_objs",
",",
"submission_header",
")",
":",
"submission_lines",
"=",
"[",
"]",
"for",
"submission_obj",
"in",
"submission_objs",
":",
"# Loop over the submission objects. Each of these is a line",
"csv_line",
"=",
"[",
"]",... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | load_transcripts | Load all the transcripts
Transcript information is from ensembl.
Args:
adapter(MongoAdapter)
transcripts_lines(iterable): iterable with ensembl transcript lines
build(str)
ensembl_genes(dict): Map from ensembl_id -> HgncGene
Returns:
transcript_objs(list): A list w... | scout/load/transcript.py | 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... | 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... | [
"Load",
"all",
"the",
"transcripts"
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/load/transcript.py#L15-L114 | [
"def",
"load_transcripts",
"(",
"adapter",
",",
"transcripts_lines",
"=",
"None",
",",
"build",
"=",
"'37'",
",",
"ensembl_genes",
"=",
"None",
")",
":",
"# Fetch all genes with ensemblid as keys",
"ensembl_genes",
"=",
"ensembl_genes",
"or",
"adapter",
".",
"ensemb... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | panel | Add a gene panel to the database. | scout/commands/load/panel.py | 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... | 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... | [
"Add",
"a",
"gene",
"panel",
"to",
"the",
"database",
"."
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/commands/load/panel.py#L53-L94 | [
"def",
"panel",
"(",
"context",
",",
"path",
",",
"date",
",",
"display_name",
",",
"version",
",",
"panel_type",
",",
"panel_id",
",",
"institute",
",",
"omim",
",",
"api_key",
",",
"panel_app",
")",
":",
"adapter",
"=",
"context",
".",
"obj",
"[",
"'... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | build_exon | 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,
"transcript": str, # ENST ID
"hgnc_id": int,... | scout/build/genes/exon.py | 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... | 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... | [
"Build",
"a",
"Exon",
"object",
"object"
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/build/genes/exon.py#L4-L77 | [
"def",
"build_exon",
"(",
"exon_info",
",",
"build",
"=",
"'37'",
")",
":",
"try",
":",
"chrom",
"=",
"exon_info",
"[",
"'chrom'",
"]",
"except",
"KeyError",
":",
"raise",
"KeyError",
"(",
"\"Exons has to have a chromosome\"",
")",
"try",
":",
"start",
"=",
... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | panel | Delete a version of a gene panel or all versions of a gene panel | scout/commands/delete/delete_command.py | 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... | 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... | [
"Delete",
"a",
"version",
"of",
"a",
"gene",
"panel",
"or",
"all",
"versions",
"of",
"a",
"gene",
"panel"
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/commands/delete/delete_command.py#L16-L26 | [
"def",
"panel",
"(",
"context",
",",
"panel_id",
",",
"version",
")",
":",
"LOG",
".",
"info",
"(",
"\"Running scout delete panel\"",
")",
"adapter",
"=",
"context",
".",
"obj",
"[",
"'adapter'",
"]",
"panel_objs",
"=",
"adapter",
".",
"gene_panels",
"(",
... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | index | Delete all indexes in the database | scout/commands/delete/delete_command.py | 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") | 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") | [
"Delete",
"all",
"indexes",
"in",
"the",
"database"
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/commands/delete/delete_command.py#L52-L59 | [
"def",
"index",
"(",
"context",
")",
":",
"LOG",
".",
"info",
"(",
"\"Running scout delete index\"",
")",
"adapter",
"=",
"context",
".",
"obj",
"[",
"'adapter'",
"]",
"for",
"collection",
"in",
"adapter",
".",
"db",
".",
"collection_names",
"(",
")",
":",... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | user | Delete a user from the database | scout/commands/delete/delete_command.py | 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) | 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) | [
"Delete",
"a",
"user",
"from",
"the",
"database"
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/commands/delete/delete_command.py#L65-L73 | [
"def",
"user",
"(",
"context",
",",
"mail",
")",
":",
"LOG",
".",
"info",
"(",
"\"Running scout delete user\"",
")",
"adapter",
"=",
"context",
".",
"obj",
"[",
"'adapter'",
"]",
"user_obj",
"=",
"adapter",
".",
"user",
"(",
"mail",
")",
"if",
"not",
"... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | genes | Delete all genes in the database | scout/commands/delete/delete_command.py | 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() | 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() | [
"Delete",
"all",
"genes",
"in",
"the",
"database"
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/commands/delete/delete_command.py#L79-L88 | [
"def",
"genes",
"(",
"context",
",",
"build",
")",
":",
"LOG",
".",
"info",
"(",
"\"Running scout delete genes\"",
")",
"adapter",
"=",
"context",
".",
"obj",
"[",
"'adapter'",
"]",
"if",
"build",
":",
"LOG",
".",
"info",
"(",
"\"Dropping genes collection fo... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | exons | Delete all exons in the database | scout/commands/delete/delete_command.py | def exons(context, build):
"""Delete all exons in the database"""
LOG.info("Running scout delete exons")
adapter = context.obj['adapter']
adapter.drop_exons(build) | def exons(context, build):
"""Delete all exons in the database"""
LOG.info("Running scout delete exons")
adapter = context.obj['adapter']
adapter.drop_exons(build) | [
"Delete",
"all",
"exons",
"in",
"the",
"database"
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/commands/delete/delete_command.py#L93-L98 | [
"def",
"exons",
"(",
"context",
",",
"build",
")",
":",
"LOG",
".",
"info",
"(",
"\"Running scout delete exons\"",
")",
"adapter",
"=",
"context",
".",
"obj",
"[",
"'adapter'",
"]",
"adapter",
".",
"drop_exons",
"(",
"build",
")"
] | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | case | Delete a case and it's variants from the database | scout/commands/delete/delete_command.py | 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:
... | 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:
... | [
"Delete",
"a",
"case",
"and",
"it",
"s",
"variants",
"from",
"the",
"database"
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/commands/delete/delete_command.py#L106-L132 | [
"def",
"case",
"(",
"context",
",",
"institute",
",",
"case_id",
",",
"display_name",
")",
":",
"adapter",
"=",
"context",
".",
"obj",
"[",
"'adapter'",
"]",
"if",
"not",
"(",
"case_id",
"or",
"display_name",
")",
":",
"click",
".",
"echo",
"(",
"\"Ple... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | individuals | Show all individuals from all cases in the database | scout/commands/view/individuals.py | 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... | 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... | [
"Show",
"all",
"individuals",
"from",
"all",
"cases",
"in",
"the",
"database"
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/commands/view/individuals.py#L19-L52 | [
"def",
"individuals",
"(",
"context",
",",
"institute",
",",
"causatives",
",",
"case_id",
")",
":",
"LOG",
".",
"info",
"(",
"\"Running scout view individuals\"",
")",
"adapter",
"=",
"context",
".",
"obj",
"[",
"'adapter'",
"]",
"individuals",
"=",
"[",
"]... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | hpo_terms | Extract all phenotype-associated terms for a case. Drawback of this method is that
it returns the same phenotype terms for each affected individual
of the case.
Args:
case_obj(dict): a scout case object
Returns:
features(list): a list of phenotype objects that loo... | scout/parse/matchmaker.py | def hpo_terms(case_obj):
"""Extract all phenotype-associated terms for a case. Drawback of this method is that
it returns the same phenotype terms for each affected individual
of the case.
Args:
case_obj(dict): a scout case object
Returns:
features(list): a li... | def hpo_terms(case_obj):
"""Extract all phenotype-associated terms for a case. Drawback of this method is that
it returns the same phenotype terms for each affected individual
of the case.
Args:
case_obj(dict): a scout case object
Returns:
features(list): a li... | [
"Extract",
"all",
"phenotype",
"-",
"associated",
"terms",
"for",
"a",
"case",
".",
"Drawback",
"of",
"this",
"method",
"is",
"that",
"it",
"returns",
"the",
"same",
"phenotype",
"terms",
"for",
"each",
"affected",
"individual",
"of",
"the",
"case",
".",
"... | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/parse/matchmaker.py#L7-L36 | [
"def",
"hpo_terms",
"(",
"case_obj",
")",
":",
"LOG",
".",
"info",
"(",
"'Collecting phenotype terms for case {}'",
".",
"format",
"(",
"case_obj",
".",
"get",
"(",
"'display_name'",
")",
")",
")",
"features",
"=",
"[",
"]",
"case_features",
"=",
"case_obj",
... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | omim_terms | Extract all OMIM phenotypes available for the case
Args:
case_obj(dict): a scout case object
Returns:
disorders(list): a list of OMIM disorder objects | scout/parse/matchmaker.py | def omim_terms(case_obj):
"""Extract all OMIM phenotypes available for the case
Args:
case_obj(dict): a scout case object
Returns:
disorders(list): a list of OMIM disorder objects
"""
LOG.info("Collecting OMIM disorders for case {}".format(case_obj.get('display_name')))
disorders... | def omim_terms(case_obj):
"""Extract all OMIM phenotypes available for the case
Args:
case_obj(dict): a scout case object
Returns:
disorders(list): a list of OMIM disorder objects
"""
LOG.info("Collecting OMIM disorders for case {}".format(case_obj.get('display_name')))
disorders... | [
"Extract",
"all",
"OMIM",
"phenotypes",
"available",
"for",
"the",
"case",
"Args",
":",
"case_obj",
"(",
"dict",
")",
":",
"a",
"scout",
"case",
"object",
"Returns",
":",
"disorders",
"(",
"list",
")",
":",
"a",
"list",
"of",
"OMIM",
"disorder",
"objects... | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/parse/matchmaker.py#L39-L56 | [
"def",
"omim_terms",
"(",
"case_obj",
")",
":",
"LOG",
".",
"info",
"(",
"\"Collecting OMIM disorders for case {}\"",
".",
"format",
"(",
"case_obj",
".",
"get",
"(",
"'display_name'",
")",
")",
")",
"disorders",
"=",
"[",
"]",
"case_disorders",
"=",
"case_obj... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | genomic_features | Extract and parse matchmaker-like genomic features from pinned variants
of a patient
Args:
store(MongoAdapter) : connection to the database
case_obj(dict): a scout case object
sample_name(str): sample display name
genes_only(bool): if True only gene names will be included in ... | scout/parse/matchmaker.py | def genomic_features(store, case_obj, sample_name, genes_only):
"""Extract and parse matchmaker-like genomic features from pinned variants
of a patient
Args:
store(MongoAdapter) : connection to the database
case_obj(dict): a scout case object
sample_name(str): sample display name... | def genomic_features(store, case_obj, sample_name, genes_only):
"""Extract and parse matchmaker-like genomic features from pinned variants
of a patient
Args:
store(MongoAdapter) : connection to the database
case_obj(dict): a scout case object
sample_name(str): sample display name... | [
"Extract",
"and",
"parse",
"matchmaker",
"-",
"like",
"genomic",
"features",
"from",
"pinned",
"variants",
"of",
"a",
"patient",
"Args",
":",
"store",
"(",
"MongoAdapter",
")",
":",
"connection",
"to",
"the",
"database",
"case_obj",
"(",
"dict",
")",
":",
... | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/parse/matchmaker.py#L59-L139 | [
"def",
"genomic_features",
"(",
"store",
",",
"case_obj",
",",
"sample_name",
",",
"genes_only",
")",
":",
"g_features",
"=",
"[",
"]",
"# genome build is required",
"build",
"=",
"case_obj",
"[",
"'genome_build'",
"]",
"if",
"not",
"build",
"in",
"[",
"'37'",... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | parse_matches | 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
# match_objs looks like this:
... | scout/parse/matchmaker.py | 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
... | 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
... | [
"Parse",
"a",
"list",
"of",
"matchmaker",
"matches",
"objects",
"and",
"returns",
"a",
"readable",
"list",
"of",
"matches",
"to",
"display",
"in",
"matchmaker",
"matches",
"view",
"."
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/parse/matchmaker.py#L142-L226 | [
"def",
"parse_matches",
"(",
"patient_id",
",",
"match_objs",
")",
":",
"LOG",
".",
"info",
"(",
"'Parsing MatchMaker matches for patient {}'",
".",
"format",
"(",
"patient_id",
")",
")",
"parsed_matches",
"=",
"[",
"]",
"for",
"match_obj",
"in",
"match_objs",
"... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | cases | Display cases from the database | scout/commands/view/case.py | 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:
... | 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:
... | [
"Display",
"cases",
"from",
"the",
"database"
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/commands/view/case.py#L26-L78 | [
"def",
"cases",
"(",
"context",
",",
"institute",
",",
"display_name",
",",
"case_id",
",",
"nr_variants",
",",
"variants_treshold",
")",
":",
"LOG",
".",
"info",
"(",
"\"Running scout view institutes\"",
")",
"adapter",
"=",
"context",
".",
"obj",
"[",
"'adap... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | load_user | Returns the currently active user as an object. | scout/server/blueprints/login/views.py | 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 | 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 | [
"Returns",
"the",
"currently",
"active",
"user",
"as",
"an",
"object",
"."
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/server/blueprints/login/views.py#L24-L28 | [
"def",
"load_user",
"(",
"user_email",
")",
":",
"user_obj",
"=",
"store",
".",
"user",
"(",
"user_email",
")",
"user_inst",
"=",
"LoginUser",
"(",
"user_obj",
")",
"if",
"user_obj",
"else",
"None",
"return",
"user_inst"
] | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | login | Login a user if they have access. | scout/server/blueprints/login/views.py | 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... | 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... | [
"Login",
"a",
"user",
"if",
"they",
"have",
"access",
"."
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/server/blueprints/login/views.py#L39-L56 | [
"def",
"login",
"(",
")",
":",
"# store potential next param URL in the session",
"if",
"'next'",
"in",
"request",
".",
"args",
":",
"session",
"[",
"'next_url'",
"]",
"=",
"request",
".",
"args",
"[",
"'next'",
"]",
"if",
"current_app",
".",
"config",
".",
... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | MMEHandler.case_mme_update | Updates a case after a submission to MatchMaker Exchange
Args:
case_obj(dict): a scout case object
user_obj(dict): a scout user object
mme_subm_obj(dict): contains MME submission params and server response
Returns:
updated_case(dict... | scout/adapter/mongo/matchmaker.py | def case_mme_update(self, case_obj, user_obj, mme_subm_obj):
"""Updates a case after a submission to MatchMaker Exchange
Args:
case_obj(dict): a scout case object
user_obj(dict): a scout user object
mme_subm_obj(dict): contains MME submission params an... | def case_mme_update(self, case_obj, user_obj, mme_subm_obj):
"""Updates a case after a submission to MatchMaker Exchange
Args:
case_obj(dict): a scout case object
user_obj(dict): a scout user object
mme_subm_obj(dict): contains MME submission params an... | [
"Updates",
"a",
"case",
"after",
"a",
"submission",
"to",
"MatchMaker",
"Exchange",
"Args",
":",
"case_obj",
"(",
"dict",
")",
":",
"a",
"scout",
"case",
"object",
"user_obj",
"(",
"dict",
")",
":",
"a",
"scout",
"user",
"object",
"mme_subm_obj",
"(",
"d... | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/adapter/mongo/matchmaker.py#L10-L50 | [
"def",
"case_mme_update",
"(",
"self",
",",
"case_obj",
",",
"user_obj",
",",
"mme_subm_obj",
")",
":",
"created",
"=",
"None",
"patient_ids",
"=",
"[",
"]",
"updated",
"=",
"datetime",
".",
"now",
"(",
")",
"if",
"'mme_submission'",
"in",
"case_obj",
"and... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | MMEHandler.case_mme_delete | Delete a MatchMaker submission from a case record
and creates the related event.
Args:
case_obj(dict): a scout case object
user_obj(dict): a scout user object
Returns:
updated_case(dict): the updated scout case | scout/adapter/mongo/matchmaker.py | def case_mme_delete(self, case_obj, user_obj):
"""Delete a MatchMaker submission from a case record
and creates the related event.
Args:
case_obj(dict): a scout case object
user_obj(dict): a scout user object
Returns:
updated_case(dict): the updated... | def case_mme_delete(self, case_obj, user_obj):
"""Delete a MatchMaker submission from a case record
and creates the related event.
Args:
case_obj(dict): a scout case object
user_obj(dict): a scout user object
Returns:
updated_case(dict): the updated... | [
"Delete",
"a",
"MatchMaker",
"submission",
"from",
"a",
"case",
"record",
"and",
"creates",
"the",
"related",
"event",
".",
"Args",
":",
"case_obj",
"(",
"dict",
")",
":",
"a",
"scout",
"case",
"object",
"user_obj",
"(",
"dict",
")",
":",
"a",
"scout",
... | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/adapter/mongo/matchmaker.py#L53-L75 | [
"def",
"case_mme_delete",
"(",
"self",
",",
"case_obj",
",",
"user_obj",
")",
":",
"institute_obj",
"=",
"self",
".",
"institute",
"(",
"case_obj",
"[",
"'owner'",
"]",
")",
"# create events for subjects removal from Matchmaker this cas",
"for",
"individual",
"in",
... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | build_institute | Build a institute object
Args:
internal_id(str)
display_name(str)
sanger_recipients(list(str)): List with email addresses
Returns:
institute_obj(scout.models.Institute) | scout/build/institute.py | 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... | 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... | [
"Build",
"a",
"institute",
"object"
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/build/institute.py#L7-L35 | [
"def",
"build_institute",
"(",
"internal_id",
",",
"display_name",
",",
"sanger_recipients",
"=",
"None",
",",
"coverage_cutoff",
"=",
"None",
",",
"frequency_cutoff",
"=",
"None",
")",
":",
"LOG",
".",
"info",
"(",
"\"Building institute %s with display name %s\"",
... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | EventHandler.delete_event | Delete a event
Arguments:
event_id (str): The database key for the event | scout/adapter/mongo/event.py | 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... | 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... | [
"Delete",
"a",
"event"
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/adapter/mongo/event.py#L19-L29 | [
"def",
"delete_event",
"(",
"self",
",",
"event_id",
")",
":",
"LOG",
".",
"info",
"(",
"\"Deleting event{0}\"",
".",
"format",
"(",
"event_id",
")",
")",
"if",
"not",
"isinstance",
"(",
"event_id",
",",
"ObjectId",
")",
":",
"event_id",
"=",
"ObjectId",
... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | EventHandler.create_event | Create a Event with the parameters given.
Arguments:
institute (dict): A institute
case (dict): A case
user (dict): A User
link (str): The url to be used in the event
category (str): case or variant
verb (str): What type of event
... | scout/adapter/mongo/event.py | 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 ... | 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 ... | [
"Create",
"a",
"Event",
"with",
"the",
"parameters",
"given",
"."
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/adapter/mongo/event.py#L31-L72 | [
"def",
"create_event",
"(",
"self",
",",
"institute",
",",
"case",
",",
"user",
",",
"link",
",",
"category",
",",
"verb",
",",
"subject",
",",
"level",
"=",
"'specific'",
",",
"variant",
"=",
"None",
",",
"content",
"=",
"None",
",",
"panel",
"=",
"... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | EventHandler.events | Fetch events from the database.
Args:
institute (dict): A institute
case (dict): A case
variant_id (str, optional): global variant id
level (str, optional): restrict comments to 'specific' or 'global'
comments (bool, optional): restrict events to in... | scout/adapter/mongo/event.py | 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... | 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... | [
"Fetch",
"events",
"from",
"the",
"database",
"."
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/adapter/mongo/event.py#L74-L135 | [
"def",
"events",
"(",
"self",
",",
"institute",
",",
"case",
"=",
"None",
",",
"variant_id",
"=",
"None",
",",
"level",
"=",
"None",
",",
"comments",
"=",
"False",
",",
"panel",
"=",
"None",
")",
":",
"query",
"=",
"{",
"}",
"if",
"variant_id",
":"... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | EventHandler.user_events | Fetch all events by a specific user. | scout/adapter/mongo/event.py | 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) | 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) | [
"Fetch",
"all",
"events",
"by",
"a",
"specific",
"user",
"."
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/adapter/mongo/event.py#L137-L140 | [
"def",
"user_events",
"(",
"self",
",",
"user_obj",
"=",
"None",
")",
":",
"query",
"=",
"dict",
"(",
"user_id",
"=",
"user_obj",
"[",
"'_id'",
"]",
")",
"if",
"user_obj",
"else",
"dict",
"(",
")",
"return",
"self",
".",
"event_collection",
".",
"find"... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | EventHandler.add_phenotype | Add a new phenotype term to a case
Create a phenotype term and event with the given information
Args:
institute (Institute): A Institute object
case (Case): Case object
user (User): A User object
link (str): The url to be used in ... | scout/adapter/mongo/event.py | 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
... | 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
... | [
"Add",
"a",
"new",
"phenotype",
"term",
"to",
"a",
"case"
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/adapter/mongo/event.py#L142-L228 | [
"def",
"add_phenotype",
"(",
"self",
",",
"institute",
",",
"case",
",",
"user",
",",
"link",
",",
"hpo_term",
"=",
"None",
",",
"omim_term",
"=",
"None",
",",
"is_group",
"=",
"False",
")",
":",
"hpo_results",
"=",
"[",
"]",
"try",
":",
"if",
"hpo_t... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | EventHandler.remove_phenotype | Remove an existing phenotype from a case
Args:
institute (dict): A Institute object
case (dict): Case object
user (dict): A User object
link (dict): The url to be used in the event
phenotype_id (str): A phenotype id
Returns:
updat... | scout/adapter/mongo/event.py | 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... | 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... | [
"Remove",
"an",
"existing",
"phenotype",
"from",
"a",
"case"
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/adapter/mongo/event.py#L230-L283 | [
"def",
"remove_phenotype",
"(",
"self",
",",
"institute",
",",
"case",
",",
"user",
",",
"link",
",",
"phenotype_id",
",",
"is_group",
"=",
"False",
")",
":",
"LOG",
".",
"info",
"(",
"\"Removing HPO term from case {0}\"",
".",
"format",
"(",
"case",
"[",
... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | EventHandler.comment | 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.
A variant comment can be 'global' or specific. The global comments will
be shown for this variation in all case... | scout/adapter/mongo/event.py | 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.
... | 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.
... | [
"Add",
"a",
"comment",
"to",
"a",
"variant",
"or",
"a",
"case",
"."
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/adapter/mongo/event.py#L285-L342 | [
"def",
"comment",
"(",
"self",
",",
"institute",
",",
"case",
",",
"user",
",",
"link",
",",
"variant",
"=",
"None",
",",
"content",
"=",
"\"\"",
",",
"comment_level",
"=",
"\"specific\"",
")",
":",
"if",
"not",
"comment_level",
"in",
"COMMENT_LEVELS",
"... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | parse_genotypes | 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 | scout/parse/variant/genotype.py | 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
"""
... | 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
"""
... | [
"Parse",
"the",
"genotype",
"calls",
"for",
"a",
"variant"
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/parse/variant/genotype.py#L23-L37 | [
"def",
"parse_genotypes",
"(",
"variant",
",",
"individuals",
",",
"individual_positions",
")",
":",
"genotypes",
"=",
"[",
"]",
"for",
"ind",
"in",
"individuals",
":",
"pos",
"=",
"individual_positions",
"[",
"ind",
"[",
"'individual_id'",
"]",
"]",
"genotype... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | parse_genotype | Get the genotype information in the proper format
Sv specific format fields:
##FORMAT=<ID=DV,Number=1,Type=Integer,
Description="Number of paired-ends that support the event">
##FORMAT=<ID=PE,Number=1,Type=Integer,
Description="Number of paired-ends that support the event">
##FORMAT=<ID=PR,N... | scout/parse/variant/genotype.py | def parse_genotype(variant, ind, pos):
"""Get the genotype information in the proper format
Sv specific format fields:
##FORMAT=<ID=DV,Number=1,Type=Integer,
Description="Number of paired-ends that support the event">
##FORMAT=<ID=PE,Number=1,Type=Integer,
Description="Number of paired-ends t... | def parse_genotype(variant, ind, pos):
"""Get the genotype information in the proper format
Sv specific format fields:
##FORMAT=<ID=DV,Number=1,Type=Integer,
Description="Number of paired-ends that support the event">
##FORMAT=<ID=PE,Number=1,Type=Integer,
Description="Number of paired-ends t... | [
"Get",
"the",
"genotype",
"information",
"in",
"the",
"proper",
"format"
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/parse/variant/genotype.py#L39-L217 | [
"def",
"parse_genotype",
"(",
"variant",
",",
"ind",
",",
"pos",
")",
":",
"gt_call",
"=",
"{",
"}",
"ind_id",
"=",
"ind",
"[",
"'individual_id'",
"]",
"gt_call",
"[",
"'individual_id'",
"]",
"=",
"ind_id",
"gt_call",
"[",
"'display_name'",
"]",
"=",
"in... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | is_par | Check if a variant is in the Pseudo Autosomal Region or not
Args:
chromosome(str)
position(int)
build(str): The genome build
Returns:
bool | scout/utils/coordinates.py | def is_par(chromosome, position, build='37'):
"""Check if a variant is in the Pseudo Autosomal Region or not
Args:
chromosome(str)
position(int)
build(str): The genome build
Returns:
bool
"""
chrom_match = CHR_PATTERN.match(chromosome)
chrom = chrom_matc... | def is_par(chromosome, position, build='37'):
"""Check if a variant is in the Pseudo Autosomal Region or not
Args:
chromosome(str)
position(int)
build(str): The genome build
Returns:
bool
"""
chrom_match = CHR_PATTERN.match(chromosome)
chrom = chrom_matc... | [
"Check",
"if",
"a",
"variant",
"is",
"in",
"the",
"Pseudo",
"Autosomal",
"Region",
"or",
"not",
"Args",
":",
"chromosome",
"(",
"str",
")",
"position",
"(",
"int",
")",
"build",
"(",
"str",
")",
":",
"The",
"genome",
"build",
"Returns",
":",
"bool"
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/utils/coordinates.py#L3-L24 | [
"def",
"is_par",
"(",
"chromosome",
",",
"position",
",",
"build",
"=",
"'37'",
")",
":",
"chrom_match",
"=",
"CHR_PATTERN",
".",
"match",
"(",
"chromosome",
")",
"chrom",
"=",
"chrom_match",
".",
"group",
"(",
"2",
")",
"# PAR regions are only on X and Y",
... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | check_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 | scout/utils/coordinates.py | 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... | 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... | [
"Check",
"if",
"the",
"variant",
"is",
"in",
"the",
"interval",
"given",
"by",
"the",
"coordinates"
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/utils/coordinates.py#L26-L43 | [
"def",
"check_coordinates",
"(",
"chromosome",
",",
"pos",
",",
"coordinates",
")",
":",
"chrom_match",
"=",
"CHR_PATTERN",
".",
"match",
"(",
"chromosome",
")",
"chrom",
"=",
"chrom_match",
".",
"group",
"(",
"2",
")",
"if",
"chrom",
"!=",
"coordinates",
... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | export_panels | Export all genes in gene panels
Exports the union of genes in one or several gene panels to a bed like format with coordinates.
Args:
adapter(scout.adapter.MongoAdapter)
panels(iterable(str)): Iterable with panel ids
bed(bool): If lines should be bed formated | scout/export/panel.py | def export_panels(adapter, panels, versions=None, build='37'):
"""Export all genes in gene panels
Exports the union of genes in one or several gene panels to a bed like format with coordinates.
Args:
adapter(scout.adapter.MongoAdapter)
panels(iterable(str)): Iterable with panel ids... | def export_panels(adapter, panels, versions=None, build='37'):
"""Export all genes in gene panels
Exports the union of genes in one or several gene panels to a bed like format with coordinates.
Args:
adapter(scout.adapter.MongoAdapter)
panels(iterable(str)): Iterable with panel ids... | [
"Export",
"all",
"genes",
"in",
"gene",
"panels",
"Exports",
"the",
"union",
"of",
"genes",
"in",
"one",
"or",
"several",
"gene",
"panels",
"to",
"a",
"bed",
"like",
"format",
"with",
"coordinates",
".",
"Args",
":",
"adapter",
"(",
"scout",
".",
"adapte... | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/export/panel.py#L8-L92 | [
"def",
"export_panels",
"(",
"adapter",
",",
"panels",
",",
"versions",
"=",
"None",
",",
"build",
"=",
"'37'",
")",
":",
"if",
"versions",
"and",
"(",
"len",
"(",
"versions",
")",
"!=",
"len",
"(",
"panels",
")",
")",
":",
"raise",
"SyntaxError",
"(... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | export_gene_panels | Export the genes of a gene panel
Takes a list of gene panel names and return the lines of the gene panels.
Unlike export_panels this function only export the genes and extra information,
not the coordinates.
Args:
adapter(MongoAdapter)
panels(list(str))
version(float):... | scout/export/panel.py | def export_gene_panels(adapter, panels, version=None):
"""Export the genes of a gene panel
Takes a list of gene panel names and return the lines of the gene panels.
Unlike export_panels this function only export the genes and extra information,
not the coordinates.
Args:
adapter(M... | def export_gene_panels(adapter, panels, version=None):
"""Export the genes of a gene panel
Takes a list of gene panel names and return the lines of the gene panels.
Unlike export_panels this function only export the genes and extra information,
not the coordinates.
Args:
adapter(M... | [
"Export",
"the",
"genes",
"of",
"a",
"gene",
"panel",
"Takes",
"a",
"list",
"of",
"gene",
"panel",
"names",
"and",
"return",
"the",
"lines",
"of",
"the",
"gene",
"panels",
".",
"Unlike",
"export_panels",
"this",
"function",
"only",
"export",
"the",
"genes"... | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/export/panel.py#L94-L146 | [
"def",
"export_gene_panels",
"(",
"adapter",
",",
"panels",
",",
"version",
"=",
"None",
")",
":",
"if",
"version",
"and",
"len",
"(",
"panels",
")",
">",
"1",
":",
"raise",
"SyntaxError",
"(",
"\"Version only possible with one panel\"",
")",
"bed_string",
"="... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | hpo_terms | Render search box and view for HPO phenotype terms | scout/server/blueprints/phenotypes/views.py | 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')
... | 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')
... | [
"Render",
"search",
"box",
"and",
"view",
"for",
"HPO",
"phenotype",
"terms"
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/server/blueprints/phenotypes/views.py#L12-L21 | [
"def",
"hpo_terms",
"(",
")",
":",
"if",
"request",
".",
"method",
"==",
"'GET'",
":",
"data",
"=",
"controllers",
".",
"hpo_terms",
"(",
"store",
"=",
"store",
",",
"limit",
"=",
"100",
")",
"return",
"data",
"else",
":",
"# POST. user is searching for a ... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | transcripts | Export all transcripts to .bed like format | scout/commands/export/transcript.py | 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... | 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... | [
"Export",
"all",
"transcripts",
"to",
".",
"bed",
"like",
"format"
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/commands/export/transcript.py#L15-L36 | [
"def",
"transcripts",
"(",
"context",
",",
"build",
")",
":",
"LOG",
".",
"info",
"(",
"\"Running scout export transcripts\"",
")",
"adapter",
"=",
"context",
".",
"obj",
"[",
"'adapter'",
"]",
"header",
"=",
"[",
"\"#Chrom\\tStart\\tEnd\\tTranscript\\tRefSeq\\tHgnc... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | exons | Load exons into the scout database | scout/commands/load/exons.py | 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... | 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... | [
"Load",
"exons",
"into",
"the",
"scout",
"database"
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/commands/load/exons.py#L23-L43 | [
"def",
"exons",
"(",
"context",
",",
"build",
")",
":",
"adapter",
"=",
"context",
".",
"obj",
"[",
"'adapter'",
"]",
"start",
"=",
"datetime",
".",
"now",
"(",
")",
"# Test if there are any exons loaded",
"nr_exons",
"=",
"adapter",
".",
"exons",
"(",
"bu... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | intervals | Show all indexes in the database | scout/commands/view/intervals.py | def intervals(context, build):
"""Show all indexes in the database"""
LOG.info("Running scout view index")
adapter = context.obj['adapter']
intervals = adapter.get_coding_intervals(build)
nr_intervals = 0
longest = 0
for chrom in CHROMOSOMES:
for iv in intervals[chrom]:
... | def intervals(context, build):
"""Show all indexes in the database"""
LOG.info("Running scout view index")
adapter = context.obj['adapter']
intervals = adapter.get_coding_intervals(build)
nr_intervals = 0
longest = 0
for chrom in CHROMOSOMES:
for iv in intervals[chrom]:
... | [
"Show",
"all",
"indexes",
"in",
"the",
"database"
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/commands/view/intervals.py#L15-L34 | [
"def",
"intervals",
"(",
"context",
",",
"build",
")",
":",
"LOG",
".",
"info",
"(",
"\"Running scout view index\"",
")",
"adapter",
"=",
"context",
".",
"obj",
"[",
"'adapter'",
"]",
"intervals",
"=",
"adapter",
".",
"get_coding_intervals",
"(",
"build",
")... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | region | Load all variants in a region to a existing case | scout/commands/load/region.py | 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
) | 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
) | [
"Load",
"all",
"variants",
"in",
"a",
"region",
"to",
"a",
"existing",
"case"
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/commands/load/region.py#L20-L25 | [
"def",
"region",
"(",
"context",
",",
"hgnc_id",
",",
"case_id",
",",
"chromosome",
",",
"start",
",",
"end",
")",
":",
"adapter",
"=",
"context",
".",
"obj",
"[",
"'adapter'",
"]",
"load_region",
"(",
"adapter",
"=",
"adapter",
",",
"case_id",
"=",
"c... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | EventManager._get_kwargs | Helper function for getting category/tag kwargs. | happenings/managers.py | def _get_kwargs(self, category, tag):
"""Helper function for getting category/tag kwargs."""
vals = {
'categories__title__iexact': category,
'tags__name__iexact': tag
}
kwargs = {}
for k, v in vals.items():
if v:
kwargs[k] = v
... | def _get_kwargs(self, category, tag):
"""Helper function for getting category/tag kwargs."""
vals = {
'categories__title__iexact': category,
'tags__name__iexact': tag
}
kwargs = {}
for k, v in vals.items():
if v:
kwargs[k] = v
... | [
"Helper",
"function",
"for",
"getting",
"category",
"/",
"tag",
"kwargs",
"."
] | wreckage/django-happenings | python | https://github.com/wreckage/django-happenings/blob/7bca5576efa6cd4c4e87356bf9e5b8cd538ae91d/happenings/managers.py#L12-L22 | [
"def",
"_get_kwargs",
"(",
"self",
",",
"category",
",",
"tag",
")",
":",
"vals",
"=",
"{",
"'categories__title__iexact'",
":",
"category",
",",
"'tags__name__iexact'",
":",
"tag",
"}",
"kwargs",
"=",
"{",
"}",
"for",
"k",
",",
"v",
"in",
"vals",
".",
... | 7bca5576efa6cd4c4e87356bf9e5b8cd538ae91d |
test | EventManager.get_first_and_last | Returns two datetimes: first day and last day of given year&month | happenings/managers.py | def get_first_and_last(year, month):
"""Returns two datetimes: first day and last day of given year&month"""
ym_first = make_aware(
datetime.datetime(year, month, 1),
get_default_timezone()
)
ym_last = make_aware(
datetime.datetime(year, month, monthra... | def get_first_and_last(year, month):
"""Returns two datetimes: first day and last day of given year&month"""
ym_first = make_aware(
datetime.datetime(year, month, 1),
get_default_timezone()
)
ym_last = make_aware(
datetime.datetime(year, month, monthra... | [
"Returns",
"two",
"datetimes",
":",
"first",
"day",
"and",
"last",
"day",
"of",
"given",
"year&month"
] | wreckage/django-happenings | python | https://github.com/wreckage/django-happenings/blob/7bca5576efa6cd4c4e87356bf9e5b8cd538ae91d/happenings/managers.py#L25-L35 | [
"def",
"get_first_and_last",
"(",
"year",
",",
"month",
")",
":",
"ym_first",
"=",
"make_aware",
"(",
"datetime",
".",
"datetime",
"(",
"year",
",",
"month",
",",
"1",
")",
",",
"get_default_timezone",
"(",
")",
")",
"ym_last",
"=",
"make_aware",
"(",
"d... | 7bca5576efa6cd4c4e87356bf9e5b8cd538ae91d |
test | EventManager.all_month_events | Returns all events that have an occurrence within the given
month & year. | happenings/managers.py | 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_... | 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_... | [
"Returns",
"all",
"events",
"that",
"have",
"an",
"occurrence",
"within",
"the",
"given",
"month",
"&",
"year",
"."
] | wreckage/django-happenings | python | https://github.com/wreckage/django-happenings/blob/7bca5576efa6cd4c4e87356bf9e5b8cd538ae91d/happenings/managers.py#L37-L68 | [
"def",
"all_month_events",
"(",
"self",
",",
"year",
",",
"month",
",",
"category",
"=",
"None",
",",
"tag",
"=",
"None",
",",
"loc",
"=",
"False",
",",
"cncl",
"=",
"False",
")",
":",
"kwargs",
"=",
"self",
".",
"_get_kwargs",
"(",
"category",
",",
... | 7bca5576efa6cd4c4e87356bf9e5b8cd538ae91d |
test | EventManager.live | Returns a queryset of events that will occur again after 'now'.
Used to help generate a list of upcoming events. | happenings/managers.py | 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... | 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... | [
"Returns",
"a",
"queryset",
"of",
"events",
"that",
"will",
"occur",
"again",
"after",
"now",
".",
"Used",
"to",
"help",
"generate",
"a",
"list",
"of",
"upcoming",
"events",
"."
] | wreckage/django-happenings | python | https://github.com/wreckage/django-happenings/blob/7bca5576efa6cd4c4e87356bf9e5b8cd538ae91d/happenings/managers.py#L88-L99 | [
"def",
"live",
"(",
"self",
",",
"now",
")",
":",
"return",
"self",
".",
"model",
".",
"objects",
".",
"filter",
"(",
"Q",
"(",
"end_repeat",
"=",
"None",
")",
"|",
"Q",
"(",
"end_repeat__gte",
"=",
"now",
")",
"|",
"Q",
"(",
"start_date__gte",
"="... | 7bca5576efa6cd4c4e87356bf9e5b8cd538ae91d |
test | build_user | Build a user object
Args:
user_info(dict): A dictionary with user information
Returns:
user_obj(scout.models.User) | scout/build/user.py | def build_user(user_info):
"""Build a user object
Args:
user_info(dict): A dictionary with user information
Returns:
user_obj(scout.models.User)
"""
try:
email = user_info['email']
except KeyError as err:
raise KeyError("A user has to have a email")
... | def build_user(user_info):
"""Build a user object
Args:
user_info(dict): A dictionary with user information
Returns:
user_obj(scout.models.User)
"""
try:
email = user_info['email']
except KeyError as err:
raise KeyError("A user has to have a email")
... | [
"Build",
"a",
"user",
"object",
"Args",
":",
"user_info",
"(",
"dict",
")",
":",
"A",
"dictionary",
"with",
"user",
"information",
"Returns",
":",
"user_obj",
"(",
"scout",
".",
"models",
".",
"User",
")"
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/build/user.py#L3-L34 | [
"def",
"build_user",
"(",
"user_info",
")",
":",
"try",
":",
"email",
"=",
"user_info",
"[",
"'email'",
"]",
"except",
"KeyError",
"as",
"err",
":",
"raise",
"KeyError",
"(",
"\"A user has to have a email\"",
")",
"try",
":",
"name",
"=",
"user_info",
"[",
... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | parse_reqs | Recursively parse requirements from nested pip files. | setup.py | 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
... | 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
... | [
"Recursively",
"parse",
"requirements",
"from",
"nested",
"pip",
"files",
"."
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/setup.py#L23-L41 | [
"def",
"parse_reqs",
"(",
"req_path",
"=",
"'./requirements.txt'",
")",
":",
"install_requires",
"=",
"[",
"]",
"with",
"io",
".",
"open",
"(",
"os",
".",
"path",
".",
"join",
"(",
"here",
",",
"'requirements.txt'",
")",
",",
"encoding",
"=",
"'utf-8'",
... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | existing_gene | Check if gene is already added to a panel. | scout/server/blueprints/panels/controllers.py | 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) | 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) | [
"Check",
"if",
"gene",
"is",
"already",
"added",
"to",
"a",
"panel",
"."
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/server/blueprints/panels/controllers.py#L24-L27 | [
"def",
"existing_gene",
"(",
"store",
",",
"panel_obj",
",",
"hgnc_id",
")",
":",
"existing_genes",
"=",
"{",
"gene",
"[",
"'hgnc_id'",
"]",
":",
"gene",
"for",
"gene",
"in",
"panel_obj",
"[",
"'genes'",
"]",
"}",
"return",
"existing_genes",
".",
"get",
... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | update_panel | 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) | scout/server/blueprints/panels/controllers.py | 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)
"""
... | 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)
"""
... | [
"Update",
"an",
"existing",
"gene",
"panel",
"with",
"genes",
"."
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/server/blueprints/panels/controllers.py#L30-L86 | [
"def",
"update_panel",
"(",
"store",
",",
"panel_name",
",",
"csv_lines",
",",
"option",
")",
":",
"new_genes",
"=",
"[",
"]",
"panel_obj",
"=",
"store",
".",
"gene_panel",
"(",
"panel_name",
")",
"if",
"panel_obj",
"is",
"None",
":",
"return",
"None",
"... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | new_panel | Create a new gene panel.
Args:
store(scout.adapter.MongoAdapter)
institute_id(str)
panel_name(str)
display_name(str)
csv_lines(iterable(str)): Stream with genes
Returns:
panel_id: the ID of the new panel document created or None | scout/server/blueprints/panels/controllers.py | def new_panel(store, institute_id, panel_name, display_name, csv_lines):
"""Create a new gene panel.
Args:
store(scout.adapter.MongoAdapter)
institute_id(str)
panel_name(str)
display_name(str)
csv_lines(iterable(str)): Stream with genes
Returns:
panel_id: th... | def new_panel(store, institute_id, panel_name, display_name, csv_lines):
"""Create a new gene panel.
Args:
store(scout.adapter.MongoAdapter)
institute_id(str)
panel_name(str)
display_name(str)
csv_lines(iterable(str)): Stream with genes
Returns:
panel_id: th... | [
"Create",
"a",
"new",
"gene",
"panel",
"."
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/server/blueprints/panels/controllers.py#L89-L138 | [
"def",
"new_panel",
"(",
"store",
",",
"institute_id",
",",
"panel_name",
",",
"display_name",
",",
"csv_lines",
")",
":",
"institute_obj",
"=",
"store",
".",
"institute",
"(",
"institute_id",
")",
"if",
"institute_obj",
"is",
"None",
":",
"flash",
"(",
"\"{... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | panel_export | Preprocess a panel of genes. | scout/server/blueprints/panels/controllers.py | def panel_export(store, panel_obj):
"""Preprocess a panel of genes."""
panel_obj['institute'] = store.institute(panel_obj['institute'])
full_name = "{}({})".format(panel_obj['display_name'], panel_obj['version'])
panel_obj['name_and_version'] = full_name
return dict(panel=panel_obj) | def panel_export(store, panel_obj):
"""Preprocess a panel of genes."""
panel_obj['institute'] = store.institute(panel_obj['institute'])
full_name = "{}({})".format(panel_obj['display_name'], panel_obj['version'])
panel_obj['name_and_version'] = full_name
return dict(panel=panel_obj) | [
"Preprocess",
"a",
"panel",
"of",
"genes",
"."
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/server/blueprints/panels/controllers.py#L141-L147 | [
"def",
"panel_export",
"(",
"store",
",",
"panel_obj",
")",
":",
"panel_obj",
"[",
"'institute'",
"]",
"=",
"store",
".",
"institute",
"(",
"panel_obj",
"[",
"'institute'",
"]",
")",
"full_name",
"=",
"\"{}({})\"",
".",
"format",
"(",
"panel_obj",
"[",
"'d... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.