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 |
|---|---|---|---|---|---|---|---|---|---|---|
flo-compbio/genometools | genometools/gcloud/storage.py | get_files | def get_files(client, bucket, prefix=''):
"""Lists files/objects on a bucket.
TODO: docstring"""
bucket = client.get_bucket(bucket)
files = list(bucket.list_blobs(prefix=prefix))
return files | python | def get_files(client, bucket, prefix=''):
"""Lists files/objects on a bucket.
TODO: docstring"""
bucket = client.get_bucket(bucket)
files = list(bucket.list_blobs(prefix=prefix))
return files | [
"def",
"get_files",
"(",
"client",
",",
"bucket",
",",
"prefix",
"=",
"''",
")",
":",
"bucket",
"=",
"client",
".",
"get_bucket",
"(",
"bucket",
")",
"files",
"=",
"list",
"(",
"bucket",
".",
"list_blobs",
"(",
"prefix",
"=",
"prefix",
")",
")",
"ret... | Lists files/objects on a bucket.
TODO: docstring | [
"Lists",
"files",
"/",
"objects",
"on",
"a",
"bucket",
".",
"TODO",
":",
"docstring"
] | train | https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/gcloud/storage.py#L64-L70 |
flo-compbio/genometools | genometools/gcloud/storage.py | download_file | def download_file(client, bucket, remote_path, local_path, overwrite=False):
"""Downloads a file from a bucket.
TODO: docstring"""
bucket = client.get_bucket(bucket)
if (not overwrite) and os.path.isfile(local_path):
raise OSError('File already exists!')
with open(local_path, 'wb') as o... | python | def download_file(client, bucket, remote_path, local_path, overwrite=False):
"""Downloads a file from a bucket.
TODO: docstring"""
bucket = client.get_bucket(bucket)
if (not overwrite) and os.path.isfile(local_path):
raise OSError('File already exists!')
with open(local_path, 'wb') as o... | [
"def",
"download_file",
"(",
"client",
",",
"bucket",
",",
"remote_path",
",",
"local_path",
",",
"overwrite",
"=",
"False",
")",
":",
"bucket",
"=",
"client",
".",
"get_bucket",
"(",
"bucket",
")",
"if",
"(",
"not",
"overwrite",
")",
"and",
"os",
".",
... | Downloads a file from a bucket.
TODO: docstring | [
"Downloads",
"a",
"file",
"from",
"a",
"bucket",
".",
"TODO",
":",
"docstring"
] | train | https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/gcloud/storage.py#L73-L81 |
flo-compbio/genometools | genometools/gcloud/storage.py | delete_file | def delete_file(client, bucket, remote_path):
"""Deletes a file from a bucket.
TODO: docstring"""
bucket = client.get_bucket(bucket)
bucket.delete_blob(remote_path) | python | def delete_file(client, bucket, remote_path):
"""Deletes a file from a bucket.
TODO: docstring"""
bucket = client.get_bucket(bucket)
bucket.delete_blob(remote_path) | [
"def",
"delete_file",
"(",
"client",
",",
"bucket",
",",
"remote_path",
")",
":",
"bucket",
"=",
"client",
".",
"get_bucket",
"(",
"bucket",
")",
"bucket",
".",
"delete_blob",
"(",
"remote_path",
")"
] | Deletes a file from a bucket.
TODO: docstring | [
"Deletes",
"a",
"file",
"from",
"a",
"bucket",
".",
"TODO",
":",
"docstring"
] | train | https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/gcloud/storage.py#L84-L89 |
flo-compbio/genometools | genometools/gcloud/storage.py | upload_file | def upload_file(client, bucket, local_path, remote_path, overwrite=False):
"""Uploads a file to a bucket.
TODO: docstring"""
bucket = client.get_bucket(bucket)
blob = storage.Blob(remote_path, bucket)
if (not overwrite) and blob.exists():
raise Conflict('File/object already exists on th... | python | def upload_file(client, bucket, local_path, remote_path, overwrite=False):
"""Uploads a file to a bucket.
TODO: docstring"""
bucket = client.get_bucket(bucket)
blob = storage.Blob(remote_path, bucket)
if (not overwrite) and blob.exists():
raise Conflict('File/object already exists on th... | [
"def",
"upload_file",
"(",
"client",
",",
"bucket",
",",
"local_path",
",",
"remote_path",
",",
"overwrite",
"=",
"False",
")",
":",
"bucket",
"=",
"client",
".",
"get_bucket",
"(",
"bucket",
")",
"blob",
"=",
"storage",
".",
"Blob",
"(",
"remote_path",
... | Uploads a file to a bucket.
TODO: docstring | [
"Uploads",
"a",
"file",
"to",
"a",
"bucket",
".",
"TODO",
":",
"docstring"
] | train | https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/gcloud/storage.py#L92-L100 |
acorg/dark-matter | dark/alignments.py | ReadsAlignmentsFilter.filter | def filter(self, readAlignments):
"""
Filter a read's alignments.
@param readAlignments: A C{ReadAlignments} instance.
@return: A C{ReadAlignments} instance if the passed
C{readAlignments} is not filtered out, else C{False}.
"""
# Implementation notes:
... | python | def filter(self, readAlignments):
"""
Filter a read's alignments.
@param readAlignments: A C{ReadAlignments} instance.
@return: A C{ReadAlignments} instance if the passed
C{readAlignments} is not filtered out, else C{False}.
"""
# Implementation notes:
... | [
"def",
"filter",
"(",
"self",
",",
"readAlignments",
")",
":",
"# Implementation notes:",
"#",
"# 1. The order in which we carry out the filtering actions can make",
"# a big difference in the result of this function. The current",
"# ordering is based on what seems reasonable - it may... | Filter a read's alignments.
@param readAlignments: A C{ReadAlignments} instance.
@return: A C{ReadAlignments} instance if the passed
C{readAlignments} is not filtered out, else C{False}. | [
"Filter",
"a",
"read",
"s",
"alignments",
"."
] | train | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/alignments.py#L173-L324 |
acorg/dark-matter | dark/alignments.py | ReadsAlignments.hsps | def hsps(self):
"""
Provide access to all HSPs for all alignments of all reads.
@return: A generator that yields HSPs (or LSPs).
"""
for readAlignments in self:
for alignment in readAlignments:
for hsp in alignment.hsps:
yield hsp | python | def hsps(self):
"""
Provide access to all HSPs for all alignments of all reads.
@return: A generator that yields HSPs (or LSPs).
"""
for readAlignments in self:
for alignment in readAlignments:
for hsp in alignment.hsps:
yield hsp | [
"def",
"hsps",
"(",
"self",
")",
":",
"for",
"readAlignments",
"in",
"self",
":",
"for",
"alignment",
"in",
"readAlignments",
":",
"for",
"hsp",
"in",
"alignment",
".",
"hsps",
":",
"yield",
"hsp"
] | Provide access to all HSPs for all alignments of all reads.
@return: A generator that yields HSPs (or LSPs). | [
"Provide",
"access",
"to",
"all",
"HSPs",
"for",
"all",
"alignments",
"of",
"all",
"reads",
"."
] | train | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/alignments.py#L375-L384 |
acorg/dark-matter | dark/alignments.py | ReadsAlignments.filter | def filter(self, **kwargs):
"""
Add a filter to this C{readsAlignments}.
@param kwargs: Keyword arguments, as accepted by
C{ReadsAlignmentsFilter}.
@return: C{self}
"""
self._filters.append(ReadsAlignmentsFilter(**kwargs).filter)
return self | python | def filter(self, **kwargs):
"""
Add a filter to this C{readsAlignments}.
@param kwargs: Keyword arguments, as accepted by
C{ReadsAlignmentsFilter}.
@return: C{self}
"""
self._filters.append(ReadsAlignmentsFilter(**kwargs).filter)
return self | [
"def",
"filter",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_filters",
".",
"append",
"(",
"ReadsAlignmentsFilter",
"(",
"*",
"*",
"kwargs",
")",
".",
"filter",
")",
"return",
"self"
] | Add a filter to this C{readsAlignments}.
@param kwargs: Keyword arguments, as accepted by
C{ReadsAlignmentsFilter}.
@return: C{self} | [
"Add",
"a",
"filter",
"to",
"this",
"C",
"{",
"readsAlignments",
"}",
"."
] | train | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/alignments.py#L416-L425 |
flo-compbio/genometools | genometools/ensembl/annotations.py | get_annotation_urls_and_checksums | def get_annotation_urls_and_checksums(species, release=None, ftp=None):
"""Get FTP URLs and checksums for Ensembl genome annotations.
Parameters
----------
species : str or list of str
The species or list of species for which to get genome annotations
(e.g., "Homo_sapiens").
rel... | python | def get_annotation_urls_and_checksums(species, release=None, ftp=None):
"""Get FTP URLs and checksums for Ensembl genome annotations.
Parameters
----------
species : str or list of str
The species or list of species for which to get genome annotations
(e.g., "Homo_sapiens").
rel... | [
"def",
"get_annotation_urls_and_checksums",
"(",
"species",
",",
"release",
"=",
"None",
",",
"ftp",
"=",
"None",
")",
":",
"### type checks",
"assert",
"isinstance",
"(",
"species",
",",
"(",
"str",
",",
"_oldstr",
")",
")",
"or",
"isinstance",
"(",
"specie... | Get FTP URLs and checksums for Ensembl genome annotations.
Parameters
----------
species : str or list of str
The species or list of species for which to get genome annotations
(e.g., "Homo_sapiens").
release : int, optional
The release number to look up. If `None`, use late... | [
"Get",
"FTP",
"URLs",
"and",
"checksums",
"for",
"Ensembl",
"genome",
"annotations",
".",
"Parameters",
"----------",
"species",
":",
"str",
"or",
"list",
"of",
"str",
"The",
"species",
"or",
"list",
"of",
"species",
"for",
"which",
"to",
"get",
"genome",
... | train | https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/ensembl/annotations.py#L38-L110 |
flo-compbio/genometools | genometools/ensembl/annotations.py | get_genes | def get_genes(
path_or_buffer, valid_biotypes,
chunksize=10000,
chromosome_pattern=None,
#chromosome_pattern=r'(?:\d\d?|MT|X|Y)$',
only_manual=False,
remove_duplicates=True,
sort_by='name'):
"""Get all genes of a specific a biotype from an Ensembl GTF file.
... | python | def get_genes(
path_or_buffer, valid_biotypes,
chunksize=10000,
chromosome_pattern=None,
#chromosome_pattern=r'(?:\d\d?|MT|X|Y)$',
only_manual=False,
remove_duplicates=True,
sort_by='name'):
"""Get all genes of a specific a biotype from an Ensembl GTF file.
... | [
"def",
"get_genes",
"(",
"path_or_buffer",
",",
"valid_biotypes",
",",
"chunksize",
"=",
"10000",
",",
"chromosome_pattern",
"=",
"None",
",",
"#chromosome_pattern=r'(?:\\d\\d?|MT|X|Y)$',",
"only_manual",
"=",
"False",
",",
"remove_duplicates",
"=",
"True",
",",
"sort... | Get all genes of a specific a biotype from an Ensembl GTF file.
Parameters
----------
path_or_buffer : str or buffer
The GTF file (either the file path or a buffer).
valid_biotypes : set of str
The set of biotypes to include (e.g., "protein_coding").
chromosome_pattern : str, op... | [
"Get",
"all",
"genes",
"of",
"a",
"specific",
"a",
"biotype",
"from",
"an",
"Ensembl",
"GTF",
"file",
".",
"Parameters",
"----------",
"path_or_buffer",
":",
"str",
"or",
"buffer",
"The",
"GTF",
"file",
"(",
"either",
"the",
"file",
"path",
"or",
"a",
"b... | train | https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/ensembl/annotations.py#L113-L422 |
flo-compbio/genometools | genometools/ensembl/annotations.py | get_protein_coding_genes | def get_protein_coding_genes(
path_or_buffer,
include_polymorphic_pseudogenes=True,
remove_duplicates=True,
**kwargs):
r"""Get list of all protein-coding genes based on Ensembl GTF file.
Parameters
----------
See :func:`get_genes` function.
Returns
-------
... | python | def get_protein_coding_genes(
path_or_buffer,
include_polymorphic_pseudogenes=True,
remove_duplicates=True,
**kwargs):
r"""Get list of all protein-coding genes based on Ensembl GTF file.
Parameters
----------
See :func:`get_genes` function.
Returns
-------
... | [
"def",
"get_protein_coding_genes",
"(",
"path_or_buffer",
",",
"include_polymorphic_pseudogenes",
"=",
"True",
",",
"remove_duplicates",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"valid_biotypes",
"=",
"set",
"(",
"[",
"'protein_coding'",
"]",
")",
"if",
"... | r"""Get list of all protein-coding genes based on Ensembl GTF file.
Parameters
----------
See :func:`get_genes` function.
Returns
-------
`pandas.DataFrame`
Table with rows corresponding to protein-coding genes. | [
"r",
"Get",
"list",
"of",
"all",
"protein",
"-",
"coding",
"genes",
"based",
"on",
"Ensembl",
"GTF",
"file",
".",
"Parameters",
"----------",
"See",
":",
"func",
":",
"get_genes",
"function",
"."
] | train | https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/ensembl/annotations.py#L425-L448 |
flo-compbio/genometools | genometools/ensembl/annotations.py | get_linc_rna_genes | def get_linc_rna_genes(
path_or_buffer,
remove_duplicates=True,
**kwargs):
r"""Get list of all protein-coding genes based on Ensembl GTF file.
Parameters
----------
See :func:`get_genes` function.
Returns
-------
`pandas.DataFrame`
Table with rows corres... | python | def get_linc_rna_genes(
path_or_buffer,
remove_duplicates=True,
**kwargs):
r"""Get list of all protein-coding genes based on Ensembl GTF file.
Parameters
----------
See :func:`get_genes` function.
Returns
-------
`pandas.DataFrame`
Table with rows corres... | [
"def",
"get_linc_rna_genes",
"(",
"path_or_buffer",
",",
"remove_duplicates",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"valid_biotypes",
"=",
"set",
"(",
"[",
"'lincRNA'",
"]",
")",
"df",
"=",
"get_genes",
"(",
"path_or_buffer",
",",
"valid_biotypes",
... | r"""Get list of all protein-coding genes based on Ensembl GTF file.
Parameters
----------
See :func:`get_genes` function.
Returns
-------
`pandas.DataFrame`
Table with rows corresponding to protein-coding genes. | [
"r",
"Get",
"list",
"of",
"all",
"protein",
"-",
"coding",
"genes",
"based",
"on",
"Ensembl",
"GTF",
"file",
".",
"Parameters",
"----------",
"See",
":",
"func",
":",
"get_genes",
"function",
"."
] | train | https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/ensembl/annotations.py#L451-L471 |
nkavaldj/myhdl_lib | myhdl_lib/simulation/payload_generator.py | payload_generator | def payload_generator(levels=0, dimensions=None, sequential=True, string=True, max_int=255, max_pkt_len=150, max_dim_size=3):
""" Generates random data in a form of nested lists, to be used as a test packet payload
levels - nesting levels:
0 - list of integers (single packet payload)
... | python | def payload_generator(levels=0, dimensions=None, sequential=True, string=True, max_int=255, max_pkt_len=150, max_dim_size=3):
""" Generates random data in a form of nested lists, to be used as a test packet payload
levels - nesting levels:
0 - list of integers (single packet payload)
... | [
"def",
"payload_generator",
"(",
"levels",
"=",
"0",
",",
"dimensions",
"=",
"None",
",",
"sequential",
"=",
"True",
",",
"string",
"=",
"True",
",",
"max_int",
"=",
"255",
",",
"max_pkt_len",
"=",
"150",
",",
"max_dim_size",
"=",
"3",
")",
":",
"MAX_I... | Generates random data in a form of nested lists, to be used as a test packet payload
levels - nesting levels:
0 - list of integers (single packet payload)
1 - list of lists of integers (list of packets)
2 - list of lists of lists of integers (list of packets, ... | [
"Generates",
"random",
"data",
"in",
"a",
"form",
"of",
"nested",
"lists",
"to",
"be",
"used",
"as",
"a",
"test",
"packet",
"payload",
"levels",
"-",
"nesting",
"levels",
":",
"0",
"-",
"list",
"of",
"integers",
"(",
"single",
"packet",
"payload",
")",
... | train | https://github.com/nkavaldj/myhdl_lib/blob/9902afd2031e7847373f692821b2135fd0810aa8/myhdl_lib/simulation/payload_generator.py#L4-L93 |
acorg/dark-matter | dark/entrez.py | getSequence | def getSequence(title, db='nucleotide'):
"""
Get information about a sequence from Genbank.
@param title: A C{str} sequence title from a BLAST hit. Of the form
'gi|63148399|gb|DQ011818.1| Description...'.
@param db: The C{str} name of the Entrez database to consult.
NOTE: this uses the net... | python | def getSequence(title, db='nucleotide'):
"""
Get information about a sequence from Genbank.
@param title: A C{str} sequence title from a BLAST hit. Of the form
'gi|63148399|gb|DQ011818.1| Description...'.
@param db: The C{str} name of the Entrez database to consult.
NOTE: this uses the net... | [
"def",
"getSequence",
"(",
"title",
",",
"db",
"=",
"'nucleotide'",
")",
":",
"titleId",
"=",
"title",
".",
"split",
"(",
"' '",
",",
"1",
")",
"[",
"0",
"]",
"try",
":",
"gi",
"=",
"titleId",
".",
"split",
"(",
"'|'",
")",
"[",
"1",
"]",
"exce... | Get information about a sequence from Genbank.
@param title: A C{str} sequence title from a BLAST hit. Of the form
'gi|63148399|gb|DQ011818.1| Description...'.
@param db: The C{str} name of the Entrez database to consult.
NOTE: this uses the network! Also, there is a 3 requests/second limit
i... | [
"Get",
"information",
"about",
"a",
"sequence",
"from",
"Genbank",
"."
] | train | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/entrez.py#L7-L32 |
cloudrave/avwx | avwx/models.py | CloudLayerSet.get_ceiling_cloud_layer | def get_ceiling_cloud_layer(self):
"""
Returns the lowest layer of broken or overcast clouds.
:rtype: CloudLayer|None
"""
lowest_layer = None
for layer in self.cloud_layers:
if layer.coverage not in [CloudLayer.BROKEN, CloudLayer.OVERCAST]:
con... | python | def get_ceiling_cloud_layer(self):
"""
Returns the lowest layer of broken or overcast clouds.
:rtype: CloudLayer|None
"""
lowest_layer = None
for layer in self.cloud_layers:
if layer.coverage not in [CloudLayer.BROKEN, CloudLayer.OVERCAST]:
con... | [
"def",
"get_ceiling_cloud_layer",
"(",
"self",
")",
":",
"lowest_layer",
"=",
"None",
"for",
"layer",
"in",
"self",
".",
"cloud_layers",
":",
"if",
"layer",
".",
"coverage",
"not",
"in",
"[",
"CloudLayer",
".",
"BROKEN",
",",
"CloudLayer",
".",
"OVERCAST",
... | Returns the lowest layer of broken or overcast clouds.
:rtype: CloudLayer|None | [
"Returns",
"the",
"lowest",
"layer",
"of",
"broken",
"or",
"overcast",
"clouds",
".",
":",
"rtype",
":",
"CloudLayer|None"
] | train | https://github.com/cloudrave/avwx/blob/d5a9a1179e0634e94f40d446b89ceecbd1e61e13/avwx/models.py#L42-L59 |
cloudrave/avwx | avwx/models.py | WeatherReport.parse_xml_data | def parse_xml_data(self):
"""
Parses `xml_data` and loads it into object properties.
"""
self.raw_text = self.xml_data.find('raw_text').text
self.station = WeatherStation(self.xml_data.find('station_id').text)
self.station.latitude = float(self.xml_data.find('latitude').t... | python | def parse_xml_data(self):
"""
Parses `xml_data` and loads it into object properties.
"""
self.raw_text = self.xml_data.find('raw_text').text
self.station = WeatherStation(self.xml_data.find('station_id').text)
self.station.latitude = float(self.xml_data.find('latitude').t... | [
"def",
"parse_xml_data",
"(",
"self",
")",
":",
"self",
".",
"raw_text",
"=",
"self",
".",
"xml_data",
".",
"find",
"(",
"'raw_text'",
")",
".",
"text",
"self",
".",
"station",
"=",
"WeatherStation",
"(",
"self",
".",
"xml_data",
".",
"find",
"(",
"'st... | Parses `xml_data` and loads it into object properties. | [
"Parses",
"xml_data",
"and",
"loads",
"it",
"into",
"object",
"properties",
"."
] | train | https://github.com/cloudrave/avwx/blob/d5a9a1179e0634e94f40d446b89ceecbd1e61e13/avwx/models.py#L149-L157 |
cloudrave/avwx | avwx/models.py | WeatherReportSet.download_data | def download_data(self, mock_response=None):
"""
Loads XML data into the `xml_data` attribute.
"""
if mock_response is not None:
body = mock_response
else:
api_url = self.get_api_url()
body = urlopen(api_url).read()
xml_root = ElementTr... | python | def download_data(self, mock_response=None):
"""
Loads XML data into the `xml_data` attribute.
"""
if mock_response is not None:
body = mock_response
else:
api_url = self.get_api_url()
body = urlopen(api_url).read()
xml_root = ElementTr... | [
"def",
"download_data",
"(",
"self",
",",
"mock_response",
"=",
"None",
")",
":",
"if",
"mock_response",
"is",
"not",
"None",
":",
"body",
"=",
"mock_response",
"else",
":",
"api_url",
"=",
"self",
".",
"get_api_url",
"(",
")",
"body",
"=",
"urlopen",
"(... | Loads XML data into the `xml_data` attribute. | [
"Loads",
"XML",
"data",
"into",
"the",
"xml_data",
"attribute",
"."
] | train | https://github.com/cloudrave/avwx/blob/d5a9a1179e0634e94f40d446b89ceecbd1e61e13/avwx/models.py#L215-L231 |
acorg/dark-matter | dark/summarize.py | summarizeReads | def summarizeReads(file_handle, file_type):
"""
open a fasta or fastq file, prints number of of reads,
average length of read, total number of bases, longest,
shortest and median read, total number and average of
individual base (A, T, G, C, N).
"""
base_counts = defaultdict(int)
read_nu... | python | def summarizeReads(file_handle, file_type):
"""
open a fasta or fastq file, prints number of of reads,
average length of read, total number of bases, longest,
shortest and median read, total number and average of
individual base (A, T, G, C, N).
"""
base_counts = defaultdict(int)
read_nu... | [
"def",
"summarizeReads",
"(",
"file_handle",
",",
"file_type",
")",
":",
"base_counts",
"=",
"defaultdict",
"(",
"int",
")",
"read_number",
"=",
"0",
"total_length",
"=",
"0",
"length_list",
"=",
"[",
"]",
"records",
"=",
"SeqIO",
".",
"parse",
"(",
"file_... | open a fasta or fastq file, prints number of of reads,
average length of read, total number of bases, longest,
shortest and median read, total number and average of
individual base (A, T, G, C, N). | [
"open",
"a",
"fasta",
"or",
"fastq",
"file",
"prints",
"number",
"of",
"of",
"reads",
"average",
"length",
"of",
"read",
"total",
"number",
"of",
"bases",
"longest",
"shortest",
"and",
"median",
"read",
"total",
"number",
"and",
"average",
"of",
"individual"... | train | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/summarize.py#L7-L38 |
acorg/dark-matter | dark/summarize.py | sequenceCategoryLengths | def sequenceCategoryLengths(read, categories, defaultCategory=None,
suppressedCategory='...', minLength=1):
"""
Summarize the nucleotides or AAs found in a read by assigning each to a
category and reporting the lengths of the contiguous category classes
found along the sequen... | python | def sequenceCategoryLengths(read, categories, defaultCategory=None,
suppressedCategory='...', minLength=1):
"""
Summarize the nucleotides or AAs found in a read by assigning each to a
category and reporting the lengths of the contiguous category classes
found along the sequen... | [
"def",
"sequenceCategoryLengths",
"(",
"read",
",",
"categories",
",",
"defaultCategory",
"=",
"None",
",",
"suppressedCategory",
"=",
"'...'",
",",
"minLength",
"=",
"1",
")",
":",
"result",
"=",
"[",
"]",
"append",
"=",
"result",
".",
"append",
"get",
"=... | Summarize the nucleotides or AAs found in a read by assigning each to a
category and reporting the lengths of the contiguous category classes
found along the sequence.
@param read: A C{Read} instance or one of its subclasses.
@param categories: A C{dict} mapping nucleotides or AAs to category.
@par... | [
"Summarize",
"the",
"nucleotides",
"or",
"AAs",
"found",
"in",
"a",
"read",
"by",
"assigning",
"each",
"to",
"a",
"category",
"and",
"reporting",
"the",
"lengths",
"of",
"the",
"contiguous",
"category",
"classes",
"found",
"along",
"the",
"sequence",
"."
] | train | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/summarize.py#L41-L113 |
acorg/dark-matter | dark/simplify.py | simplifyTitle | def simplifyTitle(title, target):
"""
Simplify a given sequence title. Given a title, look for the first
occurrence of target anywhere in any of its words. Return a space-separated
string of the words of the title up to and including the occurrence of the
target. Ignore case.
E.g.,
# S... | python | def simplifyTitle(title, target):
"""
Simplify a given sequence title. Given a title, look for the first
occurrence of target anywhere in any of its words. Return a space-separated
string of the words of the title up to and including the occurrence of the
target. Ignore case.
E.g.,
# S... | [
"def",
"simplifyTitle",
"(",
"title",
",",
"target",
")",
":",
"targetLen",
"=",
"len",
"(",
"target",
")",
"result",
"=",
"[",
"]",
"for",
"word",
"in",
"title",
".",
"split",
"(",
")",
":",
"if",
"len",
"(",
"word",
")",
">=",
"targetLen",
":",
... | Simplify a given sequence title. Given a title, look for the first
occurrence of target anywhere in any of its words. Return a space-separated
string of the words of the title up to and including the occurrence of the
target. Ignore case.
E.g.,
# Suffix
simplifyTitle('Bovine polyomavirus... | [
"Simplify",
"a",
"given",
"sequence",
"title",
".",
"Given",
"a",
"title",
"look",
"for",
"the",
"first",
"occurrence",
"of",
"target",
"anywhere",
"in",
"any",
"of",
"its",
"words",
".",
"Return",
"a",
"space",
"-",
"separated",
"string",
"of",
"the",
"... | train | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/simplify.py#L1-L36 |
nkavaldj/myhdl_lib | myhdl_lib/simulation/_DUTer.py | DUTer.registerSimulator | def registerSimulator(self, name=None, hdl=None, analyze_cmd=None, elaborate_cmd=None, simulate_cmd=None):
''' Registers an HDL _simulator
name - str, user defined name, used to identify this _simulator record
hdl - str, case insensitive, (verilog, vhdl), the HDL to which the sim... | python | def registerSimulator(self, name=None, hdl=None, analyze_cmd=None, elaborate_cmd=None, simulate_cmd=None):
''' Registers an HDL _simulator
name - str, user defined name, used to identify this _simulator record
hdl - str, case insensitive, (verilog, vhdl), the HDL to which the sim... | [
"def",
"registerSimulator",
"(",
"self",
",",
"name",
"=",
"None",
",",
"hdl",
"=",
"None",
",",
"analyze_cmd",
"=",
"None",
",",
"elaborate_cmd",
"=",
"None",
",",
"simulate_cmd",
"=",
"None",
")",
":",
"if",
"not",
"isinstance",
"(",
"name",
",",
"st... | Registers an HDL _simulator
name - str, user defined name, used to identify this _simulator record
hdl - str, case insensitive, (verilog, vhdl), the HDL to which the simulated MyHDL code will be converted
analyze_cmd - str, system command that will be run to analyze the g... | [
"Registers",
"an",
"HDL",
"_simulator",
"name",
"-",
"str",
"user",
"defined",
"name",
"used",
"to",
"identify",
"this",
"_simulator",
"record",
"hdl",
"-",
"str",
"case",
"insensitive",
"(",
"verilog",
"vhdl",
")",
"the",
"HDL",
"to",
"which",
"the",
"sim... | train | https://github.com/nkavaldj/myhdl_lib/blob/9902afd2031e7847373f692821b2135fd0810aa8/myhdl_lib/simulation/_DUTer.py#L29-L51 |
nkavaldj/myhdl_lib | myhdl_lib/simulation/_DUTer.py | DUTer._getCosimulation | def _getCosimulation(self, func, **kwargs):
''' Returns a co-simulation instance of func.
Uses the _simulator specified by self._simulator.
Enables traces if self._trace is True
func - MyHDL function to be simulated
kwargs - dict of func interface assign... | python | def _getCosimulation(self, func, **kwargs):
''' Returns a co-simulation instance of func.
Uses the _simulator specified by self._simulator.
Enables traces if self._trace is True
func - MyHDL function to be simulated
kwargs - dict of func interface assign... | [
"def",
"_getCosimulation",
"(",
"self",
",",
"func",
",",
"*",
"*",
"kwargs",
")",
":",
"vals",
"=",
"{",
"}",
"vals",
"[",
"'topname'",
"]",
"=",
"func",
".",
"func_name",
"vals",
"[",
"'unitname'",
"]",
"=",
"func",
".",
"func_name",
".",
"lower",
... | Returns a co-simulation instance of func.
Uses the _simulator specified by self._simulator.
Enables traces if self._trace is True
func - MyHDL function to be simulated
kwargs - dict of func interface assignments: for signals and parameters | [
"Returns",
"a",
"co",
"-",
"simulation",
"instance",
"of",
"func",
".",
"Uses",
"the",
"_simulator",
"specified",
"by",
"self",
".",
"_simulator",
".",
"Enables",
"traces",
"if",
"self",
".",
"_trace",
"is",
"True",
"func",
"-",
"MyHDL",
"function",
"to",
... | train | https://github.com/nkavaldj/myhdl_lib/blob/9902afd2031e7847373f692821b2135fd0810aa8/myhdl_lib/simulation/_DUTer.py#L66-L98 |
nkavaldj/myhdl_lib | myhdl_lib/simulation/_DUTer.py | DUTer._enableTracesVerilog | def _enableTracesVerilog(self, verilogFile):
''' Enables traces in a Verilog file'''
fname, _ = os.path.splitext(verilogFile)
inserted = False
for _, line in enumerate(fileinput.input(verilogFile, inplace = 1)):
sys.stdout.write(line)
if line.startswith("end") and... | python | def _enableTracesVerilog(self, verilogFile):
''' Enables traces in a Verilog file'''
fname, _ = os.path.splitext(verilogFile)
inserted = False
for _, line in enumerate(fileinput.input(verilogFile, inplace = 1)):
sys.stdout.write(line)
if line.startswith("end") and... | [
"def",
"_enableTracesVerilog",
"(",
"self",
",",
"verilogFile",
")",
":",
"fname",
",",
"_",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
"verilogFile",
")",
"inserted",
"=",
"False",
"for",
"_",
",",
"line",
"in",
"enumerate",
"(",
"fileinput",
".",
... | Enables traces in a Verilog file | [
"Enables",
"traces",
"in",
"a",
"Verilog",
"file"
] | train | https://github.com/nkavaldj/myhdl_lib/blob/9902afd2031e7847373f692821b2135fd0810aa8/myhdl_lib/simulation/_DUTer.py#L101-L113 |
nkavaldj/myhdl_lib | myhdl_lib/simulation/_DUTer.py | DUTer._getDut | def _getDut(self, func, **kwargs):
''' Returns a simulation instance of func.
Uses the simulator specified by self._simulator.
Enables traces if self._trace is True
func - MyHDL function to be simulated
kwargs - dict of func interface assignments: for si... | python | def _getDut(self, func, **kwargs):
''' Returns a simulation instance of func.
Uses the simulator specified by self._simulator.
Enables traces if self._trace is True
func - MyHDL function to be simulated
kwargs - dict of func interface assignments: for si... | [
"def",
"_getDut",
"(",
"self",
",",
"func",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"_simulator",
"==",
"\"myhdl\"",
":",
"if",
"not",
"self",
".",
"_trace",
":",
"sim_dut",
"=",
"func",
"(",
"*",
"*",
"kwargs",
")",
"else",
":",
"s... | Returns a simulation instance of func.
Uses the simulator specified by self._simulator.
Enables traces if self._trace is True
func - MyHDL function to be simulated
kwargs - dict of func interface assignments: for signals and parameters | [
"Returns",
"a",
"simulation",
"instance",
"of",
"func",
".",
"Uses",
"the",
"simulator",
"specified",
"by",
"self",
".",
"_simulator",
".",
"Enables",
"traces",
"if",
"self",
".",
"_trace",
"is",
"True",
"func",
"-",
"MyHDL",
"function",
"to",
"be",
"simul... | train | https://github.com/nkavaldj/myhdl_lib/blob/9902afd2031e7847373f692821b2135fd0810aa8/myhdl_lib/simulation/_DUTer.py#L116-L131 |
acorg/dark-matter | dark/fastq.py | FastqReads.iter | def iter(self):
"""
Iterate over the sequences in the files in self.files_, yielding each
as an instance of the desired read class.
"""
for _file in self._files:
with asHandle(_file) as fp:
# Use FastqGeneralIterator because it provides access to
... | python | def iter(self):
"""
Iterate over the sequences in the files in self.files_, yielding each
as an instance of the desired read class.
"""
for _file in self._files:
with asHandle(_file) as fp:
# Use FastqGeneralIterator because it provides access to
... | [
"def",
"iter",
"(",
"self",
")",
":",
"for",
"_file",
"in",
"self",
".",
"_files",
":",
"with",
"asHandle",
"(",
"_file",
")",
"as",
"fp",
":",
"# Use FastqGeneralIterator because it provides access to",
"# the unconverted quality string (i.e., it doesn't try to",
"# fi... | Iterate over the sequences in the files in self.files_, yielding each
as an instance of the desired read class. | [
"Iterate",
"over",
"the",
"sequences",
"in",
"the",
"files",
"in",
"self",
".",
"files_",
"yielding",
"each",
"as",
"an",
"instance",
"of",
"the",
"desired",
"read",
"class",
"."
] | train | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/fastq.py#L26-L38 |
acorg/dark-matter | bin/write-htcondor-job-spec.py | splitFASTA | def splitFASTA(params):
"""
Read the FASTA file named params['fastaFile'] and print out its
sequences into files named 0.fasta, 1.fasta, etc. with
params['seqsPerJob'] sequences per file.
"""
assert params['fastaFile'][-1] == 'a', ('You must specify a file in '
... | python | def splitFASTA(params):
"""
Read the FASTA file named params['fastaFile'] and print out its
sequences into files named 0.fasta, 1.fasta, etc. with
params['seqsPerJob'] sequences per file.
"""
assert params['fastaFile'][-1] == 'a', ('You must specify a file in '
... | [
"def",
"splitFASTA",
"(",
"params",
")",
":",
"assert",
"params",
"[",
"'fastaFile'",
"]",
"[",
"-",
"1",
"]",
"==",
"'a'",
",",
"(",
"'You must specify a file in '",
"'fasta-format that ends in '",
"'.fasta'",
")",
"fileCount",
"=",
"count",
"=",
"seqCount",
... | Read the FASTA file named params['fastaFile'] and print out its
sequences into files named 0.fasta, 1.fasta, etc. with
params['seqsPerJob'] sequences per file. | [
"Read",
"the",
"FASTA",
"file",
"named",
"params",
"[",
"fastaFile",
"]",
"and",
"print",
"out",
"its",
"sequences",
"into",
"files",
"named",
"0",
".",
"fasta",
"1",
".",
"fasta",
"etc",
".",
"with",
"params",
"[",
"seqsPerJob",
"]",
"sequences",
"per",... | train | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/bin/write-htcondor-job-spec.py#L44-L68 |
invenia/Arbiter | arbiter/scheduler.py | Scheduler.add_task | def add_task(self, task):
"""
Add a task to the scheduler.
task: The task to add.
"""
if not self._valid_name(task.name):
raise ValueError(task.name)
self._tasks[task.name] = task
incomplete_dependencies = set()
for dependency in task.depen... | python | def add_task(self, task):
"""
Add a task to the scheduler.
task: The task to add.
"""
if not self._valid_name(task.name):
raise ValueError(task.name)
self._tasks[task.name] = task
incomplete_dependencies = set()
for dependency in task.depen... | [
"def",
"add_task",
"(",
"self",
",",
"task",
")",
":",
"if",
"not",
"self",
".",
"_valid_name",
"(",
"task",
".",
"name",
")",
":",
"raise",
"ValueError",
"(",
"task",
".",
"name",
")",
"self",
".",
"_tasks",
"[",
"task",
".",
"name",
"]",
"=",
"... | Add a task to the scheduler.
task: The task to add. | [
"Add",
"a",
"task",
"to",
"the",
"scheduler",
"."
] | train | https://github.com/invenia/Arbiter/blob/51008393ae8797da85bcd67807259a157f941dfd/arbiter/scheduler.py#L68-L94 |
invenia/Arbiter | arbiter/scheduler.py | Scheduler.start_task | def start_task(self, name=None):
"""
Start a task.
Returns the task that was started (or None if no task has been
started).
name: (optional, None) The task to start. If a name is given,
Scheduler will attempt to start the task (and raise an
exception... | python | def start_task(self, name=None):
"""
Start a task.
Returns the task that was started (or None if no task has been
started).
name: (optional, None) The task to start. If a name is given,
Scheduler will attempt to start the task (and raise an
exception... | [
"def",
"start_task",
"(",
"self",
",",
"name",
"=",
"None",
")",
":",
"if",
"name",
"is",
"None",
":",
"for",
"possibility",
"in",
"self",
".",
"_graph",
".",
"roots",
":",
"if",
"possibility",
"not",
"in",
"self",
".",
"_running",
":",
"name",
"=",
... | Start a task.
Returns the task that was started (or None if no task has been
started).
name: (optional, None) The task to start. If a name is given,
Scheduler will attempt to start the task (and raise an
exception if the task doesn't exist or isn't runnable). If
... | [
"Start",
"a",
"task",
"."
] | train | https://github.com/invenia/Arbiter/blob/51008393ae8797da85bcd67807259a157f941dfd/arbiter/scheduler.py#L96-L121 |
invenia/Arbiter | arbiter/scheduler.py | Scheduler.end_task | def end_task(self, name, success=True):
"""
End a running task. Raises an exception if the task isn't
running.
name: The name of the task to complete.
success: (optional, True) Whether the task was successful.
"""
self._running.remove(name)
if success:
... | python | def end_task(self, name, success=True):
"""
End a running task. Raises an exception if the task isn't
running.
name: The name of the task to complete.
success: (optional, True) Whether the task was successful.
"""
self._running.remove(name)
if success:
... | [
"def",
"end_task",
"(",
"self",
",",
"name",
",",
"success",
"=",
"True",
")",
":",
"self",
".",
"_running",
".",
"remove",
"(",
"name",
")",
"if",
"success",
":",
"self",
".",
"_completed",
".",
"add",
"(",
"name",
")",
"self",
".",
"_graph",
".",... | End a running task. Raises an exception if the task isn't
running.
name: The name of the task to complete.
success: (optional, True) Whether the task was successful. | [
"End",
"a",
"running",
"task",
".",
"Raises",
"an",
"exception",
"if",
"the",
"task",
"isn",
"t",
"running",
"."
] | train | https://github.com/invenia/Arbiter/blob/51008393ae8797da85bcd67807259a157f941dfd/arbiter/scheduler.py#L123-L137 |
invenia/Arbiter | arbiter/scheduler.py | Scheduler.fail_remaining | def fail_remaining(self):
"""
Mark all unfinished tasks (including currently running ones) as
failed.
"""
self._failed.update(self._graph.nodes)
self._graph = Graph()
self._running = set() | python | def fail_remaining(self):
"""
Mark all unfinished tasks (including currently running ones) as
failed.
"""
self._failed.update(self._graph.nodes)
self._graph = Graph()
self._running = set() | [
"def",
"fail_remaining",
"(",
"self",
")",
":",
"self",
".",
"_failed",
".",
"update",
"(",
"self",
".",
"_graph",
".",
"nodes",
")",
"self",
".",
"_graph",
"=",
"Graph",
"(",
")",
"self",
".",
"_running",
"=",
"set",
"(",
")"
] | Mark all unfinished tasks (including currently running ones) as
failed. | [
"Mark",
"all",
"unfinished",
"tasks",
"(",
"including",
"currently",
"running",
"ones",
")",
"as",
"failed",
"."
] | train | https://github.com/invenia/Arbiter/blob/51008393ae8797da85bcd67807259a157f941dfd/arbiter/scheduler.py#L145-L152 |
invenia/Arbiter | arbiter/scheduler.py | Scheduler._cascade_failure | def _cascade_failure(self, name):
"""
Mark a task (and anything that depends on it) as failed.
name: The name of the offending task
"""
if name in self._graph:
self._failed.update(
self._graph.remove(name, strategy=Strategy.remove)
)
... | python | def _cascade_failure(self, name):
"""
Mark a task (and anything that depends on it) as failed.
name: The name of the offending task
"""
if name in self._graph:
self._failed.update(
self._graph.remove(name, strategy=Strategy.remove)
)
... | [
"def",
"_cascade_failure",
"(",
"self",
",",
"name",
")",
":",
"if",
"name",
"in",
"self",
".",
"_graph",
":",
"self",
".",
"_failed",
".",
"update",
"(",
"self",
".",
"_graph",
".",
"remove",
"(",
"name",
",",
"strategy",
"=",
"Strategy",
".",
"remo... | Mark a task (and anything that depends on it) as failed.
name: The name of the offending task | [
"Mark",
"a",
"task",
"(",
"and",
"anything",
"that",
"depends",
"on",
"it",
")",
"as",
"failed",
"."
] | train | https://github.com/invenia/Arbiter/blob/51008393ae8797da85bcd67807259a157f941dfd/arbiter/scheduler.py#L154-L165 |
acorg/dark-matter | bin/get-features.py | main | def main(gi, ranges):
"""
Print the features of the genbank entry given by gi. If ranges is
non-emtpy, only print features that include the ranges.
gi: either a hit from a BLAST record, in the form
'gi|63148399|gb|DQ011818.1|' or a gi number (63148399 in this example).
ranges: a possibly em... | python | def main(gi, ranges):
"""
Print the features of the genbank entry given by gi. If ranges is
non-emtpy, only print features that include the ranges.
gi: either a hit from a BLAST record, in the form
'gi|63148399|gb|DQ011818.1|' or a gi number (63148399 in this example).
ranges: a possibly em... | [
"def",
"main",
"(",
"gi",
",",
"ranges",
")",
":",
"# TODO: Make it so we can pass a 'db' argument to getSequence.",
"record",
"=",
"getSequence",
"(",
"gi",
")",
"if",
"record",
"is",
"None",
":",
"print",
"(",
"\"Looks like you're offline.\"",
")",
"sys",
".",
"... | Print the features of the genbank entry given by gi. If ranges is
non-emtpy, only print features that include the ranges.
gi: either a hit from a BLAST record, in the form
'gi|63148399|gb|DQ011818.1|' or a gi number (63148399 in this example).
ranges: a possibly empty list of ranges to print inform... | [
"Print",
"the",
"features",
"of",
"the",
"genbank",
"entry",
"given",
"by",
"gi",
".",
"If",
"ranges",
"is",
"non",
"-",
"emtpy",
"only",
"print",
"features",
"that",
"include",
"the",
"ranges",
"."
] | train | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/bin/get-features.py#L10-L39 |
flo-compbio/genometools | genometools/gcloud/compute/instance.py | create_instance | def create_instance(credentials, project, zone, name,
startup_script=None, startup_script_url=None,
metadata=None,
machine_type='f1-micro', tags=None,
disk_size_gb=10, wait_until_done=False):
"""Create instance with startup script.
... | python | def create_instance(credentials, project, zone, name,
startup_script=None, startup_script_url=None,
metadata=None,
machine_type='f1-micro', tags=None,
disk_size_gb=10, wait_until_done=False):
"""Create instance with startup script.
... | [
"def",
"create_instance",
"(",
"credentials",
",",
"project",
",",
"zone",
",",
"name",
",",
"startup_script",
"=",
"None",
",",
"startup_script_url",
"=",
"None",
",",
"metadata",
"=",
"None",
",",
"machine_type",
"=",
"'f1-micro'",
",",
"tags",
"=",
"None"... | Create instance with startup script.
TODO: docstring | [
"Create",
"instance",
"with",
"startup",
"script",
"."
] | train | https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/gcloud/compute/instance.py#L13-L129 |
flo-compbio/genometools | genometools/gcloud/compute/instance.py | delete_instance | def delete_instance(credentials, project, zone, name, wait_until_done=False):
"""Delete an instance.
TODO: docstring
"""
access_token = credentials.get_access_token()
headers = {
'Authorization': 'Bearer %s' % access_token.access_token
}
r = requests.delete('https://www.googleapi... | python | def delete_instance(credentials, project, zone, name, wait_until_done=False):
"""Delete an instance.
TODO: docstring
"""
access_token = credentials.get_access_token()
headers = {
'Authorization': 'Bearer %s' % access_token.access_token
}
r = requests.delete('https://www.googleapi... | [
"def",
"delete_instance",
"(",
"credentials",
",",
"project",
",",
"zone",
",",
"name",
",",
"wait_until_done",
"=",
"False",
")",
":",
"access_token",
"=",
"credentials",
".",
"get_access_token",
"(",
")",
"headers",
"=",
"{",
"'Authorization'",
":",
"'Bearer... | Delete an instance.
TODO: docstring | [
"Delete",
"an",
"instance",
"."
] | train | https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/gcloud/compute/instance.py#L132-L161 |
flo-compbio/genometools | genometools/gcloud/compute/instance.py | wait_for_instance_deletion | def wait_for_instance_deletion(credentials, project, zone, instance_name,
interval_seconds=5):
"""Wait until an instance is deleted.
We require that initially, the specified instance exists.
TODO: docstring
"""
t0 = time.time()
access_token = credentials.... | python | def wait_for_instance_deletion(credentials, project, zone, instance_name,
interval_seconds=5):
"""Wait until an instance is deleted.
We require that initially, the specified instance exists.
TODO: docstring
"""
t0 = time.time()
access_token = credentials.... | [
"def",
"wait_for_instance_deletion",
"(",
"credentials",
",",
"project",
",",
"zone",
",",
"instance_name",
",",
"interval_seconds",
"=",
"5",
")",
":",
"t0",
"=",
"time",
".",
"time",
"(",
")",
"access_token",
"=",
"credentials",
".",
"get_access_token",
"(",... | Wait until an instance is deleted.
We require that initially, the specified instance exists.
TODO: docstring | [
"Wait",
"until",
"an",
"instance",
"is",
"deleted",
".",
"We",
"require",
"that",
"initially",
"the",
"specified",
"instance",
"exists",
".",
"TODO",
":",
"docstring"
] | train | https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/gcloud/compute/instance.py#L164-L209 |
acorg/dark-matter | dark/sam.py | samReferencesToStr | def samReferencesToStr(filenameOrSamfile, indent=0):
"""
List SAM/BAM file reference names and lengths.
@param filenameOrSamfile: Either a C{str} SAM/BAM file name or an
instance of C{pysam.AlignmentFile}.
@param indent: An C{int} number of spaces to indent each line.
@return: A C{str} desc... | python | def samReferencesToStr(filenameOrSamfile, indent=0):
"""
List SAM/BAM file reference names and lengths.
@param filenameOrSamfile: Either a C{str} SAM/BAM file name or an
instance of C{pysam.AlignmentFile}.
@param indent: An C{int} number of spaces to indent each line.
@return: A C{str} desc... | [
"def",
"samReferencesToStr",
"(",
"filenameOrSamfile",
",",
"indent",
"=",
"0",
")",
":",
"indent",
"=",
"' '",
"*",
"indent",
"def",
"_references",
"(",
"sam",
")",
":",
"result",
"=",
"[",
"]",
"for",
"i",
"in",
"range",
"(",
"sam",
".",
"nreferences... | List SAM/BAM file reference names and lengths.
@param filenameOrSamfile: Either a C{str} SAM/BAM file name or an
instance of C{pysam.AlignmentFile}.
@param indent: An C{int} number of spaces to indent each line.
@return: A C{str} describing known reference names and their lengths. | [
"List",
"SAM",
"/",
"BAM",
"file",
"reference",
"names",
"and",
"lengths",
"."
] | train | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/sam.py#L43-L65 |
acorg/dark-matter | dark/sam.py | _hardClip | def _hardClip(sequence, quality, cigartuples):
"""
Hard clip (if necessary) a sequence.
@param sequence: A C{str} nucleotide sequence.
@param quality: A C{str} quality string, or a C{list} of C{int} quality
values as returned by pysam, or C{None} if the SAM file had a '*'
for the qualit... | python | def _hardClip(sequence, quality, cigartuples):
"""
Hard clip (if necessary) a sequence.
@param sequence: A C{str} nucleotide sequence.
@param quality: A C{str} quality string, or a C{list} of C{int} quality
values as returned by pysam, or C{None} if the SAM file had a '*'
for the qualit... | [
"def",
"_hardClip",
"(",
"sequence",
",",
"quality",
",",
"cigartuples",
")",
":",
"hardClipCount",
"=",
"cigarLength",
"=",
"0",
"for",
"(",
"operation",
",",
"length",
")",
"in",
"cigartuples",
":",
"hardClipCount",
"+=",
"operation",
"==",
"CHARD_CLIP",
"... | Hard clip (if necessary) a sequence.
@param sequence: A C{str} nucleotide sequence.
@param quality: A C{str} quality string, or a C{list} of C{int} quality
values as returned by pysam, or C{None} if the SAM file had a '*'
for the quality string (which pysam converts to C{None}).
@param ciga... | [
"Hard",
"clip",
"(",
"if",
"necessary",
")",
"a",
"sequence",
"."
] | train | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/sam.py#L68-L159 |
acorg/dark-matter | dark/sam.py | SAMFilter.addFilteringOptions | def addFilteringOptions(parser, samfileIsPositionalArg=False):
"""
Add options to an argument parser for filtering SAM/BAM.
@param samfileIsPositionalArg: If C{True} the SAM/BAM file must
be given as the final argument on the command line (without
being preceded by --sam... | python | def addFilteringOptions(parser, samfileIsPositionalArg=False):
"""
Add options to an argument parser for filtering SAM/BAM.
@param samfileIsPositionalArg: If C{True} the SAM/BAM file must
be given as the final argument on the command line (without
being preceded by --sam... | [
"def",
"addFilteringOptions",
"(",
"parser",
",",
"samfileIsPositionalArg",
"=",
"False",
")",
":",
"parser",
".",
"add_argument",
"(",
"'%ssamfile'",
"%",
"(",
"''",
"if",
"samfileIsPositionalArg",
"else",
"'--'",
")",
",",
"required",
"=",
"True",
",",
"help... | Add options to an argument parser for filtering SAM/BAM.
@param samfileIsPositionalArg: If C{True} the SAM/BAM file must
be given as the final argument on the command line (without
being preceded by --samfile).
@param parser: An C{argparse.ArgumentParser} instance. | [
"Add",
"options",
"to",
"an",
"argument",
"parser",
"for",
"filtering",
"SAM",
"/",
"BAM",
"."
] | train | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/sam.py#L211-L269 |
acorg/dark-matter | dark/sam.py | SAMFilter.parseFilteringOptions | def parseFilteringOptions(cls, args, filterRead=None, storeQueryIds=False):
"""
Parse command line options (added in C{addSAMFilteringOptions}.
@param args: The command line arguments, as returned by
C{argparse.parse_args}.
@param filterRead: A one-argument function that acc... | python | def parseFilteringOptions(cls, args, filterRead=None, storeQueryIds=False):
"""
Parse command line options (added in C{addSAMFilteringOptions}.
@param args: The command line arguments, as returned by
C{argparse.parse_args}.
@param filterRead: A one-argument function that acc... | [
"def",
"parseFilteringOptions",
"(",
"cls",
",",
"args",
",",
"filterRead",
"=",
"None",
",",
"storeQueryIds",
"=",
"False",
")",
":",
"referenceIds",
"=",
"(",
"set",
"(",
"chain",
".",
"from_iterable",
"(",
"args",
".",
"referenceId",
")",
")",
"if",
"... | Parse command line options (added in C{addSAMFilteringOptions}.
@param args: The command line arguments, as returned by
C{argparse.parse_args}.
@param filterRead: A one-argument function that accepts a read
and returns C{None} if the read should be omitted in filtering
... | [
"Parse",
"command",
"line",
"options",
"(",
"added",
"in",
"C",
"{",
"addSAMFilteringOptions",
"}",
"."
] | train | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/sam.py#L272-L299 |
acorg/dark-matter | dark/sam.py | SAMFilter.alignments | def alignments(self):
"""
Get alignments from the SAM/BAM file, subject to filtering.
"""
referenceIds = self.referenceIds
dropUnmapped = self.dropUnmapped
dropSecondary = self.dropSecondary
dropSupplementary = self.dropSupplementary
dropDuplicates = self.... | python | def alignments(self):
"""
Get alignments from the SAM/BAM file, subject to filtering.
"""
referenceIds = self.referenceIds
dropUnmapped = self.dropUnmapped
dropSecondary = self.dropSecondary
dropSupplementary = self.dropSupplementary
dropDuplicates = self.... | [
"def",
"alignments",
"(",
"self",
")",
":",
"referenceIds",
"=",
"self",
".",
"referenceIds",
"dropUnmapped",
"=",
"self",
".",
"dropUnmapped",
"dropSecondary",
"=",
"self",
".",
"dropSecondary",
"dropSupplementary",
"=",
"self",
".",
"dropSupplementary",
"dropDup... | Get alignments from the SAM/BAM file, subject to filtering. | [
"Get",
"alignments",
"from",
"the",
"SAM",
"/",
"BAM",
"file",
"subject",
"to",
"filtering",
"."
] | train | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/sam.py#L301-L388 |
acorg/dark-matter | dark/sam.py | SAMFilter.referenceLengths | def referenceLengths(self):
"""
Get the lengths of wanted references.
@raise UnknownReference: If a reference id is not present in the
SAM/BAM file.
@return: A C{dict} of C{str} reference id to C{int} length with a key
for each reference id in C{self.referenceIds... | python | def referenceLengths(self):
"""
Get the lengths of wanted references.
@raise UnknownReference: If a reference id is not present in the
SAM/BAM file.
@return: A C{dict} of C{str} reference id to C{int} length with a key
for each reference id in C{self.referenceIds... | [
"def",
"referenceLengths",
"(",
"self",
")",
":",
"result",
"=",
"{",
"}",
"with",
"samfile",
"(",
"self",
".",
"filename",
")",
"as",
"sam",
":",
"if",
"self",
".",
"referenceIds",
":",
"for",
"referenceId",
"in",
"self",
".",
"referenceIds",
":",
"ti... | Get the lengths of wanted references.
@raise UnknownReference: If a reference id is not present in the
SAM/BAM file.
@return: A C{dict} of C{str} reference id to C{int} length with a key
for each reference id in C{self.referenceIds} or for all references
if C{self.re... | [
"Get",
"the",
"lengths",
"of",
"wanted",
"references",
"."
] | train | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/sam.py#L390-L414 |
acorg/dark-matter | dark/sam.py | PaddedSAM.queries | def queries(self, rcSuffix='', rcNeeded=False, padChar='-',
queryInsertionChar='N', unknownQualityChar='!',
allowDuplicateIds=False, addAlignment=False):
"""
Produce padded (with gaps) queries according to the CIGAR string and
reference sequence length for each ma... | python | def queries(self, rcSuffix='', rcNeeded=False, padChar='-',
queryInsertionChar='N', unknownQualityChar='!',
allowDuplicateIds=False, addAlignment=False):
"""
Produce padded (with gaps) queries according to the CIGAR string and
reference sequence length for each ma... | [
"def",
"queries",
"(",
"self",
",",
"rcSuffix",
"=",
"''",
",",
"rcNeeded",
"=",
"False",
",",
"padChar",
"=",
"'-'",
",",
"queryInsertionChar",
"=",
"'N'",
",",
"unknownQualityChar",
"=",
"'!'",
",",
"allowDuplicateIds",
"=",
"False",
",",
"addAlignment",
... | Produce padded (with gaps) queries according to the CIGAR string and
reference sequence length for each matching query sequence.
@param rcSuffix: A C{str} to add to the end of query names that are
reverse complemented. This is added before the /1, /2, etc., that
are added for du... | [
"Produce",
"padded",
"(",
"with",
"gaps",
")",
"queries",
"according",
"to",
"the",
"CIGAR",
"string",
"and",
"reference",
"sequence",
"length",
"for",
"each",
"matching",
"query",
"sequence",
"."
] | train | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/sam.py#L449-L653 |
nkavaldj/myhdl_lib | myhdl_lib/mux.py | mux | def mux(sel, ls_di, do):
""" Multiplexes a list of input signals to an output signal
do = sl_di[sel]
sel - select index
ls_di - list of input signals
do - output signals
"""
N = len(ls_di)
@always_comb
def _mux():
do.next = 0
... | python | def mux(sel, ls_di, do):
""" Multiplexes a list of input signals to an output signal
do = sl_di[sel]
sel - select index
ls_di - list of input signals
do - output signals
"""
N = len(ls_di)
@always_comb
def _mux():
do.next = 0
... | [
"def",
"mux",
"(",
"sel",
",",
"ls_di",
",",
"do",
")",
":",
"N",
"=",
"len",
"(",
"ls_di",
")",
"@",
"always_comb",
"def",
"_mux",
"(",
")",
":",
"do",
".",
"next",
"=",
"0",
"for",
"i",
"in",
"range",
"(",
"N",
")",
":",
"if",
"i",
"==",
... | Multiplexes a list of input signals to an output signal
do = sl_di[sel]
sel - select index
ls_di - list of input signals
do - output signals | [
"Multiplexes",
"a",
"list",
"of",
"input",
"signals",
"to",
"an",
"output",
"signal",
"do",
"=",
"sl_di",
"[",
"sel",
"]"
] | train | https://github.com/nkavaldj/myhdl_lib/blob/9902afd2031e7847373f692821b2135fd0810aa8/myhdl_lib/mux.py#L4-L20 |
nkavaldj/myhdl_lib | myhdl_lib/mux.py | demux | def demux(sel, di, ls_do):
""" Demultiplexes an input signal to a list of output signals
ls_do[sel] = di
sel - select index
di - input signal
ls_do - list of output signals
"""
N = len(ls_do)
@always_comb
def _demux():
for i in range(N):
... | python | def demux(sel, di, ls_do):
""" Demultiplexes an input signal to a list of output signals
ls_do[sel] = di
sel - select index
di - input signal
ls_do - list of output signals
"""
N = len(ls_do)
@always_comb
def _demux():
for i in range(N):
... | [
"def",
"demux",
"(",
"sel",
",",
"di",
",",
"ls_do",
")",
":",
"N",
"=",
"len",
"(",
"ls_do",
")",
"@",
"always_comb",
"def",
"_demux",
"(",
")",
":",
"for",
"i",
"in",
"range",
"(",
"N",
")",
":",
"ls_do",
"[",
"i",
"]",
".",
"next",
"=",
... | Demultiplexes an input signal to a list of output signals
ls_do[sel] = di
sel - select index
di - input signal
ls_do - list of output signals | [
"Demultiplexes",
"an",
"input",
"signal",
"to",
"a",
"list",
"of",
"output",
"signals",
"ls_do",
"[",
"sel",
"]",
"=",
"di"
] | train | https://github.com/nkavaldj/myhdl_lib/blob/9902afd2031e7847373f692821b2135fd0810aa8/myhdl_lib/mux.py#L23-L38 |
nkavaldj/myhdl_lib | myhdl_lib/mux.py | ls_mux | def ls_mux(sel, lsls_di, ls_do):
""" Multiplexes a list of input signal structures to an output structure.
A structure is represented by a list of signals: [signal_1, signal_2, ..., signal_n]
ls_do[0] = lsls_di[sel][0]
ls_do[1] = lsls_di[sel][1]
...
ls_do[n] ... | python | def ls_mux(sel, lsls_di, ls_do):
""" Multiplexes a list of input signal structures to an output structure.
A structure is represented by a list of signals: [signal_1, signal_2, ..., signal_n]
ls_do[0] = lsls_di[sel][0]
ls_do[1] = lsls_di[sel][1]
...
ls_do[n] ... | [
"def",
"ls_mux",
"(",
"sel",
",",
"lsls_di",
",",
"ls_do",
")",
":",
"N",
"=",
"len",
"(",
"ls_do",
")",
"lsls_in",
"=",
"[",
"list",
"(",
"x",
")",
"for",
"x",
"in",
"zip",
"(",
"*",
"lsls_di",
")",
"]",
"return",
"[",
"mux",
"(",
"sel",
","... | Multiplexes a list of input signal structures to an output structure.
A structure is represented by a list of signals: [signal_1, signal_2, ..., signal_n]
ls_do[0] = lsls_di[sel][0]
ls_do[1] = lsls_di[sel][1]
...
ls_do[n] = lsls_di[sel][n]
sel - sele... | [
"Multiplexes",
"a",
"list",
"of",
"input",
"signal",
"structures",
"to",
"an",
"output",
"structure",
".",
"A",
"structure",
"is",
"represented",
"by",
"a",
"list",
"of",
"signals",
":",
"[",
"signal_1",
"signal_2",
"...",
"signal_n",
"]",
"ls_do",
"[",
"0... | train | https://github.com/nkavaldj/myhdl_lib/blob/9902afd2031e7847373f692821b2135fd0810aa8/myhdl_lib/mux.py#L41-L55 |
nkavaldj/myhdl_lib | myhdl_lib/mux.py | ls_demux | def ls_demux(sel, ls_di, lsls_do):
""" Demultiplexes an input signal structure to list of output structures.
A structure is represented by a list of signals: [signal_1, signal_2, ..., signal_n]
lsls_do[sel][0] = ls_di[0]
lsls_do[sel][1] = ls_di[1]
...
lsls_do... | python | def ls_demux(sel, ls_di, lsls_do):
""" Demultiplexes an input signal structure to list of output structures.
A structure is represented by a list of signals: [signal_1, signal_2, ..., signal_n]
lsls_do[sel][0] = ls_di[0]
lsls_do[sel][1] = ls_di[1]
...
lsls_do... | [
"def",
"ls_demux",
"(",
"sel",
",",
"ls_di",
",",
"lsls_do",
")",
":",
"N",
"=",
"len",
"(",
"ls_di",
")",
"lsls_out",
"=",
"[",
"list",
"(",
"x",
")",
"for",
"x",
"in",
"zip",
"(",
"*",
"lsls_do",
")",
"]",
"return",
"[",
"demux",
"(",
"sel",
... | Demultiplexes an input signal structure to list of output structures.
A structure is represented by a list of signals: [signal_1, signal_2, ..., signal_n]
lsls_do[sel][0] = ls_di[0]
lsls_do[sel][1] = ls_di[1]
...
lsls_do[sel][n] = ls_di[n]
sel - sele... | [
"Demultiplexes",
"an",
"input",
"signal",
"structure",
"to",
"list",
"of",
"output",
"structures",
".",
"A",
"structure",
"is",
"represented",
"by",
"a",
"list",
"of",
"signals",
":",
"[",
"signal_1",
"signal_2",
"...",
"signal_n",
"]",
"lsls_do",
"[",
"sel"... | train | https://github.com/nkavaldj/myhdl_lib/blob/9902afd2031e7847373f692821b2135fd0810aa8/myhdl_lib/mux.py#L58-L72 |
nkavaldj/myhdl_lib | myhdl_lib/mux.py | bitslice_select | def bitslice_select(offset, bv_di, bv_do):
''' Selects a bit-slice from a bit-vector
offset - (i) bit offset of the slice
bv_di - (i) bit vector where the slice is taken from
bv_do - (o) selected slice; the length of this bit-vector defines the number of bit in the slice
... | python | def bitslice_select(offset, bv_di, bv_do):
''' Selects a bit-slice from a bit-vector
offset - (i) bit offset of the slice
bv_di - (i) bit vector where the slice is taken from
bv_do - (o) selected slice; the length of this bit-vector defines the number of bit in the slice
... | [
"def",
"bitslice_select",
"(",
"offset",
",",
"bv_di",
",",
"bv_do",
")",
":",
"LEN_I",
"=",
"len",
"(",
"bv_di",
")",
"LEN_O",
"=",
"len",
"(",
"bv_do",
")",
"assert",
"LEN_I",
">=",
"LEN_O",
",",
"\"bitslice_select: expects len(bv_di) >= len(bv_do), but len(bv... | Selects a bit-slice from a bit-vector
offset - (i) bit offset of the slice
bv_di - (i) bit vector where the slice is taken from
bv_do - (o) selected slice; the length of this bit-vector defines the number of bit in the slice
bv_do = bv_di[len(bv_do)+offset:offset] | [
"Selects",
"a",
"bit",
"-",
"slice",
"from",
"a",
"bit",
"-",
"vector",
"offset",
"-",
"(",
"i",
")",
"bit",
"offset",
"of",
"the",
"slice",
"bv_di",
"-",
"(",
"i",
")",
"bit",
"vector",
"where",
"the",
"slice",
"is",
"taken",
"from",
"bv_do",
"-",... | train | https://github.com/nkavaldj/myhdl_lib/blob/9902afd2031e7847373f692821b2135fd0810aa8/myhdl_lib/mux.py#L75-L98 |
nkavaldj/myhdl_lib | myhdl_lib/mux.py | byteslice_select | def byteslice_select(offset, bv_di, bv_do):
''' Selects a slice of length 8*n aligned on a byte from a bit-vector
offset - (i) byte offset of the slice
bv_di - (i) bit vector where the slice is taken from; must len(bv_di) = 8*m
bv_do - (o) selected slice; must len(bv_do) = 8*n,... | python | def byteslice_select(offset, bv_di, bv_do):
''' Selects a slice of length 8*n aligned on a byte from a bit-vector
offset - (i) byte offset of the slice
bv_di - (i) bit vector where the slice is taken from; must len(bv_di) = 8*m
bv_do - (o) selected slice; must len(bv_do) = 8*n,... | [
"def",
"byteslice_select",
"(",
"offset",
",",
"bv_di",
",",
"bv_do",
")",
":",
"LEN_I",
"=",
"len",
"(",
"bv_di",
")",
"LEN_O",
"=",
"len",
"(",
"bv_do",
")",
"assert",
"(",
"LEN_I",
"%",
"8",
")",
"==",
"0",
",",
"\"byteslice_select: expects len(bv_di)... | Selects a slice of length 8*n aligned on a byte from a bit-vector
offset - (i) byte offset of the slice
bv_di - (i) bit vector where the slice is taken from; must len(bv_di) = 8*m
bv_do - (o) selected slice; must len(bv_do) = 8*n, n<=m; len(bv_do) defines the number of bit in the s... | [
"Selects",
"a",
"slice",
"of",
"length",
"8",
"*",
"n",
"aligned",
"on",
"a",
"byte",
"from",
"a",
"bit",
"-",
"vector",
"offset",
"-",
"(",
"i",
")",
"byte",
"offset",
"of",
"the",
"slice",
"bv_di",
"-",
"(",
"i",
")",
"bit",
"vector",
"where",
... | train | https://github.com/nkavaldj/myhdl_lib/blob/9902afd2031e7847373f692821b2135fd0810aa8/myhdl_lib/mux.py#L101-L121 |
flo-compbio/genometools | genometools/ncbi/sra/find_experiment_runs.py | get_argument_parser | def get_argument_parser():
"""Function to obtain the argument parser.
Returns
-------
A fully configured `argparse.ArgumentParser` object.
Notes
-----
This function is used by the `sphinx-argparse` extension for sphinx.
"""
file_mv = cli.file_mv
desc = 'Find all runs (SRR..) ... | python | def get_argument_parser():
"""Function to obtain the argument parser.
Returns
-------
A fully configured `argparse.ArgumentParser` object.
Notes
-----
This function is used by the `sphinx-argparse` extension for sphinx.
"""
file_mv = cli.file_mv
desc = 'Find all runs (SRR..) ... | [
"def",
"get_argument_parser",
"(",
")",
":",
"file_mv",
"=",
"cli",
".",
"file_mv",
"desc",
"=",
"'Find all runs (SRR..) associated with an SRA experiment (SRX...).'",
"parser",
"=",
"cli",
".",
"get_argument_parser",
"(",
"desc",
"=",
"desc",
")",
"parser",
".",
"a... | Function to obtain the argument parser.
Returns
-------
A fully configured `argparse.ArgumentParser` object.
Notes
-----
This function is used by the `sphinx-argparse` extension for sphinx. | [
"Function",
"to",
"obtain",
"the",
"argument",
"parser",
"."
] | train | https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/ncbi/sra/find_experiment_runs.py#L38-L68 |
flo-compbio/genometools | genometools/ncbi/sra/find_experiment_runs.py | main | def main(args=None):
"""Download all .sra from NCBI SRA for a given experiment ID.
Parameters
----------
args: argparse.Namespace object, optional
The argument values. If not specified, the values will be obtained by
parsing the command line arguments using the `argparse` module.
R... | python | def main(args=None):
"""Download all .sra from NCBI SRA for a given experiment ID.
Parameters
----------
args: argparse.Namespace object, optional
The argument values. If not specified, the values will be obtained by
parsing the command line arguments using the `argparse` module.
R... | [
"def",
"main",
"(",
"args",
"=",
"None",
")",
":",
"if",
"args",
"is",
"None",
":",
"# parse command-line arguments",
"parser",
"=",
"get_argument_parser",
"(",
")",
"args",
"=",
"parser",
".",
"parse_args",
"(",
")",
"experiment_file",
"=",
"args",
".",
"... | Download all .sra from NCBI SRA for a given experiment ID.
Parameters
----------
args: argparse.Namespace object, optional
The argument values. If not specified, the values will be obtained by
parsing the command line arguments using the `argparse` module.
Returns
-------
int
... | [
"Download",
"all",
".",
"sra",
"from",
"NCBI",
"SRA",
"for",
"a",
"given",
"experiment",
"ID",
"."
] | train | https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/ncbi/sra/find_experiment_runs.py#L79-L140 |
cebel/pyuniprot | src/pyuniprot/manager/query.py | QueryManager._one_to_many_query | def _one_to_many_query(cls, query_obj, search4, model_attrib):
"""extends and returns a SQLAlchemy query object to allow one-to-many queries
:param query_obj: SQL Alchemy query object
:param str search4: search string
:param model_attrib: attribute in model
"""
model = m... | python | def _one_to_many_query(cls, query_obj, search4, model_attrib):
"""extends and returns a SQLAlchemy query object to allow one-to-many queries
:param query_obj: SQL Alchemy query object
:param str search4: search string
:param model_attrib: attribute in model
"""
model = m... | [
"def",
"_one_to_many_query",
"(",
"cls",
",",
"query_obj",
",",
"search4",
",",
"model_attrib",
")",
":",
"model",
"=",
"model_attrib",
".",
"parent",
".",
"class_",
"if",
"isinstance",
"(",
"search4",
",",
"str",
")",
":",
"query_obj",
"=",
"query_obj",
"... | extends and returns a SQLAlchemy query object to allow one-to-many queries
:param query_obj: SQL Alchemy query object
:param str search4: search string
:param model_attrib: attribute in model | [
"extends",
"and",
"returns",
"a",
"SQLAlchemy",
"query",
"object",
"to",
"allow",
"one",
"-",
"to",
"-",
"many",
"queries"
] | train | https://github.com/cebel/pyuniprot/blob/9462a6042c7c9295415a5eb589b77b27cb7c142b/src/pyuniprot/manager/query.py#L115-L133 |
cebel/pyuniprot | src/pyuniprot/manager/query.py | QueryManager.keyword | def keyword(self, name=None, identifier=None, entry_name=None, limit=None, as_df=False):
"""Method to query :class:`.models.Keyword` objects in database
:param name: keyword name(s)
:type name: str or tuple(str) or None
:param identifier: keyword identifier(s)
:type identifier:... | python | def keyword(self, name=None, identifier=None, entry_name=None, limit=None, as_df=False):
"""Method to query :class:`.models.Keyword` objects in database
:param name: keyword name(s)
:type name: str or tuple(str) or None
:param identifier: keyword identifier(s)
:type identifier:... | [
"def",
"keyword",
"(",
"self",
",",
"name",
"=",
"None",
",",
"identifier",
"=",
"None",
",",
"entry_name",
"=",
"None",
",",
"limit",
"=",
"None",
",",
"as_df",
"=",
"False",
")",
":",
"q",
"=",
"self",
".",
"session",
".",
"query",
"(",
"models",... | Method to query :class:`.models.Keyword` objects in database
:param name: keyword name(s)
:type name: str or tuple(str) or None
:param identifier: keyword identifier(s)
:type identifier: str or tuple(str) or None
:param entry_name: name(s) in :class:`.models.Entry`
:ty... | [
"Method",
"to",
"query",
":",
"class",
":",
".",
"models",
".",
"Keyword",
"objects",
"in",
"database"
] | train | https://github.com/cebel/pyuniprot/blob/9462a6042c7c9295415a5eb589b77b27cb7c142b/src/pyuniprot/manager/query.py#L135-L171 |
cebel/pyuniprot | src/pyuniprot/manager/query.py | QueryManager.entry | def entry(self,
name=None,
dataset=None,
recommended_full_name=None,
recommended_short_name=None,
gene_name=None,
taxid=None,
accession=None,
organism_host=None,
feature_type=None,
... | python | def entry(self,
name=None,
dataset=None,
recommended_full_name=None,
recommended_short_name=None,
gene_name=None,
taxid=None,
accession=None,
organism_host=None,
feature_type=None,
... | [
"def",
"entry",
"(",
"self",
",",
"name",
"=",
"None",
",",
"dataset",
"=",
"None",
",",
"recommended_full_name",
"=",
"None",
",",
"recommended_short_name",
"=",
"None",
",",
"gene_name",
"=",
"None",
",",
"taxid",
"=",
"None",
",",
"accession",
"=",
"N... | Method to query :class:`.models.Entry` objects in database
An entry is the root element in UniProt datasets. Everything is linked to entry and can be accessed from
:param name: UniProt entry name(s)
:type name: str or tuple(str) or None
:param dataset: Swiss-Prot or TrEMBL
:ty... | [
"Method",
"to",
"query",
":",
"class",
":",
".",
"models",
".",
"Entry",
"objects",
"in",
"database"
] | train | https://github.com/cebel/pyuniprot/blob/9462a6042c7c9295415a5eb589b77b27cb7c142b/src/pyuniprot/manager/query.py#L173-L318 |
cebel/pyuniprot | src/pyuniprot/manager/query.py | QueryManager.disease | def disease(self,
identifier=None,
ref_id=None,
ref_type=None,
name=None,
acronym=None,
description=None,
entry_name=None,
limit=None,
as_df=False
):
""... | python | def disease(self,
identifier=None,
ref_id=None,
ref_type=None,
name=None,
acronym=None,
description=None,
entry_name=None,
limit=None,
as_df=False
):
""... | [
"def",
"disease",
"(",
"self",
",",
"identifier",
"=",
"None",
",",
"ref_id",
"=",
"None",
",",
"ref_type",
"=",
"None",
",",
"name",
"=",
"None",
",",
"acronym",
"=",
"None",
",",
"description",
"=",
"None",
",",
"entry_name",
"=",
"None",
",",
"lim... | Method to query :class:`.models.Disease` objects in database
:param identifier: disease UniProt identifier(s)
:type identifier: str or tuple(str) or None
:param ref_id: identifier(s) of referenced database
:type ref_id: str or tuple(str) or None
:param ref_type: database name... | [
"Method",
"to",
"query",
":",
"class",
":",
".",
"models",
".",
"Disease",
"objects",
"in",
"database"
] | train | https://github.com/cebel/pyuniprot/blob/9462a6042c7c9295415a5eb589b77b27cb7c142b/src/pyuniprot/manager/query.py#L320-L387 |
cebel/pyuniprot | src/pyuniprot/manager/query.py | QueryManager.disease_comment | def disease_comment(self, comment=None, entry_name=None, limit=None, as_df=False):
"""Method to query :class:`.models.DiseaseComment` objects in database
:param comment: Comment(s) to disease
:type comment: str or tuple(str) or None
:param entry_name: name(s) in :class:`.models.Entry`
... | python | def disease_comment(self, comment=None, entry_name=None, limit=None, as_df=False):
"""Method to query :class:`.models.DiseaseComment` objects in database
:param comment: Comment(s) to disease
:type comment: str or tuple(str) or None
:param entry_name: name(s) in :class:`.models.Entry`
... | [
"def",
"disease_comment",
"(",
"self",
",",
"comment",
"=",
"None",
",",
"entry_name",
"=",
"None",
",",
"limit",
"=",
"None",
",",
"as_df",
"=",
"False",
")",
":",
"q",
"=",
"self",
".",
"session",
".",
"query",
"(",
"models",
".",
"DiseaseComment",
... | Method to query :class:`.models.DiseaseComment` objects in database
:param comment: Comment(s) to disease
:type comment: str or tuple(str) or None
:param entry_name: name(s) in :class:`.models.Entry`
:type entry_name: str or tuple(str) or None
:param limit:
- if `i... | [
"Method",
"to",
"query",
":",
"class",
":",
".",
"models",
".",
"DiseaseComment",
"objects",
"in",
"database"
] | train | https://github.com/cebel/pyuniprot/blob/9462a6042c7c9295415a5eb589b77b27cb7c142b/src/pyuniprot/manager/query.py#L389-L417 |
cebel/pyuniprot | src/pyuniprot/manager/query.py | QueryManager.other_gene_name | def other_gene_name(self, type_=None, name=None, entry_name=None, limit=None, as_df=None):
"""Method to query :class:`.models.OtherGeneName` objects in database
:param type_: type(s) of gene name e.g. *synonym*
:type type_: str or tuple(str) or None
:param name: other gene name(s)
... | python | def other_gene_name(self, type_=None, name=None, entry_name=None, limit=None, as_df=None):
"""Method to query :class:`.models.OtherGeneName` objects in database
:param type_: type(s) of gene name e.g. *synonym*
:type type_: str or tuple(str) or None
:param name: other gene name(s)
... | [
"def",
"other_gene_name",
"(",
"self",
",",
"type_",
"=",
"None",
",",
"name",
"=",
"None",
",",
"entry_name",
"=",
"None",
",",
"limit",
"=",
"None",
",",
"as_df",
"=",
"None",
")",
":",
"q",
"=",
"self",
".",
"session",
".",
"query",
"(",
"models... | Method to query :class:`.models.OtherGeneName` objects in database
:param type_: type(s) of gene name e.g. *synonym*
:type type_: str or tuple(str) or None
:param name: other gene name(s)
:type name: str or tuple(str) or None
:param entry_name: name(s) in :class:`.models.Entry... | [
"Method",
"to",
"query",
":",
"class",
":",
".",
"models",
".",
"OtherGeneName",
"objects",
"in",
"database"
] | train | https://github.com/cebel/pyuniprot/blob/9462a6042c7c9295415a5eb589b77b27cb7c142b/src/pyuniprot/manager/query.py#L419-L455 |
cebel/pyuniprot | src/pyuniprot/manager/query.py | QueryManager.alternative_full_name | def alternative_full_name(self, name=None, entry_name=None, limit=None, as_df=False):
"""Method to query :class:`.models.AlternativeFullName` objects in database
:param name: alternative full name(s)
:type name: str or tuple(str) or None
:param entry_name: name(s) in :class:`.models.En... | python | def alternative_full_name(self, name=None, entry_name=None, limit=None, as_df=False):
"""Method to query :class:`.models.AlternativeFullName` objects in database
:param name: alternative full name(s)
:type name: str or tuple(str) or None
:param entry_name: name(s) in :class:`.models.En... | [
"def",
"alternative_full_name",
"(",
"self",
",",
"name",
"=",
"None",
",",
"entry_name",
"=",
"None",
",",
"limit",
"=",
"None",
",",
"as_df",
"=",
"False",
")",
":",
"q",
"=",
"self",
".",
"session",
".",
"query",
"(",
"models",
".",
"AlternativeFull... | Method to query :class:`.models.AlternativeFullName` objects in database
:param name: alternative full name(s)
:type name: str or tuple(str) or None
:param entry_name: name(s) in :class:`.models.Entry`
:type entry_name: str or tuple(str) or None
:param limit:
- if ... | [
"Method",
"to",
"query",
":",
"class",
":",
".",
"models",
".",
"AlternativeFullName",
"objects",
"in",
"database"
] | train | https://github.com/cebel/pyuniprot/blob/9462a6042c7c9295415a5eb589b77b27cb7c142b/src/pyuniprot/manager/query.py#L457-L488 |
cebel/pyuniprot | src/pyuniprot/manager/query.py | QueryManager.alternative_short_name | def alternative_short_name(self, name=None, entry_name=None, limit=None, as_df=False):
"""Method to query :class:`.models.AlternativeShortlName` objects in database
:param name: alternative short name(s)
:type name: str or tuple(str) or None
:param entry_name: name(s) in :class:`.model... | python | def alternative_short_name(self, name=None, entry_name=None, limit=None, as_df=False):
"""Method to query :class:`.models.AlternativeShortlName` objects in database
:param name: alternative short name(s)
:type name: str or tuple(str) or None
:param entry_name: name(s) in :class:`.model... | [
"def",
"alternative_short_name",
"(",
"self",
",",
"name",
"=",
"None",
",",
"entry_name",
"=",
"None",
",",
"limit",
"=",
"None",
",",
"as_df",
"=",
"False",
")",
":",
"q",
"=",
"self",
".",
"session",
".",
"query",
"(",
"models",
".",
"AlternativeSho... | Method to query :class:`.models.AlternativeShortlName` objects in database
:param name: alternative short name(s)
:type name: str or tuple(str) or None
:param entry_name: name(s) in :class:`.models.Entry`
:type entry_name: str or tuple(str) or None
:param limit:
- ... | [
"Method",
"to",
"query",
":",
"class",
":",
".",
"models",
".",
"AlternativeShortlName",
"objects",
"in",
"database"
] | train | https://github.com/cebel/pyuniprot/blob/9462a6042c7c9295415a5eb589b77b27cb7c142b/src/pyuniprot/manager/query.py#L490-L521 |
cebel/pyuniprot | src/pyuniprot/manager/query.py | QueryManager.accession | def accession(self, accession=None, entry_name=None, limit=None, as_df=False):
"""Method to query :class:`.models.Accession` objects in database
:param accession: UniProt Accession number(s)
:type accession: str or tuple(str) or None
:param entry_name: name(s) in :class:`.models.Entry`... | python | def accession(self, accession=None, entry_name=None, limit=None, as_df=False):
"""Method to query :class:`.models.Accession` objects in database
:param accession: UniProt Accession number(s)
:type accession: str or tuple(str) or None
:param entry_name: name(s) in :class:`.models.Entry`... | [
"def",
"accession",
"(",
"self",
",",
"accession",
"=",
"None",
",",
"entry_name",
"=",
"None",
",",
"limit",
"=",
"None",
",",
"as_df",
"=",
"False",
")",
":",
"q",
"=",
"self",
".",
"session",
".",
"query",
"(",
"models",
".",
"Accession",
")",
"... | Method to query :class:`.models.Accession` objects in database
:param accession: UniProt Accession number(s)
:type accession: str or tuple(str) or None
:param entry_name: name(s) in :class:`.models.Entry`
:type entry_name: str or tuple(str) or None
:param limit:
- ... | [
"Method",
"to",
"query",
":",
"class",
":",
".",
"models",
".",
"Accession",
"objects",
"in",
"database"
] | train | https://github.com/cebel/pyuniprot/blob/9462a6042c7c9295415a5eb589b77b27cb7c142b/src/pyuniprot/manager/query.py#L523-L554 |
cebel/pyuniprot | src/pyuniprot/manager/query.py | QueryManager.pmid | def pmid(self,
pmid=None,
entry_name=None,
first=None,
last=None,
volume=None,
name=None,
date=None,
title=None,
limit=None,
as_df=False
):
"""Method to query :class:`.m... | python | def pmid(self,
pmid=None,
entry_name=None,
first=None,
last=None,
volume=None,
name=None,
date=None,
title=None,
limit=None,
as_df=False
):
"""Method to query :class:`.m... | [
"def",
"pmid",
"(",
"self",
",",
"pmid",
"=",
"None",
",",
"entry_name",
"=",
"None",
",",
"first",
"=",
"None",
",",
"last",
"=",
"None",
",",
"volume",
"=",
"None",
",",
"name",
"=",
"None",
",",
"date",
"=",
"None",
",",
"title",
"=",
"None",
... | Method to query :class:`.models.Pmid` objects in database
:param pmid: PubMed identifier(s)
:type pmid: int or tuple(int) or None
:param entry_name: name(s) in :class:`.models.Entry`
:type entry_name: str or tuple(str) or None
:param first: first page(s)
:type first: s... | [
"Method",
"to",
"query",
":",
"class",
":",
".",
"models",
".",
"Pmid",
"objects",
"in",
"database"
] | train | https://github.com/cebel/pyuniprot/blob/9462a6042c7c9295415a5eb589b77b27cb7c142b/src/pyuniprot/manager/query.py#L556-L622 |
cebel/pyuniprot | src/pyuniprot/manager/query.py | QueryManager.organism_host | def organism_host(self, taxid=None, entry_name=None, limit=None, as_df=False):
"""Method to query :class:`.models.OrganismHost` objects in database
:param taxid: NCBI taxonomy identifier(s)
:type taxid: int or tuple(int) or None
:param entry_name: name(s) in :class:`.models.Entry`
... | python | def organism_host(self, taxid=None, entry_name=None, limit=None, as_df=False):
"""Method to query :class:`.models.OrganismHost` objects in database
:param taxid: NCBI taxonomy identifier(s)
:type taxid: int or tuple(int) or None
:param entry_name: name(s) in :class:`.models.Entry`
... | [
"def",
"organism_host",
"(",
"self",
",",
"taxid",
"=",
"None",
",",
"entry_name",
"=",
"None",
",",
"limit",
"=",
"None",
",",
"as_df",
"=",
"False",
")",
":",
"q",
"=",
"self",
".",
"session",
".",
"query",
"(",
"models",
".",
"OrganismHost",
")",
... | Method to query :class:`.models.OrganismHost` objects in database
:param taxid: NCBI taxonomy identifier(s)
:type taxid: int or tuple(int) or None
:param entry_name: name(s) in :class:`.models.Entry`
:type entry_name: str or tuple(str) or None
:param limit:
- if `i... | [
"Method",
"to",
"query",
":",
"class",
":",
".",
"models",
".",
"OrganismHost",
"objects",
"in",
"database"
] | train | https://github.com/cebel/pyuniprot/blob/9462a6042c7c9295415a5eb589b77b27cb7c142b/src/pyuniprot/manager/query.py#L624-L652 |
cebel/pyuniprot | src/pyuniprot/manager/query.py | QueryManager.db_reference | def db_reference(self, type_=None, identifier=None, entry_name=None, limit=None, as_df=False):
"""Method to query :class:`.models.DbReference` objects in database
Check list of available databases with on :py:attr:`.dbreference_types`
:param type_: type(s) (or name(s)) of database
:typ... | python | def db_reference(self, type_=None, identifier=None, entry_name=None, limit=None, as_df=False):
"""Method to query :class:`.models.DbReference` objects in database
Check list of available databases with on :py:attr:`.dbreference_types`
:param type_: type(s) (or name(s)) of database
:typ... | [
"def",
"db_reference",
"(",
"self",
",",
"type_",
"=",
"None",
",",
"identifier",
"=",
"None",
",",
"entry_name",
"=",
"None",
",",
"limit",
"=",
"None",
",",
"as_df",
"=",
"False",
")",
":",
"q",
"=",
"self",
".",
"session",
".",
"query",
"(",
"mo... | Method to query :class:`.models.DbReference` objects in database
Check list of available databases with on :py:attr:`.dbreference_types`
:param type_: type(s) (or name(s)) of database
:type type_: str or tuple(str) or None
:param identifier: unique identifier(s) in specific database (... | [
"Method",
"to",
"query",
":",
"class",
":",
".",
"models",
".",
"DbReference",
"objects",
"in",
"database"
] | train | https://github.com/cebel/pyuniprot/blob/9462a6042c7c9295415a5eb589b77b27cb7c142b/src/pyuniprot/manager/query.py#L654-L695 |
cebel/pyuniprot | src/pyuniprot/manager/query.py | QueryManager.feature | def feature(self, type_=None, identifier=None, description=None, entry_name=None, limit=None, as_df=False):
"""Method to query :class:`.models.Feature` objects in database
Check available features types with ``pyuniprot.query().feature_types``
:param type_: type(s) of feature
:type typ... | python | def feature(self, type_=None, identifier=None, description=None, entry_name=None, limit=None, as_df=False):
"""Method to query :class:`.models.Feature` objects in database
Check available features types with ``pyuniprot.query().feature_types``
:param type_: type(s) of feature
:type typ... | [
"def",
"feature",
"(",
"self",
",",
"type_",
"=",
"None",
",",
"identifier",
"=",
"None",
",",
"description",
"=",
"None",
",",
"entry_name",
"=",
"None",
",",
"limit",
"=",
"None",
",",
"as_df",
"=",
"False",
")",
":",
"q",
"=",
"self",
".",
"sess... | Method to query :class:`.models.Feature` objects in database
Check available features types with ``pyuniprot.query().feature_types``
:param type_: type(s) of feature
:type type_: str or tuple(str) or None
:param identifier: feature identifier(s)
:type identifier: str or tuple(... | [
"Method",
"to",
"query",
":",
"class",
":",
".",
"models",
".",
"Feature",
"objects",
"in",
"database"
] | train | https://github.com/cebel/pyuniprot/blob/9462a6042c7c9295415a5eb589b77b27cb7c142b/src/pyuniprot/manager/query.py#L697-L738 |
cebel/pyuniprot | src/pyuniprot/manager/query.py | QueryManager.function | def function(self, text=None, entry_name=None, limit=None, as_df=False):
"""Method to query :class:`.models.Function` objects in database
:param text: description(s) of function(s)
:type text: str or tuple(str) or None
:param entry_name: name(s) in :class:`.models.Entry`
:type ... | python | def function(self, text=None, entry_name=None, limit=None, as_df=False):
"""Method to query :class:`.models.Function` objects in database
:param text: description(s) of function(s)
:type text: str or tuple(str) or None
:param entry_name: name(s) in :class:`.models.Entry`
:type ... | [
"def",
"function",
"(",
"self",
",",
"text",
"=",
"None",
",",
"entry_name",
"=",
"None",
",",
"limit",
"=",
"None",
",",
"as_df",
"=",
"False",
")",
":",
"q",
"=",
"self",
".",
"session",
".",
"query",
"(",
"models",
".",
"Function",
")",
"model_q... | Method to query :class:`.models.Function` objects in database
:param text: description(s) of function(s)
:type text: str or tuple(str) or None
:param entry_name: name(s) in :class:`.models.Entry`
:type entry_name: str or tuple(str) or None
:param limit:
- if `isins... | [
"Method",
"to",
"query",
":",
"class",
":",
".",
"models",
".",
"Function",
"objects",
"in",
"database"
] | train | https://github.com/cebel/pyuniprot/blob/9462a6042c7c9295415a5eb589b77b27cb7c142b/src/pyuniprot/manager/query.py#L740-L771 |
cebel/pyuniprot | src/pyuniprot/manager/query.py | QueryManager.ec_number | def ec_number(self, ec_number=None, entry_name=None, limit=None, as_df=False):
"""Method to query :class:`.models.ECNumber` objects in database
:param ec_number: Enzyme Commission number(s)
:type ec_number: str or tuple(str) or None
:param entry_name: name(s) in :class:`.models.Entry`
... | python | def ec_number(self, ec_number=None, entry_name=None, limit=None, as_df=False):
"""Method to query :class:`.models.ECNumber` objects in database
:param ec_number: Enzyme Commission number(s)
:type ec_number: str or tuple(str) or None
:param entry_name: name(s) in :class:`.models.Entry`
... | [
"def",
"ec_number",
"(",
"self",
",",
"ec_number",
"=",
"None",
",",
"entry_name",
"=",
"None",
",",
"limit",
"=",
"None",
",",
"as_df",
"=",
"False",
")",
":",
"q",
"=",
"self",
".",
"session",
".",
"query",
"(",
"models",
".",
"ECNumber",
")",
"q... | Method to query :class:`.models.ECNumber` objects in database
:param ec_number: Enzyme Commission number(s)
:type ec_number: str or tuple(str) or None
:param entry_name: name(s) in :class:`.models.Entry`
:type entry_name: str or tuple(str) or None
:param limit:
- i... | [
"Method",
"to",
"query",
":",
"class",
":",
".",
"models",
".",
"ECNumber",
"objects",
"in",
"database"
] | train | https://github.com/cebel/pyuniprot/blob/9462a6042c7c9295415a5eb589b77b27cb7c142b/src/pyuniprot/manager/query.py#L773-L801 |
cebel/pyuniprot | src/pyuniprot/manager/query.py | QueryManager.subcellular_location | def subcellular_location(self, location=None, entry_name=None, limit=None, as_df=False):
"""Method to query :class:`.models.SubcellularLocation` objects in database
:param location: subcellular location(s)
:type location: str or tuple(str) or None
:param entry_name: name(s) in :class:`... | python | def subcellular_location(self, location=None, entry_name=None, limit=None, as_df=False):
"""Method to query :class:`.models.SubcellularLocation` objects in database
:param location: subcellular location(s)
:type location: str or tuple(str) or None
:param entry_name: name(s) in :class:`... | [
"def",
"subcellular_location",
"(",
"self",
",",
"location",
"=",
"None",
",",
"entry_name",
"=",
"None",
",",
"limit",
"=",
"None",
",",
"as_df",
"=",
"False",
")",
":",
"q",
"=",
"self",
".",
"session",
".",
"query",
"(",
"models",
".",
"SubcellularL... | Method to query :class:`.models.SubcellularLocation` objects in database
:param location: subcellular location(s)
:type location: str or tuple(str) or None
:param entry_name: name(s) in :class:`.models.Entry`
:type entry_name: str or tuple(str) or None
:param limit:
... | [
"Method",
"to",
"query",
":",
"class",
":",
".",
"models",
".",
"SubcellularLocation",
"objects",
"in",
"database"
] | train | https://github.com/cebel/pyuniprot/blob/9462a6042c7c9295415a5eb589b77b27cb7c142b/src/pyuniprot/manager/query.py#L833-L861 |
cebel/pyuniprot | src/pyuniprot/manager/query.py | QueryManager.tissue_specificity | def tissue_specificity(self, comment=None, entry_name=None, limit=None, as_df=False):
"""Method to query :class:`.models.TissueSpecificity` objects in database
Provides information on the expression of a gene at the mRNA or protein level in cells or in tissues of
multicellular organisms. By def... | python | def tissue_specificity(self, comment=None, entry_name=None, limit=None, as_df=False):
"""Method to query :class:`.models.TissueSpecificity` objects in database
Provides information on the expression of a gene at the mRNA or protein level in cells or in tissues of
multicellular organisms. By def... | [
"def",
"tissue_specificity",
"(",
"self",
",",
"comment",
"=",
"None",
",",
"entry_name",
"=",
"None",
",",
"limit",
"=",
"None",
",",
"as_df",
"=",
"False",
")",
":",
"q",
"=",
"self",
".",
"session",
".",
"query",
"(",
"models",
".",
"TissueSpecifici... | Method to query :class:`.models.TissueSpecificity` objects in database
Provides information on the expression of a gene at the mRNA or protein level in cells or in tissues of
multicellular organisms. By default, the information is derived from experiments at the mRNA level, unless
specified ‘at... | [
"Method",
"to",
"query",
":",
"class",
":",
".",
"models",
".",
"TissueSpecificity",
"objects",
"in",
"database"
] | train | https://github.com/cebel/pyuniprot/blob/9462a6042c7c9295415a5eb589b77b27cb7c142b/src/pyuniprot/manager/query.py#L863-L895 |
cebel/pyuniprot | src/pyuniprot/manager/query.py | QueryManager.tissue_in_reference | def tissue_in_reference(self, tissue=None, entry_name=None, limit=None, as_df=False):
"""Method to query :class:`.models.TissueInReference` objects in database
:param tissue: tissue(s) linked to reference
:type tissue: str or tuple(str) or None
:param entry_name: name(s) in :class:`.mo... | python | def tissue_in_reference(self, tissue=None, entry_name=None, limit=None, as_df=False):
"""Method to query :class:`.models.TissueInReference` objects in database
:param tissue: tissue(s) linked to reference
:type tissue: str or tuple(str) or None
:param entry_name: name(s) in :class:`.mo... | [
"def",
"tissue_in_reference",
"(",
"self",
",",
"tissue",
"=",
"None",
",",
"entry_name",
"=",
"None",
",",
"limit",
"=",
"None",
",",
"as_df",
"=",
"False",
")",
":",
"q",
"=",
"self",
".",
"session",
".",
"query",
"(",
"models",
".",
"TissueInReferen... | Method to query :class:`.models.TissueInReference` objects in database
:param tissue: tissue(s) linked to reference
:type tissue: str or tuple(str) or None
:param entry_name: name(s) in :class:`.models.Entry`
:type entry_name: str or tuple(str) or None
:param limit:
... | [
"Method",
"to",
"query",
":",
"class",
":",
".",
"models",
".",
"TissueInReference",
"objects",
"in",
"database"
] | train | https://github.com/cebel/pyuniprot/blob/9462a6042c7c9295415a5eb589b77b27cb7c142b/src/pyuniprot/manager/query.py#L897-L928 |
cebel/pyuniprot | src/pyuniprot/manager/query.py | QueryManager.dbreference_types | def dbreference_types(self):
"""Distinct database reference types (``type_``) in :class:`.models.DbReference`
:return: List of strings for all available database cross reference types used in model DbReference
:rtype: list[str]
"""
q = self.session.query(distinct(models.DbRefere... | python | def dbreference_types(self):
"""Distinct database reference types (``type_``) in :class:`.models.DbReference`
:return: List of strings for all available database cross reference types used in model DbReference
:rtype: list[str]
"""
q = self.session.query(distinct(models.DbRefere... | [
"def",
"dbreference_types",
"(",
"self",
")",
":",
"q",
"=",
"self",
".",
"session",
".",
"query",
"(",
"distinct",
"(",
"models",
".",
"DbReference",
".",
"type_",
")",
")",
"return",
"[",
"x",
"[",
"0",
"]",
"for",
"x",
"in",
"q",
".",
"all",
"... | Distinct database reference types (``type_``) in :class:`.models.DbReference`
:return: List of strings for all available database cross reference types used in model DbReference
:rtype: list[str] | [
"Distinct",
"database",
"reference",
"types",
"(",
"type_",
")",
"in",
":",
"class",
":",
".",
"models",
".",
"DbReference"
] | train | https://github.com/cebel/pyuniprot/blob/9462a6042c7c9295415a5eb589b77b27cb7c142b/src/pyuniprot/manager/query.py#L931-L938 |
cebel/pyuniprot | src/pyuniprot/manager/query.py | QueryManager.taxids | def taxids(self):
"""Distinct NCBI taxonomy identifiers (``taxid``) in :class:`.models.Entry`
:return: NCBI taxonomy identifiers
:rtype: list[int]
"""
r = self.session.query(distinct(models.Entry.taxid)).all()
return [x[0] for x in r] | python | def taxids(self):
"""Distinct NCBI taxonomy identifiers (``taxid``) in :class:`.models.Entry`
:return: NCBI taxonomy identifiers
:rtype: list[int]
"""
r = self.session.query(distinct(models.Entry.taxid)).all()
return [x[0] for x in r] | [
"def",
"taxids",
"(",
"self",
")",
":",
"r",
"=",
"self",
".",
"session",
".",
"query",
"(",
"distinct",
"(",
"models",
".",
"Entry",
".",
"taxid",
")",
")",
".",
"all",
"(",
")",
"return",
"[",
"x",
"[",
"0",
"]",
"for",
"x",
"in",
"r",
"]"
... | Distinct NCBI taxonomy identifiers (``taxid``) in :class:`.models.Entry`
:return: NCBI taxonomy identifiers
:rtype: list[int] | [
"Distinct",
"NCBI",
"taxonomy",
"identifiers",
"(",
"taxid",
")",
"in",
":",
"class",
":",
".",
"models",
".",
"Entry"
] | train | https://github.com/cebel/pyuniprot/blob/9462a6042c7c9295415a5eb589b77b27cb7c142b/src/pyuniprot/manager/query.py#L941-L948 |
cebel/pyuniprot | src/pyuniprot/manager/query.py | QueryManager.datasets | def datasets(self):
"""Distinct datasets (``dataset``) in :class:`.models.Entry`
Distinct datasets are SwissProt or/and TrEMBL
:return: all distinct dataset types
:rtype: list[str]
"""
r = self.session.query(distinct(models.Entry.dataset)).all()
return [x[0] for... | python | def datasets(self):
"""Distinct datasets (``dataset``) in :class:`.models.Entry`
Distinct datasets are SwissProt or/and TrEMBL
:return: all distinct dataset types
:rtype: list[str]
"""
r = self.session.query(distinct(models.Entry.dataset)).all()
return [x[0] for... | [
"def",
"datasets",
"(",
"self",
")",
":",
"r",
"=",
"self",
".",
"session",
".",
"query",
"(",
"distinct",
"(",
"models",
".",
"Entry",
".",
"dataset",
")",
")",
".",
"all",
"(",
")",
"return",
"[",
"x",
"[",
"0",
"]",
"for",
"x",
"in",
"r",
... | Distinct datasets (``dataset``) in :class:`.models.Entry`
Distinct datasets are SwissProt or/and TrEMBL
:return: all distinct dataset types
:rtype: list[str] | [
"Distinct",
"datasets",
"(",
"dataset",
")",
"in",
":",
"class",
":",
".",
"models",
".",
"Entry"
] | train | https://github.com/cebel/pyuniprot/blob/9462a6042c7c9295415a5eb589b77b27cb7c142b/src/pyuniprot/manager/query.py#L951-L960 |
cebel/pyuniprot | src/pyuniprot/manager/query.py | QueryManager.feature_types | def feature_types(self):
"""Distinct types (``type_``) in :class:`.models.Feature`
:return: all distinct feature types
:rtype: list[str]
"""
r = self.session.query(distinct(models.Feature.type_)).all()
return [x[0] for x in r] | python | def feature_types(self):
"""Distinct types (``type_``) in :class:`.models.Feature`
:return: all distinct feature types
:rtype: list[str]
"""
r = self.session.query(distinct(models.Feature.type_)).all()
return [x[0] for x in r] | [
"def",
"feature_types",
"(",
"self",
")",
":",
"r",
"=",
"self",
".",
"session",
".",
"query",
"(",
"distinct",
"(",
"models",
".",
"Feature",
".",
"type_",
")",
")",
".",
"all",
"(",
")",
"return",
"[",
"x",
"[",
"0",
"]",
"for",
"x",
"in",
"r... | Distinct types (``type_``) in :class:`.models.Feature`
:return: all distinct feature types
:rtype: list[str] | [
"Distinct",
"types",
"(",
"type_",
")",
"in",
":",
"class",
":",
".",
"models",
".",
"Feature"
] | train | https://github.com/cebel/pyuniprot/blob/9462a6042c7c9295415a5eb589b77b27cb7c142b/src/pyuniprot/manager/query.py#L963-L970 |
cebel/pyuniprot | src/pyuniprot/manager/query.py | QueryManager.subcellular_locations | def subcellular_locations(self):
"""Distinct subcellular locations (``location`` in :class:`.models.SubcellularLocation`)
:return: all distinct subcellular locations
:rtype: list[str]
"""
return [x[0] for x in self.session.query(models.SubcellularLocation.location).all()] | python | def subcellular_locations(self):
"""Distinct subcellular locations (``location`` in :class:`.models.SubcellularLocation`)
:return: all distinct subcellular locations
:rtype: list[str]
"""
return [x[0] for x in self.session.query(models.SubcellularLocation.location).all()] | [
"def",
"subcellular_locations",
"(",
"self",
")",
":",
"return",
"[",
"x",
"[",
"0",
"]",
"for",
"x",
"in",
"self",
".",
"session",
".",
"query",
"(",
"models",
".",
"SubcellularLocation",
".",
"location",
")",
".",
"all",
"(",
")",
"]"
] | Distinct subcellular locations (``location`` in :class:`.models.SubcellularLocation`)
:return: all distinct subcellular locations
:rtype: list[str] | [
"Distinct",
"subcellular",
"locations",
"(",
"location",
"in",
":",
"class",
":",
".",
"models",
".",
"SubcellularLocation",
")"
] | train | https://github.com/cebel/pyuniprot/blob/9462a6042c7c9295415a5eb589b77b27cb7c142b/src/pyuniprot/manager/query.py#L973-L979 |
cebel/pyuniprot | src/pyuniprot/manager/query.py | QueryManager.tissues_in_references | def tissues_in_references(self):
"""Distinct tissues (``tissue`` in :class:`.models.TissueInReference`)
:return: all distinct tissues in references
:rtype: list[str]
"""
return [x[0] for x in self.session.query(models.TissueInReference.tissue).all()] | python | def tissues_in_references(self):
"""Distinct tissues (``tissue`` in :class:`.models.TissueInReference`)
:return: all distinct tissues in references
:rtype: list[str]
"""
return [x[0] for x in self.session.query(models.TissueInReference.tissue).all()] | [
"def",
"tissues_in_references",
"(",
"self",
")",
":",
"return",
"[",
"x",
"[",
"0",
"]",
"for",
"x",
"in",
"self",
".",
"session",
".",
"query",
"(",
"models",
".",
"TissueInReference",
".",
"tissue",
")",
".",
"all",
"(",
")",
"]"
] | Distinct tissues (``tissue`` in :class:`.models.TissueInReference`)
:return: all distinct tissues in references
:rtype: list[str] | [
"Distinct",
"tissues",
"(",
"tissue",
"in",
":",
"class",
":",
".",
"models",
".",
"TissueInReference",
")"
] | train | https://github.com/cebel/pyuniprot/blob/9462a6042c7c9295415a5eb589b77b27cb7c142b/src/pyuniprot/manager/query.py#L982-L988 |
cebel/pyuniprot | src/pyuniprot/manager/query.py | QueryManager.keywords | def keywords(self):
"""Distinct keywords (``name`` in :class:`.models.Keyword`)
:returns: all distinct keywords
:rtype: list[str]
"""
return [x[0] for x in self.session.query(models.Keyword.name).all()] | python | def keywords(self):
"""Distinct keywords (``name`` in :class:`.models.Keyword`)
:returns: all distinct keywords
:rtype: list[str]
"""
return [x[0] for x in self.session.query(models.Keyword.name).all()] | [
"def",
"keywords",
"(",
"self",
")",
":",
"return",
"[",
"x",
"[",
"0",
"]",
"for",
"x",
"in",
"self",
".",
"session",
".",
"query",
"(",
"models",
".",
"Keyword",
".",
"name",
")",
".",
"all",
"(",
")",
"]"
] | Distinct keywords (``name`` in :class:`.models.Keyword`)
:returns: all distinct keywords
:rtype: list[str] | [
"Distinct",
"keywords",
"(",
"name",
"in",
":",
"class",
":",
".",
"models",
".",
"Keyword",
")"
] | train | https://github.com/cebel/pyuniprot/blob/9462a6042c7c9295415a5eb589b77b27cb7c142b/src/pyuniprot/manager/query.py#L991-L997 |
cebel/pyuniprot | src/pyuniprot/manager/query.py | QueryManager.diseases | def diseases(self):
"""Distinct diseases (``name`` in :class:`.models.Disease`)
:returns: all distinct disease names
:rtype: list[str]
"""
return [x[0] for x in self.session.query(models.Disease.name).all()] | python | def diseases(self):
"""Distinct diseases (``name`` in :class:`.models.Disease`)
:returns: all distinct disease names
:rtype: list[str]
"""
return [x[0] for x in self.session.query(models.Disease.name).all()] | [
"def",
"diseases",
"(",
"self",
")",
":",
"return",
"[",
"x",
"[",
"0",
"]",
"for",
"x",
"in",
"self",
".",
"session",
".",
"query",
"(",
"models",
".",
"Disease",
".",
"name",
")",
".",
"all",
"(",
")",
"]"
] | Distinct diseases (``name`` in :class:`.models.Disease`)
:returns: all distinct disease names
:rtype: list[str] | [
"Distinct",
"diseases",
"(",
"name",
"in",
":",
"class",
":",
".",
"models",
".",
"Disease",
")"
] | train | https://github.com/cebel/pyuniprot/blob/9462a6042c7c9295415a5eb589b77b27cb7c142b/src/pyuniprot/manager/query.py#L1000-L1006 |
cebel/pyuniprot | src/pyuniprot/manager/query.py | QueryManager.version | def version(self):
"""Version of UniPort knowledgebase
:returns: dictionary with version info
:rtype: dict
"""
return [x for x in self.session.query(models.Version).all()] | python | def version(self):
"""Version of UniPort knowledgebase
:returns: dictionary with version info
:rtype: dict
"""
return [x for x in self.session.query(models.Version).all()] | [
"def",
"version",
"(",
"self",
")",
":",
"return",
"[",
"x",
"for",
"x",
"in",
"self",
".",
"session",
".",
"query",
"(",
"models",
".",
"Version",
")",
".",
"all",
"(",
")",
"]"
] | Version of UniPort knowledgebase
:returns: dictionary with version info
:rtype: dict | [
"Version",
"of",
"UniPort",
"knowledgebase"
] | train | https://github.com/cebel/pyuniprot/blob/9462a6042c7c9295415a5eb589b77b27cb7c142b/src/pyuniprot/manager/query.py#L1009-L1015 |
shmir/PyIxExplorer | ixexplorer/ixe_port.py | IxePort.reserve | def reserve(self, force=False):
""" Reserve port.
:param force: True - take forcefully, False - fail if port is reserved by other user
"""
if not force:
try:
self.api.call_rc('ixPortTakeOwnership {}'.format(self.uri))
except Exception as _:
... | python | def reserve(self, force=False):
""" Reserve port.
:param force: True - take forcefully, False - fail if port is reserved by other user
"""
if not force:
try:
self.api.call_rc('ixPortTakeOwnership {}'.format(self.uri))
except Exception as _:
... | [
"def",
"reserve",
"(",
"self",
",",
"force",
"=",
"False",
")",
":",
"if",
"not",
"force",
":",
"try",
":",
"self",
".",
"api",
".",
"call_rc",
"(",
"'ixPortTakeOwnership {}'",
".",
"format",
"(",
"self",
".",
"uri",
")",
")",
"except",
"Exception",
... | Reserve port.
:param force: True - take forcefully, False - fail if port is reserved by other user | [
"Reserve",
"port",
"."
] | train | https://github.com/shmir/PyIxExplorer/blob/d6946b9ce0e8961507cc912062e10c365d4beee2/ixexplorer/ixe_port.py#L169-L181 |
shmir/PyIxExplorer | ixexplorer/ixe_port.py | IxePort.write | def write(self):
""" Write configuration to chassis.
Raise StreamWarningsError if configuration warnings found.
"""
self.ix_command('write')
stream_warnings = self.streamRegion.generateWarningList()
warnings_list = (self.api.call('join ' + ' {' + stream_warnings + '} ' ... | python | def write(self):
""" Write configuration to chassis.
Raise StreamWarningsError if configuration warnings found.
"""
self.ix_command('write')
stream_warnings = self.streamRegion.generateWarningList()
warnings_list = (self.api.call('join ' + ' {' + stream_warnings + '} ' ... | [
"def",
"write",
"(",
"self",
")",
":",
"self",
".",
"ix_command",
"(",
"'write'",
")",
"stream_warnings",
"=",
"self",
".",
"streamRegion",
".",
"generateWarningList",
"(",
")",
"warnings_list",
"=",
"(",
"self",
".",
"api",
".",
"call",
"(",
"'join '",
... | Write configuration to chassis.
Raise StreamWarningsError if configuration warnings found. | [
"Write",
"configuration",
"to",
"chassis",
"."
] | train | https://github.com/shmir/PyIxExplorer/blob/d6946b9ce0e8961507cc912062e10c365d4beee2/ixexplorer/ixe_port.py#L187-L199 |
shmir/PyIxExplorer | ixexplorer/ixe_port.py | IxePort.load_config | def load_config(self, config_file_name):
""" Load configuration file from prt or str.
Configuration file type is extracted from the file suffix - prt or str.
:param config_file_name: full path to the configuration file.
IxTclServer must have access to the file location. either:
... | python | def load_config(self, config_file_name):
""" Load configuration file from prt or str.
Configuration file type is extracted from the file suffix - prt or str.
:param config_file_name: full path to the configuration file.
IxTclServer must have access to the file location. either:
... | [
"def",
"load_config",
"(",
"self",
",",
"config_file_name",
")",
":",
"config_file_name",
"=",
"config_file_name",
".",
"replace",
"(",
"'\\\\'",
",",
"'/'",
")",
"ext",
"=",
"path",
".",
"splitext",
"(",
"config_file_name",
")",
"[",
"-",
"1",
"]",
".",
... | Load configuration file from prt or str.
Configuration file type is extracted from the file suffix - prt or str.
:param config_file_name: full path to the configuration file.
IxTclServer must have access to the file location. either:
The config file is on shared folder.
... | [
"Load",
"configuration",
"file",
"from",
"prt",
"or",
"str",
"."
] | train | https://github.com/shmir/PyIxExplorer/blob/d6946b9ce0e8961507cc912062e10c365d4beee2/ixexplorer/ixe_port.py#L211-L231 |
shmir/PyIxExplorer | ixexplorer/ixe_port.py | IxePort.save_config | def save_config(self, config_file_name):
""" Save configuration file from prt or str.
Configuration file type is extracted from the file suffix - prt or str.
:param config_file_name: full path to the configuration file.
IxTclServer must have access to the file location. either:
... | python | def save_config(self, config_file_name):
""" Save configuration file from prt or str.
Configuration file type is extracted from the file suffix - prt or str.
:param config_file_name: full path to the configuration file.
IxTclServer must have access to the file location. either:
... | [
"def",
"save_config",
"(",
"self",
",",
"config_file_name",
")",
":",
"config_file_name",
"=",
"config_file_name",
".",
"replace",
"(",
"'\\\\'",
",",
"'/'",
")",
"ext",
"=",
"path",
".",
"splitext",
"(",
"config_file_name",
")",
"[",
"-",
"1",
"]",
".",
... | Save configuration file from prt or str.
Configuration file type is extracted from the file suffix - prt or str.
:param config_file_name: full path to the configuration file.
IxTclServer must have access to the file location. either:
The config file is on shared folder.
... | [
"Save",
"configuration",
"file",
"from",
"prt",
"or",
"str",
"."
] | train | https://github.com/shmir/PyIxExplorer/blob/d6946b9ce0e8961507cc912062e10c365d4beee2/ixexplorer/ixe_port.py#L233-L251 |
shmir/PyIxExplorer | ixexplorer/ixe_port.py | IxePort.start_transmit | def start_transmit(self, blocking=False):
""" Start transmit on port.
:param blocking: True - wait for traffic end, False - return after traffic start.
"""
self.session.start_transmit(blocking, False, self) | python | def start_transmit(self, blocking=False):
""" Start transmit on port.
:param blocking: True - wait for traffic end, False - return after traffic start.
"""
self.session.start_transmit(blocking, False, self) | [
"def",
"start_transmit",
"(",
"self",
",",
"blocking",
"=",
"False",
")",
":",
"self",
".",
"session",
".",
"start_transmit",
"(",
"blocking",
",",
"False",
",",
"self",
")"
] | Start transmit on port.
:param blocking: True - wait for traffic end, False - return after traffic start. | [
"Start",
"transmit",
"on",
"port",
"."
] | train | https://github.com/shmir/PyIxExplorer/blob/d6946b9ce0e8961507cc912062e10c365d4beee2/ixexplorer/ixe_port.py#L268-L274 |
shmir/PyIxExplorer | ixexplorer/ixe_port.py | IxePort.stop_capture | def stop_capture(self, cap_file_name=None, cap_file_format=IxeCapFileFormat.mem):
""" Stop capture on port.
:param cap_file_name: prefix for the capture file name.
Capture file will be saved as pcap file named 'prefix' + 'URI'.pcap.
:param cap_file_format: exported file format
... | python | def stop_capture(self, cap_file_name=None, cap_file_format=IxeCapFileFormat.mem):
""" Stop capture on port.
:param cap_file_name: prefix for the capture file name.
Capture file will be saved as pcap file named 'prefix' + 'URI'.pcap.
:param cap_file_format: exported file format
... | [
"def",
"stop_capture",
"(",
"self",
",",
"cap_file_name",
"=",
"None",
",",
"cap_file_format",
"=",
"IxeCapFileFormat",
".",
"mem",
")",
":",
"return",
"self",
".",
"session",
".",
"stop_capture",
"(",
"cap_file_name",
",",
"cap_file_format",
",",
"self",
")",... | Stop capture on port.
:param cap_file_name: prefix for the capture file name.
Capture file will be saved as pcap file named 'prefix' + 'URI'.pcap.
:param cap_file_format: exported file format
:return: number of captured frames | [
"Stop",
"capture",
"on",
"port",
"."
] | train | https://github.com/shmir/PyIxExplorer/blob/d6946b9ce0e8961507cc912062e10c365d4beee2/ixexplorer/ixe_port.py#L286-L295 |
shmir/PyIxExplorer | ixexplorer/ixe_port.py | IxePort.get_cap_frames | def get_cap_frames(self, *frame_nums):
""" Stop capture on ports.
:param frame_nums: list of frame numbers to read.
:return: list of captured frames.
"""
frames = []
for frame_num in frame_nums:
if self.captureBuffer.getframe(frame_num) == '0':
... | python | def get_cap_frames(self, *frame_nums):
""" Stop capture on ports.
:param frame_nums: list of frame numbers to read.
:return: list of captured frames.
"""
frames = []
for frame_num in frame_nums:
if self.captureBuffer.getframe(frame_num) == '0':
... | [
"def",
"get_cap_frames",
"(",
"self",
",",
"*",
"frame_nums",
")",
":",
"frames",
"=",
"[",
"]",
"for",
"frame_num",
"in",
"frame_nums",
":",
"if",
"self",
".",
"captureBuffer",
".",
"getframe",
"(",
"frame_num",
")",
"==",
"'0'",
":",
"frames",
".",
"... | Stop capture on ports.
:param frame_nums: list of frame numbers to read.
:return: list of captured frames. | [
"Stop",
"capture",
"on",
"ports",
"."
] | train | https://github.com/shmir/PyIxExplorer/blob/d6946b9ce0e8961507cc912062e10c365d4beee2/ixexplorer/ixe_port.py#L300-L313 |
shmir/PyIxExplorer | ixexplorer/ixe_port.py | IxePort.clear_port_stats | def clear_port_stats(self):
""" Clear only port stats (leave stream and packet group stats).
Do not use - still working with Ixia to resolve.
"""
stat = IxeStat(self)
stat.ix_set_default()
stat.enableValidStats = True
stat.ix_set()
stat.write() | python | def clear_port_stats(self):
""" Clear only port stats (leave stream and packet group stats).
Do not use - still working with Ixia to resolve.
"""
stat = IxeStat(self)
stat.ix_set_default()
stat.enableValidStats = True
stat.ix_set()
stat.write() | [
"def",
"clear_port_stats",
"(",
"self",
")",
":",
"stat",
"=",
"IxeStat",
"(",
"self",
")",
"stat",
".",
"ix_set_default",
"(",
")",
"stat",
".",
"enableValidStats",
"=",
"True",
"stat",
".",
"ix_set",
"(",
")",
"stat",
".",
"write",
"(",
")"
] | Clear only port stats (leave stream and packet group stats).
Do not use - still working with Ixia to resolve. | [
"Clear",
"only",
"port",
"stats",
"(",
"leave",
"stream",
"and",
"packet",
"group",
"stats",
")",
"."
] | train | https://github.com/shmir/PyIxExplorer/blob/d6946b9ce0e8961507cc912062e10c365d4beee2/ixexplorer/ixe_port.py#L319-L328 |
shmir/PyIxExplorer | ixexplorer/ixe_port.py | IxePort.set_phy_mode | def set_phy_mode(self, mode=IxePhyMode.ignore):
""" Set phy mode to copper or fiber.
:param mode: requested PHY mode.
"""
if isinstance(mode, IxePhyMode):
if mode.value:
self.api.call_rc('port setPhyMode {} {}'.format(mode.value, self.uri))
else:
... | python | def set_phy_mode(self, mode=IxePhyMode.ignore):
""" Set phy mode to copper or fiber.
:param mode: requested PHY mode.
"""
if isinstance(mode, IxePhyMode):
if mode.value:
self.api.call_rc('port setPhyMode {} {}'.format(mode.value, self.uri))
else:
... | [
"def",
"set_phy_mode",
"(",
"self",
",",
"mode",
"=",
"IxePhyMode",
".",
"ignore",
")",
":",
"if",
"isinstance",
"(",
"mode",
",",
"IxePhyMode",
")",
":",
"if",
"mode",
".",
"value",
":",
"self",
".",
"api",
".",
"call_rc",
"(",
"'port setPhyMode {} {}'"... | Set phy mode to copper or fiber.
:param mode: requested PHY mode. | [
"Set",
"phy",
"mode",
"to",
"copper",
"or",
"fiber",
".",
":",
"param",
"mode",
":",
"requested",
"PHY",
"mode",
"."
] | train | https://github.com/shmir/PyIxExplorer/blob/d6946b9ce0e8961507cc912062e10c365d4beee2/ixexplorer/ixe_port.py#L344-L352 |
shmir/PyIxExplorer | ixexplorer/ixe_port.py | IxePort.set_transmit_mode | def set_transmit_mode(self, mode):
""" set port transmit mode
:param mode: request transmit mode
:type mode: ixexplorer.ixe_port.IxeTransmitMode
"""
self.api.call_rc('port setTransmitMode {} {}'.format(mode, self.uri)) | python | def set_transmit_mode(self, mode):
""" set port transmit mode
:param mode: request transmit mode
:type mode: ixexplorer.ixe_port.IxeTransmitMode
"""
self.api.call_rc('port setTransmitMode {} {}'.format(mode, self.uri)) | [
"def",
"set_transmit_mode",
"(",
"self",
",",
"mode",
")",
":",
"self",
".",
"api",
".",
"call_rc",
"(",
"'port setTransmitMode {} {}'",
".",
"format",
"(",
"mode",
",",
"self",
".",
"uri",
")",
")"
] | set port transmit mode
:param mode: request transmit mode
:type mode: ixexplorer.ixe_port.IxeTransmitMode | [
"set",
"port",
"transmit",
"mode"
] | train | https://github.com/shmir/PyIxExplorer/blob/d6946b9ce0e8961507cc912062e10c365d4beee2/ixexplorer/ixe_port.py#L372-L379 |
lewiscollard/django-flexible-images | flexible_images/util.py | get_image_sizes | def get_image_sizes(image):
"""Given an ImageField `image`, returns a list of images sizes in this
form:
[
{
"url": "http://example.com/xxx.jpg",
"width": 1440,
"height": 960
},
[...]
]"""
# It is possible to have the same width appear mo... | python | def get_image_sizes(image):
"""Given an ImageField `image`, returns a list of images sizes in this
form:
[
{
"url": "http://example.com/xxx.jpg",
"width": 1440,
"height": 960
},
[...]
]"""
# It is possible to have the same width appear mo... | [
"def",
"get_image_sizes",
"(",
"image",
")",
":",
"# It is possible to have the same width appear more than once, if",
"# THUMBNAIL_UPSCALE is set to False and the image's width is less than the",
"# largest value in FLEXIBLE_IMAGE_SIZES. So keep track of widths and",
"# don't output more than one... | Given an ImageField `image`, returns a list of images sizes in this
form:
[
{
"url": "http://example.com/xxx.jpg",
"width": 1440,
"height": 960
},
[...]
] | [
"Given",
"an",
"ImageField",
"image",
"returns",
"a",
"list",
"of",
"images",
"sizes",
"in",
"this",
"form",
":"
] | train | https://github.com/lewiscollard/django-flexible-images/blob/d9e369586b70067f137b785c0e727d7244c0b17f/flexible_images/util.py#L64-L98 |
lewiscollard/django-flexible-images | flexible_images/util.py | get_template_context | def get_template_context(src, container="div", classes="", inner_classes="", alt="", background_image=False, no_css=False, aria_hidden=False):
"""Returns a template context for a flexible image template
tag implementation."""
context = {
"container": container,
"classes": classes,
"a... | python | def get_template_context(src, container="div", classes="", inner_classes="", alt="", background_image=False, no_css=False, aria_hidden=False):
"""Returns a template context for a flexible image template
tag implementation."""
context = {
"container": container,
"classes": classes,
"a... | [
"def",
"get_template_context",
"(",
"src",
",",
"container",
"=",
"\"div\"",
",",
"classes",
"=",
"\"\"",
",",
"inner_classes",
"=",
"\"\"",
",",
"alt",
"=",
"\"\"",
",",
"background_image",
"=",
"False",
",",
"no_css",
"=",
"False",
",",
"aria_hidden",
"=... | Returns a template context for a flexible image template
tag implementation. | [
"Returns",
"a",
"template",
"context",
"for",
"a",
"flexible",
"image",
"template",
"tag",
"implementation",
"."
] | train | https://github.com/lewiscollard/django-flexible-images/blob/d9e369586b70067f137b785c0e727d7244c0b17f/flexible_images/util.py#L101-L132 |
thunder-project/thunder-registration | registration/algorithms/crosscorr.py | CrossCorr.fit | def fit(self, images, reference=None):
"""
Estimate registration model using cross-correlation.
Use cross correlation to compute displacements between
images or volumes and reference. Displacements will be
2D for images and 3D for volumes.
Parameters
---------... | python | def fit(self, images, reference=None):
"""
Estimate registration model using cross-correlation.
Use cross correlation to compute displacements between
images or volumes and reference. Displacements will be
2D for images and 3D for volumes.
Parameters
---------... | [
"def",
"fit",
"(",
"self",
",",
"images",
",",
"reference",
"=",
"None",
")",
":",
"images",
"=",
"check_images",
"(",
"images",
")",
"reference",
"=",
"check_reference",
"(",
"images",
",",
"reference",
")",
"def",
"func",
"(",
"item",
")",
":",
"key"... | Estimate registration model using cross-correlation.
Use cross correlation to compute displacements between
images or volumes and reference. Displacements will be
2D for images and 3D for volumes.
Parameters
----------
images : array-like or thunder images
... | [
"Estimate",
"registration",
"model",
"using",
"cross",
"-",
"correlation",
"."
] | train | https://github.com/thunder-project/thunder-registration/blob/286f091e6c402d592e9686d4821e0fd80dbf86ec/registration/algorithms/crosscorr.py#L27-L55 |
thunder-project/thunder-registration | registration/algorithms/crosscorr.py | CrossCorr.fit_and_transform | def fit_and_transform(self, images, reference=None):
"""
Estimate and apply registration model using cross-correlation.
Use cross correlation to compute displacements between
images or volumes and reference, and apply the
estimated model to the data. Displacements will be
... | python | def fit_and_transform(self, images, reference=None):
"""
Estimate and apply registration model using cross-correlation.
Use cross correlation to compute displacements between
images or volumes and reference, and apply the
estimated model to the data. Displacements will be
... | [
"def",
"fit_and_transform",
"(",
"self",
",",
"images",
",",
"reference",
"=",
"None",
")",
":",
"images",
"=",
"check_images",
"(",
"images",
")",
"check_reference",
"(",
"images",
",",
"reference",
")",
"def",
"func",
"(",
"image",
")",
":",
"t",
"=",
... | Estimate and apply registration model using cross-correlation.
Use cross correlation to compute displacements between
images or volumes and reference, and apply the
estimated model to the data. Displacements will be
2D for images and 3D for volumes.
Parameters
-------... | [
"Estimate",
"and",
"apply",
"registration",
"model",
"using",
"cross",
"-",
"correlation",
"."
] | train | https://github.com/thunder-project/thunder-registration/blob/286f091e6c402d592e9686d4821e0fd80dbf86ec/registration/algorithms/crosscorr.py#L57-L81 |
grabbles/grabbit | grabbit/extensions/writable.py | build_path | def build_path(entities, path_patterns, strict=False):
"""
Constructs a path given a set of entities and a list of potential
filename patterns to use.
Args:
entities (dict): A dictionary mapping entity names to entity values.
path_patterns (str, list): One or more filename patterns to w... | python | def build_path(entities, path_patterns, strict=False):
"""
Constructs a path given a set of entities and a list of potential
filename patterns to use.
Args:
entities (dict): A dictionary mapping entity names to entity values.
path_patterns (str, list): One or more filename patterns to w... | [
"def",
"build_path",
"(",
"entities",
",",
"path_patterns",
",",
"strict",
"=",
"False",
")",
":",
"if",
"isinstance",
"(",
"path_patterns",
",",
"string_types",
")",
":",
"path_patterns",
"=",
"[",
"path_patterns",
"]",
"# Loop over available patherns, return first... | Constructs a path given a set of entities and a list of potential
filename patterns to use.
Args:
entities (dict): A dictionary mapping entity names to entity values.
path_patterns (str, list): One or more filename patterns to write
the file to. Entities should be represented by the... | [
"Constructs",
"a",
"path",
"given",
"a",
"set",
"of",
"entities",
"and",
"a",
"list",
"of",
"potential",
"filename",
"patterns",
"to",
"use",
"."
] | train | https://github.com/grabbles/grabbit/blob/83ff93df36019eaaee9d4e31f816a518e46cae07/grabbit/extensions/writable.py#L55-L104 |
mikebryant/django-autoconfig | django_autoconfig/environment_settings/autoconfig.py | get_settings_from_environment | def get_settings_from_environment(environ):
'''Deduce settings from environment variables'''
settings = {}
for name, value in environ.items():
if not name.startswith('DJANGO_'):
continue
name = name.replace('DJANGO_', '', 1)
if _ignore_setting(name):
continue
... | python | def get_settings_from_environment(environ):
'''Deduce settings from environment variables'''
settings = {}
for name, value in environ.items():
if not name.startswith('DJANGO_'):
continue
name = name.replace('DJANGO_', '', 1)
if _ignore_setting(name):
continue
... | [
"def",
"get_settings_from_environment",
"(",
"environ",
")",
":",
"settings",
"=",
"{",
"}",
"for",
"name",
",",
"value",
"in",
"environ",
".",
"items",
"(",
")",
":",
"if",
"not",
"name",
".",
"startswith",
"(",
"'DJANGO_'",
")",
":",
"continue",
"name"... | Deduce settings from environment variables | [
"Deduce",
"settings",
"from",
"environment",
"variables"
] | train | https://github.com/mikebryant/django-autoconfig/blob/1ce793e95b024dccb189de1dc111dc4ae6c2f3a6/django_autoconfig/environment_settings/autoconfig.py#L12-L25 |
biocommons/bioutils | src/bioutils/vmc_digest.py | vmc_digest | def vmc_digest(data, digest_size=DEFAULT_DIGEST_SIZE):
"""Returns the VMC Digest as a Digest object, which has both bytes and str (
URL-safe, Base 64) representations.
>>> d = vmc_digest("")
# I can't figure out how to make this test work on Py 2 and 3 :-(
>>> d # doctest: +S... | python | def vmc_digest(data, digest_size=DEFAULT_DIGEST_SIZE):
"""Returns the VMC Digest as a Digest object, which has both bytes and str (
URL-safe, Base 64) representations.
>>> d = vmc_digest("")
# I can't figure out how to make this test work on Py 2 and 3 :-(
>>> d # doctest: +S... | [
"def",
"vmc_digest",
"(",
"data",
",",
"digest_size",
"=",
"DEFAULT_DIGEST_SIZE",
")",
":",
"# TODO: Consider relaxing %3 constraint and stripping padding",
"if",
"digest_size",
"%",
"3",
"!=",
"0",
":",
"raise",
"ValueError",
"(",
"\"digest_size must be a multiple of 3\"",... | Returns the VMC Digest as a Digest object, which has both bytes and str (
URL-safe, Base 64) representations.
>>> d = vmc_digest("")
# I can't figure out how to make this test work on Py 2 and 3 :-(
>>> d # doctest: +SKIP
b'\xcf\x83\xe15~\xef\xb8\xbd\xf1T(P\xd6m\x80'
>>>... | [
"Returns",
"the",
"VMC",
"Digest",
"as",
"a",
"Digest",
"object",
"which",
"has",
"both",
"bytes",
"and",
"str",
"(",
"URL",
"-",
"safe",
"Base",
"64",
")",
"representations",
"."
] | train | https://github.com/biocommons/bioutils/blob/88bcbdfa707268fed1110800e91b6d4f8e9475a0/src/bioutils/vmc_digest.py#L13-L107 |
flo-compbio/genometools | genometools/expression/filter.py | filter_variance | def filter_variance(matrix, top):
"""Filter genes in an expression matrix by variance.
Parameters
----------
matrix: ExpMatrix
The expression matrix.
top: int
The number of genes to retain.
Returns
-------
ExpMatrix
The filtered expression matrix.
"""
as... | python | def filter_variance(matrix, top):
"""Filter genes in an expression matrix by variance.
Parameters
----------
matrix: ExpMatrix
The expression matrix.
top: int
The number of genes to retain.
Returns
-------
ExpMatrix
The filtered expression matrix.
"""
as... | [
"def",
"filter_variance",
"(",
"matrix",
",",
"top",
")",
":",
"assert",
"isinstance",
"(",
"matrix",
",",
"ExpMatrix",
")",
"assert",
"isinstance",
"(",
"top",
",",
"(",
"int",
",",
"np",
".",
"integer",
")",
")",
"if",
"top",
">=",
"matrix",
".",
"... | Filter genes in an expression matrix by variance.
Parameters
----------
matrix: ExpMatrix
The expression matrix.
top: int
The number of genes to retain.
Returns
-------
ExpMatrix
The filtered expression matrix. | [
"Filter",
"genes",
"in",
"an",
"expression",
"matrix",
"by",
"variance",
"."
] | train | https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/expression/filter.py#L32-L71 |
flo-compbio/genometools | genometools/expression/filter.py | filter_mean | def filter_mean(matrix, top):
"""Filter genes in an expression matrix by mean expression.
Parameters
----------
matrix: ExpMatrix
The expression matrix.
top: int
The number of genes to retain.
Returns
-------
ExpMatrix
The filtered expression matrix.
"""
... | python | def filter_mean(matrix, top):
"""Filter genes in an expression matrix by mean expression.
Parameters
----------
matrix: ExpMatrix
The expression matrix.
top: int
The number of genes to retain.
Returns
-------
ExpMatrix
The filtered expression matrix.
"""
... | [
"def",
"filter_mean",
"(",
"matrix",
",",
"top",
")",
":",
"assert",
"isinstance",
"(",
"matrix",
",",
"ExpMatrix",
")",
"assert",
"isinstance",
"(",
"top",
",",
"int",
")",
"if",
"top",
">=",
"matrix",
".",
"p",
":",
"logger",
".",
"warning",
"(",
"... | Filter genes in an expression matrix by mean expression.
Parameters
----------
matrix: ExpMatrix
The expression matrix.
top: int
The number of genes to retain.
Returns
-------
ExpMatrix
The filtered expression matrix. | [
"Filter",
"genes",
"in",
"an",
"expression",
"matrix",
"by",
"mean",
"expression",
"."
] | train | https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/expression/filter.py#L74-L104 |
flo-compbio/genometools | genometools/expression/filter.py | filter_percentile | def filter_percentile(matrix, top, percentile=50):
"""Filter genes in an expression matrix by percentile expression.
Parameters
----------
matrix: ExpMatrix
The expression matrix.
top: int
The number of genes to retain.
percentile: int or float, optinonal
The percentile ... | python | def filter_percentile(matrix, top, percentile=50):
"""Filter genes in an expression matrix by percentile expression.
Parameters
----------
matrix: ExpMatrix
The expression matrix.
top: int
The number of genes to retain.
percentile: int or float, optinonal
The percentile ... | [
"def",
"filter_percentile",
"(",
"matrix",
",",
"top",
",",
"percentile",
"=",
"50",
")",
":",
"assert",
"isinstance",
"(",
"matrix",
",",
"ExpMatrix",
")",
"assert",
"isinstance",
"(",
"top",
",",
"int",
")",
"assert",
"isinstance",
"(",
"percentile",
","... | Filter genes in an expression matrix by percentile expression.
Parameters
----------
matrix: ExpMatrix
The expression matrix.
top: int
The number of genes to retain.
percentile: int or float, optinonal
The percentile to use Defaults to the median (50th percentile).
Ret... | [
"Filter",
"genes",
"in",
"an",
"expression",
"matrix",
"by",
"percentile",
"expression",
"."
] | train | https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/expression/filter.py#L107-L140 |
flo-compbio/genometools | genometools/ensembl/dna.py | _transform_chrom | def _transform_chrom(chrom):
"""Helper function to obtain specific sort order."""
try:
c = int(chrom)
except:
if chrom in ['X', 'Y']:
return chrom
elif chrom == 'MT':
return '_MT' # sort to the end
else:
return '__' + chrom # sort to the v... | python | def _transform_chrom(chrom):
"""Helper function to obtain specific sort order."""
try:
c = int(chrom)
except:
if chrom in ['X', 'Y']:
return chrom
elif chrom == 'MT':
return '_MT' # sort to the end
else:
return '__' + chrom # sort to the v... | [
"def",
"_transform_chrom",
"(",
"chrom",
")",
":",
"try",
":",
"c",
"=",
"int",
"(",
"chrom",
")",
"except",
":",
"if",
"chrom",
"in",
"[",
"'X'",
",",
"'Y'",
"]",
":",
"return",
"chrom",
"elif",
"chrom",
"==",
"'MT'",
":",
"return",
"'_MT'",
"# so... | Helper function to obtain specific sort order. | [
"Helper",
"function",
"to",
"obtain",
"specific",
"sort",
"order",
"."
] | train | https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/ensembl/dna.py#L35-L48 |
flo-compbio/genometools | genometools/ensembl/dna.py | get_chromosome_lengths | def get_chromosome_lengths(fasta_file, fancy_sort=True):
"""Extract chromosome lengths from genome FASTA file."""
chromlen = []
with gzip.open(fasta_file, 'rt', encoding='ascii') as fh:
fasta = SeqIO.parse(fh, 'fasta')
for i, f in enumerate(fasta):
chromlen.append((f.id, len(f.se... | python | def get_chromosome_lengths(fasta_file, fancy_sort=True):
"""Extract chromosome lengths from genome FASTA file."""
chromlen = []
with gzip.open(fasta_file, 'rt', encoding='ascii') as fh:
fasta = SeqIO.parse(fh, 'fasta')
for i, f in enumerate(fasta):
chromlen.append((f.id, len(f.se... | [
"def",
"get_chromosome_lengths",
"(",
"fasta_file",
",",
"fancy_sort",
"=",
"True",
")",
":",
"chromlen",
"=",
"[",
"]",
"with",
"gzip",
".",
"open",
"(",
"fasta_file",
",",
"'rt'",
",",
"encoding",
"=",
"'ascii'",
")",
"as",
"fh",
":",
"fasta",
"=",
"... | Extract chromosome lengths from genome FASTA file. | [
"Extract",
"chromosome",
"lengths",
"from",
"genome",
"FASTA",
"file",
"."
] | train | https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/ensembl/dna.py#L51-L73 |
inveniosoftware/invenio-jsonschemas | invenio_jsonschemas/utils.py | resolve_schema | def resolve_schema(schema):
"""Transform JSON schemas "allOf".
This is the default schema resolver.
This function was created because some javascript JSON Schema libraries
don't support "allOf". We recommend to use this function only in this
specific case.
This function is transforming the JS... | python | def resolve_schema(schema):
"""Transform JSON schemas "allOf".
This is the default schema resolver.
This function was created because some javascript JSON Schema libraries
don't support "allOf". We recommend to use this function only in this
specific case.
This function is transforming the JS... | [
"def",
"resolve_schema",
"(",
"schema",
")",
":",
"def",
"traverse",
"(",
"schema",
")",
":",
"if",
"isinstance",
"(",
"schema",
",",
"dict",
")",
":",
"if",
"'allOf'",
"in",
"schema",
":",
"for",
"x",
"in",
"schema",
"[",
"'allOf'",
"]",
":",
"sub_s... | Transform JSON schemas "allOf".
This is the default schema resolver.
This function was created because some javascript JSON Schema libraries
don't support "allOf". We recommend to use this function only in this
specific case.
This function is transforming the JSON Schema by removing "allOf" keywo... | [
"Transform",
"JSON",
"schemas",
"allOf",
"."
] | train | https://github.com/inveniosoftware/invenio-jsonschemas/blob/93019b8fe3bf549335e94c84198c9c0b76d8fde2/invenio_jsonschemas/utils.py#L16-L55 |
inveniosoftware/invenio-jsonschemas | invenio_jsonschemas/utils.py | _merge_dicts | def _merge_dicts(first, second):
"""Merge the 'second' multiple-dictionary into the 'first' one."""
new = deepcopy(first)
for k, v in second.items():
if isinstance(v, dict) and v:
ret = _merge_dicts(new.get(k, dict()), v)
new[k] = ret
else:
new[k] = second... | python | def _merge_dicts(first, second):
"""Merge the 'second' multiple-dictionary into the 'first' one."""
new = deepcopy(first)
for k, v in second.items():
if isinstance(v, dict) and v:
ret = _merge_dicts(new.get(k, dict()), v)
new[k] = ret
else:
new[k] = second... | [
"def",
"_merge_dicts",
"(",
"first",
",",
"second",
")",
":",
"new",
"=",
"deepcopy",
"(",
"first",
")",
"for",
"k",
",",
"v",
"in",
"second",
".",
"items",
"(",
")",
":",
"if",
"isinstance",
"(",
"v",
",",
"dict",
")",
"and",
"v",
":",
"ret",
... | Merge the 'second' multiple-dictionary into the 'first' one. | [
"Merge",
"the",
"second",
"multiple",
"-",
"dictionary",
"into",
"the",
"first",
"one",
"."
] | train | https://github.com/inveniosoftware/invenio-jsonschemas/blob/93019b8fe3bf549335e94c84198c9c0b76d8fde2/invenio_jsonschemas/utils.py#L58-L67 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.