repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1
value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
acorg/dark-matter | dark/blast/hacks.py | printBlastRecordForDerek | def printBlastRecordForDerek(record):
"""
This is a hacked version of printBlastRecord that I wrote in
Addenbrookes hospital so Derek could try hacking on the reads
that had low e values. It's called by bin/print-blast-xml-for-derek.py
"""
if len(record.alignments) == 0:
return 0
if... | python | def printBlastRecordForDerek(record):
"""
This is a hacked version of printBlastRecord that I wrote in
Addenbrookes hospital so Derek could try hacking on the reads
that had low e values. It's called by bin/print-blast-xml-for-derek.py
"""
if len(record.alignments) == 0:
return 0
if... | [
"def",
"printBlastRecordForDerek",
"(",
"record",
")",
":",
"if",
"len",
"(",
"record",
".",
"alignments",
")",
"==",
"0",
":",
"return",
"0",
"if",
"record",
".",
"descriptions",
"[",
"0",
"]",
".",
"e",
">",
"1e-120",
":",
"return",
"0",
"print",
"... | This is a hacked version of printBlastRecord that I wrote in
Addenbrookes hospital so Derek could try hacking on the reads
that had low e values. It's called by bin/print-blast-xml-for-derek.py | [
"This",
"is",
"a",
"hacked",
"version",
"of",
"printBlastRecord",
"that",
"I",
"wrote",
"in",
"Addenbrookes",
"hospital",
"so",
"Derek",
"could",
"try",
"hacking",
"on",
"the",
"reads",
"that",
"had",
"low",
"e",
"values",
".",
"It",
"s",
"called",
"by",
... | train | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/blast/hacks.py#L4-L32 |
acorg/dark-matter | dark/proteins.py | splitNames | def splitNames(names):
"""
Split a sequence id string like "Protein name [pathogen name]" into two
pieces using the final square brackets to delimit the pathogen name.
@param names: A C{str} "protein name [pathogen name]" string.
@return: A 2-C{tuple} giving the C{str} protein name and C{str} patho... | python | def splitNames(names):
"""
Split a sequence id string like "Protein name [pathogen name]" into two
pieces using the final square brackets to delimit the pathogen name.
@param names: A C{str} "protein name [pathogen name]" string.
@return: A 2-C{tuple} giving the C{str} protein name and C{str} patho... | [
"def",
"splitNames",
"(",
"names",
")",
":",
"match",
"=",
"_PATHOGEN_RE",
".",
"match",
"(",
"names",
")",
"if",
"match",
":",
"proteinName",
"=",
"match",
".",
"group",
"(",
"1",
")",
".",
"strip",
"(",
")",
"pathogenName",
"=",
"match",
".",
"grou... | Split a sequence id string like "Protein name [pathogen name]" into two
pieces using the final square brackets to delimit the pathogen name.
@param names: A C{str} "protein name [pathogen name]" string.
@return: A 2-C{tuple} giving the C{str} protein name and C{str} pathogen
name. If C{names} canno... | [
"Split",
"a",
"sequence",
"id",
"string",
"like",
"Protein",
"name",
"[",
"pathogen",
"name",
"]",
"into",
"two",
"pieces",
"using",
"the",
"final",
"square",
"brackets",
"to",
"delimit",
"the",
"pathogen",
"name",
"."
] | train | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/proteins.py#L44-L62 |
acorg/dark-matter | dark/proteins.py | getPathogenProteinCounts | def getPathogenProteinCounts(filenames):
"""
Get the number of proteins for each pathogen in C{filenames}.
@param filenames: Either C{None} or a C{list} of C{str} FASTA file names.
If C{None} an empty C{Counter} is returned. If FASTA file names are
given, their sequence ids should have the ... | python | def getPathogenProteinCounts(filenames):
"""
Get the number of proteins for each pathogen in C{filenames}.
@param filenames: Either C{None} or a C{list} of C{str} FASTA file names.
If C{None} an empty C{Counter} is returned. If FASTA file names are
given, their sequence ids should have the ... | [
"def",
"getPathogenProteinCounts",
"(",
"filenames",
")",
":",
"result",
"=",
"Counter",
"(",
")",
"if",
"filenames",
":",
"for",
"filename",
"in",
"filenames",
":",
"for",
"protein",
"in",
"FastaReads",
"(",
"filename",
")",
":",
"_",
",",
"pathogenName",
... | Get the number of proteins for each pathogen in C{filenames}.
@param filenames: Either C{None} or a C{list} of C{str} FASTA file names.
If C{None} an empty C{Counter} is returned. If FASTA file names are
given, their sequence ids should have the format used in the NCBI
bacterial and viral p... | [
"Get",
"the",
"number",
"of",
"proteins",
"for",
"each",
"pathogen",
"in",
"C",
"{",
"filenames",
"}",
"."
] | train | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/proteins.py#L65-L85 |
acorg/dark-matter | dark/proteins.py | PathogenSampleFiles.add | def add(self, pathogenName, sampleName):
"""
Add a (pathogen name, sample name) combination and get its FASTA/FASTQ
file name and unique read count. Write the FASTA/FASTQ file if it does
not already exist. Save the unique read count into
C{self._proteinGrouper}.
@param p... | python | def add(self, pathogenName, sampleName):
"""
Add a (pathogen name, sample name) combination and get its FASTA/FASTQ
file name and unique read count. Write the FASTA/FASTQ file if it does
not already exist. Save the unique read count into
C{self._proteinGrouper}.
@param p... | [
"def",
"add",
"(",
"self",
",",
"pathogenName",
",",
"sampleName",
")",
":",
"pathogenIndex",
"=",
"self",
".",
"_pathogens",
".",
"setdefault",
"(",
"pathogenName",
",",
"len",
"(",
"self",
".",
"_pathogens",
")",
")",
"sampleIndex",
"=",
"self",
".",
"... | Add a (pathogen name, sample name) combination and get its FASTA/FASTQ
file name and unique read count. Write the FASTA/FASTQ file if it does
not already exist. Save the unique read count into
C{self._proteinGrouper}.
@param pathogenName: A C{str} pathogen name.
@param sampleNam... | [
"Add",
"a",
"(",
"pathogen",
"name",
"sample",
"name",
")",
"combination",
"and",
"get",
"its",
"FASTA",
"/",
"FASTQ",
"file",
"name",
"and",
"unique",
"read",
"count",
".",
"Write",
"the",
"FASTA",
"/",
"FASTQ",
"file",
"if",
"it",
"does",
"not",
"alr... | train | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/proteins.py#L110-L145 |
acorg/dark-matter | dark/proteins.py | PathogenSampleFiles.lookup | def lookup(self, pathogenName, sampleName):
"""
Look up a pathogen name, sample name combination and get its
FASTA/FASTQ file name and unique read count.
This method should be used instead of C{add} in situations where
you want an exception to be raised if a pathogen/sample comb... | python | def lookup(self, pathogenName, sampleName):
"""
Look up a pathogen name, sample name combination and get its
FASTA/FASTQ file name and unique read count.
This method should be used instead of C{add} in situations where
you want an exception to be raised if a pathogen/sample comb... | [
"def",
"lookup",
"(",
"self",
",",
"pathogenName",
",",
"sampleName",
")",
":",
"pathogenIndex",
"=",
"self",
".",
"_pathogens",
"[",
"pathogenName",
"]",
"sampleIndex",
"=",
"self",
".",
"_samples",
"[",
"sampleName",
"]",
"return",
"self",
".",
"_readsFile... | Look up a pathogen name, sample name combination and get its
FASTA/FASTQ file name and unique read count.
This method should be used instead of C{add} in situations where
you want an exception to be raised if a pathogen/sample combination has
not already been passed to C{add}.
... | [
"Look",
"up",
"a",
"pathogen",
"name",
"sample",
"name",
"combination",
"and",
"get",
"its",
"FASTA",
"/",
"FASTQ",
"file",
"name",
"and",
"unique",
"read",
"count",
"."
] | train | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/proteins.py#L147-L164 |
acorg/dark-matter | dark/proteins.py | PathogenSampleFiles.writeSampleIndex | def writeSampleIndex(self, fp):
"""
Write a file of sample indices and names, sorted by index.
@param fp: A file-like object, opened for writing.
"""
print('\n'.join(
'%d %s' % (index, name) for (index, name) in
sorted((index, name) for (name, index) in s... | python | def writeSampleIndex(self, fp):
"""
Write a file of sample indices and names, sorted by index.
@param fp: A file-like object, opened for writing.
"""
print('\n'.join(
'%d %s' % (index, name) for (index, name) in
sorted((index, name) for (name, index) in s... | [
"def",
"writeSampleIndex",
"(",
"self",
",",
"fp",
")",
":",
"print",
"(",
"'\\n'",
".",
"join",
"(",
"'%d %s'",
"%",
"(",
"index",
",",
"name",
")",
"for",
"(",
"index",
",",
"name",
")",
"in",
"sorted",
"(",
"(",
"index",
",",
"name",
")",
"for... | Write a file of sample indices and names, sorted by index.
@param fp: A file-like object, opened for writing. | [
"Write",
"a",
"file",
"of",
"sample",
"indices",
"and",
"names",
"sorted",
"by",
"index",
"."
] | train | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/proteins.py#L166-L175 |
acorg/dark-matter | dark/proteins.py | PathogenSampleFiles.writePathogenIndex | def writePathogenIndex(self, fp):
"""
Write a file of pathogen indices and names, sorted by index.
@param fp: A file-like object, opened for writing.
"""
print('\n'.join(
'%d %s' % (index, name) for (index, name) in
sorted((index, name) for (name, index) ... | python | def writePathogenIndex(self, fp):
"""
Write a file of pathogen indices and names, sorted by index.
@param fp: A file-like object, opened for writing.
"""
print('\n'.join(
'%d %s' % (index, name) for (index, name) in
sorted((index, name) for (name, index) ... | [
"def",
"writePathogenIndex",
"(",
"self",
",",
"fp",
")",
":",
"print",
"(",
"'\\n'",
".",
"join",
"(",
"'%d %s'",
"%",
"(",
"index",
",",
"name",
")",
"for",
"(",
"index",
",",
"name",
")",
"in",
"sorted",
"(",
"(",
"index",
",",
"name",
")",
"f... | Write a file of pathogen indices and names, sorted by index.
@param fp: A file-like object, opened for writing. | [
"Write",
"a",
"file",
"of",
"pathogen",
"indices",
"and",
"names",
"sorted",
"by",
"index",
"."
] | train | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/proteins.py#L177-L186 |
acorg/dark-matter | dark/proteins.py | ProteinGrouper._title | def _title(self):
"""
Create a title summarizing the pathogens and samples.
@return: A C{str} title.
"""
return (
'Overall, proteins from %d pathogen%s were found in %d sample%s.' %
(len(self.pathogenNames),
'' if len(self.pathogenNames) == 1... | python | def _title(self):
"""
Create a title summarizing the pathogens and samples.
@return: A C{str} title.
"""
return (
'Overall, proteins from %d pathogen%s were found in %d sample%s.' %
(len(self.pathogenNames),
'' if len(self.pathogenNames) == 1... | [
"def",
"_title",
"(",
"self",
")",
":",
"return",
"(",
"'Overall, proteins from %d pathogen%s were found in %d sample%s.'",
"%",
"(",
"len",
"(",
"self",
".",
"pathogenNames",
")",
",",
"''",
"if",
"len",
"(",
"self",
".",
"pathogenNames",
")",
"==",
"1",
"els... | Create a title summarizing the pathogens and samples.
@return: A C{str} title. | [
"Create",
"a",
"title",
"summarizing",
"the",
"pathogens",
"and",
"samples",
"."
] | train | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/proteins.py#L244-L255 |
acorg/dark-matter | dark/proteins.py | ProteinGrouper.addFile | def addFile(self, filename, fp):
"""
Read and record protein information for a sample.
@param filename: A C{str} file name.
@param fp: An open file pointer to read the file's data from.
@raise ValueError: If information for a pathogen/protein/sample
combination is gi... | python | def addFile(self, filename, fp):
"""
Read and record protein information for a sample.
@param filename: A C{str} file name.
@param fp: An open file pointer to read the file's data from.
@raise ValueError: If information for a pathogen/protein/sample
combination is gi... | [
"def",
"addFile",
"(",
"self",
",",
"filename",
",",
"fp",
")",
":",
"if",
"self",
".",
"_sampleName",
":",
"sampleName",
"=",
"self",
".",
"_sampleName",
"elif",
"self",
".",
"_sampleNameRegex",
":",
"match",
"=",
"self",
".",
"_sampleNameRegex",
".",
"... | Read and record protein information for a sample.
@param filename: A C{str} file name.
@param fp: An open file pointer to read the file's data from.
@raise ValueError: If information for a pathogen/protein/sample
combination is given more than once. | [
"Read",
"and",
"record",
"protein",
"information",
"for",
"a",
"sample",
"."
] | train | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/proteins.py#L257-L327 |
acorg/dark-matter | dark/proteins.py | ProteinGrouper._computeUniqueReadCounts | def _computeUniqueReadCounts(self):
"""
Add all pathogen / sample combinations to self.pathogenSampleFiles.
This will make all de-duplicated (by id) FASTA/FASTQ files and store
the number of de-duplicated reads into C{self.pathogenNames}.
"""
for pathogenName, samples in... | python | def _computeUniqueReadCounts(self):
"""
Add all pathogen / sample combinations to self.pathogenSampleFiles.
This will make all de-duplicated (by id) FASTA/FASTQ files and store
the number of de-duplicated reads into C{self.pathogenNames}.
"""
for pathogenName, samples in... | [
"def",
"_computeUniqueReadCounts",
"(",
"self",
")",
":",
"for",
"pathogenName",
",",
"samples",
"in",
"self",
".",
"pathogenNames",
".",
"items",
"(",
")",
":",
"for",
"sampleName",
"in",
"samples",
":",
"self",
".",
"pathogenSampleFiles",
".",
"add",
"(",
... | Add all pathogen / sample combinations to self.pathogenSampleFiles.
This will make all de-duplicated (by id) FASTA/FASTQ files and store
the number of de-duplicated reads into C{self.pathogenNames}. | [
"Add",
"all",
"pathogen",
"/",
"sample",
"combinations",
"to",
"self",
".",
"pathogenSampleFiles",
"."
] | train | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/proteins.py#L329-L338 |
acorg/dark-matter | dark/proteins.py | ProteinGrouper.toStr | def toStr(self):
"""
Produce a string representation of the pathogen summary.
@return: A C{str} suitable for printing.
"""
# Note that the string representation contains much less
# information than the HTML summary. E.g., it does not contain the
# unique (de-dup... | python | def toStr(self):
"""
Produce a string representation of the pathogen summary.
@return: A C{str} suitable for printing.
"""
# Note that the string representation contains much less
# information than the HTML summary. E.g., it does not contain the
# unique (de-dup... | [
"def",
"toStr",
"(",
"self",
")",
":",
"# Note that the string representation contains much less",
"# information than the HTML summary. E.g., it does not contain the",
"# unique (de-duplicated, by id) read count, since that is only computed",
"# when we are making combined FASTA files of reads ma... | Produce a string representation of the pathogen summary.
@return: A C{str} suitable for printing. | [
"Produce",
"a",
"string",
"representation",
"of",
"the",
"pathogen",
"summary",
"."
] | train | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/proteins.py#L340-L380 |
acorg/dark-matter | dark/proteins.py | ProteinGrouper.toHTML | def toHTML(self, pathogenPanelFilename=None, minProteinFraction=0.0,
pathogenType='viral', sampleIndexFilename=None,
pathogenIndexFilename=None):
"""
Produce an HTML string representation of the pathogen summary.
@param pathogenPanelFilename: If not C{None}, a C{st... | python | def toHTML(self, pathogenPanelFilename=None, minProteinFraction=0.0,
pathogenType='viral', sampleIndexFilename=None,
pathogenIndexFilename=None):
"""
Produce an HTML string representation of the pathogen summary.
@param pathogenPanelFilename: If not C{None}, a C{st... | [
"def",
"toHTML",
"(",
"self",
",",
"pathogenPanelFilename",
"=",
"None",
",",
"minProteinFraction",
"=",
"0.0",
",",
"pathogenType",
"=",
"'viral'",
",",
"sampleIndexFilename",
"=",
"None",
",",
"pathogenIndexFilename",
"=",
"None",
")",
":",
"if",
"pathogenType... | Produce an HTML string representation of the pathogen summary.
@param pathogenPanelFilename: If not C{None}, a C{str} filename to
write a pathogen panel PNG image to.
@param minProteinFraction: The C{float} minimum fraction of proteins
in a pathogen that must be matched by a sam... | [
"Produce",
"an",
"HTML",
"string",
"representation",
"of",
"the",
"pathogen",
"summary",
"."
] | train | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/proteins.py#L382-L776 |
acorg/dark-matter | dark/proteins.py | ProteinGrouper._pathogenSamplePlot | def _pathogenSamplePlot(self, pathogenName, sampleNames, ax):
"""
Make an image of a graph giving pathogen read count (Y axis) versus
sample id (X axis).
@param pathogenName: A C{str} pathogen name.
@param sampleNames: A sorted C{list} of sample names.
@param ax: A matpl... | python | def _pathogenSamplePlot(self, pathogenName, sampleNames, ax):
"""
Make an image of a graph giving pathogen read count (Y axis) versus
sample id (X axis).
@param pathogenName: A C{str} pathogen name.
@param sampleNames: A sorted C{list} of sample names.
@param ax: A matpl... | [
"def",
"_pathogenSamplePlot",
"(",
"self",
",",
"pathogenName",
",",
"sampleNames",
",",
"ax",
")",
":",
"readCounts",
"=",
"[",
"]",
"for",
"i",
",",
"sampleName",
"in",
"enumerate",
"(",
"sampleNames",
")",
":",
"try",
":",
"readCount",
"=",
"self",
".... | Make an image of a graph giving pathogen read count (Y axis) versus
sample id (X axis).
@param pathogenName: A C{str} pathogen name.
@param sampleNames: A sorted C{list} of sample names.
@param ax: A matplotlib C{axes} instance. | [
"Make",
"an",
"image",
"of",
"a",
"graph",
"giving",
"pathogen",
"read",
"count",
"(",
"Y",
"axis",
")",
"versus",
"sample",
"id",
"(",
"X",
"axis",
")",
"."
] | train | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/proteins.py#L778-L837 |
acorg/dark-matter | dark/proteins.py | ProteinGrouper.pathogenPanel | def pathogenPanel(self, filename):
"""
Make a panel of images, with each image being a graph giving pathogen
de-duplicated (by id) read count (Y axis) versus sample id (X axis).
@param filename: A C{str} file name to write the image to.
"""
import matplotlib
matp... | python | def pathogenPanel(self, filename):
"""
Make a panel of images, with each image being a graph giving pathogen
de-duplicated (by id) read count (Y axis) versus sample id (X axis).
@param filename: A C{str} file name to write the image to.
"""
import matplotlib
matp... | [
"def",
"pathogenPanel",
"(",
"self",
",",
"filename",
")",
":",
"import",
"matplotlib",
"matplotlib",
".",
"use",
"(",
"'PDF'",
")",
"import",
"matplotlib",
".",
"pyplot",
"as",
"plt",
"self",
".",
"_computeUniqueReadCounts",
"(",
")",
"pathogenNames",
"=",
... | Make a panel of images, with each image being a graph giving pathogen
de-duplicated (by id) read count (Y axis) versus sample id (X axis).
@param filename: A C{str} file name to write the image to. | [
"Make",
"a",
"panel",
"of",
"images",
"with",
"each",
"image",
"being",
"a",
"graph",
"giving",
"pathogen",
"de",
"-",
"duplicated",
"(",
"by",
"id",
")",
"read",
"count",
"(",
"Y",
"axis",
")",
"versus",
"sample",
"id",
"(",
"X",
"axis",
")",
"."
] | train | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/proteins.py#L839-L884 |
cebel/pyuniprot | src/pyuniprot/webserver/web.py | get_args | def get_args(request_args, allowed_int_args=[], allowed_str_args=[]):
"""Check allowed argument names and return is as dictionary"""
args = {}
for allowed_int_arg in allowed_int_args:
int_value = request_args.get(allowed_int_arg, default=None, type=None)
if int_value:
args[allow... | python | def get_args(request_args, allowed_int_args=[], allowed_str_args=[]):
"""Check allowed argument names and return is as dictionary"""
args = {}
for allowed_int_arg in allowed_int_args:
int_value = request_args.get(allowed_int_arg, default=None, type=None)
if int_value:
args[allow... | [
"def",
"get_args",
"(",
"request_args",
",",
"allowed_int_args",
"=",
"[",
"]",
",",
"allowed_str_args",
"=",
"[",
"]",
")",
":",
"args",
"=",
"{",
"}",
"for",
"allowed_int_arg",
"in",
"allowed_int_args",
":",
"int_value",
"=",
"request_args",
".",
"get",
... | Check allowed argument names and return is as dictionary | [
"Check",
"allowed",
"argument",
"names",
"and",
"return",
"is",
"as",
"dictionary"
] | train | https://github.com/cebel/pyuniprot/blob/9462a6042c7c9295415a5eb589b77b27cb7c142b/src/pyuniprot/webserver/web.py#L31-L45 |
cebel/pyuniprot | src/pyuniprot/webserver/web.py | query_disease | def query_disease():
"""
Returns list of diseases by query parameters
---
tags:
- Query functions
parameters:
- name: identifier
in: query
type: string
required: false
description: Disease identifier
default: DI-03832
- name: ref_id
... | python | def query_disease():
"""
Returns list of diseases by query parameters
---
tags:
- Query functions
parameters:
- name: identifier
in: query
type: string
required: false
description: Disease identifier
default: DI-03832
- name: ref_id
... | [
"def",
"query_disease",
"(",
")",
":",
"allowed_str_args",
"=",
"[",
"'identifier'",
",",
"'ref_id'",
",",
"'ref_type'",
",",
"'name'",
",",
"'acronym'",
",",
"'description'",
"]",
"args",
"=",
"get_args",
"(",
"request_args",
"=",
"request",
".",
"args",
",... | Returns list of diseases by query parameters
---
tags:
- Query functions
parameters:
- name: identifier
in: query
type: string
required: false
description: Disease identifier
default: DI-03832
- name: ref_id
in: query
type: strin... | [
"Returns",
"list",
"of",
"diseases",
"by",
"query",
"parameters",
"---"
] | train | https://github.com/cebel/pyuniprot/blob/9462a6042c7c9295415a5eb589b77b27cb7c142b/src/pyuniprot/webserver/web.py#L364-L431 |
cebel/pyuniprot | src/pyuniprot/webserver/web.py | query_alternative_full_name | def query_alternative_full_name():
"""
Returns list of alternative full name by query query parameters
---
tags:
- Query functions
parameters:
- name: name
in: query
type: string
required: false
description: Alternative full name
default: 'Alzhe... | python | def query_alternative_full_name():
"""
Returns list of alternative full name by query query parameters
---
tags:
- Query functions
parameters:
- name: name
in: query
type: string
required: false
description: Alternative full name
default: 'Alzhe... | [
"def",
"query_alternative_full_name",
"(",
")",
":",
"args",
"=",
"get_args",
"(",
"request_args",
"=",
"request",
".",
"args",
",",
"allowed_str_args",
"=",
"[",
"'name'",
",",
"'entry_name'",
"]",
",",
"allowed_int_args",
"=",
"[",
"'limit'",
"]",
")",
"re... | Returns list of alternative full name by query query parameters
---
tags:
- Query functions
parameters:
- name: name
in: query
type: string
required: false
description: Alternative full name
default: 'Alzheimer disease amyloid protein'
- name: en... | [
"Returns",
"list",
"of",
"alternative",
"full",
"name",
"by",
"query",
"query",
"parameters",
"---",
"tags",
":"
] | train | https://github.com/cebel/pyuniprot/blob/9462a6042c7c9295415a5eb589b77b27cb7c142b/src/pyuniprot/webserver/web.py#L435-L473 |
cebel/pyuniprot | src/pyuniprot/webserver/web.py | query_alternative_short_name | def query_alternative_short_name():
"""
Returns list of alternative short name by query query parameters
---
tags:
- Query functions
parameters:
- name: name
in: query
type: string
required: false
description: Alternative short name
default: CV... | python | def query_alternative_short_name():
"""
Returns list of alternative short name by query query parameters
---
tags:
- Query functions
parameters:
- name: name
in: query
type: string
required: false
description: Alternative short name
default: CV... | [
"def",
"query_alternative_short_name",
"(",
")",
":",
"args",
"=",
"get_args",
"(",
"request_args",
"=",
"request",
".",
"args",
",",
"allowed_str_args",
"=",
"[",
"'name'",
",",
"'entry_name'",
"]",
",",
"allowed_int_args",
"=",
"[",
"'limit'",
"]",
")",
"r... | Returns list of alternative short name by query query parameters
---
tags:
- Query functions
parameters:
- name: name
in: query
type: string
required: false
description: Alternative short name
default: CVAP
- name: entry_name
in: query
... | [
"Returns",
"list",
"of",
"alternative",
"short",
"name",
"by",
"query",
"query",
"parameters",
"---"
] | train | https://github.com/cebel/pyuniprot/blob/9462a6042c7c9295415a5eb589b77b27cb7c142b/src/pyuniprot/webserver/web.py#L477-L516 |
cebel/pyuniprot | src/pyuniprot/webserver/web.py | query_other_gene_name | def query_other_gene_name():
"""
Returns list of alternative short name by query query parameters
---
tags:
- Query functions
parameters:
- name: type_
in: query
type: string
required: false
description: Alternative short name
default: CVAP
... | python | def query_other_gene_name():
"""
Returns list of alternative short name by query query parameters
---
tags:
- Query functions
parameters:
- name: type_
in: query
type: string
required: false
description: Alternative short name
default: CVAP
... | [
"def",
"query_other_gene_name",
"(",
")",
":",
"args",
"=",
"get_args",
"(",
"request_args",
"=",
"request",
".",
"args",
",",
"allowed_str_args",
"=",
"[",
"'name'",
",",
"'entry_name'",
"]",
",",
"allowed_int_args",
"=",
"[",
"'limit'",
"]",
")",
"return",... | Returns list of alternative short name by query query parameters
---
tags:
- Query functions
parameters:
- name: type_
in: query
type: string
required: false
description: Alternative short name
default: CVAP
- name: name
in: query
... | [
"Returns",
"list",
"of",
"alternative",
"short",
"name",
"by",
"query",
"query",
"parameters",
"---"
] | train | https://github.com/cebel/pyuniprot/blob/9462a6042c7c9295415a5eb589b77b27cb7c142b/src/pyuniprot/webserver/web.py#L520-L566 |
cebel/pyuniprot | src/pyuniprot/webserver/web.py | query_accession | def query_accession():
"""
Returns list of accession numbers by query query parameters
---
tags:
- Query functions
parameters:
- name: accession
in: query
type: string
required: false
description: UniProt accession number
default: P05067
... | python | def query_accession():
"""
Returns list of accession numbers by query query parameters
---
tags:
- Query functions
parameters:
- name: accession
in: query
type: string
required: false
description: UniProt accession number
default: P05067
... | [
"def",
"query_accession",
"(",
")",
":",
"args",
"=",
"get_args",
"(",
"request_args",
"=",
"request",
".",
"args",
",",
"allowed_str_args",
"=",
"[",
"'accession'",
",",
"'entry_name'",
"]",
",",
"allowed_int_args",
"=",
"[",
"'limit'",
"]",
")",
"return",
... | Returns list of accession numbers by query query parameters
---
tags:
- Query functions
parameters:
- name: accession
in: query
type: string
required: false
description: UniProt accession number
default: P05067
- name: entry_name
in: que... | [
"Returns",
"list",
"of",
"accession",
"numbers",
"by",
"query",
"query",
"parameters",
"---"
] | train | https://github.com/cebel/pyuniprot/blob/9462a6042c7c9295415a5eb589b77b27cb7c142b/src/pyuniprot/webserver/web.py#L570-L609 |
cebel/pyuniprot | src/pyuniprot/webserver/web.py | query_pmid | def query_pmid():
"""
Returns list of PubMed identifier by query parameters
---
tags:
- Query functions
parameters:
- name: pmid
in: query
type: string
required: false
description: PubMed identifier
default: 20697050
- name: entry_name
... | python | def query_pmid():
"""
Returns list of PubMed identifier by query parameters
---
tags:
- Query functions
parameters:
- name: pmid
in: query
type: string
required: false
description: PubMed identifier
default: 20697050
- name: entry_name
... | [
"def",
"query_pmid",
"(",
")",
":",
"args",
"=",
"get_args",
"(",
"request_args",
"=",
"request",
".",
"args",
",",
"allowed_str_args",
"=",
"[",
"'first'",
",",
"'last'",
",",
"'volume'",
",",
"'name'",
",",
"'date'",
",",
"'title'",
",",
"'entry_name'",
... | Returns list of PubMed identifier by query parameters
---
tags:
- Query functions
parameters:
- name: pmid
in: query
type: string
required: false
description: PubMed identifier
default: 20697050
- name: entry_name
in: query
type:... | [
"Returns",
"list",
"of",
"PubMed",
"identifier",
"by",
"query",
"parameters",
"---"
] | train | https://github.com/cebel/pyuniprot/blob/9462a6042c7c9295415a5eb589b77b27cb7c142b/src/pyuniprot/webserver/web.py#L613-L693 |
cebel/pyuniprot | src/pyuniprot/webserver/web.py | query_organism_host | def query_organism_host():
"""
Returns list of host organism by query parameters
---
tags:
- Query functions
parameters:
- name: taxid
in: query
type: integer
required: false
description: NCBI taxonomy identifier
default: 9606
- name: en... | python | def query_organism_host():
"""
Returns list of host organism by query parameters
---
tags:
- Query functions
parameters:
- name: taxid
in: query
type: integer
required: false
description: NCBI taxonomy identifier
default: 9606
- name: en... | [
"def",
"query_organism_host",
"(",
")",
":",
"args",
"=",
"get_args",
"(",
"request_args",
"=",
"request",
".",
"args",
",",
"allowed_str_args",
"=",
"[",
"'entry_name'",
"]",
",",
"allowed_int_args",
"=",
"[",
"'taxid'",
",",
"'limit'",
"]",
")",
"return",
... | Returns list of host organism by query parameters
---
tags:
- Query functions
parameters:
- name: taxid
in: query
type: integer
required: false
description: NCBI taxonomy identifier
default: 9606
- name: entry_name
in: query
type... | [
"Returns",
"list",
"of",
"host",
"organism",
"by",
"query",
"parameters",
"---"
] | train | https://github.com/cebel/pyuniprot/blob/9462a6042c7c9295415a5eb589b77b27cb7c142b/src/pyuniprot/webserver/web.py#L697-L735 |
cebel/pyuniprot | src/pyuniprot/webserver/web.py | query_db_reference | def query_db_reference():
"""
Returns list of cross references by query parameters
---
tags:
- Query functions
parameters:
- name: type_
in: query
type: string
required: false
description: Reference type
default: EMBL
- name: identifier
... | python | def query_db_reference():
"""
Returns list of cross references by query parameters
---
tags:
- Query functions
parameters:
- name: type_
in: query
type: string
required: false
description: Reference type
default: EMBL
- name: identifier
... | [
"def",
"query_db_reference",
"(",
")",
":",
"args",
"=",
"get_args",
"(",
"request_args",
"=",
"request",
".",
"args",
",",
"allowed_str_args",
"=",
"[",
"'type_'",
",",
"'identifier'",
",",
"'entry_name'",
"]",
",",
"allowed_int_args",
"=",
"[",
"'limit'",
... | Returns list of cross references by query parameters
---
tags:
- Query functions
parameters:
- name: type_
in: query
type: string
required: false
description: Reference type
default: EMBL
- name: identifier
in: query
type: string... | [
"Returns",
"list",
"of",
"cross",
"references",
"by",
"query",
"parameters",
"---"
] | train | https://github.com/cebel/pyuniprot/blob/9462a6042c7c9295415a5eb589b77b27cb7c142b/src/pyuniprot/webserver/web.py#L739-L784 |
cebel/pyuniprot | src/pyuniprot/webserver/web.py | query_feature | def query_feature():
"""
Returns list of sequence feature by query parameters
---
tags:
- Query functions
parameters:
- name: type_
in: query
type: string
required: false
description: Feature type
default: 'splice variant'
- name: identif... | python | def query_feature():
"""
Returns list of sequence feature by query parameters
---
tags:
- Query functions
parameters:
- name: type_
in: query
type: string
required: false
description: Feature type
default: 'splice variant'
- name: identif... | [
"def",
"query_feature",
"(",
")",
":",
"args",
"=",
"get_args",
"(",
"request_args",
"=",
"request",
".",
"args",
",",
"allowed_str_args",
"=",
"[",
"'type_'",
",",
"'identifier'",
",",
"'entry_name'",
"]",
",",
"allowed_int_args",
"=",
"[",
"'limit'",
"]",
... | Returns list of sequence feature by query parameters
---
tags:
- Query functions
parameters:
- name: type_
in: query
type: string
required: false
description: Feature type
default: 'splice variant'
- name: identifier
in: query
typ... | [
"Returns",
"list",
"of",
"sequence",
"feature",
"by",
"query",
"parameters",
"---",
"tags",
":"
] | train | https://github.com/cebel/pyuniprot/blob/9462a6042c7c9295415a5eb589b77b27cb7c142b/src/pyuniprot/webserver/web.py#L788-L839 |
cebel/pyuniprot | src/pyuniprot/webserver/web.py | query_function | def query_function():
"""
Returns list of functions by query parameters
---
tags:
- Query functions
parameters:
- name: text
in: query
type: string
required: false
description: Text describing protein function
default: '%axonogenesis%'
- ... | python | def query_function():
"""
Returns list of functions by query parameters
---
tags:
- Query functions
parameters:
- name: text
in: query
type: string
required: false
description: Text describing protein function
default: '%axonogenesis%'
- ... | [
"def",
"query_function",
"(",
")",
":",
"args",
"=",
"get_args",
"(",
"request_args",
"=",
"request",
".",
"args",
",",
"allowed_str_args",
"=",
"[",
"'text'",
",",
"'entry_name'",
"]",
",",
"allowed_int_args",
"=",
"[",
"'limit'",
"]",
")",
"return",
"jso... | Returns list of functions by query parameters
---
tags:
- Query functions
parameters:
- name: text
in: query
type: string
required: false
description: Text describing protein function
default: '%axonogenesis%'
- name: entry_name
in: query... | [
"Returns",
"list",
"of",
"functions",
"by",
"query",
"parameters",
"---",
"tags",
":"
] | train | https://github.com/cebel/pyuniprot/blob/9462a6042c7c9295415a5eb589b77b27cb7c142b/src/pyuniprot/webserver/web.py#L843-L880 |
cebel/pyuniprot | src/pyuniprot/webserver/web.py | query_keyword | def query_keyword():
"""
Returns list of keywords linked to entries by query parameters
---
tags:
- Query functions
parameters:
- name: name
in: query
type: string
required: false
description: Disease identifier
default: 'Ubl conjugation'
... | python | def query_keyword():
"""
Returns list of keywords linked to entries by query parameters
---
tags:
- Query functions
parameters:
- name: name
in: query
type: string
required: false
description: Disease identifier
default: 'Ubl conjugation'
... | [
"def",
"query_keyword",
"(",
")",
":",
"args",
"=",
"get_args",
"(",
"request_args",
"=",
"request",
".",
"args",
",",
"allowed_str_args",
"=",
"[",
"'name'",
",",
"'identifier'",
",",
"'entry_name'",
"]",
",",
"allowed_int_args",
"=",
"[",
"'limit'",
"]",
... | Returns list of keywords linked to entries by query parameters
---
tags:
- Query functions
parameters:
- name: name
in: query
type: string
required: false
description: Disease identifier
default: 'Ubl conjugation'
- name: identifier
in: q... | [
"Returns",
"list",
"of",
"keywords",
"linked",
"to",
"entries",
"by",
"query",
"parameters",
"---",
"tags",
":"
] | train | https://github.com/cebel/pyuniprot/blob/9462a6042c7c9295415a5eb589b77b27cb7c142b/src/pyuniprot/webserver/web.py#L884-L930 |
cebel/pyuniprot | src/pyuniprot/webserver/web.py | query_ec_number | def query_ec_number():
"""
Returns list of Enzyme Commission Numbers (EC numbers) by query parameters
---
tags:
- Query functions
parameters:
- name: ec_number
in: query
type: string
required: false
description: Enzyme Commission Number
default:... | python | def query_ec_number():
"""
Returns list of Enzyme Commission Numbers (EC numbers) by query parameters
---
tags:
- Query functions
parameters:
- name: ec_number
in: query
type: string
required: false
description: Enzyme Commission Number
default:... | [
"def",
"query_ec_number",
"(",
")",
":",
"args",
"=",
"get_args",
"(",
"request_args",
"=",
"request",
".",
"args",
",",
"allowed_str_args",
"=",
"[",
"'ec_number'",
",",
"'entry_name'",
"]",
",",
"allowed_int_args",
"=",
"[",
"'limit'",
"]",
")",
"return",
... | Returns list of Enzyme Commission Numbers (EC numbers) by query parameters
---
tags:
- Query functions
parameters:
- name: ec_number
in: query
type: string
required: false
description: Enzyme Commission Number
default: '1.1.1.1'
- name: entry_nam... | [
"Returns",
"list",
"of",
"Enzyme",
"Commission",
"Numbers",
"(",
"EC",
"numbers",
")",
"by",
"query",
"parameters",
"---",
"tags",
":"
] | train | https://github.com/cebel/pyuniprot/blob/9462a6042c7c9295415a5eb589b77b27cb7c142b/src/pyuniprot/webserver/web.py#L934-L970 |
cebel/pyuniprot | src/pyuniprot/webserver/web.py | query_subcellular_location | def query_subcellular_location():
"""
Returns list of subcellular locations by query parameters
---
tags:
- Query functions
parameters:
- name: location
in: query
type: string
required: false
description: Subcellular location
default: 'Clathrin-... | python | def query_subcellular_location():
"""
Returns list of subcellular locations by query parameters
---
tags:
- Query functions
parameters:
- name: location
in: query
type: string
required: false
description: Subcellular location
default: 'Clathrin-... | [
"def",
"query_subcellular_location",
"(",
")",
":",
"args",
"=",
"get_args",
"(",
"request_args",
"=",
"request",
".",
"args",
",",
"allowed_str_args",
"=",
"[",
"'location'",
",",
"'entry_name'",
"]",
",",
"allowed_int_args",
"=",
"[",
"'limit'",
"]",
")",
... | Returns list of subcellular locations by query parameters
---
tags:
- Query functions
parameters:
- name: location
in: query
type: string
required: false
description: Subcellular location
default: 'Clathrin-coated pit'
- name: entry_name
... | [
"Returns",
"list",
"of",
"subcellular",
"locations",
"by",
"query",
"parameters",
"---"
] | train | https://github.com/cebel/pyuniprot/blob/9462a6042c7c9295415a5eb589b77b27cb7c142b/src/pyuniprot/webserver/web.py#L974-L1011 |
cebel/pyuniprot | src/pyuniprot/webserver/web.py | query_tissue_specificity | def query_tissue_specificity():
"""
Returns list of tissue specificity by query parameters
---
tags:
- Query functions
parameters:
- name: comment
in: query
type: string
required: false
description: Comment to tissue specificity
default: '%APP6... | python | def query_tissue_specificity():
"""
Returns list of tissue specificity by query parameters
---
tags:
- Query functions
parameters:
- name: comment
in: query
type: string
required: false
description: Comment to tissue specificity
default: '%APP6... | [
"def",
"query_tissue_specificity",
"(",
")",
":",
"args",
"=",
"get_args",
"(",
"request_args",
"=",
"request",
".",
"args",
",",
"allowed_str_args",
"=",
"[",
"'comment'",
",",
"'entry_name'",
"]",
",",
"allowed_int_args",
"=",
"[",
"'limit'",
"]",
")",
"re... | Returns list of tissue specificity by query parameters
---
tags:
- Query functions
parameters:
- name: comment
in: query
type: string
required: false
description: Comment to tissue specificity
default: '%APP695%'
- name: entry_name
in: q... | [
"Returns",
"list",
"of",
"tissue",
"specificity",
"by",
"query",
"parameters",
"---"
] | train | https://github.com/cebel/pyuniprot/blob/9462a6042c7c9295415a5eb589b77b27cb7c142b/src/pyuniprot/webserver/web.py#L1015-L1053 |
cebel/pyuniprot | src/pyuniprot/webserver/web.py | query_tissue_in_reference | def query_tissue_in_reference():
"""
Returns list of tissues linked to references by query parameters
---
tags:
- Query functions
parameters:
- name: tissue
in: query
type: string
required: false
description: Tissue
default: brain
- name:... | python | def query_tissue_in_reference():
"""
Returns list of tissues linked to references by query parameters
---
tags:
- Query functions
parameters:
- name: tissue
in: query
type: string
required: false
description: Tissue
default: brain
- name:... | [
"def",
"query_tissue_in_reference",
"(",
")",
":",
"args",
"=",
"get_args",
"(",
"request_args",
"=",
"request",
".",
"args",
",",
"allowed_str_args",
"=",
"[",
"'tissue'",
",",
"'entry_name'",
"]",
",",
"allowed_int_args",
"=",
"[",
"'limit'",
"]",
")",
"re... | Returns list of tissues linked to references by query parameters
---
tags:
- Query functions
parameters:
- name: tissue
in: query
type: string
required: false
description: Tissue
default: brain
- name: entry_name
in: query
type: s... | [
"Returns",
"list",
"of",
"tissues",
"linked",
"to",
"references",
"by",
"query",
"parameters",
"---"
] | train | https://github.com/cebel/pyuniprot/blob/9462a6042c7c9295415a5eb589b77b27cb7c142b/src/pyuniprot/webserver/web.py#L1057-L1094 |
cebel/pyuniprot | src/pyuniprot/webserver/web.py | query_disease_comment | def query_disease_comment():
"""
Returns list of diseases comments by query parameters
---
tags:
- Query functions
parameters:
- name: comment
in: query
type: string
required: false
description: Comment on disease linked to UniProt entry
defaul... | python | def query_disease_comment():
"""
Returns list of diseases comments by query parameters
---
tags:
- Query functions
parameters:
- name: comment
in: query
type: string
required: false
description: Comment on disease linked to UniProt entry
defaul... | [
"def",
"query_disease_comment",
"(",
")",
":",
"args",
"=",
"get_args",
"(",
"request_args",
"=",
"request",
".",
"args",
",",
"allowed_str_args",
"=",
"[",
"'comment'",
",",
"'entry_name'",
"]",
",",
"allowed_int_args",
"=",
"[",
"'limit'",
"]",
")",
"retur... | Returns list of diseases comments by query parameters
---
tags:
- Query functions
parameters:
- name: comment
in: query
type: string
required: false
description: Comment on disease linked to UniProt entry
default: '%mutations%'
- name: entry_nam... | [
"Returns",
"list",
"of",
"diseases",
"comments",
"by",
"query",
"parameters",
"---"
] | train | https://github.com/cebel/pyuniprot/blob/9462a6042c7c9295415a5eb589b77b27cb7c142b/src/pyuniprot/webserver/web.py#L1098-L1135 |
acorg/dark-matter | dark/fasta_ss.py | SSFastaReads.iter | def iter(self):
"""
Iterate over the sequences in self.file_, yielding each as an
instance of the desired read class.
@raise ValueError: If the input file has an odd number of records or
if any sequence has a different length than its predicted
secondary structur... | python | def iter(self):
"""
Iterate over the sequences in self.file_, yielding each as an
instance of the desired read class.
@raise ValueError: If the input file has an odd number of records or
if any sequence has a different length than its predicted
secondary structur... | [
"def",
"iter",
"(",
"self",
")",
":",
"upperCase",
"=",
"self",
".",
"_upperCase",
"for",
"_file",
"in",
"self",
".",
"_files",
":",
"with",
"asHandle",
"(",
"_file",
")",
"as",
"fp",
":",
"records",
"=",
"SeqIO",
".",
"parse",
"(",
"fp",
",",
"'fa... | Iterate over the sequences in self.file_, yielding each as an
instance of the desired read class.
@raise ValueError: If the input file has an odd number of records or
if any sequence has a different length than its predicted
secondary structure. | [
"Iterate",
"over",
"the",
"sequences",
"in",
"self",
".",
"file_",
"yielding",
"each",
"as",
"an",
"instance",
"of",
"the",
"desired",
"read",
"class",
"."
] | train | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/fasta_ss.py#L43-L85 |
Snaipe/python-rst2ansi | rst2ansi/functional.py | npartial | def npartial(func, *args, **kwargs):
"""
Returns a partial node visitor function
"""
def wrapped(self, node):
func(self, *args, **kwargs)
return wrapped | python | def npartial(func, *args, **kwargs):
"""
Returns a partial node visitor function
"""
def wrapped(self, node):
func(self, *args, **kwargs)
return wrapped | [
"def",
"npartial",
"(",
"func",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"def",
"wrapped",
"(",
"self",
",",
"node",
")",
":",
"func",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"return",
"wrapped"
] | Returns a partial node visitor function | [
"Returns",
"a",
"partial",
"node",
"visitor",
"function"
] | train | https://github.com/Snaipe/python-rst2ansi/blob/1b1b963804bcc87a7187d07c3943585d9385ea92/rst2ansi/functional.py#L26-L32 |
biocommons/bioutils | src/bioutils/sequences.py | aa3_to_aa1 | def aa3_to_aa1(seq):
"""convert string of 3-letter amino acids to 1-letter amino acids
>>> aa3_to_aa1("CysAlaThrSerAlaArgGluLeuAlaMetGlu")
'CATSARELAME'
>>> aa3_to_aa1(None)
"""
if seq is None:
return None
return "".join(aa3_to_aa1_lut[aa3]
for aa3 in [seq[i:i +... | python | def aa3_to_aa1(seq):
"""convert string of 3-letter amino acids to 1-letter amino acids
>>> aa3_to_aa1("CysAlaThrSerAlaArgGluLeuAlaMetGlu")
'CATSARELAME'
>>> aa3_to_aa1(None)
"""
if seq is None:
return None
return "".join(aa3_to_aa1_lut[aa3]
for aa3 in [seq[i:i +... | [
"def",
"aa3_to_aa1",
"(",
"seq",
")",
":",
"if",
"seq",
"is",
"None",
":",
"return",
"None",
"return",
"\"\"",
".",
"join",
"(",
"aa3_to_aa1_lut",
"[",
"aa3",
"]",
"for",
"aa3",
"in",
"[",
"seq",
"[",
"i",
":",
"i",
"+",
"3",
"]",
"for",
"i",
"... | convert string of 3-letter amino acids to 1-letter amino acids
>>> aa3_to_aa1("CysAlaThrSerAlaArgGluLeuAlaMetGlu")
'CATSARELAME'
>>> aa3_to_aa1(None) | [
"convert",
"string",
"of",
"3",
"-",
"letter",
"amino",
"acids",
"to",
"1",
"-",
"letter",
"amino",
"acids"
] | train | https://github.com/biocommons/bioutils/blob/88bcbdfa707268fed1110800e91b6d4f8e9475a0/src/bioutils/sequences.py#L158-L170 |
biocommons/bioutils | src/bioutils/sequences.py | elide_sequence | def elide_sequence(s, flank=5, elision="..."):
"""trim a sequence to include the left and right flanking sequences of
size `flank`, with the intervening sequence elided by `elision`.
>>> elide_sequence("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
'ABCDE...VWXYZ'
>>> elide_sequence("ABCDEFGHIJKLMNOPQRSTUVWXYZ", f... | python | def elide_sequence(s, flank=5, elision="..."):
"""trim a sequence to include the left and right flanking sequences of
size `flank`, with the intervening sequence elided by `elision`.
>>> elide_sequence("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
'ABCDE...VWXYZ'
>>> elide_sequence("ABCDEFGHIJKLMNOPQRSTUVWXYZ", f... | [
"def",
"elide_sequence",
"(",
"s",
",",
"flank",
"=",
"5",
",",
"elision",
"=",
"\"...\"",
")",
":",
"elided_sequence_len",
"=",
"flank",
"+",
"flank",
"+",
"len",
"(",
"elision",
")",
"if",
"len",
"(",
"s",
")",
"<=",
"elided_sequence_len",
":",
"retu... | trim a sequence to include the left and right flanking sequences of
size `flank`, with the intervening sequence elided by `elision`.
>>> elide_sequence("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
'ABCDE...VWXYZ'
>>> elide_sequence("ABCDEFGHIJKLMNOPQRSTUVWXYZ", flank=3)
'ABC...XYZ'
>>> elide_sequence("ABCDE... | [
"trim",
"a",
"sequence",
"to",
"include",
"the",
"left",
"and",
"right",
"flanking",
"sequences",
"of",
"size",
"flank",
"with",
"the",
"intervening",
"sequence",
"elided",
"by",
"elision",
"."
] | train | https://github.com/biocommons/bioutils/blob/88bcbdfa707268fed1110800e91b6d4f8e9475a0/src/bioutils/sequences.py#L188-L212 |
biocommons/bioutils | src/bioutils/sequences.py | normalize_sequence | def normalize_sequence(seq):
"""return normalized representation of sequence for hashing
This really means ensuring that the sequence is represented as a
binary blob and removing whitespace and asterisks and uppercasing.
>>> normalize_sequence("ACGT")
'ACGT'
>>> normalize_sequence(" A C G T ... | python | def normalize_sequence(seq):
"""return normalized representation of sequence for hashing
This really means ensuring that the sequence is represented as a
binary blob and removing whitespace and asterisks and uppercasing.
>>> normalize_sequence("ACGT")
'ACGT'
>>> normalize_sequence(" A C G T ... | [
"def",
"normalize_sequence",
"(",
"seq",
")",
":",
"nseq",
"=",
"re",
".",
"sub",
"(",
"r\"[\\s\\*]\"",
",",
"\"\"",
",",
"seq",
")",
".",
"upper",
"(",
")",
"m",
"=",
"re",
".",
"search",
"(",
"\"[^A-Z]\"",
",",
"nseq",
")",
"if",
"m",
":",
"_lo... | return normalized representation of sequence for hashing
This really means ensuring that the sequence is represented as a
binary blob and removing whitespace and asterisks and uppercasing.
>>> normalize_sequence("ACGT")
'ACGT'
>>> normalize_sequence(" A C G T * ")
'ACGT'
>>> normalize_s... | [
"return",
"normalized",
"representation",
"of",
"sequence",
"for",
"hashing"
] | train | https://github.com/biocommons/bioutils/blob/88bcbdfa707268fed1110800e91b6d4f8e9475a0/src/bioutils/sequences.py#L221-L247 |
biocommons/bioutils | src/bioutils/sequences.py | translate_cds | def translate_cds(seq, full_codons=True, ter_symbol="*"):
"""translate a DNA or RNA sequence into a single-letter amino acid sequence
using the standard translation table
If full_codons is True, a sequence whose length isn't a multiple of three
generates a ValueError; else an 'X' will be added as the l... | python | def translate_cds(seq, full_codons=True, ter_symbol="*"):
"""translate a DNA or RNA sequence into a single-letter amino acid sequence
using the standard translation table
If full_codons is True, a sequence whose length isn't a multiple of three
generates a ValueError; else an 'X' will be added as the l... | [
"def",
"translate_cds",
"(",
"seq",
",",
"full_codons",
"=",
"True",
",",
"ter_symbol",
"=",
"\"*\"",
")",
":",
"if",
"seq",
"is",
"None",
":",
"return",
"None",
"if",
"len",
"(",
"seq",
")",
"==",
"0",
":",
"return",
"\"\"",
"if",
"full_codons",
"an... | translate a DNA or RNA sequence into a single-letter amino acid sequence
using the standard translation table
If full_codons is True, a sequence whose length isn't a multiple of three
generates a ValueError; else an 'X' will be added as the last amino acid.
This matches biopython's behaviour when paddi... | [
"translate",
"a",
"DNA",
"or",
"RNA",
"sequence",
"into",
"a",
"single",
"-",
"letter",
"amino",
"acid",
"sequence",
"using",
"the",
"standard",
"translation",
"table"
] | train | https://github.com/biocommons/bioutils/blob/88bcbdfa707268fed1110800e91b6d4f8e9475a0/src/bioutils/sequences.py#L290-L349 |
vovanec/httputil | httputil/request_engines/base.py | BaseRequestEngine.request | def request(self, url, *,
method='GET', headers=None, data=None, result_callback=None):
"""Perform request.
:param str url: request URL.
:param str method: request method.
:param dict headers: request headers.
:param object data: request data.
:param obje... | python | def request(self, url, *,
method='GET', headers=None, data=None, result_callback=None):
"""Perform request.
:param str url: request URL.
:param str method: request method.
:param dict headers: request headers.
:param object data: request data.
:param obje... | [
"def",
"request",
"(",
"self",
",",
"url",
",",
"*",
",",
"method",
"=",
"'GET'",
",",
"headers",
"=",
"None",
",",
"data",
"=",
"None",
",",
"result_callback",
"=",
"None",
")",
":",
"url",
"=",
"self",
".",
"_make_full_url",
"(",
"url",
")",
"sel... | Perform request.
:param str url: request URL.
:param str method: request method.
:param dict headers: request headers.
:param object data: request data.
:param object -> object result_callback: result callback.
:rtype: dict
:raise: APIError | [
"Perform",
"request",
"."
] | train | https://github.com/vovanec/httputil/blob/0b8dab5a23166cceb7dbc2a1dbc802ab5b311347/httputil/request_engines/base.py#L47-L65 |
vovanec/httputil | httputil/request_engines/base.py | BaseRequestEngine._make_full_url | def _make_full_url(self, url):
"""Given base and relative URL, construct the full URL.
:param str url: relative URL.
:return: full URL.
:rtype: str
"""
return SLASH.join([self._api_base_url, url.lstrip(SLASH)]) | python | def _make_full_url(self, url):
"""Given base and relative URL, construct the full URL.
:param str url: relative URL.
:return: full URL.
:rtype: str
"""
return SLASH.join([self._api_base_url, url.lstrip(SLASH)]) | [
"def",
"_make_full_url",
"(",
"self",
",",
"url",
")",
":",
"return",
"SLASH",
".",
"join",
"(",
"[",
"self",
".",
"_api_base_url",
",",
"url",
".",
"lstrip",
"(",
"SLASH",
")",
"]",
")"
] | Given base and relative URL, construct the full URL.
:param str url: relative URL.
:return: full URL.
:rtype: str | [
"Given",
"base",
"and",
"relative",
"URL",
"construct",
"the",
"full",
"URL",
"."
] | train | https://github.com/vovanec/httputil/blob/0b8dab5a23166cceb7dbc2a1dbc802ab5b311347/httputil/request_engines/base.py#L84-L93 |
mikebryant/django-autoconfig | django_autoconfig/autoconfig.py | merge_dictionaries | def merge_dictionaries(current, new, only_defaults=False, template_special_case=False):
'''
Merge two settings dictionaries, recording how many changes were needed.
'''
changes = 0
for key, value in new.items():
if key not in current:
if hasattr(global_settings, key):
... | python | def merge_dictionaries(current, new, only_defaults=False, template_special_case=False):
'''
Merge two settings dictionaries, recording how many changes were needed.
'''
changes = 0
for key, value in new.items():
if key not in current:
if hasattr(global_settings, key):
... | [
"def",
"merge_dictionaries",
"(",
"current",
",",
"new",
",",
"only_defaults",
"=",
"False",
",",
"template_special_case",
"=",
"False",
")",
":",
"changes",
"=",
"0",
"for",
"key",
",",
"value",
"in",
"new",
".",
"items",
"(",
")",
":",
"if",
"key",
"... | Merge two settings dictionaries, recording how many changes were needed. | [
"Merge",
"two",
"settings",
"dictionaries",
"recording",
"how",
"many",
"changes",
"were",
"needed",
"."
] | train | https://github.com/mikebryant/django-autoconfig/blob/1ce793e95b024dccb189de1dc111dc4ae6c2f3a6/django_autoconfig/autoconfig.py#L94-L144 |
mikebryant/django-autoconfig | django_autoconfig/autoconfig.py | configure_settings | def configure_settings(settings, environment_settings=True):
'''
Given a settings object, run automatic configuration of all
the apps in INSTALLED_APPS.
'''
changes = 1
iterations = 0
while changes:
changes = 0
app_names = ['django_autoconfig'] + list(settings['INSTALLED_APP... | python | def configure_settings(settings, environment_settings=True):
'''
Given a settings object, run automatic configuration of all
the apps in INSTALLED_APPS.
'''
changes = 1
iterations = 0
while changes:
changes = 0
app_names = ['django_autoconfig'] + list(settings['INSTALLED_APP... | [
"def",
"configure_settings",
"(",
"settings",
",",
"environment_settings",
"=",
"True",
")",
":",
"changes",
"=",
"1",
"iterations",
"=",
"0",
"while",
"changes",
":",
"changes",
"=",
"0",
"app_names",
"=",
"[",
"'django_autoconfig'",
"]",
"+",
"list",
"(",
... | Given a settings object, run automatic configuration of all
the apps in INSTALLED_APPS. | [
"Given",
"a",
"settings",
"object",
"run",
"automatic",
"configuration",
"of",
"all",
"the",
"apps",
"in",
"INSTALLED_APPS",
"."
] | train | https://github.com/mikebryant/django-autoconfig/blob/1ce793e95b024dccb189de1dc111dc4ae6c2f3a6/django_autoconfig/autoconfig.py#L158-L197 |
mikebryant/django-autoconfig | django_autoconfig/autoconfig.py | configure_urls | def configure_urls(apps, index_view=None, prefixes=None):
'''
Configure urls from a list of apps.
'''
prefixes = prefixes or {}
urlpatterns = patterns('')
if index_view:
from django.views.generic.base import RedirectView
urlpatterns += patterns('',
url(r'^$', Redirec... | python | def configure_urls(apps, index_view=None, prefixes=None):
'''
Configure urls from a list of apps.
'''
prefixes = prefixes or {}
urlpatterns = patterns('')
if index_view:
from django.views.generic.base import RedirectView
urlpatterns += patterns('',
url(r'^$', Redirec... | [
"def",
"configure_urls",
"(",
"apps",
",",
"index_view",
"=",
"None",
",",
"prefixes",
"=",
"None",
")",
":",
"prefixes",
"=",
"prefixes",
"or",
"{",
"}",
"urlpatterns",
"=",
"patterns",
"(",
"''",
")",
"if",
"index_view",
":",
"from",
"django",
".",
"... | Configure urls from a list of apps. | [
"Configure",
"urls",
"from",
"a",
"list",
"of",
"apps",
"."
] | train | https://github.com/mikebryant/django-autoconfig/blob/1ce793e95b024dccb189de1dc111dc4ae6c2f3a6/django_autoconfig/autoconfig.py#L200-L230 |
thunder-project/thunder-registration | registration/utils.py | check_images | def check_images(data):
"""
Check and reformat input images if needed
"""
if isinstance(data, ndarray):
data = fromarray(data)
if not isinstance(data, Images):
data = fromarray(asarray(data))
if len(data.shape) not in set([3, 4]):
raise Exception('Number of image di... | python | def check_images(data):
"""
Check and reformat input images if needed
"""
if isinstance(data, ndarray):
data = fromarray(data)
if not isinstance(data, Images):
data = fromarray(asarray(data))
if len(data.shape) not in set([3, 4]):
raise Exception('Number of image di... | [
"def",
"check_images",
"(",
"data",
")",
":",
"if",
"isinstance",
"(",
"data",
",",
"ndarray",
")",
":",
"data",
"=",
"fromarray",
"(",
"data",
")",
"if",
"not",
"isinstance",
"(",
"data",
",",
"Images",
")",
":",
"data",
"=",
"fromarray",
"(",
"asar... | Check and reformat input images if needed | [
"Check",
"and",
"reformat",
"input",
"images",
"if",
"needed"
] | train | https://github.com/thunder-project/thunder-registration/blob/286f091e6c402d592e9686d4821e0fd80dbf86ec/registration/utils.py#L4-L17 |
thunder-project/thunder-registration | registration/utils.py | check_reference | def check_reference(images, reference):
"""
Ensure the reference matches image dimensions
"""
if not images.shape[1:] == reference.shape:
raise Exception('Image shape %s and reference shape %s must match'
% (images.shape[1:], reference.shape))
return reference | python | def check_reference(images, reference):
"""
Ensure the reference matches image dimensions
"""
if not images.shape[1:] == reference.shape:
raise Exception('Image shape %s and reference shape %s must match'
% (images.shape[1:], reference.shape))
return reference | [
"def",
"check_reference",
"(",
"images",
",",
"reference",
")",
":",
"if",
"not",
"images",
".",
"shape",
"[",
"1",
":",
"]",
"==",
"reference",
".",
"shape",
":",
"raise",
"Exception",
"(",
"'Image shape %s and reference shape %s must match'",
"%",
"(",
"imag... | Ensure the reference matches image dimensions | [
"Ensure",
"the",
"reference",
"matches",
"image",
"dimensions"
] | train | https://github.com/thunder-project/thunder-registration/blob/286f091e6c402d592e9686d4821e0fd80dbf86ec/registration/utils.py#L19-L26 |
flo-compbio/genometools | genometools/expression/gene.py | ExpGene.from_dict | def from_dict(cls, data: Dict[str, Union[str, int]]):
"""Generate an `ExpGene` object from a dictionary.
Parameters
----------
data : dict
A dictionary with keys corresponding to attribute names.
Attributes with missing keys will be assigned `None`.
Retu... | python | def from_dict(cls, data: Dict[str, Union[str, int]]):
"""Generate an `ExpGene` object from a dictionary.
Parameters
----------
data : dict
A dictionary with keys corresponding to attribute names.
Attributes with missing keys will be assigned `None`.
Retu... | [
"def",
"from_dict",
"(",
"cls",
",",
"data",
":",
"Dict",
"[",
"str",
",",
"Union",
"[",
"str",
",",
"int",
"]",
"]",
")",
":",
"assert",
"isinstance",
"(",
"data",
",",
"dict",
")",
"if",
"'ensembl_id'",
"not",
"in",
"data",
":",
"raise",
"ValueEr... | Generate an `ExpGene` object from a dictionary.
Parameters
----------
data : dict
A dictionary with keys corresponding to attribute names.
Attributes with missing keys will be assigned `None`.
Returns
-------
`ExpGene`
The gene. | [
"Generate",
"an",
"ExpGene",
"object",
"from",
"a",
"dictionary",
"."
] | train | https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/expression/gene.py#L156-L186 |
acorg/dark-matter | dark/intervals.py | ReadIntervals.add | def add(self, start, end):
"""
Add the start and end offsets of a matching read.
@param start: The C{int} start offset of the read match in the subject.
@param end: The C{int} end offset of the read match in the subject.
This is Python-style: the end offset is not included i... | python | def add(self, start, end):
"""
Add the start and end offsets of a matching read.
@param start: The C{int} start offset of the read match in the subject.
@param end: The C{int} end offset of the read match in the subject.
This is Python-style: the end offset is not included i... | [
"def",
"add",
"(",
"self",
",",
"start",
",",
"end",
")",
":",
"assert",
"start",
"<=",
"end",
"self",
".",
"_intervals",
".",
"append",
"(",
"(",
"start",
",",
"end",
")",
")"
] | Add the start and end offsets of a matching read.
@param start: The C{int} start offset of the read match in the subject.
@param end: The C{int} end offset of the read match in the subject.
This is Python-style: the end offset is not included in the match. | [
"Add",
"the",
"start",
"and",
"end",
"offsets",
"of",
"a",
"matching",
"read",
"."
] | train | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/intervals.py#L20-L29 |
acorg/dark-matter | dark/intervals.py | ReadIntervals.walk | def walk(self):
"""
Get the non-overlapping read intervals that match the subject.
@return: A generator that produces (TYPE, (START, END)) tuples, where
where TYPE is either self.EMPTY or self.FULL and (START, STOP) is
the interval. The endpoint (STOP) of the interval is... | python | def walk(self):
"""
Get the non-overlapping read intervals that match the subject.
@return: A generator that produces (TYPE, (START, END)) tuples, where
where TYPE is either self.EMPTY or self.FULL and (START, STOP) is
the interval. The endpoint (STOP) of the interval is... | [
"def",
"walk",
"(",
"self",
")",
":",
"intervals",
"=",
"sorted",
"(",
"self",
".",
"_intervals",
")",
"def",
"nextFull",
"(",
")",
":",
"start",
",",
"stop",
"=",
"intervals",
".",
"pop",
"(",
"0",
")",
"while",
"intervals",
":",
"if",
"intervals",
... | Get the non-overlapping read intervals that match the subject.
@return: A generator that produces (TYPE, (START, END)) tuples, where
where TYPE is either self.EMPTY or self.FULL and (START, STOP) is
the interval. The endpoint (STOP) of the interval is not considered
to be in... | [
"Get",
"the",
"non",
"-",
"overlapping",
"read",
"intervals",
"that",
"match",
"the",
"subject",
"."
] | train | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/intervals.py#L31-L72 |
acorg/dark-matter | dark/intervals.py | ReadIntervals.coverage | def coverage(self):
"""
Get the fraction of a subject is matched by its set of reads.
@return: The C{float} fraction of a subject matched by its reads.
"""
if self._targetLength == 0:
return 0.0
coverage = 0
for (intervalType, (start, end)) in self.w... | python | def coverage(self):
"""
Get the fraction of a subject is matched by its set of reads.
@return: The C{float} fraction of a subject matched by its reads.
"""
if self._targetLength == 0:
return 0.0
coverage = 0
for (intervalType, (start, end)) in self.w... | [
"def",
"coverage",
"(",
"self",
")",
":",
"if",
"self",
".",
"_targetLength",
"==",
"0",
":",
"return",
"0.0",
"coverage",
"=",
"0",
"for",
"(",
"intervalType",
",",
"(",
"start",
",",
"end",
")",
")",
"in",
"self",
".",
"walk",
"(",
")",
":",
"i... | Get the fraction of a subject is matched by its set of reads.
@return: The C{float} fraction of a subject matched by its reads. | [
"Get",
"the",
"fraction",
"of",
"a",
"subject",
"is",
"matched",
"by",
"its",
"set",
"of",
"reads",
"."
] | train | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/intervals.py#L74-L89 |
acorg/dark-matter | dark/intervals.py | ReadIntervals.coverageCounts | def coverageCounts(self):
"""
For each location in the subject, return a count of how many times that
location is covered by a read.
@return: a C{Counter} where the keys are the C{int} locations on the
subject and the value is the number of times the location is
... | python | def coverageCounts(self):
"""
For each location in the subject, return a count of how many times that
location is covered by a read.
@return: a C{Counter} where the keys are the C{int} locations on the
subject and the value is the number of times the location is
... | [
"def",
"coverageCounts",
"(",
"self",
")",
":",
"coverageCounts",
"=",
"Counter",
"(",
")",
"for",
"start",
",",
"end",
"in",
"self",
".",
"_intervals",
":",
"coverageCounts",
".",
"update",
"(",
"range",
"(",
"max",
"(",
"0",
",",
"start",
")",
",",
... | For each location in the subject, return a count of how many times that
location is covered by a read.
@return: a C{Counter} where the keys are the C{int} locations on the
subject and the value is the number of times the location is
covered by a read. | [
"For",
"each",
"location",
"in",
"the",
"subject",
"return",
"a",
"count",
"of",
"how",
"many",
"times",
"that",
"location",
"is",
"covered",
"by",
"a",
"read",
"."
] | train | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/intervals.py#L91-L104 |
acorg/dark-matter | dark/intervals.py | OffsetAdjuster._reductionForOffset | def _reductionForOffset(self, offset):
"""
Calculate the total reduction for a given X axis offset.
@param offset: The C{int} offset.
@return: The total C{float} reduction that should be made for this
offset.
"""
reduction = 0
for (thisOffset, thisRed... | python | def _reductionForOffset(self, offset):
"""
Calculate the total reduction for a given X axis offset.
@param offset: The C{int} offset.
@return: The total C{float} reduction that should be made for this
offset.
"""
reduction = 0
for (thisOffset, thisRed... | [
"def",
"_reductionForOffset",
"(",
"self",
",",
"offset",
")",
":",
"reduction",
"=",
"0",
"for",
"(",
"thisOffset",
",",
"thisReduction",
")",
"in",
"self",
".",
"_adjustments",
":",
"if",
"offset",
">=",
"thisOffset",
":",
"reduction",
"+=",
"thisReduction... | Calculate the total reduction for a given X axis offset.
@param offset: The C{int} offset.
@return: The total C{float} reduction that should be made for this
offset. | [
"Calculate",
"the",
"total",
"reduction",
"for",
"a",
"given",
"X",
"axis",
"offset",
"."
] | train | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/intervals.py#L136-L150 |
acorg/dark-matter | dark/intervals.py | OffsetAdjuster.adjustHSP | def adjustHSP(self, hsp):
"""
Adjust the read and subject start and end offsets in an HSP.
@param hsp: a L{dark.hsp.HSP} or L{dark.hsp.LSP} instance.
"""
reduction = self._reductionForOffset(
min(hsp.readStartInSubject, hsp.subjectStart))
hsp.readEndInSubjec... | python | def adjustHSP(self, hsp):
"""
Adjust the read and subject start and end offsets in an HSP.
@param hsp: a L{dark.hsp.HSP} or L{dark.hsp.LSP} instance.
"""
reduction = self._reductionForOffset(
min(hsp.readStartInSubject, hsp.subjectStart))
hsp.readEndInSubjec... | [
"def",
"adjustHSP",
"(",
"self",
",",
"hsp",
")",
":",
"reduction",
"=",
"self",
".",
"_reductionForOffset",
"(",
"min",
"(",
"hsp",
".",
"readStartInSubject",
",",
"hsp",
".",
"subjectStart",
")",
")",
"hsp",
".",
"readEndInSubject",
"=",
"hsp",
".",
"r... | Adjust the read and subject start and end offsets in an HSP.
@param hsp: a L{dark.hsp.HSP} or L{dark.hsp.LSP} instance. | [
"Adjust",
"the",
"read",
"and",
"subject",
"start",
"and",
"end",
"offsets",
"in",
"an",
"HSP",
"."
] | train | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/intervals.py#L161-L173 |
flo-compbio/genometools | genometools/basic/gene_set_collection.py | GeneSetCollection.get_by_index | def get_by_index(self, i):
"""Look up a gene set by its index.
Parameters
----------
i: int
The index of the gene set.
Returns
-------
GeneSet
The gene set.
Raises
------
ValueError
If the given index ... | python | def get_by_index(self, i):
"""Look up a gene set by its index.
Parameters
----------
i: int
The index of the gene set.
Returns
-------
GeneSet
The gene set.
Raises
------
ValueError
If the given index ... | [
"def",
"get_by_index",
"(",
"self",
",",
"i",
")",
":",
"if",
"i",
">=",
"self",
".",
"n",
":",
"raise",
"ValueError",
"(",
"'Index %d out of bounds '",
"%",
"i",
"+",
"'for database with %d gene sets.'",
"%",
"self",
".",
"n",
")",
"return",
"self",
".",
... | Look up a gene set by its index.
Parameters
----------
i: int
The index of the gene set.
Returns
-------
GeneSet
The gene set.
Raises
------
ValueError
If the given index is out of bounds. | [
"Look",
"up",
"a",
"gene",
"set",
"by",
"its",
"index",
"."
] | train | https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/basic/gene_set_collection.py#L159-L180 |
flo-compbio/genometools | genometools/basic/gene_set_collection.py | GeneSetCollection.read_tsv | def read_tsv(cls, path, encoding='utf-8'):
"""Read a gene set database from a tab-delimited text file.
Parameters
----------
path: str
The path name of the the file.
encoding: str
The encoding of the text file.
Returns
-------
Non... | python | def read_tsv(cls, path, encoding='utf-8'):
"""Read a gene set database from a tab-delimited text file.
Parameters
----------
path: str
The path name of the the file.
encoding: str
The encoding of the text file.
Returns
-------
Non... | [
"def",
"read_tsv",
"(",
"cls",
",",
"path",
",",
"encoding",
"=",
"'utf-8'",
")",
":",
"gene_sets",
"=",
"[",
"]",
"n",
"=",
"0",
"with",
"open",
"(",
"path",
",",
"'rb'",
")",
"as",
"fh",
":",
"reader",
"=",
"csv",
".",
"reader",
"(",
"fh",
",... | Read a gene set database from a tab-delimited text file.
Parameters
----------
path: str
The path name of the the file.
encoding: str
The encoding of the text file.
Returns
-------
None | [
"Read",
"a",
"gene",
"set",
"database",
"from",
"a",
"tab",
"-",
"delimited",
"text",
"file",
"."
] | train | https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/basic/gene_set_collection.py#L206-L230 |
flo-compbio/genometools | genometools/basic/gene_set_collection.py | GeneSetCollection.write_tsv | def write_tsv(self, path):
"""Write the database to a tab-delimited text file.
Parameters
----------
path: str
The path name of the file.
Returns
-------
None
"""
with open(path, 'wb') as ofh:
writer = csv.writer(
... | python | def write_tsv(self, path):
"""Write the database to a tab-delimited text file.
Parameters
----------
path: str
The path name of the file.
Returns
-------
None
"""
with open(path, 'wb') as ofh:
writer = csv.writer(
... | [
"def",
"write_tsv",
"(",
"self",
",",
"path",
")",
":",
"with",
"open",
"(",
"path",
",",
"'wb'",
")",
"as",
"ofh",
":",
"writer",
"=",
"csv",
".",
"writer",
"(",
"ofh",
",",
"dialect",
"=",
"'excel-tab'",
",",
"quoting",
"=",
"csv",
".",
"QUOTE_NO... | Write the database to a tab-delimited text file.
Parameters
----------
path: str
The path name of the file.
Returns
-------
None | [
"Write",
"the",
"database",
"to",
"a",
"tab",
"-",
"delimited",
"text",
"file",
"."
] | train | https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/basic/gene_set_collection.py#L232-L250 |
flo-compbio/genometools | genometools/basic/gene_set_collection.py | GeneSetCollection.read_msigdb_xml | def read_msigdb_xml(cls, path, entrez2gene, species=None): # pragma: no cover
"""Read the complete MSigDB database from an XML file.
The XML file can be downloaded from here:
http://software.broadinstitute.org/gsea/msigdb/download_file.jsp?filePath=/resources/msigdb/5.0/msigdb_v5.0.xml
... | python | def read_msigdb_xml(cls, path, entrez2gene, species=None): # pragma: no cover
"""Read the complete MSigDB database from an XML file.
The XML file can be downloaded from here:
http://software.broadinstitute.org/gsea/msigdb/download_file.jsp?filePath=/resources/msigdb/5.0/msigdb_v5.0.xml
... | [
"def",
"read_msigdb_xml",
"(",
"cls",
",",
"path",
",",
"entrez2gene",
",",
"species",
"=",
"None",
")",
":",
"# pragma: no cover",
"# note: is XML file really encoded in UTF-8?",
"assert",
"isinstance",
"(",
"path",
",",
"(",
"str",
",",
"_oldstr",
")",
")",
"a... | Read the complete MSigDB database from an XML file.
The XML file can be downloaded from here:
http://software.broadinstitute.org/gsea/msigdb/download_file.jsp?filePath=/resources/msigdb/5.0/msigdb_v5.0.xml
Parameters
----------
path: str
The path name of the XML fil... | [
"Read",
"the",
"complete",
"MSigDB",
"database",
"from",
"an",
"XML",
"file",
"."
] | train | https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/basic/gene_set_collection.py#L253-L354 |
acorg/dark-matter | dark/features.py | Feature.legendLabel | def legendLabel(self):
"""
Provide a textual description of the feature and its qualifiers to be
used as a label in a plot legend.
@return: A C{str} description of the feature.
"""
excludedQualifiers = set((
'codon_start', 'db_xref', 'protein_id', 'region_nam... | python | def legendLabel(self):
"""
Provide a textual description of the feature and its qualifiers to be
used as a label in a plot legend.
@return: A C{str} description of the feature.
"""
excludedQualifiers = set((
'codon_start', 'db_xref', 'protein_id', 'region_nam... | [
"def",
"legendLabel",
"(",
"self",
")",
":",
"excludedQualifiers",
"=",
"set",
"(",
"(",
"'codon_start'",
",",
"'db_xref'",
",",
"'protein_id'",
",",
"'region_name'",
",",
"'ribosomal_slippage'",
",",
"'rpt_type'",
",",
"'translation'",
",",
"'transl_except'",
","... | Provide a textual description of the feature and its qualifiers to be
used as a label in a plot legend.
@return: A C{str} description of the feature. | [
"Provide",
"a",
"textual",
"description",
"of",
"the",
"feature",
"and",
"its",
"qualifiers",
"to",
"be",
"used",
"as",
"a",
"label",
"in",
"a",
"plot",
"legend",
"."
] | train | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/features.py#L52-L80 |
acorg/dark-matter | dark/features.py | _FeatureAdder.add | def add(self, fig, title, minX, maxX, offsetAdjuster=None,
sequenceFetcher=None):
"""
Find the features for a sequence title. If there aren't too many, add
the features to C{fig}. Return information about the features, as
described below.
@param fig: A matplotlib fig... | python | def add(self, fig, title, minX, maxX, offsetAdjuster=None,
sequenceFetcher=None):
"""
Find the features for a sequence title. If there aren't too many, add
the features to C{fig}. Return information about the features, as
described below.
@param fig: A matplotlib fig... | [
"def",
"add",
"(",
"self",
",",
"fig",
",",
"title",
",",
"minX",
",",
"maxX",
",",
"offsetAdjuster",
"=",
"None",
",",
"sequenceFetcher",
"=",
"None",
")",
":",
"offsetAdjuster",
"=",
"offsetAdjuster",
"or",
"(",
"lambda",
"x",
":",
"x",
")",
"fig",
... | Find the features for a sequence title. If there aren't too many, add
the features to C{fig}. Return information about the features, as
described below.
@param fig: A matplotlib figure.
@param title: A C{str} sequence title from a BLAST hit. Of the form
'gi|63148399|gb|DQ011... | [
"Find",
"the",
"features",
"for",
"a",
"sequence",
"title",
".",
"If",
"there",
"aren",
"t",
"too",
"many",
"add",
"the",
"features",
"to",
"C",
"{",
"fig",
"}",
".",
"Return",
"information",
"about",
"the",
"features",
"as",
"described",
"below",
"."
] | train | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/features.py#L136-L195 |
acorg/dark-matter | dark/features.py | ProteinFeatureAdder._displayFeatures | def _displayFeatures(self, fig, features, minX, maxX, offsetAdjuster):
"""
Add the given C{features} to the figure in C{fig}.
@param fig: A matplotlib figure.
@param features: A C{FeatureList} instance.
@param minX: The smallest x coordinate.
@param maxX: The largest x c... | python | def _displayFeatures(self, fig, features, minX, maxX, offsetAdjuster):
"""
Add the given C{features} to the figure in C{fig}.
@param fig: A matplotlib figure.
@param features: A C{FeatureList} instance.
@param minX: The smallest x coordinate.
@param maxX: The largest x c... | [
"def",
"_displayFeatures",
"(",
"self",
",",
"fig",
",",
"features",
",",
"minX",
",",
"maxX",
",",
"offsetAdjuster",
")",
":",
"labels",
"=",
"[",
"]",
"for",
"index",
",",
"feature",
"in",
"enumerate",
"(",
"features",
")",
":",
"fig",
".",
"plot",
... | Add the given C{features} to the figure in C{fig}.
@param fig: A matplotlib figure.
@param features: A C{FeatureList} instance.
@param minX: The smallest x coordinate.
@param maxX: The largest x coordinate.
@param offsetAdjuster: a function for adjusting feature X axis offsets
... | [
"Add",
"the",
"given",
"C",
"{",
"features",
"}",
"to",
"the",
"figure",
"in",
"C",
"{",
"fig",
"}",
"."
] | train | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/features.py#L220-L250 |
acorg/dark-matter | dark/features.py | NucleotideFeatureAdder._displayFeatures | def _displayFeatures(self, fig, features, minX, maxX, offsetAdjuster):
"""
Add the given C{features} to the figure in C{fig}.
@param fig: A matplotlib figure.
@param features: A C{FeatureList} instance.
@param minX: The smallest x coordinate.
@param maxX: The largest x c... | python | def _displayFeatures(self, fig, features, minX, maxX, offsetAdjuster):
"""
Add the given C{features} to the figure in C{fig}.
@param fig: A matplotlib figure.
@param features: A C{FeatureList} instance.
@param minX: The smallest x coordinate.
@param maxX: The largest x c... | [
"def",
"_displayFeatures",
"(",
"self",
",",
"fig",
",",
"features",
",",
"minX",
",",
"maxX",
",",
"offsetAdjuster",
")",
":",
"frame",
"=",
"None",
"labels",
"=",
"[",
"]",
"for",
"feature",
"in",
"features",
":",
"start",
"=",
"offsetAdjuster",
"(",
... | Add the given C{features} to the figure in C{fig}.
@param fig: A matplotlib figure.
@param features: A C{FeatureList} instance.
@param minX: The smallest x coordinate.
@param maxX: The largest x coordinate.
@param offsetAdjuster: a function for adjusting feature X axis offsets
... | [
"Add",
"the",
"given",
"C",
"{",
"features",
"}",
"to",
"the",
"figure",
"in",
"C",
"{",
"fig",
"}",
"."
] | train | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/features.py#L263-L312 |
zniper/simple-article | article/templatetags/article_tags.py | recent_articles | def recent_articles(limit=10, exclude=None):
"""Returns list of latest article"""
queryset = Article.objects.filter(published=True).order_by('-modified')
if exclude:
if hasattr(exclude, '__iter__'):
queryset = queryset.exclude(pk__in=exclude)
else:
queryset = queryset... | python | def recent_articles(limit=10, exclude=None):
"""Returns list of latest article"""
queryset = Article.objects.filter(published=True).order_by('-modified')
if exclude:
if hasattr(exclude, '__iter__'):
queryset = queryset.exclude(pk__in=exclude)
else:
queryset = queryset... | [
"def",
"recent_articles",
"(",
"limit",
"=",
"10",
",",
"exclude",
"=",
"None",
")",
":",
"queryset",
"=",
"Article",
".",
"objects",
".",
"filter",
"(",
"published",
"=",
"True",
")",
".",
"order_by",
"(",
"'-modified'",
")",
"if",
"exclude",
":",
"if... | Returns list of latest article | [
"Returns",
"list",
"of",
"latest",
"article"
] | train | https://github.com/zniper/simple-article/blob/db605bdd966e7023f27870d040804798db606522/article/templatetags/article_tags.py#L9-L17 |
digidotcom/python-streamexpect | streamexpect.py | _flatten | def _flatten(n):
"""Recursively flatten a mixed sequence of sub-sequences and items"""
if isinstance(n, collections.Sequence):
for x in n:
for y in _flatten(x):
yield y
else:
yield n | python | def _flatten(n):
"""Recursively flatten a mixed sequence of sub-sequences and items"""
if isinstance(n, collections.Sequence):
for x in n:
for y in _flatten(x):
yield y
else:
yield n | [
"def",
"_flatten",
"(",
"n",
")",
":",
"if",
"isinstance",
"(",
"n",
",",
"collections",
".",
"Sequence",
")",
":",
"for",
"x",
"in",
"n",
":",
"for",
"y",
"in",
"_flatten",
"(",
"x",
")",
":",
"yield",
"y",
"else",
":",
"yield",
"n"
] | Recursively flatten a mixed sequence of sub-sequences and items | [
"Recursively",
"flatten",
"a",
"mixed",
"sequence",
"of",
"sub",
"-",
"sequences",
"and",
"items"
] | train | https://github.com/digidotcom/python-streamexpect/blob/9ab894506ffd679b37230e935158ff3b0aa170ab/streamexpect.py#L259-L266 |
digidotcom/python-streamexpect | streamexpect.py | wrap | def wrap(stream, unicode=False, window=1024, echo=False, close_stream=True):
"""Wrap a stream to implement expect functionality.
This function provides a convenient way to wrap any Python stream (a
file-like object) or socket with an appropriate :class:`Expecter` class for
the stream type. The returned... | python | def wrap(stream, unicode=False, window=1024, echo=False, close_stream=True):
"""Wrap a stream to implement expect functionality.
This function provides a convenient way to wrap any Python stream (a
file-like object) or socket with an appropriate :class:`Expecter` class for
the stream type. The returned... | [
"def",
"wrap",
"(",
"stream",
",",
"unicode",
"=",
"False",
",",
"window",
"=",
"1024",
",",
"echo",
"=",
"False",
",",
"close_stream",
"=",
"True",
")",
":",
"if",
"hasattr",
"(",
"stream",
",",
"'read'",
")",
":",
"proxy",
"=",
"PollingStreamAdapter"... | Wrap a stream to implement expect functionality.
This function provides a convenient way to wrap any Python stream (a
file-like object) or socket with an appropriate :class:`Expecter` class for
the stream type. The returned object adds an :func:`Expect.expect` method
to the stream, while passing normal... | [
"Wrap",
"a",
"stream",
"to",
"implement",
"expect",
"functionality",
"."
] | train | https://github.com/digidotcom/python-streamexpect/blob/9ab894506ffd679b37230e935158ff3b0aa170ab/streamexpect.py#L740-L790 |
digidotcom/python-streamexpect | streamexpect.py | Searcher._check_type | def _check_type(self, value):
"""Checks that *value* matches the type of this *Searcher*.
Checks that *value* matches the type of this *Searcher*, returning the
value if it does and raising a `TypeError` if it does not.
:return: *value* if type of *value* matches type of this *Searcher... | python | def _check_type(self, value):
"""Checks that *value* matches the type of this *Searcher*.
Checks that *value* matches the type of this *Searcher*, returning the
value if it does and raising a `TypeError` if it does not.
:return: *value* if type of *value* matches type of this *Searcher... | [
"def",
"_check_type",
"(",
"self",
",",
"value",
")",
":",
"if",
"not",
"isinstance",
"(",
"value",
",",
"self",
".",
"match_type",
")",
":",
"raise",
"TypeError",
"(",
"'Type '",
"+",
"str",
"(",
"type",
"(",
"value",
")",
")",
"+",
"' does not match ... | Checks that *value* matches the type of this *Searcher*.
Checks that *value* matches the type of this *Searcher*, returning the
value if it does and raising a `TypeError` if it does not.
:return: *value* if type of *value* matches type of this *Searcher*.
:raises TypeError: if type of ... | [
"Checks",
"that",
"*",
"value",
"*",
"matches",
"the",
"type",
"of",
"this",
"*",
"Searcher",
"*",
"."
] | train | https://github.com/digidotcom/python-streamexpect/blob/9ab894506ffd679b37230e935158ff3b0aa170ab/streamexpect.py#L101-L115 |
digidotcom/python-streamexpect | streamexpect.py | BytesSearcher.search | def search(self, buf):
"""Search the provided buffer for matching bytes.
Search the provided buffer for matching bytes. If the *match* is found,
returns a :class:`SequenceMatch` object, otherwise returns ``None``.
:param buf: Buffer to search for a match.
:return: :class:`Seque... | python | def search(self, buf):
"""Search the provided buffer for matching bytes.
Search the provided buffer for matching bytes. If the *match* is found,
returns a :class:`SequenceMatch` object, otherwise returns ``None``.
:param buf: Buffer to search for a match.
:return: :class:`Seque... | [
"def",
"search",
"(",
"self",
",",
"buf",
")",
":",
"idx",
"=",
"self",
".",
"_check_type",
"(",
"buf",
")",
".",
"find",
"(",
"self",
".",
"_bytes",
")",
"if",
"idx",
"<",
"0",
":",
"return",
"None",
"else",
":",
"start",
"=",
"idx",
"end",
"=... | Search the provided buffer for matching bytes.
Search the provided buffer for matching bytes. If the *match* is found,
returns a :class:`SequenceMatch` object, otherwise returns ``None``.
:param buf: Buffer to search for a match.
:return: :class:`SequenceMatch` if matched, None if no m... | [
"Search",
"the",
"provided",
"buffer",
"for",
"matching",
"bytes",
"."
] | train | https://github.com/digidotcom/python-streamexpect/blob/9ab894506ffd679b37230e935158ff3b0aa170ab/streamexpect.py#L143-L158 |
digidotcom/python-streamexpect | streamexpect.py | TextSearcher.search | def search(self, buf):
"""Search the provided buffer for matching text.
Search the provided buffer for matching text. If the *match* is found,
returns a :class:`SequenceMatch` object, otherwise returns ``None``.
:param buf: Buffer to search for a match.
:return: :class:`Sequenc... | python | def search(self, buf):
"""Search the provided buffer for matching text.
Search the provided buffer for matching text. If the *match* is found,
returns a :class:`SequenceMatch` object, otherwise returns ``None``.
:param buf: Buffer to search for a match.
:return: :class:`Sequenc... | [
"def",
"search",
"(",
"self",
",",
"buf",
")",
":",
"self",
".",
"_check_type",
"(",
"buf",
")",
"normalized",
"=",
"unicodedata",
".",
"normalize",
"(",
"self",
".",
"FORM",
",",
"buf",
")",
"idx",
"=",
"normalized",
".",
"find",
"(",
"self",
".",
... | Search the provided buffer for matching text.
Search the provided buffer for matching text. If the *match* is found,
returns a :class:`SequenceMatch` object, otherwise returns ``None``.
:param buf: Buffer to search for a match.
:return: :class:`SequenceMatch` if matched, None if no mat... | [
"Search",
"the",
"provided",
"buffer",
"for",
"matching",
"text",
"."
] | train | https://github.com/digidotcom/python-streamexpect/blob/9ab894506ffd679b37230e935158ff3b0aa170ab/streamexpect.py#L193-L209 |
digidotcom/python-streamexpect | streamexpect.py | RegexSearcher.search | def search(self, buf):
"""Search the provided buffer for a match to the object's regex.
Search the provided buffer for a match to the object's regex. If the
*match* is found, returns a :class:`RegexMatch` object, otherwise
returns ``None``.
:param buf: Buffer to search for a ma... | python | def search(self, buf):
"""Search the provided buffer for a match to the object's regex.
Search the provided buffer for a match to the object's regex. If the
*match* is found, returns a :class:`RegexMatch` object, otherwise
returns ``None``.
:param buf: Buffer to search for a ma... | [
"def",
"search",
"(",
"self",
",",
"buf",
")",
":",
"match",
"=",
"self",
".",
"_regex",
".",
"search",
"(",
"self",
".",
"_check_type",
"(",
"buf",
")",
")",
"if",
"match",
"is",
"not",
"None",
":",
"start",
"=",
"match",
".",
"start",
"(",
")",... | Search the provided buffer for a match to the object's regex.
Search the provided buffer for a match to the object's regex. If the
*match* is found, returns a :class:`RegexMatch` object, otherwise
returns ``None``.
:param buf: Buffer to search for a match.
:return: :class:`Rege... | [
"Search",
"the",
"provided",
"buffer",
"for",
"a",
"match",
"to",
"the",
"object",
"s",
"regex",
"."
] | train | https://github.com/digidotcom/python-streamexpect/blob/9ab894506ffd679b37230e935158ff3b0aa170ab/streamexpect.py#L242-L256 |
digidotcom/python-streamexpect | streamexpect.py | SearcherCollection.search | def search(self, buf):
"""Search the provided buffer for a match to any sub-searchers.
Search the provided buffer for a match to any of this collection's
sub-searchers. If a single matching sub-searcher is found, returns that
sub-searcher's *match* object. If multiple matches are found,... | python | def search(self, buf):
"""Search the provided buffer for a match to any sub-searchers.
Search the provided buffer for a match to any of this collection's
sub-searchers. If a single matching sub-searcher is found, returns that
sub-searcher's *match* object. If multiple matches are found,... | [
"def",
"search",
"(",
"self",
",",
"buf",
")",
":",
"self",
".",
"_check_type",
"(",
"buf",
")",
"best_match",
"=",
"None",
"best_index",
"=",
"sys",
".",
"maxsize",
"for",
"searcher",
"in",
"self",
":",
"match",
"=",
"searcher",
".",
"search",
"(",
... | Search the provided buffer for a match to any sub-searchers.
Search the provided buffer for a match to any of this collection's
sub-searchers. If a single matching sub-searcher is found, returns that
sub-searcher's *match* object. If multiple matches are found, the match
with the smalle... | [
"Search",
"the",
"provided",
"buffer",
"for",
"a",
"match",
"to",
"any",
"sub",
"-",
"searchers",
"."
] | train | https://github.com/digidotcom/python-streamexpect/blob/9ab894506ffd679b37230e935158ff3b0aa170ab/streamexpect.py#L316-L336 |
digidotcom/python-streamexpect | streamexpect.py | PollingStreamAdapter.poll | def poll(self, timeout):
"""
:param float timeout: Timeout in seconds.
"""
timeout = float(timeout)
end_time = time.time() + timeout
while True:
# Keep reading until data is received or timeout
incoming = self.stream.read(self._max_read)
... | python | def poll(self, timeout):
"""
:param float timeout: Timeout in seconds.
"""
timeout = float(timeout)
end_time = time.time() + timeout
while True:
# Keep reading until data is received or timeout
incoming = self.stream.read(self._max_read)
... | [
"def",
"poll",
"(",
"self",
",",
"timeout",
")",
":",
"timeout",
"=",
"float",
"(",
"timeout",
")",
"end_time",
"=",
"time",
".",
"time",
"(",
")",
"+",
"timeout",
"while",
"True",
":",
"# Keep reading until data is received or timeout",
"incoming",
"=",
"se... | :param float timeout: Timeout in seconds. | [
":",
"param",
"float",
"timeout",
":",
"Timeout",
"in",
"seconds",
"."
] | train | https://github.com/digidotcom/python-streamexpect/blob/9ab894506ffd679b37230e935158ff3b0aa170ab/streamexpect.py#L441-L454 |
digidotcom/python-streamexpect | streamexpect.py | PollingSocketStreamAdapter.poll | def poll(self, timeout):
"""
:param float timeout: Timeout in seconds. A timeout that is less than
the poll_period will still cause a single read that may take up to
poll_period seconds.
"""
now = time.time()
end_time = now + float(timeout)
prev_ti... | python | def poll(self, timeout):
"""
:param float timeout: Timeout in seconds. A timeout that is less than
the poll_period will still cause a single read that may take up to
poll_period seconds.
"""
now = time.time()
end_time = now + float(timeout)
prev_ti... | [
"def",
"poll",
"(",
"self",
",",
"timeout",
")",
":",
"now",
"=",
"time",
".",
"time",
"(",
")",
"end_time",
"=",
"now",
"+",
"float",
"(",
"timeout",
")",
"prev_timeout",
"=",
"self",
".",
"stream",
".",
"gettimeout",
"(",
")",
"self",
".",
"strea... | :param float timeout: Timeout in seconds. A timeout that is less than
the poll_period will still cause a single read that may take up to
poll_period seconds. | [
":",
"param",
"float",
"timeout",
":",
"Timeout",
"in",
"seconds",
".",
"A",
"timeout",
"that",
"is",
"less",
"than",
"the",
"poll_period",
"will",
"still",
"cause",
"a",
"single",
"read",
"that",
"may",
"take",
"up",
"to",
"poll_period",
"seconds",
"."
] | train | https://github.com/digidotcom/python-streamexpect/blob/9ab894506ffd679b37230e935158ff3b0aa170ab/streamexpect.py#L475-L497 |
digidotcom/python-streamexpect | streamexpect.py | ExpectRegexMixin.expect_regex | def expect_regex(self, pattern, timeout=3, regex_options=0):
"""Wait for a match to the regex in *pattern* to appear on the stream.
Waits for input matching the regex *pattern* for up to *timeout*
seconds. If a match is found, a :class:`RegexMatch` result is returned.
If no match is fou... | python | def expect_regex(self, pattern, timeout=3, regex_options=0):
"""Wait for a match to the regex in *pattern* to appear on the stream.
Waits for input matching the regex *pattern* for up to *timeout*
seconds. If a match is found, a :class:`RegexMatch` result is returned.
If no match is fou... | [
"def",
"expect_regex",
"(",
"self",
",",
"pattern",
",",
"timeout",
"=",
"3",
",",
"regex_options",
"=",
"0",
")",
":",
"return",
"self",
".",
"expect",
"(",
"RegexSearcher",
"(",
"pattern",
",",
"regex_options",
")",
",",
"timeout",
")"
] | Wait for a match to the regex in *pattern* to appear on the stream.
Waits for input matching the regex *pattern* for up to *timeout*
seconds. If a match is found, a :class:`RegexMatch` result is returned.
If no match is found within *timeout* seconds, raise an
:class:`ExpectTimeout` exc... | [
"Wait",
"for",
"a",
"match",
"to",
"the",
"regex",
"in",
"*",
"pattern",
"*",
"to",
"appear",
"on",
"the",
"stream",
"."
] | train | https://github.com/digidotcom/python-streamexpect/blob/9ab894506ffd679b37230e935158ff3b0aa170ab/streamexpect.py#L536-L550 |
digidotcom/python-streamexpect | streamexpect.py | BytesExpecter.expect | def expect(self, searcher, timeout=3):
"""Wait for input matching *searcher*
Waits for input matching *searcher* for up to *timeout* seconds. If
a match is found, the match result is returned (the specific type of
returned result depends on the :class:`Searcher` type). If no match is
... | python | def expect(self, searcher, timeout=3):
"""Wait for input matching *searcher*
Waits for input matching *searcher* for up to *timeout* seconds. If
a match is found, the match result is returned (the specific type of
returned result depends on the :class:`Searcher` type). If no match is
... | [
"def",
"expect",
"(",
"self",
",",
"searcher",
",",
"timeout",
"=",
"3",
")",
":",
"timeout",
"=",
"float",
"(",
"timeout",
")",
"end",
"=",
"time",
".",
"time",
"(",
")",
"+",
"timeout",
"match",
"=",
"searcher",
".",
"search",
"(",
"self",
".",
... | Wait for input matching *searcher*
Waits for input matching *searcher* for up to *timeout* seconds. If
a match is found, the match result is returned (the specific type of
returned result depends on the :class:`Searcher` type). If no match is
found within *timeout* seconds, raise an :cl... | [
"Wait",
"for",
"input",
"matching",
"*",
"searcher",
"*"
] | train | https://github.com/digidotcom/python-streamexpect/blob/9ab894506ffd679b37230e935158ff3b0aa170ab/streamexpect.py#L646-L677 |
Peter-Slump/django-dynamic-fixtures | src/dynamic_fixtures/fixtures/runner.py | LoadFixtureRunner.init_graph | def init_graph(self):
"""
Initialize graph
Load all nodes and set dependencies.
To avoid errors about missing nodes all nodes get loaded first before
setting the dependencies.
"""
self._graph = Graph()
# First add all nodes
for key in self.loader... | python | def init_graph(self):
"""
Initialize graph
Load all nodes and set dependencies.
To avoid errors about missing nodes all nodes get loaded first before
setting the dependencies.
"""
self._graph = Graph()
# First add all nodes
for key in self.loader... | [
"def",
"init_graph",
"(",
"self",
")",
":",
"self",
".",
"_graph",
"=",
"Graph",
"(",
")",
"# First add all nodes",
"for",
"key",
"in",
"self",
".",
"loader",
".",
"disk_fixtures",
".",
"keys",
"(",
")",
":",
"self",
".",
"graph",
".",
"add_node",
"(",... | Initialize graph
Load all nodes and set dependencies.
To avoid errors about missing nodes all nodes get loaded first before
setting the dependencies. | [
"Initialize",
"graph",
"Load",
"all",
"nodes",
"and",
"set",
"dependencies",
"."
] | train | https://github.com/Peter-Slump/django-dynamic-fixtures/blob/da99b4b12b11be28ea4b36b6cf2896ca449c73c1/src/dynamic_fixtures/fixtures/runner.py#L26-L43 |
Peter-Slump/django-dynamic-fixtures | src/dynamic_fixtures/fixtures/runner.py | LoadFixtureRunner.get_app_nodes | def get_app_nodes(self, app_label):
"""
Get all nodes for given app
:param str app_label: app label
:rtype: list
"""
return [node for node in self.graph.nodes if node[0] == app_label] | python | def get_app_nodes(self, app_label):
"""
Get all nodes for given app
:param str app_label: app label
:rtype: list
"""
return [node for node in self.graph.nodes if node[0] == app_label] | [
"def",
"get_app_nodes",
"(",
"self",
",",
"app_label",
")",
":",
"return",
"[",
"node",
"for",
"node",
"in",
"self",
".",
"graph",
".",
"nodes",
"if",
"node",
"[",
"0",
"]",
"==",
"app_label",
"]"
] | Get all nodes for given app
:param str app_label: app label
:rtype: list | [
"Get",
"all",
"nodes",
"for",
"given",
"app",
":",
"param",
"str",
"app_label",
":",
"app",
"label",
":",
"rtype",
":",
"list"
] | train | https://github.com/Peter-Slump/django-dynamic-fixtures/blob/da99b4b12b11be28ea4b36b6cf2896ca449c73c1/src/dynamic_fixtures/fixtures/runner.py#L45-L51 |
Peter-Slump/django-dynamic-fixtures | src/dynamic_fixtures/fixtures/runner.py | LoadFixtureRunner.get_fixture_node | def get_fixture_node(self, app_label, fixture_prefix):
"""
Get all fixtures in given app with given prefix.
:param str app_label: App label
:param str fixture_prefix: first part of the fixture name
:return: list of found fixtures.
"""
app_nodes = self.get_app_node... | python | def get_fixture_node(self, app_label, fixture_prefix):
"""
Get all fixtures in given app with given prefix.
:param str app_label: App label
:param str fixture_prefix: first part of the fixture name
:return: list of found fixtures.
"""
app_nodes = self.get_app_node... | [
"def",
"get_fixture_node",
"(",
"self",
",",
"app_label",
",",
"fixture_prefix",
")",
":",
"app_nodes",
"=",
"self",
".",
"get_app_nodes",
"(",
"app_label",
"=",
"app_label",
")",
"nodes",
"=",
"[",
"node",
"for",
"node",
"in",
"app_nodes",
"if",
"node",
"... | Get all fixtures in given app with given prefix.
:param str app_label: App label
:param str fixture_prefix: first part of the fixture name
:return: list of found fixtures. | [
"Get",
"all",
"fixtures",
"in",
"given",
"app",
"with",
"given",
"prefix",
".",
":",
"param",
"str",
"app_label",
":",
"App",
"label",
":",
"param",
"str",
"fixture_prefix",
":",
"first",
"part",
"of",
"the",
"fixture",
"name",
":",
"return",
":",
"list"... | train | https://github.com/Peter-Slump/django-dynamic-fixtures/blob/da99b4b12b11be28ea4b36b6cf2896ca449c73c1/src/dynamic_fixtures/fixtures/runner.py#L53-L77 |
Peter-Slump/django-dynamic-fixtures | src/dynamic_fixtures/fixtures/runner.py | LoadFixtureRunner.load_fixtures | def load_fixtures(self, nodes=None, progress_callback=None, dry_run=False):
"""Load all fixtures for given nodes.
If no nodes are given all fixtures will be loaded.
:param list nodes: list of nodes to be loaded.
:param callable progress_callback: Callback which will be called while
... | python | def load_fixtures(self, nodes=None, progress_callback=None, dry_run=False):
"""Load all fixtures for given nodes.
If no nodes are given all fixtures will be loaded.
:param list nodes: list of nodes to be loaded.
:param callable progress_callback: Callback which will be called while
... | [
"def",
"load_fixtures",
"(",
"self",
",",
"nodes",
"=",
"None",
",",
"progress_callback",
"=",
"None",
",",
"dry_run",
"=",
"False",
")",
":",
"if",
"progress_callback",
"and",
"not",
"callable",
"(",
"progress_callback",
")",
":",
"raise",
"Exception",
"(",... | Load all fixtures for given nodes.
If no nodes are given all fixtures will be loaded.
:param list nodes: list of nodes to be loaded.
:param callable progress_callback: Callback which will be called while
handling the nodes. | [
"Load",
"all",
"fixtures",
"for",
"given",
"nodes",
"."
] | train | https://github.com/Peter-Slump/django-dynamic-fixtures/blob/da99b4b12b11be28ea4b36b6cf2896ca449c73c1/src/dynamic_fixtures/fixtures/runner.py#L79-L102 |
Peter-Slump/django-dynamic-fixtures | src/dynamic_fixtures/fixtures/runner.py | LoadFixtureRunner.get_plan | def get_plan(self, nodes=None):
"""
Retrieve a plan, e.g. a list of fixtures to be loaded sorted on
dependency.
:param list nodes: list of nodes to be loaded.
:return:
"""
if nodes:
plan = self.graph.resolve_nodes(nodes)
else:
plan... | python | def get_plan(self, nodes=None):
"""
Retrieve a plan, e.g. a list of fixtures to be loaded sorted on
dependency.
:param list nodes: list of nodes to be loaded.
:return:
"""
if nodes:
plan = self.graph.resolve_nodes(nodes)
else:
plan... | [
"def",
"get_plan",
"(",
"self",
",",
"nodes",
"=",
"None",
")",
":",
"if",
"nodes",
":",
"plan",
"=",
"self",
".",
"graph",
".",
"resolve_nodes",
"(",
"nodes",
")",
"else",
":",
"plan",
"=",
"self",
".",
"graph",
".",
"resolve_node",
"(",
")",
"ret... | Retrieve a plan, e.g. a list of fixtures to be loaded sorted on
dependency.
:param list nodes: list of nodes to be loaded.
:return: | [
"Retrieve",
"a",
"plan",
"e",
".",
"g",
".",
"a",
"list",
"of",
"fixtures",
"to",
"be",
"loaded",
"sorted",
"on",
"dependency",
"."
] | train | https://github.com/Peter-Slump/django-dynamic-fixtures/blob/da99b4b12b11be28ea4b36b6cf2896ca449c73c1/src/dynamic_fixtures/fixtures/runner.py#L115-L128 |
acorg/dark-matter | dark/mutations.py | basePlotter | def basePlotter(blastHits, title):
"""
Plot the reads and the subject, so that bases in the reads which are
different from the subject are shown. Else a '.' is shown.
like so:
subject_gi ATGCGTACGTACGACACC
read_1 A......TTC..T
@param blastHits: A L{dark.blast.BlastHits} instance.
... | python | def basePlotter(blastHits, title):
"""
Plot the reads and the subject, so that bases in the reads which are
different from the subject are shown. Else a '.' is shown.
like so:
subject_gi ATGCGTACGTACGACACC
read_1 A......TTC..T
@param blastHits: A L{dark.blast.BlastHits} instance.
... | [
"def",
"basePlotter",
"(",
"blastHits",
",",
"title",
")",
":",
"result",
"=",
"[",
"]",
"params",
"=",
"blastHits",
".",
"plotParams",
"assert",
"params",
"is",
"not",
"None",
",",
"(",
"'Oops, it looks like you forgot to run '",
"'computePlotInfo.'",
")",
"seq... | Plot the reads and the subject, so that bases in the reads which are
different from the subject are shown. Else a '.' is shown.
like so:
subject_gi ATGCGTACGTACGACACC
read_1 A......TTC..T
@param blastHits: A L{dark.blast.BlastHits} instance.
@param title: A C{str} sequence title that w... | [
"Plot",
"the",
"reads",
"and",
"the",
"subject",
"so",
"that",
"bases",
"in",
"the",
"reads",
"which",
"are",
"different",
"from",
"the",
"subject",
"are",
"shown",
".",
"Else",
"a",
".",
"is",
"shown",
".",
"like",
"so",
":",
"subject_gi",
"ATGCGTACGTAC... | train | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/mutations.py#L30-L178 |
acorg/dark-matter | dark/mutations.py | getAPOBECFrequencies | def getAPOBECFrequencies(dotAlignment, orig, new, pattern):
"""
Gets mutation frequencies if they are in a certain pattern.
@param dotAlignment: result from calling basePlotter
@param orig: A C{str}, naming the original base
@param new: A C{str}, what orig was mutated to
@param pattern: A C{str... | python | def getAPOBECFrequencies(dotAlignment, orig, new, pattern):
"""
Gets mutation frequencies if they are in a certain pattern.
@param dotAlignment: result from calling basePlotter
@param orig: A C{str}, naming the original base
@param new: A C{str}, what orig was mutated to
@param pattern: A C{str... | [
"def",
"getAPOBECFrequencies",
"(",
"dotAlignment",
",",
"orig",
",",
"new",
",",
"pattern",
")",
":",
"cPattern",
"=",
"[",
"'ACA'",
",",
"'ACC'",
",",
"'ACG'",
",",
"'ACT'",
",",
"'CCA'",
",",
"'CCC'",
",",
"'CCG'",
",",
"'CCT'",
",",
"'GCA'",
",",
... | Gets mutation frequencies if they are in a certain pattern.
@param dotAlignment: result from calling basePlotter
@param orig: A C{str}, naming the original base
@param new: A C{str}, what orig was mutated to
@param pattern: A C{str}m which pattern we're looking for
(must be one of 'cPattern', '... | [
"Gets",
"mutation",
"frequencies",
"if",
"they",
"are",
"in",
"a",
"certain",
"pattern",
"."
] | train | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/mutations.py#L181-L228 |
acorg/dark-matter | dark/mutations.py | getCompleteFreqs | def getCompleteFreqs(blastHits):
"""
Make a dictionary which collects all mutation frequencies from
all reads.
Calls basePlotter to get dotAlignment, which is passed to
getAPOBECFrequencies with the respective parameter, to collect
the frequencies.
@param blastHits: A L{dark.blast.BlastHits... | python | def getCompleteFreqs(blastHits):
"""
Make a dictionary which collects all mutation frequencies from
all reads.
Calls basePlotter to get dotAlignment, which is passed to
getAPOBECFrequencies with the respective parameter, to collect
the frequencies.
@param blastHits: A L{dark.blast.BlastHits... | [
"def",
"getCompleteFreqs",
"(",
"blastHits",
")",
":",
"allFreqs",
"=",
"{",
"}",
"for",
"title",
"in",
"blastHits",
".",
"titles",
":",
"allFreqs",
"[",
"title",
"]",
"=",
"{",
"'C>A'",
":",
"{",
"}",
",",
"'C>G'",
":",
"{",
"}",
",",
"'C>T'",
":"... | Make a dictionary which collects all mutation frequencies from
all reads.
Calls basePlotter to get dotAlignment, which is passed to
getAPOBECFrequencies with the respective parameter, to collect
the frequencies.
@param blastHits: A L{dark.blast.BlastHits} instance. | [
"Make",
"a",
"dictionary",
"which",
"collects",
"all",
"mutation",
"frequencies",
"from",
"all",
"reads",
".",
"Calls",
"basePlotter",
"to",
"get",
"dotAlignment",
"which",
"is",
"passed",
"to",
"getAPOBECFrequencies",
"with",
"the",
"respective",
"parameter",
"to... | train | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/mutations.py#L231-L265 |
acorg/dark-matter | dark/mutations.py | makeFrequencyGraph | def makeFrequencyGraph(allFreqs, title, substitution, pattern,
color='blue', createFigure=True, showFigure=True,
readsAx=False):
"""
For a title, make a graph showing the frequencies.
@param allFreqs: result from getCompleteFreqs
@param title: A C{str}, tit... | python | def makeFrequencyGraph(allFreqs, title, substitution, pattern,
color='blue', createFigure=True, showFigure=True,
readsAx=False):
"""
For a title, make a graph showing the frequencies.
@param allFreqs: result from getCompleteFreqs
@param title: A C{str}, tit... | [
"def",
"makeFrequencyGraph",
"(",
"allFreqs",
",",
"title",
",",
"substitution",
",",
"pattern",
",",
"color",
"=",
"'blue'",
",",
"createFigure",
"=",
"True",
",",
"showFigure",
"=",
"True",
",",
"readsAx",
"=",
"False",
")",
":",
"cPattern",
"=",
"[",
... | For a title, make a graph showing the frequencies.
@param allFreqs: result from getCompleteFreqs
@param title: A C{str}, title of virus of which frequencies should be
plotted.
@param substitution: A C{str}, which substitution should be plotted;
must be one of 'C>A', 'C>G', 'C>T', 'T>A', 'T>... | [
"For",
"a",
"title",
"make",
"a",
"graph",
"showing",
"the",
"frequencies",
"."
] | train | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/mutations.py#L268-L329 |
acorg/dark-matter | dark/mutations.py | makeFrequencyPanel | def makeFrequencyPanel(allFreqs, patientName):
"""
For a title, make a graph showing the frequencies.
@param allFreqs: result from getCompleteFreqs
@param patientName: A C{str}, title for the panel
"""
titles = sorted(
iter(allFreqs.keys()),
key=lambda title: (allFreqs[title]['b... | python | def makeFrequencyPanel(allFreqs, patientName):
"""
For a title, make a graph showing the frequencies.
@param allFreqs: result from getCompleteFreqs
@param patientName: A C{str}, title for the panel
"""
titles = sorted(
iter(allFreqs.keys()),
key=lambda title: (allFreqs[title]['b... | [
"def",
"makeFrequencyPanel",
"(",
"allFreqs",
",",
"patientName",
")",
":",
"titles",
"=",
"sorted",
"(",
"iter",
"(",
"allFreqs",
".",
"keys",
"(",
")",
")",
",",
"key",
"=",
"lambda",
"title",
":",
"(",
"allFreqs",
"[",
"title",
"]",
"[",
"'bitScoreM... | For a title, make a graph showing the frequencies.
@param allFreqs: result from getCompleteFreqs
@param patientName: A C{str}, title for the panel | [
"For",
"a",
"title",
"make",
"a",
"graph",
"showing",
"the",
"frequencies",
"."
] | train | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/mutations.py#L332-L404 |
acorg/dark-matter | dark/mutations.py | mutateString | def mutateString(original, n, replacements='acgt'):
"""
Mutate C{original} in C{n} places with chars chosen from C{replacements}.
@param original: The original C{str} to mutate.
@param n: The C{int} number of locations to mutate.
@param replacements: The C{str} of replacement letters.
@return:... | python | def mutateString(original, n, replacements='acgt'):
"""
Mutate C{original} in C{n} places with chars chosen from C{replacements}.
@param original: The original C{str} to mutate.
@param n: The C{int} number of locations to mutate.
@param replacements: The C{str} of replacement letters.
@return:... | [
"def",
"mutateString",
"(",
"original",
",",
"n",
",",
"replacements",
"=",
"'acgt'",
")",
":",
"if",
"not",
"original",
":",
"raise",
"ValueError",
"(",
"'Empty original string passed.'",
")",
"if",
"n",
">",
"len",
"(",
"original",
")",
":",
"raise",
"Va... | Mutate C{original} in C{n} places with chars chosen from C{replacements}.
@param original: The original C{str} to mutate.
@param n: The C{int} number of locations to mutate.
@param replacements: The C{str} of replacement letters.
@return: A new C{str} with C{n} places of C{original} mutated.
@rais... | [
"Mutate",
"C",
"{",
"original",
"}",
"in",
"C",
"{",
"n",
"}",
"places",
"with",
"chars",
"chosen",
"from",
"C",
"{",
"replacements",
"}",
"."
] | train | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/mutations.py#L407-L449 |
acorg/dark-matter | bin/filter-fasta-by-taxonomy.py | writeDetails | def writeDetails(accept, readId, taxonomy, fp):
"""
Write read and taxonomy details.
@param accept: A C{bool} indicating whether the read was accepted,
according to its taxonomy.
@param readId: The C{str} id of the read.
@taxonomy: A C{list} of taxonomy C{str} levels.
@fp: An open file ... | python | def writeDetails(accept, readId, taxonomy, fp):
"""
Write read and taxonomy details.
@param accept: A C{bool} indicating whether the read was accepted,
according to its taxonomy.
@param readId: The C{str} id of the read.
@taxonomy: A C{list} of taxonomy C{str} levels.
@fp: An open file ... | [
"def",
"writeDetails",
"(",
"accept",
",",
"readId",
",",
"taxonomy",
",",
"fp",
")",
":",
"fp",
".",
"write",
"(",
"'%s %s\\n %s\\n\\n'",
"%",
"(",
"'MATCH:'",
"if",
"accept",
"else",
"'MISS: '",
",",
"readId",
",",
"' | '",
".",
"join",
"(",
"tax... | Write read and taxonomy details.
@param accept: A C{bool} indicating whether the read was accepted,
according to its taxonomy.
@param readId: The C{str} id of the read.
@taxonomy: A C{list} of taxonomy C{str} levels.
@fp: An open file pointer to write to. | [
"Write",
"read",
"and",
"taxonomy",
"details",
"."
] | train | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/bin/filter-fasta-by-taxonomy.py#L32-L44 |
ikegami-yukino/shellinford-python | shellinford/shellinford.py | FMIndex.build | def build(self, docs=None, filename=None):
"""Build FM-index
Params:
<iterator> | <generator> docs
<str> filename
"""
if docs:
if hasattr(docs, 'items'):
for (idx, doc) in sorted(getattr(docs, 'items')(),
... | python | def build(self, docs=None, filename=None):
"""Build FM-index
Params:
<iterator> | <generator> docs
<str> filename
"""
if docs:
if hasattr(docs, 'items'):
for (idx, doc) in sorted(getattr(docs, 'items')(),
... | [
"def",
"build",
"(",
"self",
",",
"docs",
"=",
"None",
",",
"filename",
"=",
"None",
")",
":",
"if",
"docs",
":",
"if",
"hasattr",
"(",
"docs",
",",
"'items'",
")",
":",
"for",
"(",
"idx",
",",
"doc",
")",
"in",
"sorted",
"(",
"getattr",
"(",
"... | Build FM-index
Params:
<iterator> | <generator> docs
<str> filename | [
"Build",
"FM",
"-",
"index",
"Params",
":",
"<iterator",
">",
"|",
"<generator",
">",
"docs",
"<str",
">",
"filename"
] | train | https://github.com/ikegami-yukino/shellinford-python/blob/ea4d4280e05a15543aa5cd405f90b2c503916dc9/shellinford/shellinford.py#L419-L435 |
ikegami-yukino/shellinford-python | shellinford/shellinford.py | FMIndex._merge_search_result | def _merge_search_result(self, search_results, _or=False):
"""Merge of filter search results
Params:
<str> | <Sequential> query
<bool> _or
Return:
<list> computed_dids
"""
all_docids = reduce(add, [list(x.keys()) for x in search_results])
... | python | def _merge_search_result(self, search_results, _or=False):
"""Merge of filter search results
Params:
<str> | <Sequential> query
<bool> _or
Return:
<list> computed_dids
"""
all_docids = reduce(add, [list(x.keys()) for x in search_results])
... | [
"def",
"_merge_search_result",
"(",
"self",
",",
"search_results",
",",
"_or",
"=",
"False",
")",
":",
"all_docids",
"=",
"reduce",
"(",
"add",
",",
"[",
"list",
"(",
"x",
".",
"keys",
"(",
")",
")",
"for",
"x",
"in",
"search_results",
"]",
")",
"if"... | Merge of filter search results
Params:
<str> | <Sequential> query
<bool> _or
Return:
<list> computed_dids | [
"Merge",
"of",
"filter",
"search",
"results",
"Params",
":",
"<str",
">",
"|",
"<Sequential",
">",
"query",
"<bool",
">",
"_or",
"Return",
":",
"<list",
">",
"computed_dids"
] | train | https://github.com/ikegami-yukino/shellinford-python/blob/ea4d4280e05a15543aa5cd405f90b2c503916dc9/shellinford/shellinford.py#L437-L448 |
ikegami-yukino/shellinford-python | shellinford/shellinford.py | FMIndex.search | def search(self, query, _or=False, ignores=[]):
"""Search word from FM-index
Params:
<str> | <Sequential> query
<bool> _or
<list <str> > ignores
Return:
<list>SEARCH_RESULT(<int> document_id,
<list <int> > counts
... | python | def search(self, query, _or=False, ignores=[]):
"""Search word from FM-index
Params:
<str> | <Sequential> query
<bool> _or
<list <str> > ignores
Return:
<list>SEARCH_RESULT(<int> document_id,
<list <int> > counts
... | [
"def",
"search",
"(",
"self",
",",
"query",
",",
"_or",
"=",
"False",
",",
"ignores",
"=",
"[",
"]",
")",
":",
"if",
"isinstance",
"(",
"query",
",",
"str",
")",
":",
"dids",
"=",
"MapIntInt",
"(",
"{",
"}",
")",
"self",
".",
"fm",
".",
"search... | Search word from FM-index
Params:
<str> | <Sequential> query
<bool> _or
<list <str> > ignores
Return:
<list>SEARCH_RESULT(<int> document_id,
<list <int> > counts
<str> doc) | [
"Search",
"word",
"from",
"FM",
"-",
"index",
"Params",
":",
"<str",
">",
"|",
"<Sequential",
">",
"query",
"<bool",
">",
"_or",
"<list",
"<str",
">",
">",
"ignores",
"Return",
":",
"<list",
">",
"SEARCH_RESULT",
"(",
"<int",
">",
"document_id",
"<list",... | train | https://github.com/ikegami-yukino/shellinford-python/blob/ea4d4280e05a15543aa5cd405f90b2c503916dc9/shellinford/shellinford.py#L450-L485 |
ikegami-yukino/shellinford-python | shellinford/shellinford.py | FMIndex.count | def count(self, query, _or=False):
"""Count word from FM-index
Params:
<str> | <Sequential> query
<bool> _or
<list <str> > ignores
Return:
<int> counts
"""
if isinstance(query, str):
return self.fm.count(query, MapIntInt... | python | def count(self, query, _or=False):
"""Count word from FM-index
Params:
<str> | <Sequential> query
<bool> _or
<list <str> > ignores
Return:
<int> counts
"""
if isinstance(query, str):
return self.fm.count(query, MapIntInt... | [
"def",
"count",
"(",
"self",
",",
"query",
",",
"_or",
"=",
"False",
")",
":",
"if",
"isinstance",
"(",
"query",
",",
"str",
")",
":",
"return",
"self",
".",
"fm",
".",
"count",
"(",
"query",
",",
"MapIntInt",
"(",
"{",
"}",
")",
")",
"else",
"... | Count word from FM-index
Params:
<str> | <Sequential> query
<bool> _or
<list <str> > ignores
Return:
<int> counts | [
"Count",
"word",
"from",
"FM",
"-",
"index",
"Params",
":",
"<str",
">",
"|",
"<Sequential",
">",
"query",
"<bool",
">",
"_or",
"<list",
"<str",
">",
">",
"ignores",
"Return",
":",
"<int",
">",
"counts"
] | train | https://github.com/ikegami-yukino/shellinford-python/blob/ea4d4280e05a15543aa5cd405f90b2c503916dc9/shellinford/shellinford.py#L487-L511 |
invenia/Arbiter | arbiter/graph.py | Graph.add | def add(self, name, parents=None):
"""
add a node to the graph.
Raises an exception if the node cannot be added (i.e., if a node
that name already exists, or if it would create a cycle.
NOTE: A node can be added before its parents are added.
name: The name of the node ... | python | def add(self, name, parents=None):
"""
add a node to the graph.
Raises an exception if the node cannot be added (i.e., if a node
that name already exists, or if it would create a cycle.
NOTE: A node can be added before its parents are added.
name: The name of the node ... | [
"def",
"add",
"(",
"self",
",",
"name",
",",
"parents",
"=",
"None",
")",
":",
"if",
"not",
"isinstance",
"(",
"name",
",",
"Hashable",
")",
":",
"raise",
"TypeError",
"(",
"name",
")",
"parents",
"=",
"set",
"(",
"parents",
"or",
"(",
")",
")",
... | add a node to the graph.
Raises an exception if the node cannot be added (i.e., if a node
that name already exists, or if it would create a cycle.
NOTE: A node can be added before its parents are added.
name: The name of the node to add to the graph. Name can be any
unique... | [
"add",
"a",
"node",
"to",
"the",
"graph",
"."
] | train | https://github.com/invenia/Arbiter/blob/51008393ae8797da85bcd67807259a157f941dfd/arbiter/graph.py#L27-L84 |
invenia/Arbiter | arbiter/graph.py | Graph.remove | def remove(self, name, strategy=Strategy.promote):
"""
Remove a node from the graph. Returns the set of nodes that were
removed.
If the node doesn't exist, an exception will be raised.
name: The name of the node to remove.
strategy: (Optional, Strategy.promote) What to ... | python | def remove(self, name, strategy=Strategy.promote):
"""
Remove a node from the graph. Returns the set of nodes that were
removed.
If the node doesn't exist, an exception will be raised.
name: The name of the node to remove.
strategy: (Optional, Strategy.promote) What to ... | [
"def",
"remove",
"(",
"self",
",",
"name",
",",
"strategy",
"=",
"Strategy",
".",
"promote",
")",
":",
"removed",
"=",
"set",
"(",
")",
"stack",
"=",
"[",
"name",
"]",
"while",
"stack",
":",
"current",
"=",
"stack",
".",
"pop",
"(",
")",
"node",
... | Remove a node from the graph. Returns the set of nodes that were
removed.
If the node doesn't exist, an exception will be raised.
name: The name of the node to remove.
strategy: (Optional, Strategy.promote) What to do with children
or removed nodes. The options are:
... | [
"Remove",
"a",
"node",
"from",
"the",
"graph",
".",
"Returns",
"the",
"set",
"of",
"nodes",
"that",
"were",
"removed",
"."
] | train | https://github.com/invenia/Arbiter/blob/51008393ae8797da85bcd67807259a157f941dfd/arbiter/graph.py#L86-L148 |
invenia/Arbiter | arbiter/graph.py | Graph.ancestor_of | def ancestor_of(self, name, ancestor, visited=None):
"""
Check whether a node has another node as an ancestor.
name: The name of the node being checked.
ancestor: The name of the (possible) ancestor node.
visited: (optional, None) If given, a set of nodes that have
a... | python | def ancestor_of(self, name, ancestor, visited=None):
"""
Check whether a node has another node as an ancestor.
name: The name of the node being checked.
ancestor: The name of the (possible) ancestor node.
visited: (optional, None) If given, a set of nodes that have
a... | [
"def",
"ancestor_of",
"(",
"self",
",",
"name",
",",
"ancestor",
",",
"visited",
"=",
"None",
")",
":",
"if",
"visited",
"is",
"None",
":",
"visited",
"=",
"set",
"(",
")",
"node",
"=",
"self",
".",
"_nodes",
".",
"get",
"(",
"name",
")",
"if",
"... | Check whether a node has another node as an ancestor.
name: The name of the node being checked.
ancestor: The name of the (possible) ancestor node.
visited: (optional, None) If given, a set of nodes that have
already been traversed. NOTE: The set will be updated with
any... | [
"Check",
"whether",
"a",
"node",
"has",
"another",
"node",
"as",
"an",
"ancestor",
"."
] | train | https://github.com/invenia/Arbiter/blob/51008393ae8797da85bcd67807259a157f941dfd/arbiter/graph.py#L184-L219 |
invenia/Arbiter | arbiter/graph.py | Graph.prune | def prune(self):
"""
Remove any tasks that have stubs as ancestors (and the stubs
themselves).
Returns the set of nodes which were removed.
"""
pruned = set()
stubs = frozenset(self._stubs)
for stub in stubs:
pruned.update(self.remove(stub, s... | python | def prune(self):
"""
Remove any tasks that have stubs as ancestors (and the stubs
themselves).
Returns the set of nodes which were removed.
"""
pruned = set()
stubs = frozenset(self._stubs)
for stub in stubs:
pruned.update(self.remove(stub, s... | [
"def",
"prune",
"(",
"self",
")",
":",
"pruned",
"=",
"set",
"(",
")",
"stubs",
"=",
"frozenset",
"(",
"self",
".",
"_stubs",
")",
"for",
"stub",
"in",
"stubs",
":",
"pruned",
".",
"update",
"(",
"self",
".",
"remove",
"(",
"stub",
",",
"strategy",... | Remove any tasks that have stubs as ancestors (and the stubs
themselves).
Returns the set of nodes which were removed. | [
"Remove",
"any",
"tasks",
"that",
"have",
"stubs",
"as",
"ancestors",
"(",
"and",
"the",
"stubs",
"themselves",
")",
"."
] | train | https://github.com/invenia/Arbiter/blob/51008393ae8797da85bcd67807259a157f941dfd/arbiter/graph.py#L221-L234 |
disqus/overseer | overseer/views.py | respond | def respond(template, context={}, request=None, **kwargs):
"Calls render_to_response with a RequestConext"
from django.http import HttpResponse
from django.template import RequestContext
from django.template.loader import render_to_string
if request:
default = context_processors.default... | python | def respond(template, context={}, request=None, **kwargs):
"Calls render_to_response with a RequestConext"
from django.http import HttpResponse
from django.template import RequestContext
from django.template.loader import render_to_string
if request:
default = context_processors.default... | [
"def",
"respond",
"(",
"template",
",",
"context",
"=",
"{",
"}",
",",
"request",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"from",
"django",
".",
"http",
"import",
"HttpResponse",
"from",
"django",
".",
"template",
"import",
"RequestContext",
"fro... | Calls render_to_response with a RequestConext | [
"Calls",
"render_to_response",
"with",
"a",
"RequestConext"
] | train | https://github.com/disqus/overseer/blob/b37573aba33b20aa86f89eb0c7e6f4d9905bedef/overseer/views.py#L38-L51 |
disqus/overseer | overseer/views.py | index | def index(request):
"Displays a list of all services and their current status."
service_list = Service.objects.all()
event_list = list(Event.objects\
.filter(Q(status__gt=0) | Q(date_updated__gte=datetime.datetime.now()-datetime.timedelta(days=1)))\
... | python | def index(request):
"Displays a list of all services and their current status."
service_list = Service.objects.all()
event_list = list(Event.objects\
.filter(Q(status__gt=0) | Q(date_updated__gte=datetime.datetime.now()-datetime.timedelta(days=1)))\
... | [
"def",
"index",
"(",
"request",
")",
":",
"service_list",
"=",
"Service",
".",
"objects",
".",
"all",
"(",
")",
"event_list",
"=",
"list",
"(",
"Event",
".",
"objects",
".",
"filter",
"(",
"Q",
"(",
"status__gt",
"=",
"0",
")",
"|",
"Q",
"(",
"date... | Displays a list of all services and their current status. | [
"Displays",
"a",
"list",
"of",
"all",
"services",
"and",
"their",
"current",
"status",
"."
] | train | https://github.com/disqus/overseer/blob/b37573aba33b20aa86f89eb0c7e6f4d9905bedef/overseer/views.py#L53-L71 |
disqus/overseer | overseer/views.py | service | def service(request, slug):
"Displays a list of all services and their current status."
try:
service = Service.objects.get(slug=slug)
except Service.DoesNotExist:
return HttpResponseRedirect(reverse('overseer:index'))
event_list = service.event_set.order_by('-date_created')... | python | def service(request, slug):
"Displays a list of all services and their current status."
try:
service = Service.objects.get(slug=slug)
except Service.DoesNotExist:
return HttpResponseRedirect(reverse('overseer:index'))
event_list = service.event_set.order_by('-date_created')... | [
"def",
"service",
"(",
"request",
",",
"slug",
")",
":",
"try",
":",
"service",
"=",
"Service",
".",
"objects",
".",
"get",
"(",
"slug",
"=",
"slug",
")",
"except",
"Service",
".",
"DoesNotExist",
":",
"return",
"HttpResponseRedirect",
"(",
"reverse",
"(... | Displays a list of all services and their current status. | [
"Displays",
"a",
"list",
"of",
"all",
"services",
"and",
"their",
"current",
"status",
"."
] | train | https://github.com/disqus/overseer/blob/b37573aba33b20aa86f89eb0c7e6f4d9905bedef/overseer/views.py#L73-L86 |
disqus/overseer | overseer/views.py | event | def event(request, id):
"Displays a list of all services and their current status."
try:
evt = Event.objects.get(pk=id)
except Event.DoesNotExist:
return HttpResponseRedirect(reverse('overseer:index'))
update_list = list(evt.eventupdate_set.order_by('-date_created'))
r... | python | def event(request, id):
"Displays a list of all services and their current status."
try:
evt = Event.objects.get(pk=id)
except Event.DoesNotExist:
return HttpResponseRedirect(reverse('overseer:index'))
update_list = list(evt.eventupdate_set.order_by('-date_created'))
r... | [
"def",
"event",
"(",
"request",
",",
"id",
")",
":",
"try",
":",
"evt",
"=",
"Event",
".",
"objects",
".",
"get",
"(",
"pk",
"=",
"id",
")",
"except",
"Event",
".",
"DoesNotExist",
":",
"return",
"HttpResponseRedirect",
"(",
"reverse",
"(",
"'overseer:... | Displays a list of all services and their current status. | [
"Displays",
"a",
"list",
"of",
"all",
"services",
"and",
"their",
"current",
"status",
"."
] | train | https://github.com/disqus/overseer/blob/b37573aba33b20aa86f89eb0c7e6f4d9905bedef/overseer/views.py#L88-L101 |
disqus/overseer | overseer/views.py | last_event | def last_event(request, slug):
"Displays a list of all services and their current status."
try:
service = Service.objects.get(slug=slug)
except Service.DoesNotExist:
return HttpResponseRedirect(reverse('overseer:index'))
try:
evt = service.event_set.order_by('-date_crea... | python | def last_event(request, slug):
"Displays a list of all services and their current status."
try:
service = Service.objects.get(slug=slug)
except Service.DoesNotExist:
return HttpResponseRedirect(reverse('overseer:index'))
try:
evt = service.event_set.order_by('-date_crea... | [
"def",
"last_event",
"(",
"request",
",",
"slug",
")",
":",
"try",
":",
"service",
"=",
"Service",
".",
"objects",
".",
"get",
"(",
"slug",
"=",
"slug",
")",
"except",
"Service",
".",
"DoesNotExist",
":",
"return",
"HttpResponseRedirect",
"(",
"reverse",
... | Displays a list of all services and their current status. | [
"Displays",
"a",
"list",
"of",
"all",
"services",
"and",
"their",
"current",
"status",
"."
] | train | https://github.com/disqus/overseer/blob/b37573aba33b20aa86f89eb0c7e6f4d9905bedef/overseer/views.py#L103-L116 |
disqus/overseer | overseer/views.py | update_subscription | def update_subscription(request, ident):
"Shows subscriptions options for a verified subscriber."
try:
subscription = Subscription.objects.get(ident=ident)
except Subscription.DoesNotExist:
return respond('overseer/invalid_subscription_token.html', {}, request)
if request.POST:
... | python | def update_subscription(request, ident):
"Shows subscriptions options for a verified subscriber."
try:
subscription = Subscription.objects.get(ident=ident)
except Subscription.DoesNotExist:
return respond('overseer/invalid_subscription_token.html', {}, request)
if request.POST:
... | [
"def",
"update_subscription",
"(",
"request",
",",
"ident",
")",
":",
"try",
":",
"subscription",
"=",
"Subscription",
".",
"objects",
".",
"get",
"(",
"ident",
"=",
"ident",
")",
"except",
"Subscription",
".",
"DoesNotExist",
":",
"return",
"respond",
"(",
... | Shows subscriptions options for a verified subscriber. | [
"Shows",
"subscriptions",
"options",
"for",
"a",
"verified",
"subscriber",
"."
] | train | https://github.com/disqus/overseer/blob/b37573aba33b20aa86f89eb0c7e6f4d9905bedef/overseer/views.py#L120-L151 |
disqus/overseer | overseer/views.py | create_subscription | def create_subscription(request):
"Shows subscriptions options for a new subscriber."
if request.POST:
form = NewSubscriptionForm(request.POST)
if form.is_valid():
unverified = form.save()
body = """Please confirm your email address to subscribe to status updates fr... | python | def create_subscription(request):
"Shows subscriptions options for a new subscriber."
if request.POST:
form = NewSubscriptionForm(request.POST)
if form.is_valid():
unverified = form.save()
body = """Please confirm your email address to subscribe to status updates fr... | [
"def",
"create_subscription",
"(",
"request",
")",
":",
"if",
"request",
".",
"POST",
":",
"form",
"=",
"NewSubscriptionForm",
"(",
"request",
".",
"POST",
")",
"if",
"form",
".",
"is_valid",
"(",
")",
":",
"unverified",
"=",
"form",
".",
"save",
"(",
... | Shows subscriptions options for a new subscriber. | [
"Shows",
"subscriptions",
"options",
"for",
"a",
"new",
"subscriber",
"."
] | train | https://github.com/disqus/overseer/blob/b37573aba33b20aa86f89eb0c7e6f4d9905bedef/overseer/views.py#L155-L189 |
disqus/overseer | overseer/views.py | verify_subscription | def verify_subscription(request, ident):
"""
Verifies an unverified subscription and create or appends
to an existing subscription.
"""
try:
unverified = UnverifiedSubscription.objects.get(ident=ident)
except UnverifiedSubscription.DoesNotExist:
return respond('overseer/inva... | python | def verify_subscription(request, ident):
"""
Verifies an unverified subscription and create or appends
to an existing subscription.
"""
try:
unverified = UnverifiedSubscription.objects.get(ident=ident)
except UnverifiedSubscription.DoesNotExist:
return respond('overseer/inva... | [
"def",
"verify_subscription",
"(",
"request",
",",
"ident",
")",
":",
"try",
":",
"unverified",
"=",
"UnverifiedSubscription",
".",
"objects",
".",
"get",
"(",
"ident",
"=",
"ident",
")",
"except",
"UnverifiedSubscription",
".",
"DoesNotExist",
":",
"return",
... | Verifies an unverified subscription and create or appends
to an existing subscription. | [
"Verifies",
"an",
"unverified",
"subscription",
"and",
"create",
"or",
"appends",
"to",
"an",
"existing",
"subscription",
"."
] | train | https://github.com/disqus/overseer/blob/b37573aba33b20aa86f89eb0c7e6f4d9905bedef/overseer/views.py#L192-L213 |
flo-compbio/genometools | genometools/gcloud/storage.py | get_client | def get_client(key, project):
"""Gets a `Client` object (required by the other functions).
TODO: docstring"""
cred = get_storage_credentials(key)
return storage.Client(project=project, credentials=cred) | python | def get_client(key, project):
"""Gets a `Client` object (required by the other functions).
TODO: docstring"""
cred = get_storage_credentials(key)
return storage.Client(project=project, credentials=cred) | [
"def",
"get_client",
"(",
"key",
",",
"project",
")",
":",
"cred",
"=",
"get_storage_credentials",
"(",
"key",
")",
"return",
"storage",
".",
"Client",
"(",
"project",
"=",
"project",
",",
"credentials",
"=",
"cred",
")"
] | Gets a `Client` object (required by the other functions).
TODO: docstring | [
"Gets",
"a",
"Client",
"object",
"(",
"required",
"by",
"the",
"other",
"functions",
")",
".",
"TODO",
":",
"docstring"
] | train | https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/gcloud/storage.py#L56-L61 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.