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/expression/matrix.py
ExpMatrix.write_tsv
def write_tsv(self, file_path: str, encoding: str = 'UTF-8', sep: str = '\t'): """Write expression matrix to a tab-delimited text file. Parameters ---------- file_path: str The path of the output file. encoding: str, optional The file en...
python
def write_tsv(self, file_path: str, encoding: str = 'UTF-8', sep: str = '\t'): """Write expression matrix to a tab-delimited text file. Parameters ---------- file_path: str The path of the output file. encoding: str, optional The file en...
[ "def", "write_tsv", "(", "self", ",", "file_path", ":", "str", ",", "encoding", ":", "str", "=", "'UTF-8'", ",", "sep", ":", "str", "=", "'\\t'", ")", ":", "#if six.PY2:", "# sep = sep.encode('UTF-8')", "self", ".", "to_csv", "(", "file_path", ",", "sep...
Write expression matrix to a tab-delimited text file. Parameters ---------- file_path: str The path of the output file. encoding: str, optional The file encoding. ("UTF-8") Returns ------- None
[ "Write", "expression", "matrix", "to", "a", "tab", "-", "delimited", "text", "file", "." ]
train
https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/expression/matrix.py#L469-L493
flo-compbio/genometools
genometools/expression/matrix.py
ExpMatrix.write_sparse
def write_sparse(self, file_path: str): """Write a sparse representation to a tab-delimited text file. TODO: docstring""" coo = sparse.coo_matrix(self.X) data = OrderedDict([(0, coo.row+1), (1, coo.col+1), (2, coo.data)]) df = pd.DataFrame(data, columns=data.keys()) ...
python
def write_sparse(self, file_path: str): """Write a sparse representation to a tab-delimited text file. TODO: docstring""" coo = sparse.coo_matrix(self.X) data = OrderedDict([(0, coo.row+1), (1, coo.col+1), (2, coo.data)]) df = pd.DataFrame(data, columns=data.keys()) ...
[ "def", "write_sparse", "(", "self", ",", "file_path", ":", "str", ")", ":", "coo", "=", "sparse", ".", "coo_matrix", "(", "self", ".", "X", ")", "data", "=", "OrderedDict", "(", "[", "(", "0", ",", "coo", ".", "row", "+", "1", ")", ",", "(", "1...
Write a sparse representation to a tab-delimited text file. TODO: docstring
[ "Write", "a", "sparse", "representation", "to", "a", "tab", "-", "delimited", "text", "file", ".", "TODO", ":", "docstring" ]
train
https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/expression/matrix.py#L496-L511
flo-compbio/genometools
genometools/expression/matrix.py
ExpMatrix.read_sparse
def read_sparse(cls, file_path: str): """Read a sparse representation from a tab-delimited text file. TODO: docstring""" with open(file_path) as fh: next(fh) # skip header line genes = next(fh)[1:-1].split('\t') cells = next(fh)[1:-1].split(...
python
def read_sparse(cls, file_path: str): """Read a sparse representation from a tab-delimited text file. TODO: docstring""" with open(file_path) as fh: next(fh) # skip header line genes = next(fh)[1:-1].split('\t') cells = next(fh)[1:-1].split(...
[ "def", "read_sparse", "(", "cls", ",", "file_path", ":", "str", ")", ":", "with", "open", "(", "file_path", ")", "as", "fh", ":", "next", "(", "fh", ")", "# skip header line", "genes", "=", "next", "(", "fh", ")", "[", "1", ":", "-", "1", "]", "....
Read a sparse representation from a tab-delimited text file. TODO: docstring
[ "Read", "a", "sparse", "representation", "from", "a", "tab", "-", "delimited", "text", "file", ".", "TODO", ":", "docstring" ]
train
https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/expression/matrix.py#L515-L538
flo-compbio/genometools
genometools/expression/matrix.py
ExpMatrix.read_10xgenomics
def read_10xgenomics(cls, tarball_fpath: str, prefix: str, use_ensembl_ids: bool = False): """Read a 10X genomics compressed tarball containing expression data. Note: common prefix patterns: - "filtered_gene_bc_matrices/[annotations]/" - "filtered_matric...
python
def read_10xgenomics(cls, tarball_fpath: str, prefix: str, use_ensembl_ids: bool = False): """Read a 10X genomics compressed tarball containing expression data. Note: common prefix patterns: - "filtered_gene_bc_matrices/[annotations]/" - "filtered_matric...
[ "def", "read_10xgenomics", "(", "cls", ",", "tarball_fpath", ":", "str", ",", "prefix", ":", "str", ",", "use_ensembl_ids", ":", "bool", "=", "False", ")", ":", "_LOGGER", ".", "info", "(", "'Reading file: %s'", ",", "tarball_fpath", ")", "with", "tarfile", ...
Read a 10X genomics compressed tarball containing expression data. Note: common prefix patterns: - "filtered_gene_bc_matrices/[annotations]/" - "filtered_matrices_mex/[annotations]/" TODO: docstring
[ "Read", "a", "10X", "genomics", "compressed", "tarball", "containing", "expression", "data", ".", "Note", ":", "common", "prefix", "patterns", ":", "-", "filtered_gene_bc_matrices", "/", "[", "annotations", "]", "/", "-", "filtered_matrices_mex", "/", "[", "anno...
train
https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/expression/matrix.py#L541-L581
flo-compbio/genometools
genometools/expression/convert_entrez2gene.py
get_argument_parser
def get_argument_parser(): """Function to obtain the argument parser. Parameters ---------- Returns ------- `argparse.ArgumentParser` A fully configured `argparse.ArgumentParser` object. Notes ----- This function can also be used by the `sphinx-argparse` extension for ...
python
def get_argument_parser(): """Function to obtain the argument parser. Parameters ---------- Returns ------- `argparse.ArgumentParser` A fully configured `argparse.ArgumentParser` object. Notes ----- This function can also be used by the `sphinx-argparse` extension for ...
[ "def", "get_argument_parser", "(", ")", ":", "desc", "=", "'Convert Entrez IDs to gene symbols.'", "parser", "=", "cli", ".", "get_argument_parser", "(", "desc", "=", "desc", ")", "file_mv", "=", "cli", ".", "file_mv", "g", "=", "parser", ".", "add_argument_grou...
Function to obtain the argument parser. Parameters ---------- Returns ------- `argparse.ArgumentParser` A fully configured `argparse.ArgumentParser` object. Notes ----- This function can also be used by the `sphinx-argparse` extension for sphinx to generate documentation f...
[ "Function", "to", "obtain", "the", "argument", "parser", "." ]
train
https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/expression/convert_entrez2gene.py#L39-L91
jvsteiner/merkletree
merkle.py
check_chain
def check_chain(chain): """Verify a merkle chain to see if the Merkle root can be reproduced. """ link = chain[0][0] for i in range(1, len(chain) - 1): if chain[i][1] == 'R': link = hash_function(link + chain[i][0]).digest() elif chain[i][1] == 'L': link = hash_fu...
python
def check_chain(chain): """Verify a merkle chain to see if the Merkle root can be reproduced. """ link = chain[0][0] for i in range(1, len(chain) - 1): if chain[i][1] == 'R': link = hash_function(link + chain[i][0]).digest() elif chain[i][1] == 'L': link = hash_fu...
[ "def", "check_chain", "(", "chain", ")", ":", "link", "=", "chain", "[", "0", "]", "[", "0", "]", "for", "i", "in", "range", "(", "1", ",", "len", "(", "chain", ")", "-", "1", ")", ":", "if", "chain", "[", "i", "]", "[", "1", "]", "==", "...
Verify a merkle chain to see if the Merkle root can be reproduced.
[ "Verify", "a", "merkle", "chain", "to", "see", "if", "the", "Merkle", "root", "can", "be", "reproduced", "." ]
train
https://github.com/jvsteiner/merkletree/blob/0d9284f9f90fab3b8c2ef4d356d0947719950bc2/merkle.py#L174-L188
jvsteiner/merkletree
merkle.py
check_hex_chain
def check_hex_chain(chain): """Verify a merkle chain, with hashes hex encoded, to see if the Merkle root can be reproduced. """ return codecs.encode(check_chain([(codecs.decode(i[0], 'hex_codec'), i[1]) for i in chain]), 'hex_codec')
python
def check_hex_chain(chain): """Verify a merkle chain, with hashes hex encoded, to see if the Merkle root can be reproduced. """ return codecs.encode(check_chain([(codecs.decode(i[0], 'hex_codec'), i[1]) for i in chain]), 'hex_codec')
[ "def", "check_hex_chain", "(", "chain", ")", ":", "return", "codecs", ".", "encode", "(", "check_chain", "(", "[", "(", "codecs", ".", "decode", "(", "i", "[", "0", "]", ",", "'hex_codec'", ")", ",", "i", "[", "1", "]", ")", "for", "i", "in", "ch...
Verify a merkle chain, with hashes hex encoded, to see if the Merkle root can be reproduced.
[ "Verify", "a", "merkle", "chain", "with", "hashes", "hex", "encoded", "to", "see", "if", "the", "Merkle", "root", "can", "be", "reproduced", "." ]
train
https://github.com/jvsteiner/merkletree/blob/0d9284f9f90fab3b8c2ef4d356d0947719950bc2/merkle.py#L191-L194
jvsteiner/merkletree
merkle.py
MerkleTree.add_hash
def add_hash(self, value): """Add a Node based on a precomputed, hex encoded, hash value. """ self.leaves.append(Node(codecs.decode(value, 'hex_codec'), prehashed=True))
python
def add_hash(self, value): """Add a Node based on a precomputed, hex encoded, hash value. """ self.leaves.append(Node(codecs.decode(value, 'hex_codec'), prehashed=True))
[ "def", "add_hash", "(", "self", ",", "value", ")", ":", "self", ".", "leaves", ".", "append", "(", "Node", "(", "codecs", ".", "decode", "(", "value", ",", "'hex_codec'", ")", ",", "prehashed", "=", "True", ")", ")" ]
Add a Node based on a precomputed, hex encoded, hash value.
[ "Add", "a", "Node", "based", "on", "a", "precomputed", "hex", "encoded", "hash", "value", "." ]
train
https://github.com/jvsteiner/merkletree/blob/0d9284f9f90fab3b8c2ef4d356d0947719950bc2/merkle.py#L57-L60
jvsteiner/merkletree
merkle.py
MerkleTree.clear
def clear(self): """Clears the Merkle Tree by releasing the Merkle root and each leaf's references, the rest should be garbage collected. This may be useful for situations where you want to take an existing tree, make changes to the leaves, but leave it uncalculated for some time, without node ...
python
def clear(self): """Clears the Merkle Tree by releasing the Merkle root and each leaf's references, the rest should be garbage collected. This may be useful for situations where you want to take an existing tree, make changes to the leaves, but leave it uncalculated for some time, without node ...
[ "def", "clear", "(", "self", ")", ":", "self", ".", "root", "=", "None", "for", "leaf", "in", "self", ".", "leaves", ":", "leaf", ".", "p", ",", "leaf", ".", "sib", ",", "leaf", ".", "side", "=", "(", "None", ",", ")", "*", "3" ]
Clears the Merkle Tree by releasing the Merkle root and each leaf's references, the rest should be garbage collected. This may be useful for situations where you want to take an existing tree, make changes to the leaves, but leave it uncalculated for some time, without node references that are ...
[ "Clears", "the", "Merkle", "Tree", "by", "releasing", "the", "Merkle", "root", "and", "each", "leaf", "s", "references", "the", "rest", "should", "be", "garbage", "collected", ".", "This", "may", "be", "useful", "for", "situations", "where", "you", "want", ...
train
https://github.com/jvsteiner/merkletree/blob/0d9284f9f90fab3b8c2ef4d356d0947719950bc2/merkle.py#L62-L71
jvsteiner/merkletree
merkle.py
MerkleTree.build_fun
def build_fun(self, layer=None): """Calculate the merkle root and make references between nodes in the tree. Written in functional style purely for fun. """ if not layer: if not self.leaves: raise MerkleError('The tree has no leaves and cannot be calculated.')...
python
def build_fun(self, layer=None): """Calculate the merkle root and make references between nodes in the tree. Written in functional style purely for fun. """ if not layer: if not self.leaves: raise MerkleError('The tree has no leaves and cannot be calculated.')...
[ "def", "build_fun", "(", "self", ",", "layer", "=", "None", ")", ":", "if", "not", "layer", ":", "if", "not", "self", ".", "leaves", ":", "raise", "MerkleError", "(", "'The tree has no leaves and cannot be calculated.'", ")", "layer", "=", "self", ".", "leav...
Calculate the merkle root and make references between nodes in the tree. Written in functional style purely for fun.
[ "Calculate", "the", "merkle", "root", "and", "make", "references", "between", "nodes", "in", "the", "tree", ".", "Written", "in", "functional", "style", "purely", "for", "fun", "." ]
train
https://github.com/jvsteiner/merkletree/blob/0d9284f9f90fab3b8c2ef4d356d0947719950bc2/merkle.py#L84-L97
jvsteiner/merkletree
merkle.py
MerkleTree._build
def _build(self, leaves): """Private helper function to create the next aggregation level and put all references in place. """ new, odd = [], None # check if even number of leaves, promote odd leaf to next level, if not if len(leaves) % 2 == 1: odd = leaves.pop(-1) ...
python
def _build(self, leaves): """Private helper function to create the next aggregation level and put all references in place. """ new, odd = [], None # check if even number of leaves, promote odd leaf to next level, if not if len(leaves) % 2 == 1: odd = leaves.pop(-1) ...
[ "def", "_build", "(", "self", ",", "leaves", ")", ":", "new", ",", "odd", "=", "[", "]", ",", "None", "# check if even number of leaves, promote odd leaf to next level, if not", "if", "len", "(", "leaves", ")", "%", "2", "==", "1", ":", "odd", "=", "leaves",...
Private helper function to create the next aggregation level and put all references in place.
[ "Private", "helper", "function", "to", "create", "the", "next", "aggregation", "level", "and", "put", "all", "references", "in", "place", "." ]
train
https://github.com/jvsteiner/merkletree/blob/0d9284f9f90fab3b8c2ef4d356d0947719950bc2/merkle.py#L99-L114
jvsteiner/merkletree
merkle.py
MerkleTree.get_chain
def get_chain(self, index): """Assemble and return the chain leading from a given node to the merkle root of this tree. """ chain = [] this = self.leaves[index] chain.append((this.val, 'SELF')) while this.p: chain.append((this.sib.val, this.sib.side)) ...
python
def get_chain(self, index): """Assemble and return the chain leading from a given node to the merkle root of this tree. """ chain = [] this = self.leaves[index] chain.append((this.val, 'SELF')) while this.p: chain.append((this.sib.val, this.sib.side)) ...
[ "def", "get_chain", "(", "self", ",", "index", ")", ":", "chain", "=", "[", "]", "this", "=", "self", ".", "leaves", "[", "index", "]", "chain", ".", "append", "(", "(", "this", ".", "val", ",", "'SELF'", ")", ")", "while", "this", ".", "p", ":...
Assemble and return the chain leading from a given node to the merkle root of this tree.
[ "Assemble", "and", "return", "the", "chain", "leading", "from", "a", "given", "node", "to", "the", "merkle", "root", "of", "this", "tree", "." ]
train
https://github.com/jvsteiner/merkletree/blob/0d9284f9f90fab3b8c2ef4d356d0947719950bc2/merkle.py#L116-L126
jvsteiner/merkletree
merkle.py
MerkleTree.get_all_chains
def get_all_chains(self): """Assemble and return a list of all chains for all leaf nodes to the merkle root. """ return [self.get_chain(i) for i in range(len(self.leaves))]
python
def get_all_chains(self): """Assemble and return a list of all chains for all leaf nodes to the merkle root. """ return [self.get_chain(i) for i in range(len(self.leaves))]
[ "def", "get_all_chains", "(", "self", ")", ":", "return", "[", "self", ".", "get_chain", "(", "i", ")", "for", "i", "in", "range", "(", "len", "(", "self", ".", "leaves", ")", ")", "]" ]
Assemble and return a list of all chains for all leaf nodes to the merkle root.
[ "Assemble", "and", "return", "a", "list", "of", "all", "chains", "for", "all", "leaf", "nodes", "to", "the", "merkle", "root", "." ]
train
https://github.com/jvsteiner/merkletree/blob/0d9284f9f90fab3b8c2ef4d356d0947719950bc2/merkle.py#L128-L131
jvsteiner/merkletree
merkle.py
MerkleTree.get_hex_chain
def get_hex_chain(self, index): """Assemble and return the chain leading from a given node to the merkle root of this tree with hash values in hex form """ return [(codecs.encode(i[0], 'hex_codec'), i[1]) for i in self.get_chain(index)]
python
def get_hex_chain(self, index): """Assemble and return the chain leading from a given node to the merkle root of this tree with hash values in hex form """ return [(codecs.encode(i[0], 'hex_codec'), i[1]) for i in self.get_chain(index)]
[ "def", "get_hex_chain", "(", "self", ",", "index", ")", ":", "return", "[", "(", "codecs", ".", "encode", "(", "i", "[", "0", "]", ",", "'hex_codec'", ")", ",", "i", "[", "1", "]", ")", "for", "i", "in", "self", ".", "get_chain", "(", "index", ...
Assemble and return the chain leading from a given node to the merkle root of this tree with hash values in hex form
[ "Assemble", "and", "return", "the", "chain", "leading", "from", "a", "given", "node", "to", "the", "merkle", "root", "of", "this", "tree", "with", "hash", "values", "in", "hex", "form" ]
train
https://github.com/jvsteiner/merkletree/blob/0d9284f9f90fab3b8c2ef4d356d0947719950bc2/merkle.py#L133-L137
jvsteiner/merkletree
merkle.py
MerkleTree.get_all_hex_chains
def get_all_hex_chains(self): """Assemble and return a list of all chains for all nodes to the merkle root, hex encoded. """ return [[(codecs.encode(i[0], 'hex_codec'), i[1]) for i in j] for j in self.get_all_chains()]
python
def get_all_hex_chains(self): """Assemble and return a list of all chains for all nodes to the merkle root, hex encoded. """ return [[(codecs.encode(i[0], 'hex_codec'), i[1]) for i in j] for j in self.get_all_chains()]
[ "def", "get_all_hex_chains", "(", "self", ")", ":", "return", "[", "[", "(", "codecs", ".", "encode", "(", "i", "[", "0", "]", ",", "'hex_codec'", ")", ",", "i", "[", "1", "]", ")", "for", "i", "in", "j", "]", "for", "j", "in", "self", ".", "...
Assemble and return a list of all chains for all nodes to the merkle root, hex encoded.
[ "Assemble", "and", "return", "a", "list", "of", "all", "chains", "for", "all", "nodes", "to", "the", "merkle", "root", "hex", "encoded", "." ]
train
https://github.com/jvsteiner/merkletree/blob/0d9284f9f90fab3b8c2ef4d356d0947719950bc2/merkle.py#L139-L142
jvsteiner/merkletree
merkle.py
MerkleTree._get_whole_subtrees
def _get_whole_subtrees(self): """Returns an array of nodes in the tree that have balanced subtrees beneath them, moving from left to right. """ subtrees = [] loose_leaves = len(self.leaves) - 2**int(log(len(self.leaves), 2)) the_node = self.root while loose_leave...
python
def _get_whole_subtrees(self): """Returns an array of nodes in the tree that have balanced subtrees beneath them, moving from left to right. """ subtrees = [] loose_leaves = len(self.leaves) - 2**int(log(len(self.leaves), 2)) the_node = self.root while loose_leave...
[ "def", "_get_whole_subtrees", "(", "self", ")", ":", "subtrees", "=", "[", "]", "loose_leaves", "=", "len", "(", "self", ".", "leaves", ")", "-", "2", "**", "int", "(", "log", "(", "len", "(", "self", ".", "leaves", ")", ",", "2", ")", ")", "the_...
Returns an array of nodes in the tree that have balanced subtrees beneath them, moving from left to right.
[ "Returns", "an", "array", "of", "nodes", "in", "the", "tree", "that", "have", "balanced", "subtrees", "beneath", "them", "moving", "from", "left", "to", "right", "." ]
train
https://github.com/jvsteiner/merkletree/blob/0d9284f9f90fab3b8c2ef4d356d0947719950bc2/merkle.py#L144-L156
jvsteiner/merkletree
merkle.py
MerkleTree.add_adjust
def add_adjust(self, data, prehashed=False): """Add a new leaf, and adjust the tree, without rebuilding the whole thing. """ subtrees = self._get_whole_subtrees() new_node = Node(data, prehashed=prehashed) self.leaves.append(new_node) for node in reversed(subtrees): ...
python
def add_adjust(self, data, prehashed=False): """Add a new leaf, and adjust the tree, without rebuilding the whole thing. """ subtrees = self._get_whole_subtrees() new_node = Node(data, prehashed=prehashed) self.leaves.append(new_node) for node in reversed(subtrees): ...
[ "def", "add_adjust", "(", "self", ",", "data", ",", "prehashed", "=", "False", ")", ":", "subtrees", "=", "self", ".", "_get_whole_subtrees", "(", ")", "new_node", "=", "Node", "(", "data", ",", "prehashed", "=", "prehashed", ")", "self", ".", "leaves", ...
Add a new leaf, and adjust the tree, without rebuilding the whole thing.
[ "Add", "a", "new", "leaf", "and", "adjust", "the", "tree", "without", "rebuilding", "the", "whole", "thing", "." ]
train
https://github.com/jvsteiner/merkletree/blob/0d9284f9f90fab3b8c2ef4d356d0947719950bc2/merkle.py#L158-L171
flo-compbio/genometools
genometools/enrichment/result.py
StaticGSEResult.fold_enrichment
def fold_enrichment(self): """Returns the fold enrichment of the gene set. Fold enrichment is defined as ratio between the observed and the expected number of gene set genes present. """ expected = self.K * (self.n/float(self.N)) return self.k / expected
python
def fold_enrichment(self): """Returns the fold enrichment of the gene set. Fold enrichment is defined as ratio between the observed and the expected number of gene set genes present. """ expected = self.K * (self.n/float(self.N)) return self.k / expected
[ "def", "fold_enrichment", "(", "self", ")", ":", "expected", "=", "self", ".", "K", "*", "(", "self", ".", "n", "/", "float", "(", "self", ".", "N", ")", ")", "return", "self", ".", "k", "/", "expected" ]
Returns the fold enrichment of the gene set. Fold enrichment is defined as ratio between the observed and the expected number of gene set genes present.
[ "Returns", "the", "fold", "enrichment", "of", "the", "gene", "set", "." ]
train
https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/enrichment/result.py#L112-L119
flo-compbio/genometools
genometools/enrichment/result.py
StaticGSEResult.get_pretty_format
def get_pretty_format(self, max_name_length=0): """Returns a nicely formatted string describing the result. Parameters ---------- max_name_length: int [0] The maximum length of the gene set name (in characters). If the gene set name is longer than this number, it...
python
def get_pretty_format(self, max_name_length=0): """Returns a nicely formatted string describing the result. Parameters ---------- max_name_length: int [0] The maximum length of the gene set name (in characters). If the gene set name is longer than this number, it...
[ "def", "get_pretty_format", "(", "self", ",", "max_name_length", "=", "0", ")", ":", "assert", "isinstance", "(", "max_name_length", ",", "(", "int", ",", "np", ".", "integer", ")", ")", "if", "max_name_length", "<", "0", "or", "(", "1", "<=", "max_name_...
Returns a nicely formatted string describing the result. Parameters ---------- max_name_length: int [0] The maximum length of the gene set name (in characters). If the gene set name is longer than this number, it will be truncated and "..." will be appended t...
[ "Returns", "a", "nicely", "formatted", "string", "describing", "the", "result", "." ]
train
https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/enrichment/result.py#L121-L158
acorg/dark-matter
bin/get-reads.py
main
def main(recordFilenames, fastaFilename, title, xRange, bitRange): """ Print reads that match in a specified X-axis and bit score range. @param recordFilenames: A C{list} of C{str} file names contain results of a BLAST run, in JSON format. @param fastaFilename: The C{str} name of the FASTA file...
python
def main(recordFilenames, fastaFilename, title, xRange, bitRange): """ Print reads that match in a specified X-axis and bit score range. @param recordFilenames: A C{list} of C{str} file names contain results of a BLAST run, in JSON format. @param fastaFilename: The C{str} name of the FASTA file...
[ "def", "main", "(", "recordFilenames", ",", "fastaFilename", ",", "title", ",", "xRange", ",", "bitRange", ")", ":", "reads", "=", "FastaReads", "(", "fastaFilename", ")", "blastReadsAlignments", "=", "BlastReadsAlignments", "(", "reads", ",", "recordFilenames", ...
Print reads that match in a specified X-axis and bit score range. @param recordFilenames: A C{list} of C{str} file names contain results of a BLAST run, in JSON format. @param fastaFilename: The C{str} name of the FASTA file that was originally BLASTed. @param title: The C{str} title of the...
[ "Print", "reads", "that", "match", "in", "a", "specified", "X", "-", "axis", "and", "bit", "score", "range", "." ]
train
https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/bin/get-reads.py#L14-L46
biocommons/bioutils
src/bioutils/seqfetcher.py
fetch_seq
def fetch_seq(ac, start_i=None, end_i=None): """Fetches sequences and subsequences from NCBI eutils and Ensembl REST interfaces. :param string ac: accession of sequence to fetch :param int start_i: start position of *interbase* interval :param int end_i: end position of *interbase* interval *...
python
def fetch_seq(ac, start_i=None, end_i=None): """Fetches sequences and subsequences from NCBI eutils and Ensembl REST interfaces. :param string ac: accession of sequence to fetch :param int start_i: start position of *interbase* interval :param int end_i: end position of *interbase* interval *...
[ "def", "fetch_seq", "(", "ac", ",", "start_i", "=", "None", ",", "end_i", "=", "None", ")", ":", "ac_dispatch", "=", "[", "{", "\"re\"", ":", "re", ".", "compile", "(", "r\"^(?:AC|N[CGMPRTW])_|^[A-L]\\w\\d|^U\\d\"", ")", ",", "\"fetcher\"", ":", "_fetch_seq_...
Fetches sequences and subsequences from NCBI eutils and Ensembl REST interfaces. :param string ac: accession of sequence to fetch :param int start_i: start position of *interbase* interval :param int end_i: end position of *interbase* interval **IMPORTANT** start_i and end_i specify 0-based inter...
[ "Fetches", "sequences", "and", "subsequences", "from", "NCBI", "eutils", "and", "Ensembl", "REST", "interfaces", "." ]
train
https://github.com/biocommons/bioutils/blob/88bcbdfa707268fed1110800e91b6d4f8e9475a0/src/bioutils/seqfetcher.py#L24-L123
biocommons/bioutils
src/bioutils/seqfetcher.py
_fetch_seq_ensembl
def _fetch_seq_ensembl(ac, start_i=None, end_i=None): """Fetch the specified sequence slice from Ensembl using the public REST interface. An interbase interval may be optionally provided with start_i and end_i. However, the Ensembl REST interface does not currently accept intervals, so the entire s...
python
def _fetch_seq_ensembl(ac, start_i=None, end_i=None): """Fetch the specified sequence slice from Ensembl using the public REST interface. An interbase interval may be optionally provided with start_i and end_i. However, the Ensembl REST interface does not currently accept intervals, so the entire s...
[ "def", "_fetch_seq_ensembl", "(", "ac", ",", "start_i", "=", "None", ",", "end_i", "=", "None", ")", ":", "url_fmt", "=", "\"http://rest.ensembl.org/sequence/id/{ac}\"", "url", "=", "url_fmt", ".", "format", "(", "ac", "=", "ac", ")", "r", "=", "requests", ...
Fetch the specified sequence slice from Ensembl using the public REST interface. An interbase interval may be optionally provided with start_i and end_i. However, the Ensembl REST interface does not currently accept intervals, so the entire sequence is returned and sliced locally. >> len(_fetc...
[ "Fetch", "the", "specified", "sequence", "slice", "from", "Ensembl", "using", "the", "public", "REST", "interface", "." ]
train
https://github.com/biocommons/bioutils/blob/88bcbdfa707268fed1110800e91b6d4f8e9475a0/src/bioutils/seqfetcher.py#L130-L159
biocommons/bioutils
src/bioutils/seqfetcher.py
_fetch_seq_ncbi
def _fetch_seq_ncbi(ac, start_i=None, end_i=None): """Fetch sequences from NCBI using the eutils interface. An interbase interval may be optionally provided with start_i and end_i. NCBI eutils will return just the requested subsequence, which might greatly reduce payload sizes (especially with chro...
python
def _fetch_seq_ncbi(ac, start_i=None, end_i=None): """Fetch sequences from NCBI using the eutils interface. An interbase interval may be optionally provided with start_i and end_i. NCBI eutils will return just the requested subsequence, which might greatly reduce payload sizes (especially with chro...
[ "def", "_fetch_seq_ncbi", "(", "ac", ",", "start_i", "=", "None", ",", "end_i", "=", "None", ")", ":", "db", "=", "\"protein\"", "if", "ac", "[", "1", "]", "==", "\"P\"", "else", "\"nucleotide\"", "url_fmt", "=", "(", "\"https://eutils.ncbi.nlm.nih.gov/entre...
Fetch sequences from NCBI using the eutils interface. An interbase interval may be optionally provided with start_i and end_i. NCBI eutils will return just the requested subsequence, which might greatly reduce payload sizes (especially with chromosome-scale sequences). The request includes `tool` ...
[ "Fetch", "sequences", "from", "NCBI", "using", "the", "eutils", "interface", "." ]
train
https://github.com/biocommons/bioutils/blob/88bcbdfa707268fed1110800e91b6d4f8e9475a0/src/bioutils/seqfetcher.py#L162-L226
biocommons/bioutils
src/bioutils/seqfetcher.py
_add_eutils_api_key
def _add_eutils_api_key(url): """Adds eutils api key to the query :param url: eutils url with a query string :return: url with api_key parameter set to the value of environment variable 'NCBI_API_KEY' if available """ apikey = os.environ.get("NCBI_API_KEY") if apikey: url += "&api_k...
python
def _add_eutils_api_key(url): """Adds eutils api key to the query :param url: eutils url with a query string :return: url with api_key parameter set to the value of environment variable 'NCBI_API_KEY' if available """ apikey = os.environ.get("NCBI_API_KEY") if apikey: url += "&api_k...
[ "def", "_add_eutils_api_key", "(", "url", ")", ":", "apikey", "=", "os", ".", "environ", ".", "get", "(", "\"NCBI_API_KEY\"", ")", "if", "apikey", ":", "url", "+=", "\"&api_key={apikey}\"", ".", "format", "(", "apikey", "=", "apikey", ")", "return", "url" ...
Adds eutils api key to the query :param url: eutils url with a query string :return: url with api_key parameter set to the value of environment variable 'NCBI_API_KEY' if available
[ "Adds", "eutils", "api", "key", "to", "the", "query" ]
train
https://github.com/biocommons/bioutils/blob/88bcbdfa707268fed1110800e91b6d4f8e9475a0/src/bioutils/seqfetcher.py#L229-L239
nkavaldj/myhdl_lib
myhdl_lib/mem.py
rom
def rom(addr, dout, CONTENT): ''' CONTENT == tuple of non-sparse values ''' @always_comb def read(): dout.next = CONTENT[int(addr)] return read
python
def rom(addr, dout, CONTENT): ''' CONTENT == tuple of non-sparse values ''' @always_comb def read(): dout.next = CONTENT[int(addr)] return read
[ "def", "rom", "(", "addr", ",", "dout", ",", "CONTENT", ")", ":", "@", "always_comb", "def", "read", "(", ")", ":", "dout", ".", "next", "=", "CONTENT", "[", "int", "(", "addr", ")", "]", "return", "read" ]
CONTENT == tuple of non-sparse values
[ "CONTENT", "==", "tuple", "of", "non", "-", "sparse", "values" ]
train
https://github.com/nkavaldj/myhdl_lib/blob/9902afd2031e7847373f692821b2135fd0810aa8/myhdl_lib/mem.py#L3-L9
nkavaldj/myhdl_lib
myhdl_lib/mem.py
ram_sp_ar
def ram_sp_ar(clk, we, addr, di, do): ''' RAM: Single-Port, Asynchronous Read ''' memL = [Signal(intbv(0)[len(di):]) for _ in range(2**len(addr))] @always(clk.posedge) def write(): if we: memL[int(addr)].next = di @always_comb def read(): do.next = memL[int(addr)] ...
python
def ram_sp_ar(clk, we, addr, di, do): ''' RAM: Single-Port, Asynchronous Read ''' memL = [Signal(intbv(0)[len(di):]) for _ in range(2**len(addr))] @always(clk.posedge) def write(): if we: memL[int(addr)].next = di @always_comb def read(): do.next = memL[int(addr)] ...
[ "def", "ram_sp_ar", "(", "clk", ",", "we", ",", "addr", ",", "di", ",", "do", ")", ":", "memL", "=", "[", "Signal", "(", "intbv", "(", "0", ")", "[", "len", "(", "di", ")", ":", "]", ")", "for", "_", "in", "range", "(", "2", "**", "len", ...
RAM: Single-Port, Asynchronous Read
[ "RAM", ":", "Single", "-", "Port", "Asynchronous", "Read" ]
train
https://github.com/nkavaldj/myhdl_lib/blob/9902afd2031e7847373f692821b2135fd0810aa8/myhdl_lib/mem.py#L43-L57
nkavaldj/myhdl_lib
myhdl_lib/mem.py
ram_sdp_rf
def ram_sdp_rf(clk, we, addrw, addrr, di, do): ''' RAM: Simple-Dual-Port, Read-First ''' memL = [Signal(intbv(0)[len(di):]) for _ in range(2**len(addrr))] @always(clk.posedge) def write(): if we: memL[int(addrw)].next = di do.next = memL[int(addrr)] return write
python
def ram_sdp_rf(clk, we, addrw, addrr, di, do): ''' RAM: Simple-Dual-Port, Read-First ''' memL = [Signal(intbv(0)[len(di):]) for _ in range(2**len(addrr))] @always(clk.posedge) def write(): if we: memL[int(addrw)].next = di do.next = memL[int(addrr)] return write
[ "def", "ram_sdp_rf", "(", "clk", ",", "we", ",", "addrw", ",", "addrr", ",", "di", ",", "do", ")", ":", "memL", "=", "[", "Signal", "(", "intbv", "(", "0", ")", "[", "len", "(", "di", ")", ":", "]", ")", "for", "_", "in", "range", "(", "2",...
RAM: Simple-Dual-Port, Read-First
[ "RAM", ":", "Simple", "-", "Dual", "-", "Port", "Read", "-", "First" ]
train
https://github.com/nkavaldj/myhdl_lib/blob/9902afd2031e7847373f692821b2135fd0810aa8/myhdl_lib/mem.py#L60-L71
nkavaldj/myhdl_lib
myhdl_lib/mem.py
ram_dp_rf
def ram_dp_rf(clka, clkb, wea, web, addra, addrb, dia, dib, doa, dob): ''' RAM: Dual-Port, Read-First ''' memL = [Signal(intbv(0)[len(dia):]) for _ in range(2**len(addra))] @always(clka.posedge) def writea(): if wea: memL[int(addra)].next = dia doa.next = memL[int(addra)] ...
python
def ram_dp_rf(clka, clkb, wea, web, addra, addrb, dia, dib, doa, dob): ''' RAM: Dual-Port, Read-First ''' memL = [Signal(intbv(0)[len(dia):]) for _ in range(2**len(addra))] @always(clka.posedge) def writea(): if wea: memL[int(addra)].next = dia doa.next = memL[int(addra)] ...
[ "def", "ram_dp_rf", "(", "clka", ",", "clkb", ",", "wea", ",", "web", ",", "addra", ",", "addrb", ",", "dia", ",", "dib", ",", "doa", ",", "dob", ")", ":", "memL", "=", "[", "Signal", "(", "intbv", "(", "0", ")", "[", "len", "(", "dia", ")", ...
RAM: Dual-Port, Read-First
[ "RAM", ":", "Dual", "-", "Port", "Read", "-", "First" ]
train
https://github.com/nkavaldj/myhdl_lib/blob/9902afd2031e7847373f692821b2135fd0810aa8/myhdl_lib/mem.py#L110-L129
nkavaldj/myhdl_lib
myhdl_lib/mem.py
convert_rom
def convert_rom(ADDR_WIDTH=8, DATA_WIDTH=8, CONTENT=(4,5,6,7)): ''' Convert ROM''' addr = Signal(intbv(0)[ADDR_WIDTH:]) dout = Signal(intbv(0)[DATA_WIDTH:]) toVerilog(rom, addr, dout, CONTENT)
python
def convert_rom(ADDR_WIDTH=8, DATA_WIDTH=8, CONTENT=(4,5,6,7)): ''' Convert ROM''' addr = Signal(intbv(0)[ADDR_WIDTH:]) dout = Signal(intbv(0)[DATA_WIDTH:]) toVerilog(rom, addr, dout, CONTENT)
[ "def", "convert_rom", "(", "ADDR_WIDTH", "=", "8", ",", "DATA_WIDTH", "=", "8", ",", "CONTENT", "=", "(", "4", ",", "5", ",", "6", ",", "7", ")", ")", ":", "addr", "=", "Signal", "(", "intbv", "(", "0", ")", "[", "ADDR_WIDTH", ":", "]", ")", ...
Convert ROM
[ "Convert", "ROM" ]
train
https://github.com/nkavaldj/myhdl_lib/blob/9902afd2031e7847373f692821b2135fd0810aa8/myhdl_lib/mem.py#L186-L190
nkavaldj/myhdl_lib
myhdl_lib/mem.py
convert_ram_sp_rf
def convert_ram_sp_rf(ADDR_WIDTH=8, DATA_WIDTH=8): ''' Convert RAM: Single-Port, Read-First ''' clk = Signal(bool(0)) we = Signal(bool(0)) addr = Signal(intbv(0)[ADDR_WIDTH:]) di = Signal(intbv(0)[DATA_WIDTH:]) do = Signal(intbv(0)[DATA_WIDTH:]) toVerilog(ram_sp_rf, clk, we, addr, di, do)
python
def convert_ram_sp_rf(ADDR_WIDTH=8, DATA_WIDTH=8): ''' Convert RAM: Single-Port, Read-First ''' clk = Signal(bool(0)) we = Signal(bool(0)) addr = Signal(intbv(0)[ADDR_WIDTH:]) di = Signal(intbv(0)[DATA_WIDTH:]) do = Signal(intbv(0)[DATA_WIDTH:]) toVerilog(ram_sp_rf, clk, we, addr, di, do)
[ "def", "convert_ram_sp_rf", "(", "ADDR_WIDTH", "=", "8", ",", "DATA_WIDTH", "=", "8", ")", ":", "clk", "=", "Signal", "(", "bool", "(", "0", ")", ")", "we", "=", "Signal", "(", "bool", "(", "0", ")", ")", "addr", "=", "Signal", "(", "intbv", "(",...
Convert RAM: Single-Port, Read-First
[ "Convert", "RAM", ":", "Single", "-", "Port", "Read", "-", "First" ]
train
https://github.com/nkavaldj/myhdl_lib/blob/9902afd2031e7847373f692821b2135fd0810aa8/myhdl_lib/mem.py#L193-L200
nkavaldj/myhdl_lib
myhdl_lib/mem.py
convert_ram_sp_wf
def convert_ram_sp_wf(ADDR_WIDTH=8, DATA_WIDTH=8): ''' Convert RAM: Single-Port, Write-First ''' clk = Signal(bool(0)) we = Signal(bool(0)) addr = Signal(intbv(0)[ADDR_WIDTH:]) di = Signal(intbv(0)[DATA_WIDTH:]) do = Signal(intbv(0)[DATA_WIDTH:]) toVerilog(ram_sp_wf, clk, we, addr, di, do)
python
def convert_ram_sp_wf(ADDR_WIDTH=8, DATA_WIDTH=8): ''' Convert RAM: Single-Port, Write-First ''' clk = Signal(bool(0)) we = Signal(bool(0)) addr = Signal(intbv(0)[ADDR_WIDTH:]) di = Signal(intbv(0)[DATA_WIDTH:]) do = Signal(intbv(0)[DATA_WIDTH:]) toVerilog(ram_sp_wf, clk, we, addr, di, do)
[ "def", "convert_ram_sp_wf", "(", "ADDR_WIDTH", "=", "8", ",", "DATA_WIDTH", "=", "8", ")", ":", "clk", "=", "Signal", "(", "bool", "(", "0", ")", ")", "we", "=", "Signal", "(", "bool", "(", "0", ")", ")", "addr", "=", "Signal", "(", "intbv", "(",...
Convert RAM: Single-Port, Write-First
[ "Convert", "RAM", ":", "Single", "-", "Port", "Write", "-", "First" ]
train
https://github.com/nkavaldj/myhdl_lib/blob/9902afd2031e7847373f692821b2135fd0810aa8/myhdl_lib/mem.py#L203-L210
nkavaldj/myhdl_lib
myhdl_lib/mem.py
convert_ram_sp_ar
def convert_ram_sp_ar(ADDR_WIDTH=8, DATA_WIDTH=8): ''' Convert RAM: Single-Port, Asynchronous Read ''' clk = Signal(bool(0)) we = Signal(bool(0)) addr = Signal(intbv(0)[ADDR_WIDTH:]) di = Signal(intbv(0)[DATA_WIDTH:]) do = Signal(intbv(0)[DATA_WIDTH:]) toVerilog(ram_sp_ar, clk, we, addr, di,...
python
def convert_ram_sp_ar(ADDR_WIDTH=8, DATA_WIDTH=8): ''' Convert RAM: Single-Port, Asynchronous Read ''' clk = Signal(bool(0)) we = Signal(bool(0)) addr = Signal(intbv(0)[ADDR_WIDTH:]) di = Signal(intbv(0)[DATA_WIDTH:]) do = Signal(intbv(0)[DATA_WIDTH:]) toVerilog(ram_sp_ar, clk, we, addr, di,...
[ "def", "convert_ram_sp_ar", "(", "ADDR_WIDTH", "=", "8", ",", "DATA_WIDTH", "=", "8", ")", ":", "clk", "=", "Signal", "(", "bool", "(", "0", ")", ")", "we", "=", "Signal", "(", "bool", "(", "0", ")", ")", "addr", "=", "Signal", "(", "intbv", "(",...
Convert RAM: Single-Port, Asynchronous Read
[ "Convert", "RAM", ":", "Single", "-", "Port", "Asynchronous", "Read" ]
train
https://github.com/nkavaldj/myhdl_lib/blob/9902afd2031e7847373f692821b2135fd0810aa8/myhdl_lib/mem.py#L213-L220
nkavaldj/myhdl_lib
myhdl_lib/mem.py
convert_ram_sdp_rf
def convert_ram_sdp_rf(ADDR_WIDTH=8, DATA_WIDTH=8): ''' Convert RAM: Simple-Dual-Port, Read-First ''' clk = Signal(bool(0)) we = Signal(bool(0)) addrw = Signal(intbv(0)[ADDR_WIDTH:]) addrr = Signal(intbv(0)[ADDR_WIDTH:]) di = Signal(intbv(0)[DATA_WIDTH:]) do = Signal(intbv(0)[DATA_WIDTH:]) ...
python
def convert_ram_sdp_rf(ADDR_WIDTH=8, DATA_WIDTH=8): ''' Convert RAM: Simple-Dual-Port, Read-First ''' clk = Signal(bool(0)) we = Signal(bool(0)) addrw = Signal(intbv(0)[ADDR_WIDTH:]) addrr = Signal(intbv(0)[ADDR_WIDTH:]) di = Signal(intbv(0)[DATA_WIDTH:]) do = Signal(intbv(0)[DATA_WIDTH:]) ...
[ "def", "convert_ram_sdp_rf", "(", "ADDR_WIDTH", "=", "8", ",", "DATA_WIDTH", "=", "8", ")", ":", "clk", "=", "Signal", "(", "bool", "(", "0", ")", ")", "we", "=", "Signal", "(", "bool", "(", "0", ")", ")", "addrw", "=", "Signal", "(", "intbv", "(...
Convert RAM: Simple-Dual-Port, Read-First
[ "Convert", "RAM", ":", "Simple", "-", "Dual", "-", "Port", "Read", "-", "First" ]
train
https://github.com/nkavaldj/myhdl_lib/blob/9902afd2031e7847373f692821b2135fd0810aa8/myhdl_lib/mem.py#L223-L231
nkavaldj/myhdl_lib
myhdl_lib/mem.py
convert_ram_sdp_wf
def convert_ram_sdp_wf(ADDR_WIDTH=8, DATA_WIDTH=8): ''' Convert RAM: Simple-Dual-Port, Write-First ''' clk = Signal(bool(0)) we = Signal(bool(0)) addrw = Signal(intbv(0)[ADDR_WIDTH:]) addrr = Signal(intbv(0)[ADDR_WIDTH:]) di = Signal(intbv(0)[DATA_WIDTH:]) do = Signal(intbv(0)[DATA_WIDTH:]) ...
python
def convert_ram_sdp_wf(ADDR_WIDTH=8, DATA_WIDTH=8): ''' Convert RAM: Simple-Dual-Port, Write-First ''' clk = Signal(bool(0)) we = Signal(bool(0)) addrw = Signal(intbv(0)[ADDR_WIDTH:]) addrr = Signal(intbv(0)[ADDR_WIDTH:]) di = Signal(intbv(0)[DATA_WIDTH:]) do = Signal(intbv(0)[DATA_WIDTH:]) ...
[ "def", "convert_ram_sdp_wf", "(", "ADDR_WIDTH", "=", "8", ",", "DATA_WIDTH", "=", "8", ")", ":", "clk", "=", "Signal", "(", "bool", "(", "0", ")", ")", "we", "=", "Signal", "(", "bool", "(", "0", ")", ")", "addrw", "=", "Signal", "(", "intbv", "(...
Convert RAM: Simple-Dual-Port, Write-First
[ "Convert", "RAM", ":", "Simple", "-", "Dual", "-", "Port", "Write", "-", "First" ]
train
https://github.com/nkavaldj/myhdl_lib/blob/9902afd2031e7847373f692821b2135fd0810aa8/myhdl_lib/mem.py#L234-L242
nkavaldj/myhdl_lib
myhdl_lib/mem.py
convert_ram_sdp_ar
def convert_ram_sdp_ar(ADDR_WIDTH=8, DATA_WIDTH=8): ''' Convert RAM: Simple-Dual-Port, Asynchronous Read''' clk = Signal(bool(0)) we = Signal(bool(0)) addrw = Signal(intbv(0)[ADDR_WIDTH:]) addrr = Signal(intbv(0)[ADDR_WIDTH:]) di = Signal(intbv(0)[DATA_WIDTH:]) do = Signal(intbv(0)[DATA_WIDT...
python
def convert_ram_sdp_ar(ADDR_WIDTH=8, DATA_WIDTH=8): ''' Convert RAM: Simple-Dual-Port, Asynchronous Read''' clk = Signal(bool(0)) we = Signal(bool(0)) addrw = Signal(intbv(0)[ADDR_WIDTH:]) addrr = Signal(intbv(0)[ADDR_WIDTH:]) di = Signal(intbv(0)[DATA_WIDTH:]) do = Signal(intbv(0)[DATA_WIDT...
[ "def", "convert_ram_sdp_ar", "(", "ADDR_WIDTH", "=", "8", ",", "DATA_WIDTH", "=", "8", ")", ":", "clk", "=", "Signal", "(", "bool", "(", "0", ")", ")", "we", "=", "Signal", "(", "bool", "(", "0", ")", ")", "addrw", "=", "Signal", "(", "intbv", "(...
Convert RAM: Simple-Dual-Port, Asynchronous Read
[ "Convert", "RAM", ":", "Simple", "-", "Dual", "-", "Port", "Asynchronous", "Read" ]
train
https://github.com/nkavaldj/myhdl_lib/blob/9902afd2031e7847373f692821b2135fd0810aa8/myhdl_lib/mem.py#L245-L253
nkavaldj/myhdl_lib
myhdl_lib/mem.py
convert_ram_dp_ar
def convert_ram_dp_ar(ADDR_WIDTH=8, DATA_WIDTH=8): ''' Convert RAM: Dual-Port, Asynchronous Read ''' clka = Signal(bool(0)) clkb = Signal(bool(0)) wea = Signal(bool(0)) web = Signal(bool(0)) addra = Signal(intbv(0)[ADDR_WIDTH:]) addrb = Signal(intbv(0)[ADDR_WIDTH:]) dia = Signal(intbv(0)...
python
def convert_ram_dp_ar(ADDR_WIDTH=8, DATA_WIDTH=8): ''' Convert RAM: Dual-Port, Asynchronous Read ''' clka = Signal(bool(0)) clkb = Signal(bool(0)) wea = Signal(bool(0)) web = Signal(bool(0)) addra = Signal(intbv(0)[ADDR_WIDTH:]) addrb = Signal(intbv(0)[ADDR_WIDTH:]) dia = Signal(intbv(0)...
[ "def", "convert_ram_dp_ar", "(", "ADDR_WIDTH", "=", "8", ",", "DATA_WIDTH", "=", "8", ")", ":", "clka", "=", "Signal", "(", "bool", "(", "0", ")", ")", "clkb", "=", "Signal", "(", "bool", "(", "0", ")", ")", "wea", "=", "Signal", "(", "bool", "("...
Convert RAM: Dual-Port, Asynchronous Read
[ "Convert", "RAM", ":", "Dual", "-", "Port", "Asynchronous", "Read" ]
train
https://github.com/nkavaldj/myhdl_lib/blob/9902afd2031e7847373f692821b2135fd0810aa8/myhdl_lib/mem.py#L286-L298
disqus/overseer
overseer/models.py
Event.post_to_twitter
def post_to_twitter(self, message=None): """Update twitter status, i.e., post a tweet""" consumer = oauth2.Consumer(key=conf.TWITTER_CONSUMER_KEY, secret=conf.TWITTER_CONSUMER_SECRET) token = oauth2.Token(key=conf.TWITTER_ACCESS_TOKEN, secret=conf.TWITTER_ACCES...
python
def post_to_twitter(self, message=None): """Update twitter status, i.e., post a tweet""" consumer = oauth2.Consumer(key=conf.TWITTER_CONSUMER_KEY, secret=conf.TWITTER_CONSUMER_SECRET) token = oauth2.Token(key=conf.TWITTER_ACCESS_TOKEN, secret=conf.TWITTER_ACCES...
[ "def", "post_to_twitter", "(", "self", ",", "message", "=", "None", ")", ":", "consumer", "=", "oauth2", ".", "Consumer", "(", "key", "=", "conf", ".", "TWITTER_CONSUMER_KEY", ",", "secret", "=", "conf", ".", "TWITTER_CONSUMER_SECRET", ")", "token", "=", "...
Update twitter status, i.e., post a tweet
[ "Update", "twitter", "status", "i", ".", "e", ".", "post", "a", "tweet" ]
train
https://github.com/disqus/overseer/blob/b37573aba33b20aa86f89eb0c7e6f4d9905bedef/overseer/models.py#L176-L201
flo-compbio/genometools
genometools/ebi/uniprot_goa.py
get_gaf_gene_ontology_file
def get_gaf_gene_ontology_file(path): """Extract the gene ontology file associated with a GO annotation file. Parameters ---------- path: str The path name of the GO annotation file. Returns ------- str The URL of the associated gene ontology file. """ assert isinst...
python
def get_gaf_gene_ontology_file(path): """Extract the gene ontology file associated with a GO annotation file. Parameters ---------- path: str The path name of the GO annotation file. Returns ------- str The URL of the associated gene ontology file. """ assert isinst...
[ "def", "get_gaf_gene_ontology_file", "(", "path", ")", ":", "assert", "isinstance", "(", "path", ",", "str", ")", "version", "=", "None", "with", "misc", ".", "smart_open_read", "(", "path", ",", "encoding", "=", "'UTF-8'", ",", "try_gzip", "=", "True", ")...
Extract the gene ontology file associated with a GO annotation file. Parameters ---------- path: str The path name of the GO annotation file. Returns ------- str The URL of the associated gene ontology file.
[ "Extract", "the", "gene", "ontology", "file", "associated", "with", "a", "GO", "annotation", "file", "." ]
train
https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/ebi/uniprot_goa.py#L27-L50
thunder-project/thunder-registration
registration/transforms.py
Displacement.apply
def apply(self, im): """ Apply an n-dimensional displacement by shifting an image or volume. Parameters ---------- im : ndarray The image or volume to shift """ from scipy.ndimage.interpolation import shift return shift(im, map(lambda x: -x, s...
python
def apply(self, im): """ Apply an n-dimensional displacement by shifting an image or volume. Parameters ---------- im : ndarray The image or volume to shift """ from scipy.ndimage.interpolation import shift return shift(im, map(lambda x: -x, s...
[ "def", "apply", "(", "self", ",", "im", ")", ":", "from", "scipy", ".", "ndimage", ".", "interpolation", "import", "shift", "return", "shift", "(", "im", ",", "map", "(", "lambda", "x", ":", "-", "x", ",", "self", ".", "delta", ")", ",", "mode", ...
Apply an n-dimensional displacement by shifting an image or volume. Parameters ---------- im : ndarray The image or volume to shift
[ "Apply", "an", "n", "-", "dimensional", "displacement", "by", "shifting", "an", "image", "or", "volume", "." ]
train
https://github.com/thunder-project/thunder-registration/blob/286f091e6c402d592e9686d4821e0fd80dbf86ec/registration/transforms.py#L36-L46
thunder-project/thunder-registration
registration/transforms.py
Displacement.compute
def compute(a, b): """ Compute an optimal displacement between two ndarrays. Finds the displacement between two ndimensional arrays. Arrays must be of the same size. Algorithm uses a cross correlation, computed efficiently through an n-dimensional fft. Parameters ...
python
def compute(a, b): """ Compute an optimal displacement between two ndarrays. Finds the displacement between two ndimensional arrays. Arrays must be of the same size. Algorithm uses a cross correlation, computed efficiently through an n-dimensional fft. Parameters ...
[ "def", "compute", "(", "a", ",", "b", ")", ":", "from", "numpy", ".", "fft", "import", "rfftn", ",", "irfftn", "from", "numpy", "import", "unravel_index", ",", "argmax", "# compute real-valued cross-correlation in fourier domain", "s", "=", "a", ".", "shape", ...
Compute an optimal displacement between two ndarrays. Finds the displacement between two ndimensional arrays. Arrays must be of the same size. Algorithm uses a cross correlation, computed efficiently through an n-dimensional fft. Parameters ---------- a : ndarray ...
[ "Compute", "an", "optimal", "displacement", "between", "two", "ndarrays", "." ]
train
https://github.com/thunder-project/thunder-registration/blob/286f091e6c402d592e9686d4821e0fd80dbf86ec/registration/transforms.py#L49-L82
thunder-project/thunder-registration
registration/transforms.py
LocalDisplacement.compute
def compute(a, b, axis): """ Finds optimal displacements localized along an axis """ delta = [] for aa, bb in zip(rollaxis(a, axis, 0), rollaxis(b, axis, 0)): delta.append(Displacement.compute(aa, bb).delta) return LocalDisplacement(delta, axis=axis)
python
def compute(a, b, axis): """ Finds optimal displacements localized along an axis """ delta = [] for aa, bb in zip(rollaxis(a, axis, 0), rollaxis(b, axis, 0)): delta.append(Displacement.compute(aa, bb).delta) return LocalDisplacement(delta, axis=axis)
[ "def", "compute", "(", "a", ",", "b", ",", "axis", ")", ":", "delta", "=", "[", "]", "for", "aa", ",", "bb", "in", "zip", "(", "rollaxis", "(", "a", ",", "axis", ",", "0", ")", ",", "rollaxis", "(", "b", ",", "axis", ",", "0", ")", ")", "...
Finds optimal displacements localized along an axis
[ "Finds", "optimal", "displacements", "localized", "along", "an", "axis" ]
train
https://github.com/thunder-project/thunder-registration/blob/286f091e6c402d592e9686d4821e0fd80dbf86ec/registration/transforms.py#L114-L121
thunder-project/thunder-registration
registration/transforms.py
LocalDisplacement.apply
def apply(self, im): """ Apply axis-localized displacements. Parameters ---------- im : ndarray The image or volume to shift """ from scipy.ndimage.interpolation import shift im = rollaxis(im, self.axis) im.setflags(write=True) ...
python
def apply(self, im): """ Apply axis-localized displacements. Parameters ---------- im : ndarray The image or volume to shift """ from scipy.ndimage.interpolation import shift im = rollaxis(im, self.axis) im.setflags(write=True) ...
[ "def", "apply", "(", "self", ",", "im", ")", ":", "from", "scipy", ".", "ndimage", ".", "interpolation", "import", "shift", "im", "=", "rollaxis", "(", "im", ",", "self", ".", "axis", ")", "im", ".", "setflags", "(", "write", "=", "True", ")", "for...
Apply axis-localized displacements. Parameters ---------- im : ndarray The image or volume to shift
[ "Apply", "axis", "-", "localized", "displacements", "." ]
train
https://github.com/thunder-project/thunder-registration/blob/286f091e6c402d592e9686d4821e0fd80dbf86ec/registration/transforms.py#L123-L139
flo-compbio/genometools
genometools/ncbi/geo/functions.py
write_sample_sheet
def write_sample_sheet(output_file, accessions, names, celfile_urls, sel=None): """Generate a sample sheet in tab-separated text format. The columns contain the following sample attributes: 1) accession 2) name 3) CEL file name 4) CEL file URL Parameters ---------- output_file: str...
python
def write_sample_sheet(output_file, accessions, names, celfile_urls, sel=None): """Generate a sample sheet in tab-separated text format. The columns contain the following sample attributes: 1) accession 2) name 3) CEL file name 4) CEL file URL Parameters ---------- output_file: str...
[ "def", "write_sample_sheet", "(", "output_file", ",", "accessions", ",", "names", ",", "celfile_urls", ",", "sel", "=", "None", ")", ":", "assert", "isinstance", "(", "output_file", ",", "str", ")", "assert", "isinstance", "(", "accessions", ",", "(", "list"...
Generate a sample sheet in tab-separated text format. The columns contain the following sample attributes: 1) accession 2) name 3) CEL file name 4) CEL file URL Parameters ---------- output_file: str The path of the output file. accessions: list or tuple of str The ...
[ "Generate", "a", "sample", "sheet", "in", "tab", "-", "separated", "text", "format", "." ]
train
https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/ncbi/geo/functions.py#L83-L137
acorg/dark-matter
dark/process.py
Executor.execute
def execute(self, command): """ Execute (or simulate) a command. Add to our log. @param command: Either a C{str} command (which will be passed to the shell) or a C{list} of command arguments (including the executable name), in which case the shell is not used. @r...
python
def execute(self, command): """ Execute (or simulate) a command. Add to our log. @param command: Either a C{str} command (which will be passed to the shell) or a C{list} of command arguments (including the executable name), in which case the shell is not used. @r...
[ "def", "execute", "(", "self", ",", "command", ")", ":", "if", "isinstance", "(", "command", ",", "six", ".", "string_types", ")", ":", "# Can't have newlines in a command given to the shell.", "strCommand", "=", "command", "=", "command", ".", "replace", "(", "...
Execute (or simulate) a command. Add to our log. @param command: Either a C{str} command (which will be passed to the shell) or a C{list} of command arguments (including the executable name), in which case the shell is not used. @return: A C{CompletedProcess} instance. This has ...
[ "Execute", "(", "or", "simulate", ")", "a", "command", ".", "Add", "to", "our", "log", "." ]
train
https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/process.py#L23-L79
acorg/dark-matter
dark/html.py
NCBISequenceLinkURL
def NCBISequenceLinkURL(title, default=None): """ Given a sequence title, like "gi|42768646|gb|AY516849.1| Homo sapiens", return the URL of a link to the info page at NCBI. title: the sequence title to produce a link URL for. default: the value to return if the title cannot be parsed. """ t...
python
def NCBISequenceLinkURL(title, default=None): """ Given a sequence title, like "gi|42768646|gb|AY516849.1| Homo sapiens", return the URL of a link to the info page at NCBI. title: the sequence title to produce a link URL for. default: the value to return if the title cannot be parsed. """ t...
[ "def", "NCBISequenceLinkURL", "(", "title", ",", "default", "=", "None", ")", ":", "try", ":", "ref", "=", "title", ".", "split", "(", "'|'", ")", "[", "3", "]", ".", "split", "(", "'.'", ")", "[", "0", "]", "except", "IndexError", ":", "return", ...
Given a sequence title, like "gi|42768646|gb|AY516849.1| Homo sapiens", return the URL of a link to the info page at NCBI. title: the sequence title to produce a link URL for. default: the value to return if the title cannot be parsed.
[ "Given", "a", "sequence", "title", "like", "gi|42768646|gb|AY516849", ".", "1|", "Homo", "sapiens", "return", "the", "URL", "of", "a", "link", "to", "the", "info", "page", "at", "NCBI", "." ]
train
https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/html.py#L8-L21
acorg/dark-matter
dark/html.py
NCBISequenceLink
def NCBISequenceLink(title, default=None): """ Given a sequence title, like "gi|42768646|gb|AY516849.1| Homo sapiens", return an HTML A tag dispalying a link to the info page at NCBI. title: the sequence title to produce an HTML link for. default: the value to return if the title cannot be parsed. ...
python
def NCBISequenceLink(title, default=None): """ Given a sequence title, like "gi|42768646|gb|AY516849.1| Homo sapiens", return an HTML A tag dispalying a link to the info page at NCBI. title: the sequence title to produce an HTML link for. default: the value to return if the title cannot be parsed. ...
[ "def", "NCBISequenceLink", "(", "title", ",", "default", "=", "None", ")", ":", "url", "=", "NCBISequenceLinkURL", "(", "title", ")", "if", "url", "is", "None", ":", "return", "default", "else", ":", "return", "'<a href=\"%s\" target=\"_blank\">%s</a>'", "%", ...
Given a sequence title, like "gi|42768646|gb|AY516849.1| Homo sapiens", return an HTML A tag dispalying a link to the info page at NCBI. title: the sequence title to produce an HTML link for. default: the value to return if the title cannot be parsed.
[ "Given", "a", "sequence", "title", "like", "gi|42768646|gb|AY516849", ".", "1|", "Homo", "sapiens", "return", "an", "HTML", "A", "tag", "dispalying", "a", "link", "to", "the", "info", "page", "at", "NCBI", "." ]
train
https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/html.py#L24-L36
acorg/dark-matter
dark/html.py
_sortHTML
def _sortHTML(titlesAlignments, by, limit=None): """ Return an C{IPython.display.HTML} object with the alignments sorted by the given attribute. @param titlesAlignments: A L{dark.titles.TitlesAlignments} instance. @param by: A C{str}, one of 'length', 'maxScore', 'medianScore', 'readCount',...
python
def _sortHTML(titlesAlignments, by, limit=None): """ Return an C{IPython.display.HTML} object with the alignments sorted by the given attribute. @param titlesAlignments: A L{dark.titles.TitlesAlignments} instance. @param by: A C{str}, one of 'length', 'maxScore', 'medianScore', 'readCount',...
[ "def", "_sortHTML", "(", "titlesAlignments", ",", "by", ",", "limit", "=", "None", ")", ":", "out", "=", "[", "]", "for", "i", ",", "title", "in", "enumerate", "(", "titlesAlignments", ".", "sortTitles", "(", "by", ")", ",", "start", "=", "1", ")", ...
Return an C{IPython.display.HTML} object with the alignments sorted by the given attribute. @param titlesAlignments: A L{dark.titles.TitlesAlignments} instance. @param by: A C{str}, one of 'length', 'maxScore', 'medianScore', 'readCount', or 'title'. @param limit: An C{int} limit on the number ...
[ "Return", "an", "C", "{", "IPython", ".", "display", ".", "HTML", "}", "object", "with", "the", "alignments", "sorted", "by", "the", "given", "attribute", "." ]
train
https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/html.py#L39-L63
acorg/dark-matter
dark/html.py
AlignmentPanelHTMLWriter._writeFASTA
def _writeFASTA(self, i, image): """ Write a FASTA file containing the set of reads that hit a sequence. @param i: The number of the image in self._images. @param image: A member of self._images. @return: A C{str}, either 'fasta' or 'fastq' indicating the format of t...
python
def _writeFASTA(self, i, image): """ Write a FASTA file containing the set of reads that hit a sequence. @param i: The number of the image in self._images. @param image: A member of self._images. @return: A C{str}, either 'fasta' or 'fastq' indicating the format of t...
[ "def", "_writeFASTA", "(", "self", ",", "i", ",", "image", ")", ":", "if", "isinstance", "(", "self", ".", "_titlesAlignments", ".", "readsAlignments", ".", "reads", ",", "FastqReads", ")", ":", "format_", "=", "'fastq'", "else", ":", "format_", "=", "'f...
Write a FASTA file containing the set of reads that hit a sequence. @param i: The number of the image in self._images. @param image: A member of self._images. @return: A C{str}, either 'fasta' or 'fastq' indicating the format of the reads in C{self._titlesAlignments}.
[ "Write", "a", "FASTA", "file", "containing", "the", "set", "of", "reads", "that", "hit", "a", "sequence", "." ]
train
https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/html.py#L274-L293
acorg/dark-matter
dark/html.py
AlignmentPanelHTMLWriter._writeFeatures
def _writeFeatures(self, i, image): """ Write a text file containing the features as a table. @param i: The number of the image in self._images. @param image: A member of self._images. @return: The C{str} features file name - just the base name, not including the pat...
python
def _writeFeatures(self, i, image): """ Write a text file containing the features as a table. @param i: The number of the image in self._images. @param image: A member of self._images. @return: The C{str} features file name - just the base name, not including the pat...
[ "def", "_writeFeatures", "(", "self", ",", "i", ",", "image", ")", ":", "basename", "=", "'features-%d.txt'", "%", "i", "filename", "=", "'%s/%s'", "%", "(", "self", ".", "_outputDir", ",", "basename", ")", "featureList", "=", "image", "[", "'graphInfo'", ...
Write a text file containing the features as a table. @param i: The number of the image in self._images. @param image: A member of self._images. @return: The C{str} features file name - just the base name, not including the path to the file.
[ "Write", "a", "text", "file", "containing", "the", "features", "as", "a", "table", "." ]
train
https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/html.py#L295-L310
kyegupov/py-unrar2
UnRAR2/windows.py
DosDateTimeToTimeTuple
def DosDateTimeToTimeTuple(dosDateTime): """Convert an MS-DOS format date time to a Python time tuple. """ dos_date = dosDateTime >> 16 dos_time = dosDateTime & 0xffff day = dos_date & 0x1f month = (dos_date >> 5) & 0xf year = 1980 + (dos_date >> 9) second = 2 * (dos_time & 0x1f) min...
python
def DosDateTimeToTimeTuple(dosDateTime): """Convert an MS-DOS format date time to a Python time tuple. """ dos_date = dosDateTime >> 16 dos_time = dosDateTime & 0xffff day = dos_date & 0x1f month = (dos_date >> 5) & 0xf year = 1980 + (dos_date >> 9) second = 2 * (dos_time & 0x1f) min...
[ "def", "DosDateTimeToTimeTuple", "(", "dosDateTime", ")", ":", "dos_date", "=", "dosDateTime", ">>", "16", "dos_time", "=", "dosDateTime", "&", "0xffff", "day", "=", "dos_date", "&", "0x1f", "month", "=", "(", "dos_date", ">>", "5", ")", "&", "0xf", "year"...
Convert an MS-DOS format date time to a Python time tuple.
[ "Convert", "an", "MS", "-", "DOS", "format", "date", "time", "to", "a", "Python", "time", "tuple", "." ]
train
https://github.com/kyegupov/py-unrar2/blob/186a4c1feb9ef3d96a2331f8fb3ebf88036e15e5/UnRAR2/windows.py#L150-L162
acorg/dark-matter
dark/blast/score.py
bitScoreToEValue
def bitScoreToEValue(bitScore, dbSize, dbSequenceCount, queryLength, lengthAdjustment): """ Convert a bit score to an e-value. @param bitScore: The C{float} bit score to convert. @param dbSize: The C{int} total size of the database (i.e., the sum of the lengths of all seque...
python
def bitScoreToEValue(bitScore, dbSize, dbSequenceCount, queryLength, lengthAdjustment): """ Convert a bit score to an e-value. @param bitScore: The C{float} bit score to convert. @param dbSize: The C{int} total size of the database (i.e., the sum of the lengths of all seque...
[ "def", "bitScoreToEValue", "(", "bitScore", ",", "dbSize", ",", "dbSequenceCount", ",", "queryLength", ",", "lengthAdjustment", ")", ":", "effectiveDbSize", "=", "(", "(", "dbSize", "-", "dbSequenceCount", "*", "lengthAdjustment", ")", "*", "(", "queryLength", "...
Convert a bit score to an e-value. @param bitScore: The C{float} bit score to convert. @param dbSize: The C{int} total size of the database (i.e., the sum of the lengths of all sequences in the BLAST database). @param dbSequenceCount: The C{int} number of sequences in the database. @param query...
[ "Convert", "a", "bit", "score", "to", "an", "e", "-", "value", "." ]
train
https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/blast/score.py#L24-L42
acorg/dark-matter
dark/blast/score.py
eValueToBitScore
def eValueToBitScore(eValue, dbSize, dbSequenceCount, queryLength, lengthAdjustment): """ Convert an e-value to a bit score. @param eValue: The C{float} e-value to convert. @param dbSize: The C{int} total size of the database (i.e., the sum of the lengths of all sequences i...
python
def eValueToBitScore(eValue, dbSize, dbSequenceCount, queryLength, lengthAdjustment): """ Convert an e-value to a bit score. @param eValue: The C{float} e-value to convert. @param dbSize: The C{int} total size of the database (i.e., the sum of the lengths of all sequences i...
[ "def", "eValueToBitScore", "(", "eValue", ",", "dbSize", ",", "dbSequenceCount", ",", "queryLength", ",", "lengthAdjustment", ")", ":", "effectiveDbSize", "=", "(", "(", "dbSize", "-", "dbSequenceCount", "*", "lengthAdjustment", ")", "*", "(", "queryLength", "-"...
Convert an e-value to a bit score. @param eValue: The C{float} e-value to convert. @param dbSize: The C{int} total size of the database (i.e., the sum of the lengths of all sequences in the BLAST database). @param dbSequenceCount: The C{int} number of sequences in the database. @param queryLeng...
[ "Convert", "an", "e", "-", "value", "to", "a", "bit", "score", "." ]
train
https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/blast/score.py#L45-L63
acorg/dark-matter
dark/btop.py
parseBtop
def parseBtop(btopString): """ Parse a BTOP string. The format is described at https://www.ncbi.nlm.nih.gov/books/NBK279682/ @param btopString: A C{str} BTOP sequence. @raise ValueError: If C{btopString} is not valid BTOP. @return: A generator that yields a series of integers and 2-tuples of ...
python
def parseBtop(btopString): """ Parse a BTOP string. The format is described at https://www.ncbi.nlm.nih.gov/books/NBK279682/ @param btopString: A C{str} BTOP sequence. @raise ValueError: If C{btopString} is not valid BTOP. @return: A generator that yields a series of integers and 2-tuples of ...
[ "def", "parseBtop", "(", "btopString", ")", ":", "isdigit", "=", "str", ".", "isdigit", "value", "=", "None", "queryLetter", "=", "None", "for", "offset", ",", "char", "in", "enumerate", "(", "btopString", ")", ":", "if", "isdigit", "(", "char", ")", "...
Parse a BTOP string. The format is described at https://www.ncbi.nlm.nih.gov/books/NBK279682/ @param btopString: A C{str} BTOP sequence. @raise ValueError: If C{btopString} is not valid BTOP. @return: A generator that yields a series of integers and 2-tuples of letters, as found in the BTOP st...
[ "Parse", "a", "BTOP", "string", "." ]
train
https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/btop.py#L5-L53
acorg/dark-matter
dark/btop.py
countGaps
def countGaps(btopString): """ Count the query and subject gaps in a BTOP string. @param btopString: A C{str} BTOP sequence. @raise ValueError: If L{parseBtop} finds an error in the BTOP string C{btopString}. @return: A 2-tuple of C{int}s, with the (query, subject) gaps counts as fo...
python
def countGaps(btopString): """ Count the query and subject gaps in a BTOP string. @param btopString: A C{str} BTOP sequence. @raise ValueError: If L{parseBtop} finds an error in the BTOP string C{btopString}. @return: A 2-tuple of C{int}s, with the (query, subject) gaps counts as fo...
[ "def", "countGaps", "(", "btopString", ")", ":", "queryGaps", "=", "subjectGaps", "=", "0", "for", "countOrMismatch", "in", "parseBtop", "(", "btopString", ")", ":", "if", "isinstance", "(", "countOrMismatch", ",", "tuple", ")", ":", "queryChar", ",", "subje...
Count the query and subject gaps in a BTOP string. @param btopString: A C{str} BTOP sequence. @raise ValueError: If L{parseBtop} finds an error in the BTOP string C{btopString}. @return: A 2-tuple of C{int}s, with the (query, subject) gaps counts as found in C{btopString}.
[ "Count", "the", "query", "and", "subject", "gaps", "in", "a", "BTOP", "string", "." ]
train
https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/btop.py#L56-L73
acorg/dark-matter
dark/btop.py
btop2cigar
def btop2cigar(btopString, concise=False, aa=False): """ Convert a BTOP string to a CIGAR string. @param btopString: A C{str} BTOP sequence. @param concise: If C{True}, use 'M' for matches and mismatches instead of the more specific 'X' and '='. @param aa: If C{True}, C{btopString} will be ...
python
def btop2cigar(btopString, concise=False, aa=False): """ Convert a BTOP string to a CIGAR string. @param btopString: A C{str} BTOP sequence. @param concise: If C{True}, use 'M' for matches and mismatches instead of the more specific 'X' and '='. @param aa: If C{True}, C{btopString} will be ...
[ "def", "btop2cigar", "(", "btopString", ",", "concise", "=", "False", ",", "aa", "=", "False", ")", ":", "if", "aa", "and", "concise", ":", "raise", "ValueError", "(", "'aa and concise cannot both be True'", ")", "result", "=", "[", "]", "thisLength", "=", ...
Convert a BTOP string to a CIGAR string. @param btopString: A C{str} BTOP sequence. @param concise: If C{True}, use 'M' for matches and mismatches instead of the more specific 'X' and '='. @param aa: If C{True}, C{btopString} will be interpreted as though it refers to amino acids (as in the...
[ "Convert", "a", "BTOP", "string", "to", "a", "CIGAR", "string", "." ]
train
https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/btop.py#L76-L142
Peter-Slump/django-dynamic-fixtures
src/dynamic_fixtures/management/commands/load_dynamic_fixtures.py
Command.progress_callback
def progress_callback(self, action, node, elapsed_time=None): """ Callback to report progress :param str action: :param list node: app, module :param int | None elapsed_time: """ if action == 'load_start': self.stdout.write('Loading fixture {}.{}...'....
python
def progress_callback(self, action, node, elapsed_time=None): """ Callback to report progress :param str action: :param list node: app, module :param int | None elapsed_time: """ if action == 'load_start': self.stdout.write('Loading fixture {}.{}...'....
[ "def", "progress_callback", "(", "self", ",", "action", ",", "node", ",", "elapsed_time", "=", "None", ")", ":", "if", "action", "==", "'load_start'", ":", "self", ".", "stdout", ".", "write", "(", "'Loading fixture {}.{}...'", ".", "format", "(", "*", "no...
Callback to report progress :param str action: :param list node: app, module :param int | None elapsed_time:
[ "Callback", "to", "report", "progress" ]
train
https://github.com/Peter-Slump/django-dynamic-fixtures/blob/da99b4b12b11be28ea4b36b6cf2896ca449c73c1/src/dynamic_fixtures/management/commands/load_dynamic_fixtures.py#L61-L78
flo-compbio/genometools
genometools/ontology/term.py
GOTerm.get_pretty_format
def get_pretty_format(self, include_id=True, max_name_length=0, abbreviate=True): """Returns a nicely formatted string with the GO term information. Parameters ---------- include_id: bool, optional Include the GO term ID. max_name_length: in...
python
def get_pretty_format(self, include_id=True, max_name_length=0, abbreviate=True): """Returns a nicely formatted string with the GO term information. Parameters ---------- include_id: bool, optional Include the GO term ID. max_name_length: in...
[ "def", "get_pretty_format", "(", "self", ",", "include_id", "=", "True", ",", "max_name_length", "=", "0", ",", "abbreviate", "=", "True", ")", ":", "name", "=", "self", ".", "name", "if", "abbreviate", ":", "for", "abb", "in", "self", ".", "_abbrev", ...
Returns a nicely formatted string with the GO term information. Parameters ---------- include_id: bool, optional Include the GO term ID. max_name_length: int, optional Truncate the formatted string so that its total length does not exceed this value. ...
[ "Returns", "a", "nicely", "formatted", "string", "with", "the", "GO", "term", "information", "." ]
train
https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/ontology/term.py#L196-L225
flo-compbio/genometools
genometools/expression/normalize.py
quantile_normalize
def quantile_normalize(matrix, inplace=False, target=None): """Quantile normalization, allowing for missing values (NaN). In case of nan values, this implementation will calculate evenly distributed quantiles and fill in the missing data with those values. Quantile normalization is then performed on th...
python
def quantile_normalize(matrix, inplace=False, target=None): """Quantile normalization, allowing for missing values (NaN). In case of nan values, this implementation will calculate evenly distributed quantiles and fill in the missing data with those values. Quantile normalization is then performed on th...
[ "def", "quantile_normalize", "(", "matrix", ",", "inplace", "=", "False", ",", "target", "=", "None", ")", ":", "assert", "isinstance", "(", "matrix", ",", "ExpMatrix", ")", "assert", "isinstance", "(", "inplace", ",", "bool", ")", "if", "target", "is", ...
Quantile normalization, allowing for missing values (NaN). In case of nan values, this implementation will calculate evenly distributed quantiles and fill in the missing data with those values. Quantile normalization is then performed on the filled-in matrix, and the nan values are restored afterwards....
[ "Quantile", "normalization", "allowing", "for", "missing", "values", "(", "NaN", ")", "." ]
train
https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/expression/normalize.py#L31-L106
acorg/dark-matter
dark/hsp.py
HSP.toDict
def toDict(self): """ Get information about the HSP as a dictionary. @return: A C{dict} representation of the HSP. """ result = _Base.toDict(self) result['score'] = self.score.score return result
python
def toDict(self): """ Get information about the HSP as a dictionary. @return: A C{dict} representation of the HSP. """ result = _Base.toDict(self) result['score'] = self.score.score return result
[ "def", "toDict", "(", "self", ")", ":", "result", "=", "_Base", ".", "toDict", "(", "self", ")", "result", "[", "'score'", "]", "=", "self", ".", "score", ".", "score", "return", "result" ]
Get information about the HSP as a dictionary. @return: A C{dict} representation of the HSP.
[ "Get", "information", "about", "the", "HSP", "as", "a", "dictionary", "." ]
train
https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/hsp.py#L133-L141
flo-compbio/genometools
genometools/ensembl/filter_fasta.py
get_argument_parser
def get_argument_parser(): """Returns an argument parser object for the script.""" desc = 'Filter FASTA file by chromosome names.' parser = cli.get_argument_parser(desc=desc) parser.add_argument( '-f', '--fasta-file', default='-', type=str, help=textwrap.dedent("""\ Path of the...
python
def get_argument_parser(): """Returns an argument parser object for the script.""" desc = 'Filter FASTA file by chromosome names.' parser = cli.get_argument_parser(desc=desc) parser.add_argument( '-f', '--fasta-file', default='-', type=str, help=textwrap.dedent("""\ Path of the...
[ "def", "get_argument_parser", "(", ")", ":", "desc", "=", "'Filter FASTA file by chromosome names.'", "parser", "=", "cli", ".", "get_argument_parser", "(", "desc", "=", "desc", ")", "parser", ".", "add_argument", "(", "'-f'", ",", "'--fasta-file'", ",", "default"...
Returns an argument parser object for the script.
[ "Returns", "an", "argument", "parser", "object", "for", "the", "script", "." ]
train
https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/ensembl/filter_fasta.py#L49-L84
flo-compbio/genometools
genometools/ensembl/filter_fasta.py
main
def main(args=None): """Script body.""" if args is None: # parse command-line arguments parser = get_argument_parser() args = parser.parse_args() fasta_file = args.fasta_file species = args.species chrom_pat = args.chromosome_pattern output_file = args.output_file ...
python
def main(args=None): """Script body.""" if args is None: # parse command-line arguments parser = get_argument_parser() args = parser.parse_args() fasta_file = args.fasta_file species = args.species chrom_pat = args.chromosome_pattern output_file = args.output_file ...
[ "def", "main", "(", "args", "=", "None", ")", ":", "if", "args", "is", "None", ":", "# parse command-line arguments ", "parser", "=", "get_argument_parser", "(", ")", "args", "=", "parser", ".", "parse_args", "(", ")", "fasta_file", "=", "args", ".", "fast...
Script body.
[ "Script", "body", "." ]
train
https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/ensembl/filter_fasta.py#L87-L139
openfisca/openfisca-web-api
openfisca_web_api/application.py
ensure_json_content_type
def ensure_json_content_type(req, app): """ ErrorMiddleware returns hard-coded content-type text/html. Here we force it to be application/json. """ res = req.get_response(app, catch_exc_info=True) res.content_type = 'application/json; charset=utf-8' return res
python
def ensure_json_content_type(req, app): """ ErrorMiddleware returns hard-coded content-type text/html. Here we force it to be application/json. """ res = req.get_response(app, catch_exc_info=True) res.content_type = 'application/json; charset=utf-8' return res
[ "def", "ensure_json_content_type", "(", "req", ",", "app", ")", ":", "res", "=", "req", ".", "get_response", "(", "app", ",", "catch_exc_info", "=", "True", ")", "res", ".", "content_type", "=", "'application/json; charset=utf-8'", "return", "res" ]
ErrorMiddleware returns hard-coded content-type text/html. Here we force it to be application/json.
[ "ErrorMiddleware", "returns", "hard", "-", "coded", "content", "-", "type", "text", "/", "html", ".", "Here", "we", "force", "it", "to", "be", "application", "/", "json", "." ]
train
https://github.com/openfisca/openfisca-web-api/blob/d1cd3bfacac338e80bb0df7e0465b65649dd893b/openfisca_web_api/application.py#L41-L48
openfisca/openfisca-web-api
openfisca_web_api/application.py
make_app
def make_app(global_conf, **app_conf): """Create a WSGI application and return it ``global_conf`` The inherited configuration for this application. Normally from the [DEFAULT] section of the Paste ini file. ``app_conf`` The application's local configuration. Normally specified in ...
python
def make_app(global_conf, **app_conf): """Create a WSGI application and return it ``global_conf`` The inherited configuration for this application. Normally from the [DEFAULT] section of the Paste ini file. ``app_conf`` The application's local configuration. Normally specified in ...
[ "def", "make_app", "(", "global_conf", ",", "*", "*", "app_conf", ")", ":", "# Configure the environment and fill conf dictionary.", "environment", ".", "load_environment", "(", "global_conf", ",", "app_conf", ")", "# Dispatch request to controllers.", "app", "=", "contro...
Create a WSGI application and return it ``global_conf`` The inherited configuration for this application. Normally from the [DEFAULT] section of the Paste ini file. ``app_conf`` The application's local configuration. Normally specified in the [app:<name>] section of the Paste i...
[ "Create", "a", "WSGI", "application", "and", "return", "it" ]
train
https://github.com/openfisca/openfisca-web-api/blob/d1cd3bfacac338e80bb0df7e0465b65649dd893b/openfisca_web_api/application.py#L58-L103
nkavaldj/myhdl_lib
myhdl_lib/fifo_speculative.py
fifo_speculative
def fifo_speculative(rst, clk, full, we, din, empty, re, dout, wr_commit=None, wr_discard=None, rd_commit=None, rd_discard=None, afull=None, aempty=None, count=None, afull_th=None, aempty_th=None, ovf=None, udf=None, count_max=None, depth=None, width=None): """ Speculative FIFO Input interface: full, we...
python
def fifo_speculative(rst, clk, full, we, din, empty, re, dout, wr_commit=None, wr_discard=None, rd_commit=None, rd_discard=None, afull=None, aempty=None, count=None, afull_th=None, aempty_th=None, ovf=None, udf=None, count_max=None, depth=None, width=None): """ Speculative FIFO Input interface: full, we...
[ "def", "fifo_speculative", "(", "rst", ",", "clk", ",", "full", ",", "we", ",", "din", ",", "empty", ",", "re", ",", "dout", ",", "wr_commit", "=", "None", ",", "wr_discard", "=", "None", ",", "rd_commit", "=", "None", ",", "rd_discard", "=", "None",...
Speculative FIFO Input interface: full, we, din, wr_commit, wr_discard Output interface: empty, re, dout, rd_commit, rd_discard we (i) - writes data speculatively (the data can be later removed from the fifo) wr_commit (i) - accept the speculatively written data (can be rea...
[ "Speculative", "FIFO" ]
train
https://github.com/nkavaldj/myhdl_lib/blob/9902afd2031e7847373f692821b2135fd0810aa8/myhdl_lib/fifo_speculative.py#L6-L301
acorg/dark-matter
dark/dimension.py
dimensionalIterator
def dimensionalIterator(dimensions, maxItems=-1): """ Given a list of n positive integers, return a generator that yields n-tuples of coordinates to 'fill' the dimensions. This is like an odometer in a car, but the dimensions do not each have to be 10. For example: dimensionalIterator((2, 3)) will ...
python
def dimensionalIterator(dimensions, maxItems=-1): """ Given a list of n positive integers, return a generator that yields n-tuples of coordinates to 'fill' the dimensions. This is like an odometer in a car, but the dimensions do not each have to be 10. For example: dimensionalIterator((2, 3)) will ...
[ "def", "dimensionalIterator", "(", "dimensions", ",", "maxItems", "=", "-", "1", ")", ":", "nDimensions", "=", "len", "(", "dimensions", ")", "if", "nDimensions", "==", "0", "or", "maxItems", "==", "0", ":", "return", "if", "any", "(", "map", "(", "lam...
Given a list of n positive integers, return a generator that yields n-tuples of coordinates to 'fill' the dimensions. This is like an odometer in a car, but the dimensions do not each have to be 10. For example: dimensionalIterator((2, 3)) will yield in order (0, 0), (0, 1), (0, 2), (1, 0), (1, 1), (1,...
[ "Given", "a", "list", "of", "n", "positive", "integers", "return", "a", "generator", "that", "yields", "n", "-", "tuples", "of", "coordinates", "to", "fill", "the", "dimensions", ".", "This", "is", "like", "an", "odometer", "in", "a", "car", "but", "the"...
train
https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/dimension.py#L1-L34
acorg/dark-matter
dark/dna.py
matchToString
def matchToString(dnaMatch, read1, read2, matchAmbiguous=True, indent='', offsets=None): """ Format a DNA match as a string. @param dnaMatch: A C{dict} returned by C{compareDNAReads}. @param read1: A C{Read} instance or an instance of one of its subclasses. @param read2: A C{Read}...
python
def matchToString(dnaMatch, read1, read2, matchAmbiguous=True, indent='', offsets=None): """ Format a DNA match as a string. @param dnaMatch: A C{dict} returned by C{compareDNAReads}. @param read1: A C{Read} instance or an instance of one of its subclasses. @param read2: A C{Read}...
[ "def", "matchToString", "(", "dnaMatch", ",", "read1", ",", "read2", ",", "matchAmbiguous", "=", "True", ",", "indent", "=", "''", ",", "offsets", "=", "None", ")", ":", "match", "=", "dnaMatch", "[", "'match'", "]", "identicalMatchCount", "=", "match", ...
Format a DNA match as a string. @param dnaMatch: A C{dict} returned by C{compareDNAReads}. @param read1: A C{Read} instance or an instance of one of its subclasses. @param read2: A C{Read} instance or an instance of one of its subclasses. @param matchAmbiguous: If C{True}, ambiguous nucleotides that ar...
[ "Format", "a", "DNA", "match", "as", "a", "string", "." ]
train
https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/dna.py#L39-L110
acorg/dark-matter
dark/dna.py
compareDNAReads
def compareDNAReads(read1, read2, matchAmbiguous=True, gapChars='-', offsets=None): """ Compare two DNA sequences. @param read1: A C{Read} instance or an instance of one of its subclasses. @param read2: A C{Read} instance or an instance of one of its subclasses. @param matchAmbi...
python
def compareDNAReads(read1, read2, matchAmbiguous=True, gapChars='-', offsets=None): """ Compare two DNA sequences. @param read1: A C{Read} instance or an instance of one of its subclasses. @param read2: A C{Read} instance or an instance of one of its subclasses. @param matchAmbi...
[ "def", "compareDNAReads", "(", "read1", ",", "read2", ",", "matchAmbiguous", "=", "True", ",", "gapChars", "=", "'-'", ",", "offsets", "=", "None", ")", ":", "identicalMatchCount", "=", "ambiguousMatchCount", "=", "0", "gapMismatchCount", "=", "nonGapMismatchCou...
Compare two DNA sequences. @param read1: A C{Read} instance or an instance of one of its subclasses. @param read2: A C{Read} instance or an instance of one of its subclasses. @param matchAmbiguous: If C{True}, count ambiguous nucleotides that are possibly correct as actually being correct, and scor...
[ "Compare", "two", "DNA", "sequences", "." ]
train
https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/dna.py#L113-L220
acorg/dark-matter
dark/dna.py
findKozakConsensus
def findKozakConsensus(read): """ In a given DNA sequence, search for a Kozak consensus: (gcc)gccRccATGG. The upper case bases in that pattern are required, and the lower case bases are the ones most frequently found at the given positions. The initial 'gcc' sequence (in parentheses) is of uncertain...
python
def findKozakConsensus(read): """ In a given DNA sequence, search for a Kozak consensus: (gcc)gccRccATGG. The upper case bases in that pattern are required, and the lower case bases are the ones most frequently found at the given positions. The initial 'gcc' sequence (in parentheses) is of uncertain...
[ "def", "findKozakConsensus", "(", "read", ")", ":", "readLen", "=", "len", "(", "read", ")", "if", "readLen", ">", "9", ":", "offset", "=", "6", "readSeq", "=", "read", ".", "sequence", "while", "offset", "<", "readLen", "-", "3", ":", "triplet", "="...
In a given DNA sequence, search for a Kozak consensus: (gcc)gccRccATGG. The upper case bases in that pattern are required, and the lower case bases are the ones most frequently found at the given positions. The initial 'gcc' sequence (in parentheses) is of uncertain significance and is not taken into ac...
[ "In", "a", "given", "DNA", "sequence", "search", "for", "a", "Kozak", "consensus", ":", "(", "gcc", ")", "gccRccATGG", ".", "The", "upper", "case", "bases", "in", "that", "pattern", "are", "required", "and", "the", "lower", "case", "bases", "are", "the",...
train
https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/dna.py#L223-L253
acorg/dark-matter
bin/check-fasta-json-blast-consistency.py
check
def check(fastaFile, jsonFiles): """ Check for simple consistency between the FASTA file and the JSON files. Note that some checking is already performed by the BlastReadsAlignments class. That includes checking the number of reads matches the number of BLAST records and that read ids and BLAST rec...
python
def check(fastaFile, jsonFiles): """ Check for simple consistency between the FASTA file and the JSON files. Note that some checking is already performed by the BlastReadsAlignments class. That includes checking the number of reads matches the number of BLAST records and that read ids and BLAST rec...
[ "def", "check", "(", "fastaFile", ",", "jsonFiles", ")", ":", "reads", "=", "FastaReads", "(", "fastaFile", ")", "readsAlignments", "=", "BlastReadsAlignments", "(", "reads", ",", "jsonFiles", ")", "for", "index", ",", "readAlignments", "in", "enumerate", "(",...
Check for simple consistency between the FASTA file and the JSON files. Note that some checking is already performed by the BlastReadsAlignments class. That includes checking the number of reads matches the number of BLAST records and that read ids and BLAST record read ids match. @param jsonFiles: A ...
[ "Check", "for", "simple", "consistency", "between", "the", "FASTA", "file", "and", "the", "JSON", "files", "." ]
train
https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/bin/check-fasta-json-blast-consistency.py#L19-L62
acorg/dark-matter
bin/fasta-identity-table.py
thresholdForIdentity
def thresholdForIdentity(identity, colors): """ Get the best identity threshold for a specific identity value. @param identity: A C{float} nucleotide identity. @param colors: A C{list} of (threshold, color) tuples, where threshold is a C{float} and color is a C{str} to be used as a cell backgro...
python
def thresholdForIdentity(identity, colors): """ Get the best identity threshold for a specific identity value. @param identity: A C{float} nucleotide identity. @param colors: A C{list} of (threshold, color) tuples, where threshold is a C{float} and color is a C{str} to be used as a cell backgro...
[ "def", "thresholdForIdentity", "(", "identity", ",", "colors", ")", ":", "for", "threshold", ",", "_", "in", "colors", ":", "if", "identity", ">=", "threshold", ":", "return", "threshold", "raise", "ValueError", "(", "'This should never happen! Last threshold is not...
Get the best identity threshold for a specific identity value. @param identity: A C{float} nucleotide identity. @param colors: A C{list} of (threshold, color) tuples, where threshold is a C{float} and color is a C{str} to be used as a cell background. This is as returned by C{parseColors}. ...
[ "Get", "the", "best", "identity", "threshold", "for", "a", "specific", "identity", "value", "." ]
train
https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/bin/fasta-identity-table.py#L29-L43
acorg/dark-matter
bin/fasta-identity-table.py
parseColors
def parseColors(colors, defaultColor): """ Parse command line color information. @param colors: A C{list} of space separated "value color" strings, such as ["0.9 red", "0.75 rgb(23, 190, 207)", "0.1 #CF3CF3"]. @param defaultColor: The C{str} color to use for cells that do not reach the ...
python
def parseColors(colors, defaultColor): """ Parse command line color information. @param colors: A C{list} of space separated "value color" strings, such as ["0.9 red", "0.75 rgb(23, 190, 207)", "0.1 #CF3CF3"]. @param defaultColor: The C{str} color to use for cells that do not reach the ...
[ "def", "parseColors", "(", "colors", ",", "defaultColor", ")", ":", "result", "=", "[", "]", "if", "colors", ":", "for", "colorInfo", "in", "colors", ":", "fields", "=", "colorInfo", ".", "split", "(", "maxsplit", "=", "1", ")", "if", "len", "(", "fi...
Parse command line color information. @param colors: A C{list} of space separated "value color" strings, such as ["0.9 red", "0.75 rgb(23, 190, 207)", "0.1 #CF3CF3"]. @param defaultColor: The C{str} color to use for cells that do not reach the identity fraction threshold of any color in C{color...
[ "Parse", "command", "line", "color", "information", "." ]
train
https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/bin/fasta-identity-table.py#L46-L92
acorg/dark-matter
bin/fasta-identity-table.py
getReadLengths
def getReadLengths(reads, gapChars): """ Get all read lengths, excluding gap characters. @param reads: A C{Reads} instance. @param gapChars: A C{str} of sequence characters considered to be gaps. @return: A C{dict} keyed by read id, with C{int} length values. """ gapChars = set(gapChars) ...
python
def getReadLengths(reads, gapChars): """ Get all read lengths, excluding gap characters. @param reads: A C{Reads} instance. @param gapChars: A C{str} of sequence characters considered to be gaps. @return: A C{dict} keyed by read id, with C{int} length values. """ gapChars = set(gapChars) ...
[ "def", "getReadLengths", "(", "reads", ",", "gapChars", ")", ":", "gapChars", "=", "set", "(", "gapChars", ")", "result", "=", "{", "}", "for", "read", "in", "reads", ":", "result", "[", "read", ".", "id", "]", "=", "len", "(", "read", ")", "-", ...
Get all read lengths, excluding gap characters. @param reads: A C{Reads} instance. @param gapChars: A C{str} of sequence characters considered to be gaps. @return: A C{dict} keyed by read id, with C{int} length values.
[ "Get", "all", "read", "lengths", "excluding", "gap", "characters", "." ]
train
https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/bin/fasta-identity-table.py#L95-L108
acorg/dark-matter
bin/fasta-identity-table.py
explanation
def explanation(matchAmbiguous, concise, showLengths, showGaps, showNs): """ Make an explanation of the output HTML table. @param matchAmbiguous: If C{True}, count ambiguous nucleotides that are possibly correct as actually being correct. Otherwise, we are strict and insist that only non-am...
python
def explanation(matchAmbiguous, concise, showLengths, showGaps, showNs): """ Make an explanation of the output HTML table. @param matchAmbiguous: If C{True}, count ambiguous nucleotides that are possibly correct as actually being correct. Otherwise, we are strict and insist that only non-am...
[ "def", "explanation", "(", "matchAmbiguous", ",", "concise", ",", "showLengths", ",", "showGaps", ",", "showNs", ")", ":", "result", "=", "[", "\"\"\"\n<h1>Sequence versus sequence identity table</h1>\n\n<p>\n\nThe table cells below show the nucleotide identity fraction for the seq...
Make an explanation of the output HTML table. @param matchAmbiguous: If C{True}, count ambiguous nucleotides that are possibly correct as actually being correct. Otherwise, we are strict and insist that only non-ambiguous nucleotides can contribute to the matching nucleotide count. @par...
[ "Make", "an", "explanation", "of", "the", "output", "HTML", "table", "." ]
train
https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/bin/fasta-identity-table.py#L111-L179
acorg/dark-matter
bin/fasta-identity-table.py
collectData
def collectData(reads1, reads2, square, matchAmbiguous): """ Get pairwise matching statistics for two sets of reads. @param reads1: An C{OrderedDict} of C{str} read ids whose values are C{Read} instances. These will be the rows of the table. @param reads2: An C{OrderedDict} of C{str} read ids w...
python
def collectData(reads1, reads2, square, matchAmbiguous): """ Get pairwise matching statistics for two sets of reads. @param reads1: An C{OrderedDict} of C{str} read ids whose values are C{Read} instances. These will be the rows of the table. @param reads2: An C{OrderedDict} of C{str} read ids w...
[ "def", "collectData", "(", "reads1", ",", "reads2", ",", "square", ",", "matchAmbiguous", ")", ":", "result", "=", "defaultdict", "(", "dict", ")", "for", "id1", ",", "read1", "in", "reads1", ".", "items", "(", ")", ":", "for", "id2", ",", "read2", "...
Get pairwise matching statistics for two sets of reads. @param reads1: An C{OrderedDict} of C{str} read ids whose values are C{Read} instances. These will be the rows of the table. @param reads2: An C{OrderedDict} of C{str} read ids whose values are C{Read} instances. These will be the columns ...
[ "Get", "pairwise", "matching", "statistics", "for", "two", "sets", "of", "reads", "." ]
train
https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/bin/fasta-identity-table.py#L182-L208
acorg/dark-matter
bin/fasta-identity-table.py
simpleTable
def simpleTable(tableData, reads1, reads2, square, matchAmbiguous, gapChars): """ Make a text table showing inter-sequence distances. @param tableData: A C{defaultdict(dict)} keyed by read ids, whose values are the dictionaries returned by compareDNAReads. @param reads1: An C{OrderedDict} of C{...
python
def simpleTable(tableData, reads1, reads2, square, matchAmbiguous, gapChars): """ Make a text table showing inter-sequence distances. @param tableData: A C{defaultdict(dict)} keyed by read ids, whose values are the dictionaries returned by compareDNAReads. @param reads1: An C{OrderedDict} of C{...
[ "def", "simpleTable", "(", "tableData", ",", "reads1", ",", "reads2", ",", "square", ",", "matchAmbiguous", ",", "gapChars", ")", ":", "readLengths1", "=", "getReadLengths", "(", "reads1", ".", "values", "(", ")", ",", "gapChars", ")", "print", "(", "'ID\\...
Make a text table showing inter-sequence distances. @param tableData: A C{defaultdict(dict)} keyed by read ids, whose values are the dictionaries returned by compareDNAReads. @param reads1: An C{OrderedDict} of C{str} read ids whose values are C{Read} instances. These will be the rows of the ta...
[ "Make", "a", "text", "table", "showing", "inter", "-", "sequence", "distances", "." ]
train
https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/bin/fasta-identity-table.py#L211-L246
acorg/dark-matter
bin/fasta-identity-table.py
htmlTable
def htmlTable(tableData, reads1, reads2, square, matchAmbiguous, colors, concise=False, showLengths=False, showGaps=False, showNs=False, footer=False, div=False, gapChars='-'): """ Make an HTML table showing inter-sequence distances. @param tableData: A C{defaultdict(dict)} keye...
python
def htmlTable(tableData, reads1, reads2, square, matchAmbiguous, colors, concise=False, showLengths=False, showGaps=False, showNs=False, footer=False, div=False, gapChars='-'): """ Make an HTML table showing inter-sequence distances. @param tableData: A C{defaultdict(dict)} keye...
[ "def", "htmlTable", "(", "tableData", ",", "reads1", ",", "reads2", ",", "square", ",", "matchAmbiguous", ",", "colors", ",", "concise", "=", "False", ",", "showLengths", "=", "False", ",", "showGaps", "=", "False", ",", "showNs", "=", "False", ",", "foo...
Make an HTML table showing inter-sequence distances. @param tableData: A C{defaultdict(dict)} keyed by read ids, whose values are the dictionaries returned by compareDNAReads. @param reads1: An C{OrderedDict} of C{str} read ids whose values are C{Read} instances. These will be the rows of the t...
[ "Make", "an", "HTML", "table", "showing", "inter", "-", "sequence", "distances", "." ]
train
https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/bin/fasta-identity-table.py#L249-L434
invenia/Arbiter
arbiter/task.py
create_task
def create_task(function, *args, **kwargs): """ Create a task object name: The name of the task. function: The actual task function. It should take no arguments, and return a False-y value if it fails. dependencies: (optional, ()) Any dependencies that this task relies on. """ ...
python
def create_task(function, *args, **kwargs): """ Create a task object name: The name of the task. function: The actual task function. It should take no arguments, and return a False-y value if it fails. dependencies: (optional, ()) Any dependencies that this task relies on. """ ...
[ "def", "create_task", "(", "function", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "name", "=", "\"{}\"", ".", "format", "(", "uuid4", "(", ")", ")", "handler", "=", "None", "deps", "=", "set", "(", ")", "if", "'name'", "in", "kwargs", "...
Create a task object name: The name of the task. function: The actual task function. It should take no arguments, and return a False-y value if it fails. dependencies: (optional, ()) Any dependencies that this task relies on.
[ "Create", "a", "task", "object", "name", ":", "The", "name", "of", "the", "task", ".", "function", ":", "The", "actual", "task", "function", ".", "It", "should", "take", "no", "arguments", "and", "return", "a", "False", "-", "y", "value", "if", "it", ...
train
https://github.com/invenia/Arbiter/blob/51008393ae8797da85bcd67807259a157f941dfd/arbiter/task.py#L14-L50
nkavaldj/myhdl_lib
myhdl_lib/handshake.py
hs_join
def hs_join(ls_hsi, hso): """ [Many-to-one] Synchronizes (joins) a list of input handshake interfaces: output is ready when ALL inputs are ready ls_hsi - (i) list of input handshake tuples (ready, valid) hso - (o) an output handshake tuple (ready, valid) """ N = len(ls_hsi) ls...
python
def hs_join(ls_hsi, hso): """ [Many-to-one] Synchronizes (joins) a list of input handshake interfaces: output is ready when ALL inputs are ready ls_hsi - (i) list of input handshake tuples (ready, valid) hso - (o) an output handshake tuple (ready, valid) """ N = len(ls_hsi) ls...
[ "def", "hs_join", "(", "ls_hsi", ",", "hso", ")", ":", "N", "=", "len", "(", "ls_hsi", ")", "ls_hsi_rdy", ",", "ls_hsi_vld", "=", "zip", "(", "*", "ls_hsi", ")", "ls_hsi_rdy", ",", "ls_hsi_vld", "=", "list", "(", "ls_hsi_rdy", ")", ",", "list", "(", ...
[Many-to-one] Synchronizes (joins) a list of input handshake interfaces: output is ready when ALL inputs are ready ls_hsi - (i) list of input handshake tuples (ready, valid) hso - (o) an output handshake tuple (ready, valid)
[ "[", "Many", "-", "to", "-", "one", "]", "Synchronizes", "(", "joins", ")", "a", "list", "of", "input", "handshake", "interfaces", ":", "output", "is", "ready", "when", "ALL", "inputs", "are", "ready", "ls_hsi", "-", "(", "i", ")", "list", "of", "inp...
train
https://github.com/nkavaldj/myhdl_lib/blob/9902afd2031e7847373f692821b2135fd0810aa8/myhdl_lib/handshake.py#L63-L82
nkavaldj/myhdl_lib
myhdl_lib/handshake.py
hs_fork
def hs_fork(hsi, ls_hso): """ [One-to-many] Synchronizes (forks) to a list of output handshake interfaces: input is ready when ALL outputs are ready hsi - (i) input handshake tuple (ready, valid) ls_hso - (o) list of output handshake tuples (ready, valid) """ N = len(ls_hso) h...
python
def hs_fork(hsi, ls_hso): """ [One-to-many] Synchronizes (forks) to a list of output handshake interfaces: input is ready when ALL outputs are ready hsi - (i) input handshake tuple (ready, valid) ls_hso - (o) list of output handshake tuples (ready, valid) """ N = len(ls_hso) h...
[ "def", "hs_fork", "(", "hsi", ",", "ls_hso", ")", ":", "N", "=", "len", "(", "ls_hso", ")", "hsi_rdy", ",", "hsi_vld", "=", "hsi", "ls_hso_rdy", ",", "ls_hso_vld", "=", "zip", "(", "*", "ls_hso", ")", "ls_hso_rdy", ",", "ls_hso_vld", "=", "list", "("...
[One-to-many] Synchronizes (forks) to a list of output handshake interfaces: input is ready when ALL outputs are ready hsi - (i) input handshake tuple (ready, valid) ls_hso - (o) list of output handshake tuples (ready, valid)
[ "[", "One", "-", "to", "-", "many", "]", "Synchronizes", "(", "forks", ")", "to", "a", "list", "of", "output", "handshake", "interfaces", ":", "input", "is", "ready", "when", "ALL", "outputs", "are", "ready", "hsi", "-", "(", "i", ")", "input", "hand...
train
https://github.com/nkavaldj/myhdl_lib/blob/9902afd2031e7847373f692821b2135fd0810aa8/myhdl_lib/handshake.py#L85-L104
nkavaldj/myhdl_lib
myhdl_lib/handshake.py
hs_mux
def hs_mux(sel, ls_hsi, hso): """ [Many-to-one] Multiplexes a list of input handshake interfaces sel - (i) selects an input handshake interface to be connected to the output ls_hsi - (i) list of input handshake tuples (ready, valid) hso - (o) output handshake tuple (ready, ...
python
def hs_mux(sel, ls_hsi, hso): """ [Many-to-one] Multiplexes a list of input handshake interfaces sel - (i) selects an input handshake interface to be connected to the output ls_hsi - (i) list of input handshake tuples (ready, valid) hso - (o) output handshake tuple (ready, ...
[ "def", "hs_mux", "(", "sel", ",", "ls_hsi", ",", "hso", ")", ":", "N", "=", "len", "(", "ls_hsi", ")", "ls_hsi_rdy", ",", "ls_hsi_vld", "=", "zip", "(", "*", "ls_hsi", ")", "ls_hsi_rdy", ",", "ls_hsi_vld", "=", "list", "(", "ls_hsi_rdy", ")", ",", ...
[Many-to-one] Multiplexes a list of input handshake interfaces sel - (i) selects an input handshake interface to be connected to the output ls_hsi - (i) list of input handshake tuples (ready, valid) hso - (o) output handshake tuple (ready, valid)
[ "[", "Many", "-", "to", "-", "one", "]", "Multiplexes", "a", "list", "of", "input", "handshake", "interfaces", "sel", "-", "(", "i", ")", "selects", "an", "input", "handshake", "interface", "to", "be", "connected", "to", "the", "output", "ls_hsi", "-", ...
train
https://github.com/nkavaldj/myhdl_lib/blob/9902afd2031e7847373f692821b2135fd0810aa8/myhdl_lib/handshake.py#L107-L127
nkavaldj/myhdl_lib
myhdl_lib/handshake.py
hs_demux
def hs_demux(sel, hsi, ls_hso): """ [One-to-many] Demultiplexes to a list of output handshake interfaces sel - (i) selects an output handshake interface to connect to the input hsi - (i) input handshake tuple (ready, valid) ls_hso - (o) list of output handshake tuples (read...
python
def hs_demux(sel, hsi, ls_hso): """ [One-to-many] Demultiplexes to a list of output handshake interfaces sel - (i) selects an output handshake interface to connect to the input hsi - (i) input handshake tuple (ready, valid) ls_hso - (o) list of output handshake tuples (read...
[ "def", "hs_demux", "(", "sel", ",", "hsi", ",", "ls_hso", ")", ":", "N", "=", "len", "(", "ls_hso", ")", "hsi_rdy", ",", "hsi_vld", "=", "hsi", "ls_hso_rdy", ",", "ls_hso_vld", "=", "zip", "(", "*", "ls_hso", ")", "ls_hso_rdy", ",", "ls_hso_vld", "="...
[One-to-many] Demultiplexes to a list of output handshake interfaces sel - (i) selects an output handshake interface to connect to the input hsi - (i) input handshake tuple (ready, valid) ls_hso - (o) list of output handshake tuples (ready, valid)
[ "[", "One", "-", "to", "-", "many", "]", "Demultiplexes", "to", "a", "list", "of", "output", "handshake", "interfaces", "sel", "-", "(", "i", ")", "selects", "an", "output", "handshake", "interface", "to", "connect", "to", "the", "input", "hsi", "-", "...
train
https://github.com/nkavaldj/myhdl_lib/blob/9902afd2031e7847373f692821b2135fd0810aa8/myhdl_lib/handshake.py#L130-L150
nkavaldj/myhdl_lib
myhdl_lib/handshake.py
hs_arbmux
def hs_arbmux(rst, clk, ls_hsi, hso, sel, ARBITER_TYPE="priority"): """ [Many-to-one] Arbitrates a list of input handshake interfaces. Selects one of the active input interfaces and connects it to the output. Active input is an input interface with asserted "valid" signal ls_hsi - (i) li...
python
def hs_arbmux(rst, clk, ls_hsi, hso, sel, ARBITER_TYPE="priority"): """ [Many-to-one] Arbitrates a list of input handshake interfaces. Selects one of the active input interfaces and connects it to the output. Active input is an input interface with asserted "valid" signal ls_hsi - (i) li...
[ "def", "hs_arbmux", "(", "rst", ",", "clk", ",", "ls_hsi", ",", "hso", ",", "sel", ",", "ARBITER_TYPE", "=", "\"priority\"", ")", ":", "N", "=", "len", "(", "ls_hsi", ")", "ls_hsi_rdy", ",", "ls_hsi_vld", "=", "zip", "(", "*", "ls_hsi", ")", "ls_hsi_...
[Many-to-one] Arbitrates a list of input handshake interfaces. Selects one of the active input interfaces and connects it to the output. Active input is an input interface with asserted "valid" signal ls_hsi - (i) list of input handshake tuples (ready, valid) hso - (o) output ...
[ "[", "Many", "-", "to", "-", "one", "]", "Arbitrates", "a", "list", "of", "input", "handshake", "interfaces", ".", "Selects", "one", "of", "the", "active", "input", "interfaces", "and", "connects", "it", "to", "the", "output", ".", "Active", "input", "is...
train
https://github.com/nkavaldj/myhdl_lib/blob/9902afd2031e7847373f692821b2135fd0810aa8/myhdl_lib/handshake.py#L153-L189
nkavaldj/myhdl_lib
myhdl_lib/handshake.py
hs_arbdemux
def hs_arbdemux(rst, clk, hsi, ls_hso, sel, ARBITER_TYPE="priority"): """ [One-to-many] Arbitrates a list output handshake interfaces Selects one of the active output interfaces and connects it to the input. Active is an output interface with asserted "ready" signal hsi - (i) input ha...
python
def hs_arbdemux(rst, clk, hsi, ls_hso, sel, ARBITER_TYPE="priority"): """ [One-to-many] Arbitrates a list output handshake interfaces Selects one of the active output interfaces and connects it to the input. Active is an output interface with asserted "ready" signal hsi - (i) input ha...
[ "def", "hs_arbdemux", "(", "rst", ",", "clk", ",", "hsi", ",", "ls_hso", ",", "sel", ",", "ARBITER_TYPE", "=", "\"priority\"", ")", ":", "N", "=", "len", "(", "ls_hso", ")", "ls_hso_rdy", ",", "ls_hso_vld", "=", "zip", "(", "*", "ls_hso", ")", "ls_hs...
[One-to-many] Arbitrates a list output handshake interfaces Selects one of the active output interfaces and connects it to the input. Active is an output interface with asserted "ready" signal hsi - (i) input handshake tuple (ready, valid) ls_hso - (o) list of output handshake...
[ "[", "One", "-", "to", "-", "many", "]", "Arbitrates", "a", "list", "output", "handshake", "interfaces", "Selects", "one", "of", "the", "active", "output", "interfaces", "and", "connects", "it", "to", "the", "input", ".", "Active", "is", "an", "output", ...
train
https://github.com/nkavaldj/myhdl_lib/blob/9902afd2031e7847373f692821b2135fd0810aa8/myhdl_lib/handshake.py#L192-L227
flo-compbio/genometools
genometools/misc/functions.py
get_file_md5sum
def get_file_md5sum(path): """Calculate the MD5 hash for a file.""" with open(path, 'rb') as fh: h = str(hashlib.md5(fh.read()).hexdigest()) return h
python
def get_file_md5sum(path): """Calculate the MD5 hash for a file.""" with open(path, 'rb') as fh: h = str(hashlib.md5(fh.read()).hexdigest()) return h
[ "def", "get_file_md5sum", "(", "path", ")", ":", "with", "open", "(", "path", ",", "'rb'", ")", "as", "fh", ":", "h", "=", "str", "(", "hashlib", ".", "md5", "(", "fh", ".", "read", "(", ")", ")", ".", "hexdigest", "(", ")", ")", "return", "h" ...
Calculate the MD5 hash for a file.
[ "Calculate", "the", "MD5", "hash", "for", "a", "file", "." ]
train
https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/misc/functions.py#L65-L69
flo-compbio/genometools
genometools/misc/functions.py
smart_open_read
def smart_open_read(path=None, mode='rb', encoding=None, try_gzip=False): """Open a file for reading or return ``stdin``. Adapted from StackOverflow user "Wolph" (http://stackoverflow.com/a/17603000). """ assert mode in ('r', 'rb') assert path is None or isinstance(path, (str, _oldstr)) ass...
python
def smart_open_read(path=None, mode='rb', encoding=None, try_gzip=False): """Open a file for reading or return ``stdin``. Adapted from StackOverflow user "Wolph" (http://stackoverflow.com/a/17603000). """ assert mode in ('r', 'rb') assert path is None or isinstance(path, (str, _oldstr)) ass...
[ "def", "smart_open_read", "(", "path", "=", "None", ",", "mode", "=", "'rb'", ",", "encoding", "=", "None", ",", "try_gzip", "=", "False", ")", ":", "assert", "mode", "in", "(", "'r'", ",", "'rb'", ")", "assert", "path", "is", "None", "or", "isinstan...
Open a file for reading or return ``stdin``. Adapted from StackOverflow user "Wolph" (http://stackoverflow.com/a/17603000).
[ "Open", "a", "file", "for", "reading", "or", "return", "stdin", "." ]
train
https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/misc/functions.py#L73-L129
flo-compbio/genometools
genometools/misc/functions.py
smart_open_write
def smart_open_write(path=None, mode='wb', encoding=None): """Open a file for writing or return ``stdout``. Adapted from StackOverflow user "Wolph" (http://stackoverflow.com/a/17603000). """ if path is not None: # open a file fh = io.open(path, mode=mode, encoding=encoding) else...
python
def smart_open_write(path=None, mode='wb', encoding=None): """Open a file for writing or return ``stdout``. Adapted from StackOverflow user "Wolph" (http://stackoverflow.com/a/17603000). """ if path is not None: # open a file fh = io.open(path, mode=mode, encoding=encoding) else...
[ "def", "smart_open_write", "(", "path", "=", "None", ",", "mode", "=", "'wb'", ",", "encoding", "=", "None", ")", ":", "if", "path", "is", "not", "None", ":", "# open a file", "fh", "=", "io", ".", "open", "(", "path", ",", "mode", "=", "mode", ","...
Open a file for writing or return ``stdout``. Adapted from StackOverflow user "Wolph" (http://stackoverflow.com/a/17603000).
[ "Open", "a", "file", "for", "writing", "or", "return", "stdout", "." ]
train
https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/misc/functions.py#L133-L153
flo-compbio/genometools
genometools/misc/functions.py
get_url_size
def get_url_size(url): """Get the size of a URL. Note: Uses requests, so it does not work for FTP URLs. Source: StackOverflow user "Burhan Khalid". (http://stackoverflow.com/a/24585314/5651021) Parameters ---------- url : str The URL. Returns ------- int The s...
python
def get_url_size(url): """Get the size of a URL. Note: Uses requests, so it does not work for FTP URLs. Source: StackOverflow user "Burhan Khalid". (http://stackoverflow.com/a/24585314/5651021) Parameters ---------- url : str The URL. Returns ------- int The s...
[ "def", "get_url_size", "(", "url", ")", ":", "r", "=", "requests", ".", "head", "(", "url", ",", "headers", "=", "{", "'Accept-Encoding'", ":", "'identity'", "}", ")", "size", "=", "int", "(", "r", ".", "headers", "[", "'content-length'", "]", ")", "...
Get the size of a URL. Note: Uses requests, so it does not work for FTP URLs. Source: StackOverflow user "Burhan Khalid". (http://stackoverflow.com/a/24585314/5651021) Parameters ---------- url : str The URL. Returns ------- int The size of the URL in bytes.
[ "Get", "the", "size", "of", "a", "URL", "." ]
train
https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/misc/functions.py#L214-L234
flo-compbio/genometools
genometools/misc/functions.py
get_url_file_name
def get_url_file_name(url): """Get the file name from an url Parameters ---------- url : str Returns ------- str The file name """ assert isinstance(url, (str, _oldstr)) return urlparse.urlparse(url).path.split('/')[-1]
python
def get_url_file_name(url): """Get the file name from an url Parameters ---------- url : str Returns ------- str The file name """ assert isinstance(url, (str, _oldstr)) return urlparse.urlparse(url).path.split('/')[-1]
[ "def", "get_url_file_name", "(", "url", ")", ":", "assert", "isinstance", "(", "url", ",", "(", "str", ",", "_oldstr", ")", ")", "return", "urlparse", ".", "urlparse", "(", "url", ")", ".", "path", ".", "split", "(", "'/'", ")", "[", "-", "1", "]" ...
Get the file name from an url Parameters ---------- url : str Returns ------- str The file name
[ "Get", "the", "file", "name", "from", "an", "url", "Parameters", "----------", "url", ":", "str" ]
train
https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/misc/functions.py#L237-L251
flo-compbio/genometools
genometools/misc/functions.py
make_sure_dir_exists
def make_sure_dir_exists(dir_, create_subfolders=False): """Ensures that a directory exists. Adapted from StackOverflow users "Bengt" and "Heikki Toivonen" (http://stackoverflow.com/a/5032238). Parameters ---------- dir_: str The directory path. create_subfolders: bool, optional ...
python
def make_sure_dir_exists(dir_, create_subfolders=False): """Ensures that a directory exists. Adapted from StackOverflow users "Bengt" and "Heikki Toivonen" (http://stackoverflow.com/a/5032238). Parameters ---------- dir_: str The directory path. create_subfolders: bool, optional ...
[ "def", "make_sure_dir_exists", "(", "dir_", ",", "create_subfolders", "=", "False", ")", ":", "assert", "isinstance", "(", "dir_", ",", "(", "str", ",", "_oldstr", ")", ")", "assert", "isinstance", "(", "create_subfolders", ",", "bool", ")", "try", ":", "i...
Ensures that a directory exists. Adapted from StackOverflow users "Bengt" and "Heikki Toivonen" (http://stackoverflow.com/a/5032238). Parameters ---------- dir_: str The directory path. create_subfolders: bool, optional Whether to create any inexistent subfolders. [False] ...
[ "Ensures", "that", "a", "directory", "exists", "." ]
train
https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/misc/functions.py#L253-L285
flo-compbio/genometools
genometools/misc/functions.py
get_file_size
def get_file_size(path): """The the size of a file in bytes. Parameters ---------- path: str The path of the file. Returns ------- int The size of the file in bytes. Raises ------ IOError If the file does not exist. OSError If a file system ...
python
def get_file_size(path): """The the size of a file in bytes. Parameters ---------- path: str The path of the file. Returns ------- int The size of the file in bytes. Raises ------ IOError If the file does not exist. OSError If a file system ...
[ "def", "get_file_size", "(", "path", ")", ":", "assert", "isinstance", "(", "path", ",", "(", "str", ",", "_oldstr", ")", ")", "if", "not", "os", ".", "path", ".", "isfile", "(", "path", ")", ":", "raise", "IOError", "(", "'File \"%s\" does not exist.'",...
The the size of a file in bytes. Parameters ---------- path: str The path of the file. Returns ------- int The size of the file in bytes. Raises ------ IOError If the file does not exist. OSError If a file system error occurs.
[ "The", "the", "size", "of", "a", "file", "in", "bytes", "." ]
train
https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/misc/functions.py#L287-L312
flo-compbio/genometools
genometools/misc/functions.py
get_file_checksum
def get_file_checksum(path): """Get the checksum of a file (using ``sum``, Unix-only). This function is only available on certain platforms. Parameters ---------- path: str The path of the file. Returns ------- int The checksum. Raises ------ IOError ...
python
def get_file_checksum(path): """Get the checksum of a file (using ``sum``, Unix-only). This function is only available on certain platforms. Parameters ---------- path: str The path of the file. Returns ------- int The checksum. Raises ------ IOError ...
[ "def", "get_file_checksum", "(", "path", ")", ":", "if", "not", "(", "sys", ".", "platform", ".", "startswith", "(", "'linux'", ")", "or", "sys", ".", "platform", "in", "[", "'darwin'", ",", "'cygwin'", "]", ")", ":", "raise", "OSError", "(", "'This fu...
Get the checksum of a file (using ``sum``, Unix-only). This function is only available on certain platforms. Parameters ---------- path: str The path of the file. Returns ------- int The checksum. Raises ------ IOError If the file does not exist.
[ "Get", "the", "checksum", "of", "a", "file", "(", "using", "sum", "Unix", "-", "only", ")", "." ]
train
https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/misc/functions.py#L314-L356
flo-compbio/genometools
genometools/misc/functions.py
gzip_open_text
def gzip_open_text(path, encoding=None): """Opens a plain-text file that may be gzip'ed. Parameters ---------- path : str The file. encoding : str, optional The encoding to use. Returns ------- file-like A file-like object. Notes ----- Generally, re...
python
def gzip_open_text(path, encoding=None): """Opens a plain-text file that may be gzip'ed. Parameters ---------- path : str The file. encoding : str, optional The encoding to use. Returns ------- file-like A file-like object. Notes ----- Generally, re...
[ "def", "gzip_open_text", "(", "path", ",", "encoding", "=", "None", ")", ":", "if", "encoding", "is", "None", ":", "encoding", "=", "sys", ".", "getdefaultencoding", "(", ")", "assert", "os", ".", "path", ".", "isfile", "(", "path", ")", "is_compressed",...
Opens a plain-text file that may be gzip'ed. Parameters ---------- path : str The file. encoding : str, optional The encoding to use. Returns ------- file-like A file-like object. Notes ----- Generally, reading gzip'ed files with gzip.open is very slow,...
[ "Opens", "a", "plain", "-", "text", "file", "that", "may", "be", "gzip", "ed", "." ]
train
https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/misc/functions.py#L390-L438
flo-compbio/genometools
genometools/misc/functions.py
bisect_index
def bisect_index(a, x): """ Find the leftmost index of an element in a list using binary search. Parameters ---------- a: list A sorted list. x: arbitrary The element. Returns ------- int The index. """ i = bisect.bisect_left(a, x) if i != len(a) an...
python
def bisect_index(a, x): """ Find the leftmost index of an element in a list using binary search. Parameters ---------- a: list A sorted list. x: arbitrary The element. Returns ------- int The index. """ i = bisect.bisect_left(a, x) if i != len(a) an...
[ "def", "bisect_index", "(", "a", ",", "x", ")", ":", "i", "=", "bisect", ".", "bisect_left", "(", "a", ",", "x", ")", "if", "i", "!=", "len", "(", "a", ")", "and", "a", "[", "i", "]", "==", "x", ":", "return", "i", "raise", "ValueError" ]
Find the leftmost index of an element in a list using binary search. Parameters ---------- a: list A sorted list. x: arbitrary The element. Returns ------- int The index.
[ "Find", "the", "leftmost", "index", "of", "an", "element", "in", "a", "list", "using", "binary", "search", "." ]
train
https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/misc/functions.py#L470-L489
flo-compbio/genometools
genometools/misc/functions.py
read_single
def read_single(path, encoding = 'UTF-8'): """ Reads the first column of a tab-delimited text file. The file can either be uncompressed or gzip'ed. Parameters ---------- path: str The path of the file. enc: str The file encoding. Returns ------- List of str ...
python
def read_single(path, encoding = 'UTF-8'): """ Reads the first column of a tab-delimited text file. The file can either be uncompressed or gzip'ed. Parameters ---------- path: str The path of the file. enc: str The file encoding. Returns ------- List of str ...
[ "def", "read_single", "(", "path", ",", "encoding", "=", "'UTF-8'", ")", ":", "assert", "isinstance", "(", "path", ",", "(", "str", ",", "_oldstr", ")", ")", "data", "=", "[", "]", "with", "smart_open_read", "(", "path", ",", "mode", "=", "'rb'", ","...
Reads the first column of a tab-delimited text file. The file can either be uncompressed or gzip'ed. Parameters ---------- path: str The path of the file. enc: str The file encoding. Returns ------- List of str A list containing the elements in the first column...
[ "Reads", "the", "first", "column", "of", "a", "tab", "-", "delimited", "text", "file", "." ]
train
https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/misc/functions.py#L548-L572
flo-compbio/genometools
genometools/gcloud/compute/network.py
add_tcp_firewall_rule
def add_tcp_firewall_rule(project, access_token, name, tag, port): """Adds a TCP firewall rule. TODO: docstring""" headers = { 'Authorization': 'Bearer %s' % access_token.access_token } payload = { "name": name, "kind": "compute#firewall", "sourceRanges": [...
python
def add_tcp_firewall_rule(project, access_token, name, tag, port): """Adds a TCP firewall rule. TODO: docstring""" headers = { 'Authorization': 'Bearer %s' % access_token.access_token } payload = { "name": name, "kind": "compute#firewall", "sourceRanges": [...
[ "def", "add_tcp_firewall_rule", "(", "project", ",", "access_token", ",", "name", ",", "tag", ",", "port", ")", ":", "headers", "=", "{", "'Authorization'", ":", "'Bearer %s'", "%", "access_token", ".", "access_token", "}", "payload", "=", "{", "\"name\"", "...
Adds a TCP firewall rule. TODO: docstring
[ "Adds", "a", "TCP", "firewall", "rule", "." ]
train
https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/gcloud/compute/network.py#L8-L35
cebel/pyuniprot
src/pyuniprot/cli.py
update
def update(taxids, conn, force_download, silent): """Update local UniProt database""" if not silent: click.secho("WARNING: Update is very time consuming and can take several " "hours depending which organisms you are importing!", fg="yellow") if not taxids: click...
python
def update(taxids, conn, force_download, silent): """Update local UniProt database""" if not silent: click.secho("WARNING: Update is very time consuming and can take several " "hours depending which organisms you are importing!", fg="yellow") if not taxids: click...
[ "def", "update", "(", "taxids", ",", "conn", ",", "force_download", ",", "silent", ")", ":", "if", "not", "silent", ":", "click", ".", "secho", "(", "\"WARNING: Update is very time consuming and can take several \"", "\"hours depending which organisms you are importing!\"",...
Update local UniProt database
[ "Update", "local", "UniProt", "database" ]
train
https://github.com/cebel/pyuniprot/blob/9462a6042c7c9295415a5eb589b77b27cb7c142b/src/pyuniprot/cli.py#L57-L72
cebel/pyuniprot
src/pyuniprot/cli.py
web
def web(host, port): """Start web application""" from .webserver.web import get_app get_app().run(host=host, port=port)
python
def web(host, port): """Start web application""" from .webserver.web import get_app get_app().run(host=host, port=port)
[ "def", "web", "(", "host", ",", "port", ")", ":", "from", ".", "webserver", ".", "web", "import", "get_app", "get_app", "(", ")", ".", "run", "(", "host", "=", "host", ",", "port", "=", "port", ")" ]
Start web application
[ "Start", "web", "application" ]
train
https://github.com/cebel/pyuniprot/blob/9462a6042c7c9295415a5eb589b77b27cb7c142b/src/pyuniprot/cli.py#L99-L102
cebel/pyuniprot
src/pyuniprot/cli.py
connection
def connection(connection, without_connection_test): """Set MySQL/MariaDB connection""" database.set_connection(connection=connection) if not without_connection_test: test_connection(connection)
python
def connection(connection, without_connection_test): """Set MySQL/MariaDB connection""" database.set_connection(connection=connection) if not without_connection_test: test_connection(connection)
[ "def", "connection", "(", "connection", ",", "without_connection_test", ")", ":", "database", ".", "set_connection", "(", "connection", "=", "connection", ")", "if", "not", "without_connection_test", ":", "test_connection", "(", "connection", ")" ]
Set MySQL/MariaDB connection
[ "Set", "MySQL", "/", "MariaDB", "connection" ]
train
https://github.com/cebel/pyuniprot/blob/9462a6042c7c9295415a5eb589b77b27cb7c142b/src/pyuniprot/cli.py#L108-L113
acorg/dark-matter
dark/blast/params.py
checkCompatibleParams
def checkCompatibleParams(initialParams, laterParams): """ Check a later set of BLAST parameters against those originally found. @param initialParams: A C{dict} with the originally encountered BLAST parameter settings. @param laterParams: A C{dict} with BLAST parameter settings encountered ...
python
def checkCompatibleParams(initialParams, laterParams): """ Check a later set of BLAST parameters against those originally found. @param initialParams: A C{dict} with the originally encountered BLAST parameter settings. @param laterParams: A C{dict} with BLAST parameter settings encountered ...
[ "def", "checkCompatibleParams", "(", "initialParams", ",", "laterParams", ")", ":", "# Note that although the params contains a 'date', its value is empty", "# (as far as I've seen). This could become an issue one day if it", "# becomes non-empty and differs between JSON files that we cat", "#...
Check a later set of BLAST parameters against those originally found. @param initialParams: A C{dict} with the originally encountered BLAST parameter settings. @param laterParams: A C{dict} with BLAST parameter settings encountered later. @return: A C{str} summary of the parameter differenc...
[ "Check", "a", "later", "set", "of", "BLAST", "parameters", "against", "those", "originally", "found", "." ]
train
https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/blast/params.py#L12-L46
flo-compbio/genometools
genometools/basic/gene_set.py
GeneSet.to_list
def to_list(self): """Converts the GeneSet object to a flat list of strings. Note: see also :meth:`from_list`. Parameters ---------- Returns ------- list of str The data from the GeneSet object as a flat list. """ src = self._source ...
python
def to_list(self): """Converts the GeneSet object to a flat list of strings. Note: see also :meth:`from_list`. Parameters ---------- Returns ------- list of str The data from the GeneSet object as a flat list. """ src = self._source ...
[ "def", "to_list", "(", "self", ")", ":", "src", "=", "self", ".", "_source", "or", "''", "coll", "=", "self", ".", "_collection", "or", "''", "desc", "=", "self", ".", "_description", "or", "''", "l", "=", "[", "self", ".", "_id", ",", "src", ","...
Converts the GeneSet object to a flat list of strings. Note: see also :meth:`from_list`. Parameters ---------- Returns ------- list of str The data from the GeneSet object as a flat list.
[ "Converts", "the", "GeneSet", "object", "to", "a", "flat", "list", "of", "strings", "." ]
train
https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/basic/gene_set.py#L165-L184