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/basic/gene_set.py
GeneSet.from_list
def from_list(cls, l): """Generate an GeneSet object from a list of strings. Note: See also :meth:`to_list`. Parameters ---------- l: list or tuple of str A list of strings representing gene set ID, name, genes, source, collection, and description. The g...
python
def from_list(cls, l): """Generate an GeneSet object from a list of strings. Note: See also :meth:`to_list`. Parameters ---------- l: list or tuple of str A list of strings representing gene set ID, name, genes, source, collection, and description. The g...
[ "def", "from_list", "(", "cls", ",", "l", ")", ":", "id_", "=", "l", "[", "0", "]", "name", "=", "l", "[", "3", "]", "genes", "=", "l", "[", "4", "]", ".", "split", "(", "','", ")", "src", "=", "l", "[", "1", "]", "or", "None", "coll", ...
Generate an GeneSet object from a list of strings. Note: See also :meth:`to_list`. Parameters ---------- l: list or tuple of str A list of strings representing gene set ID, name, genes, source, collection, and description. The genes must be comma-sep...
[ "Generate", "an", "GeneSet", "object", "from", "a", "list", "of", "strings", "." ]
train
https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/basic/gene_set.py#L187-L212
acorg/dark-matter
dark/sequence.py
findPrimer
def findPrimer(primer, seq): """ Look for a primer sequence. @param primer: A C{str} primer sequence. @param seq: A BioPython C{Bio.Seq} sequence. @return: A C{list} of zero-based offsets into the sequence at which the primer can be found. If no instances are found, return an empty ...
python
def findPrimer(primer, seq): """ Look for a primer sequence. @param primer: A C{str} primer sequence. @param seq: A BioPython C{Bio.Seq} sequence. @return: A C{list} of zero-based offsets into the sequence at which the primer can be found. If no instances are found, return an empty ...
[ "def", "findPrimer", "(", "primer", ",", "seq", ")", ":", "offsets", "=", "[", "]", "seq", "=", "seq", ".", "upper", "(", ")", "primer", "=", "primer", ".", "upper", "(", ")", "primerLen", "=", "len", "(", "primer", ")", "discarded", "=", "0", "o...
Look for a primer sequence. @param primer: A C{str} primer sequence. @param seq: A BioPython C{Bio.Seq} sequence. @return: A C{list} of zero-based offsets into the sequence at which the primer can be found. If no instances are found, return an empty C{list}.
[ "Look", "for", "a", "primer", "sequence", "." ]
train
https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/sequence.py#L4-L28
acorg/dark-matter
dark/sequence.py
findPrimerBidi
def findPrimerBidi(primer, seq): """ Look for a primer in a sequence and its reverse complement. @param primer: A C{str} primer sequence. @param seq: A BioPython C{Bio.Seq} sequence. @return: A C{tuple} of two lists. The first contains (zero-based) ascending offsets into the sequence at wh...
python
def findPrimerBidi(primer, seq): """ Look for a primer in a sequence and its reverse complement. @param primer: A C{str} primer sequence. @param seq: A BioPython C{Bio.Seq} sequence. @return: A C{tuple} of two lists. The first contains (zero-based) ascending offsets into the sequence at wh...
[ "def", "findPrimerBidi", "(", "primer", ",", "seq", ")", ":", "# Note that we reverse complement the primer to find the reverse", "# matches. This is much simpler than reverse complementing the sequence", "# because it allows us to use findPrimer and to deal with overlapping", "# matches corre...
Look for a primer in a sequence and its reverse complement. @param primer: A C{str} primer sequence. @param seq: A BioPython C{Bio.Seq} sequence. @return: A C{tuple} of two lists. The first contains (zero-based) ascending offsets into the sequence at which the primer can be found. The seco...
[ "Look", "for", "a", "primer", "in", "a", "sequence", "and", "its", "reverse", "complement", "." ]
train
https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/sequence.py#L31-L51
acorg/dark-matter
dark/sequence.py
findPrimerBidiLimits
def findPrimerBidiLimits(primer, seq): """ Report the extreme (inner) offsets of primer in a sequence and its reverse complement. @param primer: A C{str} primer sequence. @param seq: A BioPython C{Bio.Seq} sequence. @return: A C{tuple} of two C{int} offsets. The first is a (zero-based) ...
python
def findPrimerBidiLimits(primer, seq): """ Report the extreme (inner) offsets of primer in a sequence and its reverse complement. @param primer: A C{str} primer sequence. @param seq: A BioPython C{Bio.Seq} sequence. @return: A C{tuple} of two C{int} offsets. The first is a (zero-based) ...
[ "def", "findPrimerBidiLimits", "(", "primer", ",", "seq", ")", ":", "forward", ",", "reverse", "=", "findPrimerBidi", "(", "primer", ",", "seq", ")", "if", "forward", ":", "start", "=", "forward", "[", "-", "1", "]", "+", "len", "(", "primer", ")", "...
Report the extreme (inner) offsets of primer in a sequence and its reverse complement. @param primer: A C{str} primer sequence. @param seq: A BioPython C{Bio.Seq} sequence. @return: A C{tuple} of two C{int} offsets. The first is a (zero-based) offset into the sequence that is beyond the first ...
[ "Report", "the", "extreme", "(", "inner", ")", "offsets", "of", "primer", "in", "a", "sequence", "and", "its", "reverse", "complement", "." ]
train
https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/sequence.py#L54-L87
acorg/dark-matter
dark/utils.py
numericallySortFilenames
def numericallySortFilenames(names): """ Sort (ascending) a list of file names by their numerical prefixes. The number sorted on is the numeric prefix of the basename of the given filename. E.g., '../output/1.json.bz2' will sort before '../output/10.json.bz2'. @param: A C{list} of file names, e...
python
def numericallySortFilenames(names): """ Sort (ascending) a list of file names by their numerical prefixes. The number sorted on is the numeric prefix of the basename of the given filename. E.g., '../output/1.json.bz2' will sort before '../output/10.json.bz2'. @param: A C{list} of file names, e...
[ "def", "numericallySortFilenames", "(", "names", ")", ":", "def", "numericPrefix", "(", "name", ")", ":", "\"\"\"\n Find any numeric prefix of C{name} and return it as an C{int}.\n\n @param: A C{str} file name, whose name possibly starts with digits.\n @return: The C{int...
Sort (ascending) a list of file names by their numerical prefixes. The number sorted on is the numeric prefix of the basename of the given filename. E.g., '../output/1.json.bz2' will sort before '../output/10.json.bz2'. @param: A C{list} of file names, each of whose basename starts with a strin...
[ "Sort", "(", "ascending", ")", "a", "list", "of", "file", "names", "by", "their", "numerical", "prefixes", ".", "The", "number", "sorted", "on", "is", "the", "numeric", "prefix", "of", "the", "basename", "of", "the", "given", "filename", ".", "E", ".", ...
train
https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/utils.py#L13-L41
acorg/dark-matter
dark/utils.py
asHandle
def asHandle(fileNameOrHandle, mode='r'): """ Decorator for file opening that makes it easy to open compressed files. Based on L{Bio.File.as_handle}. @param fileNameOrHandle: Either a C{str} or a file handle. @return: A generator that can be turned into a context manager via L{contextlib.co...
python
def asHandle(fileNameOrHandle, mode='r'): """ Decorator for file opening that makes it easy to open compressed files. Based on L{Bio.File.as_handle}. @param fileNameOrHandle: Either a C{str} or a file handle. @return: A generator that can be turned into a context manager via L{contextlib.co...
[ "def", "asHandle", "(", "fileNameOrHandle", ",", "mode", "=", "'r'", ")", ":", "if", "isinstance", "(", "fileNameOrHandle", ",", "six", ".", "string_types", ")", ":", "if", "fileNameOrHandle", ".", "endswith", "(", "'.gz'", ")", ":", "if", "six", ".", "P...
Decorator for file opening that makes it easy to open compressed files. Based on L{Bio.File.as_handle}. @param fileNameOrHandle: Either a C{str} or a file handle. @return: A generator that can be turned into a context manager via L{contextlib.contextmanager}.
[ "Decorator", "for", "file", "opening", "that", "makes", "it", "easy", "to", "open", "compressed", "files", ".", "Based", "on", "L", "{", "Bio", ".", "File", ".", "as_handle", "}", "." ]
train
https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/utils.py#L106-L130
acorg/dark-matter
dark/utils.py
parseRangeString
def parseRangeString(s, convertToZeroBased=False): """ Parse a range string of the form 1-5,12,100-200. @param s: A C{str} specifiying a set of numbers, given in the form of comma separated numeric ranges or individual indices. @param convertToZeroBased: If C{True} all indices will have one ...
python
def parseRangeString(s, convertToZeroBased=False): """ Parse a range string of the form 1-5,12,100-200. @param s: A C{str} specifiying a set of numbers, given in the form of comma separated numeric ranges or individual indices. @param convertToZeroBased: If C{True} all indices will have one ...
[ "def", "parseRangeString", "(", "s", ",", "convertToZeroBased", "=", "False", ")", ":", "result", "=", "set", "(", ")", "for", "_range", "in", "s", ".", "split", "(", "','", ")", ":", "match", "=", "_rangeRegex", ".", "match", "(", "_range", ")", "if...
Parse a range string of the form 1-5,12,100-200. @param s: A C{str} specifiying a set of numbers, given in the form of comma separated numeric ranges or individual indices. @param convertToZeroBased: If C{True} all indices will have one subtracted from them. @return: A C{set} of all C{int}s...
[ "Parse", "a", "range", "string", "of", "the", "form", "1", "-", "5", "12", "100", "-", "200", "." ]
train
https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/utils.py#L136-L168
acorg/dark-matter
dark/utils.py
nucleotidesToStr
def nucleotidesToStr(nucleotides, prefix=''): """ Convert offsets and base counts to a string. @param nucleotides: A C{defaultdict(Counter)} instance, keyed by C{int} offset, with nucleotides keying the Counters. @param prefix: A C{str} to put at the start of each line. @return: A C{str} re...
python
def nucleotidesToStr(nucleotides, prefix=''): """ Convert offsets and base counts to a string. @param nucleotides: A C{defaultdict(Counter)} instance, keyed by C{int} offset, with nucleotides keying the Counters. @param prefix: A C{str} to put at the start of each line. @return: A C{str} re...
[ "def", "nucleotidesToStr", "(", "nucleotides", ",", "prefix", "=", "''", ")", ":", "result", "=", "[", "]", "for", "offset", "in", "sorted", "(", "nucleotides", ")", ":", "result", ".", "append", "(", "'%s%d: %s'", "%", "(", "prefix", ",", "offset", ",...
Convert offsets and base counts to a string. @param nucleotides: A C{defaultdict(Counter)} instance, keyed by C{int} offset, with nucleotides keying the Counters. @param prefix: A C{str} to put at the start of each line. @return: A C{str} representation of the offsets and nucleotide counts ...
[ "Convert", "offsets", "and", "base", "counts", "to", "a", "string", "." ]
train
https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/utils.py#L201-L216
acorg/dark-matter
dark/utils.py
countPrint
def countPrint(mesg, count, len1, len2=None): """ Format a message followed by an integer count and a percentage (or two, if the sequence lengths are unequal). @param mesg: a C{str} message. @param count: a numeric value. @param len1: the C{int} length of sequence 1. @param len2: the C{int}...
python
def countPrint(mesg, count, len1, len2=None): """ Format a message followed by an integer count and a percentage (or two, if the sequence lengths are unequal). @param mesg: a C{str} message. @param count: a numeric value. @param len1: the C{int} length of sequence 1. @param len2: the C{int}...
[ "def", "countPrint", "(", "mesg", ",", "count", ",", "len1", ",", "len2", "=", "None", ")", ":", "def", "percentage", "(", "a", ",", "b", ")", ":", "\"\"\"\n What percent of a is b?\n\n @param a: a numeric value.\n @param b: a numeric value.\n ...
Format a message followed by an integer count and a percentage (or two, if the sequence lengths are unequal). @param mesg: a C{str} message. @param count: a numeric value. @param len1: the C{int} length of sequence 1. @param len2: the C{int} length of sequence 2. If C{None}, will default to...
[ "Format", "a", "message", "followed", "by", "an", "integer", "count", "and", "a", "percentage", "(", "or", "two", "if", "the", "sequence", "lengths", "are", "unequal", ")", "." ]
train
https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/utils.py#L219-L253
flo-compbio/genometools
genometools/gcloud/tasks/util.py
upload_scripts
def upload_scripts(client, script_dir, overwrite=True): """Uploads general-purpose scripts to a Google Storage bucket. TODO: docstring""" local_dir = os.path.join(genometools._root, 'data', 'gcloud', 'scripts') match = _BUCKET_PAT.match(script_dir) script_bucket = match.group(1) script_pref...
python
def upload_scripts(client, script_dir, overwrite=True): """Uploads general-purpose scripts to a Google Storage bucket. TODO: docstring""" local_dir = os.path.join(genometools._root, 'data', 'gcloud', 'scripts') match = _BUCKET_PAT.match(script_dir) script_bucket = match.group(1) script_pref...
[ "def", "upload_scripts", "(", "client", ",", "script_dir", ",", "overwrite", "=", "True", ")", ":", "local_dir", "=", "os", ".", "path", ".", "join", "(", "genometools", ".", "_root", ",", "'data'", ",", "'gcloud'", ",", "'scripts'", ")", "match", "=", ...
Uploads general-purpose scripts to a Google Storage bucket. TODO: docstring
[ "Uploads", "general", "-", "purpose", "scripts", "to", "a", "Google", "Storage", "bucket", ".", "TODO", ":", "docstring" ]
train
https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/gcloud/tasks/util.py#L22-L44
acorg/dark-matter
dark/diamond/alignments.py
DiamondReadsAlignments._getReader
def _getReader(self, filename, scoreClass): """ Obtain a JSON record reader for DIAMOND records. @param filename: The C{str} file name holding the JSON. @param scoreClass: A class to hold and compare scores (see scores.py). """ if filename.endswith('.json') or filename.e...
python
def _getReader(self, filename, scoreClass): """ Obtain a JSON record reader for DIAMOND records. @param filename: The C{str} file name holding the JSON. @param scoreClass: A class to hold and compare scores (see scores.py). """ if filename.endswith('.json') or filename.e...
[ "def", "_getReader", "(", "self", ",", "filename", ",", "scoreClass", ")", ":", "if", "filename", ".", "endswith", "(", "'.json'", ")", "or", "filename", ".", "endswith", "(", "'.json.bz2'", ")", ":", "return", "JSONRecordsReader", "(", "filename", ",", "s...
Obtain a JSON record reader for DIAMOND records. @param filename: The C{str} file name holding the JSON. @param scoreClass: A class to hold and compare scores (see scores.py).
[ "Obtain", "a", "JSON", "record", "reader", "for", "DIAMOND", "records", "." ]
train
https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/diamond/alignments.py#L84-L95
acorg/dark-matter
dark/diamond/alignments.py
DiamondReadsAlignments.iter
def iter(self): """ Extract DIAMOND records and yield C{ReadAlignments} instances. @return: A generator that yields C{ReadAlignments} instances. """ # Note that self._reader is already initialized (in __init__) for # the first input file. This is less clean than it could...
python
def iter(self): """ Extract DIAMOND records and yield C{ReadAlignments} instances. @return: A generator that yields C{ReadAlignments} instances. """ # Note that self._reader is already initialized (in __init__) for # the first input file. This is less clean than it could...
[ "def", "iter", "(", "self", ")", ":", "# Note that self._reader is already initialized (in __init__) for", "# the first input file. This is less clean than it could be, but it", "# makes testing easier, since open() is then only called once for", "# each input file.", "reads", "=", "iter", ...
Extract DIAMOND records and yield C{ReadAlignments} instances. @return: A generator that yields C{ReadAlignments} instances.
[ "Extract", "DIAMOND", "records", "and", "yield", "C", "{", "ReadAlignments", "}", "instances", "." ]
train
https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/diamond/alignments.py#L97-L124
acorg/dark-matter
dark/diamond/alignments.py
DiamondReadsAlignments.getSubjectSequence
def getSubjectSequence(self, title): """ Obtain information about a subject sequence given its title. @param title: A C{str} sequence title from a DIAMOND hit. @raise KeyError: If the C{title} is not present in the DIAMOND database. @return: An C{AAReadWithX} instanc...
python
def getSubjectSequence(self, title): """ Obtain information about a subject sequence given its title. @param title: A C{str} sequence title from a DIAMOND hit. @raise KeyError: If the C{title} is not present in the DIAMOND database. @return: An C{AAReadWithX} instanc...
[ "def", "getSubjectSequence", "(", "self", ",", "title", ")", ":", "if", "self", ".", "_subjectTitleToSubject", "is", "None", ":", "if", "self", ".", "_databaseFilename", "is", "None", ":", "# An Sqlite3 database is used to look up subjects.", "self", ".", "_subjectT...
Obtain information about a subject sequence given its title. @param title: A C{str} sequence title from a DIAMOND hit. @raise KeyError: If the C{title} is not present in the DIAMOND database. @return: An C{AAReadWithX} instance.
[ "Obtain", "information", "about", "a", "subject", "sequence", "given", "its", "title", "." ]
train
https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/diamond/alignments.py#L126-L150
flo-compbio/genometools
genometools/ncbi/sra/util.py
get_project_urls
def get_project_urls(project): """Get the URLs for all runs from a given project. TODO: docstring""" urls = [] with ftputil.FTPHost(sra_host, sra_user, sra_password) as ftp_host: download_paths = [] exp_dir = '/sra/sra-instant/reads/ByStudy/sra/SRP/%s/%s/' \ %(projec...
python
def get_project_urls(project): """Get the URLs for all runs from a given project. TODO: docstring""" urls = [] with ftputil.FTPHost(sra_host, sra_user, sra_password) as ftp_host: download_paths = [] exp_dir = '/sra/sra-instant/reads/ByStudy/sra/SRP/%s/%s/' \ %(projec...
[ "def", "get_project_urls", "(", "project", ")", ":", "urls", "=", "[", "]", "with", "ftputil", ".", "FTPHost", "(", "sra_host", ",", "sra_user", ",", "sra_password", ")", "as", "ftp_host", ":", "download_paths", "=", "[", "]", "exp_dir", "=", "'/sra/sra-in...
Get the URLs for all runs from a given project. TODO: docstring
[ "Get", "the", "URLs", "for", "all", "runs", "from", "a", "given", "project", ".", "TODO", ":", "docstring" ]
train
https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/ncbi/sra/util.py#L27-L46
nkavaldj/myhdl_lib
examples/pipeline_control_simple.py
twos_complement
def twos_complement(rst, clk, rx_rdy, rx_vld, rx_dat, tx_rdy, tx_vld, tx_dat): ''' Two's complement conversion of a binary number Input handshake & data rx_rdy - (o) Ready rx_vld - (i) Valid rx_dat - (i) Data Output handshake & data tx_rdy - (i) Ready ...
python
def twos_complement(rst, clk, rx_rdy, rx_vld, rx_dat, tx_rdy, tx_vld, tx_dat): ''' Two's complement conversion of a binary number Input handshake & data rx_rdy - (o) Ready rx_vld - (i) Valid rx_dat - (i) Data Output handshake & data tx_rdy - (i) Ready ...
[ "def", "twos_complement", "(", "rst", ",", "clk", ",", "rx_rdy", ",", "rx_vld", ",", "rx_dat", ",", "tx_rdy", ",", "tx_vld", ",", "tx_dat", ")", ":", "DATA_WIDTH", "=", "len", "(", "rx_dat", ")", "NUM_STAGES", "=", "3", "stage_en", "=", "Signal", "(", ...
Two's complement conversion of a binary number Input handshake & data rx_rdy - (o) Ready rx_vld - (i) Valid rx_dat - (i) Data Output handshake & data tx_rdy - (i) Ready tx_vld - (o) Valid tx_dat - (o) Data Implementation: 3...
[ "Two", "s", "complement", "conversion", "of", "a", "binary", "number", "Input", "handshake", "&", "data", "rx_rdy", "-", "(", "o", ")", "Ready", "rx_vld", "-", "(", "i", ")", "Valid", "rx_dat", "-", "(", "i", ")", "Data", "Output", "handshake", "&", ...
train
https://github.com/nkavaldj/myhdl_lib/blob/9902afd2031e7847373f692821b2135fd0810aa8/examples/pipeline_control_simple.py#L7-L72
flo-compbio/genometools
genometools/ncbi/extract_entrez2gene.py
get_argument_parser
def get_argument_parser(): """Creates the argument parser for the extract_entrez2gene.py script. Returns ------- A fully configured `argparse.ArgumentParser` object. Notes ----- This function is used by the `sphinx-argparse` extension for sphinx. """ desc = 'Generate a mapping of...
python
def get_argument_parser(): """Creates the argument parser for the extract_entrez2gene.py script. Returns ------- A fully configured `argparse.ArgumentParser` object. Notes ----- This function is used by the `sphinx-argparse` extension for sphinx. """ desc = 'Generate a mapping of...
[ "def", "get_argument_parser", "(", ")", ":", "desc", "=", "'Generate a mapping of Entrez IDs to gene symbols.'", "parser", "=", "cli", ".", "get_argument_parser", "(", "desc", "=", "desc", ")", "parser", ".", "add_argument", "(", "'-f'", ",", "'--gene2acc-file'", ",...
Creates the argument parser for the extract_entrez2gene.py script. Returns ------- A fully configured `argparse.ArgumentParser` object. Notes ----- This function is used by the `sphinx-argparse` extension for sphinx.
[ "Creates", "the", "argument", "parser", "for", "the", "extract_entrez2gene", ".", "py", "script", "." ]
train
https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/ncbi/extract_entrez2gene.py#L69-L116
flo-compbio/genometools
genometools/ncbi/extract_entrez2gene.py
read_gene2acc
def read_gene2acc(file_path, logger): """Extracts Entrez ID -> gene symbol mapping from gene2accession.gz file. Parameters ---------- file_path: str The path of the gene2accession.gz file (or a filtered version thereof). The file may be gzip'ed. Returns ------- dict ...
python
def read_gene2acc(file_path, logger): """Extracts Entrez ID -> gene symbol mapping from gene2accession.gz file. Parameters ---------- file_path: str The path of the gene2accession.gz file (or a filtered version thereof). The file may be gzip'ed. Returns ------- dict ...
[ "def", "read_gene2acc", "(", "file_path", ",", "logger", ")", ":", "gene2acc", "=", "{", "}", "with", "misc", ".", "smart_open_read", "(", "file_path", ",", "mode", "=", "'rb'", ",", "try_gzip", "=", "True", ")", "as", "fh", ":", "reader", "=", "csv", ...
Extracts Entrez ID -> gene symbol mapping from gene2accession.gz file. Parameters ---------- file_path: str The path of the gene2accession.gz file (or a filtered version thereof). The file may be gzip'ed. Returns ------- dict A mapping of Entrez IDs to gene symbols.
[ "Extracts", "Entrez", "ID", "-", ">", "gene", "symbol", "mapping", "from", "gene2accession", ".", "gz", "file", "." ]
train
https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/ncbi/extract_entrez2gene.py#L119-L160
flo-compbio/genometools
genometools/ncbi/extract_entrez2gene.py
write_entrez2gene
def write_entrez2gene(file_path, entrez2gene, logger): """Writes Entrez ID -> gene symbol mapping to a tab-delimited text file. Parameters ---------- file_path: str The path of the output file. entrez2gene: dict The mapping of Entrez IDs to gene symbols. Returns ------- ...
python
def write_entrez2gene(file_path, entrez2gene, logger): """Writes Entrez ID -> gene symbol mapping to a tab-delimited text file. Parameters ---------- file_path: str The path of the output file. entrez2gene: dict The mapping of Entrez IDs to gene symbols. Returns ------- ...
[ "def", "write_entrez2gene", "(", "file_path", ",", "entrez2gene", ",", "logger", ")", ":", "with", "misc", ".", "smart_open_write", "(", "file_path", ",", "mode", "=", "'wb'", ")", "as", "ofh", ":", "writer", "=", "csv", ".", "writer", "(", "ofh", ",", ...
Writes Entrez ID -> gene symbol mapping to a tab-delimited text file. Parameters ---------- file_path: str The path of the output file. entrez2gene: dict The mapping of Entrez IDs to gene symbols. Returns ------- None
[ "Writes", "Entrez", "ID", "-", ">", "gene", "symbol", "mapping", "to", "a", "tab", "-", "delimited", "text", "file", "." ]
train
https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/ncbi/extract_entrez2gene.py#L163-L183
flo-compbio/genometools
genometools/ncbi/extract_entrez2gene.py
main
def main(args=None): """Extracts Entrez ID -> gene symbol mapping and writes it to a text file. Parameters ---------- args: argparse.Namespace object, optional The argument values. If not specified, the values will be obtained by parsing the command line arguments using the `argparse` m...
python
def main(args=None): """Extracts Entrez ID -> gene symbol mapping and writes it to a text file. Parameters ---------- args: argparse.Namespace object, optional The argument values. If not specified, the values will be obtained by parsing the command line arguments using the `argparse` m...
[ "def", "main", "(", "args", "=", "None", ")", ":", "vinfo", "=", "sys", ".", "version_info", "if", "not", "(", "vinfo", ">=", "(", "2", ",", "7", ")", ")", ":", "raise", "SystemError", "(", "'Python interpreter version >= 2.7 required, '", "'found %d.%d inst...
Extracts Entrez ID -> gene symbol mapping and writes it to a text file. Parameters ---------- args: argparse.Namespace object, optional The argument values. If not specified, the values will be obtained by parsing the command line arguments using the `argparse` module. Returns ----...
[ "Extracts", "Entrez", "ID", "-", ">", "gene", "symbol", "mapping", "and", "writes", "it", "to", "a", "text", "file", "." ]
train
https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/ncbi/extract_entrez2gene.py#L186-L231
acorg/dark-matter
dark/aa.py
find
def find(s): """ Find an amino acid whose name or abbreviation is s. @param s: A C{str} amino acid specifier. This may be a full name, a 3-letter abbreviation or a 1-letter abbreviation. Case is ignored. return: An L{AminoAcid} instance or C{None} if no matching amino acid can be locate...
python
def find(s): """ Find an amino acid whose name or abbreviation is s. @param s: A C{str} amino acid specifier. This may be a full name, a 3-letter abbreviation or a 1-letter abbreviation. Case is ignored. return: An L{AminoAcid} instance or C{None} if no matching amino acid can be locate...
[ "def", "find", "(", "s", ")", ":", "abbrev1", "=", "None", "origS", "=", "s", "if", "' '", "in", "s", ":", "# Convert first word to title case, others to lower.", "first", ",", "rest", "=", "s", ".", "split", "(", "' '", ",", "1", ")", "s", "=", "first...
Find an amino acid whose name or abbreviation is s. @param s: A C{str} amino acid specifier. This may be a full name, a 3-letter abbreviation or a 1-letter abbreviation. Case is ignored. return: An L{AminoAcid} instance or C{None} if no matching amino acid can be located.
[ "Find", "an", "amino", "acid", "whose", "name", "or", "abbreviation", "is", "s", "." ]
train
https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/aa.py#L982-L1022
acorg/dark-matter
dark/aa.py
_propertiesOrClustersForSequence
def _propertiesOrClustersForSequence(sequence, propertyNames, propertyValues, missingAAValue): """ Extract amino acid property values or cluster numbers for a sequence. @param sequence: An C{AARead} (or a subclass) instance. @param propertyNames: An iterable of C{st...
python
def _propertiesOrClustersForSequence(sequence, propertyNames, propertyValues, missingAAValue): """ Extract amino acid property values or cluster numbers for a sequence. @param sequence: An C{AARead} (or a subclass) instance. @param propertyNames: An iterable of C{st...
[ "def", "_propertiesOrClustersForSequence", "(", "sequence", ",", "propertyNames", ",", "propertyValues", ",", "missingAAValue", ")", ":", "propertyNames", "=", "sorted", "(", "map", "(", "str", ".", "lower", ",", "set", "(", "propertyNames", ")", ")", ")", "# ...
Extract amino acid property values or cluster numbers for a sequence. @param sequence: An C{AARead} (or a subclass) instance. @param propertyNames: An iterable of C{str} property names (each of which must be a key of a key in the C{propertyValues} C{dict}). @param propertyValues: A C{dict} in the f...
[ "Extract", "amino", "acid", "property", "values", "or", "cluster", "numbers", "for", "a", "sequence", "." ]
train
https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/aa.py#L1025-L1069
acorg/dark-matter
dark/aa.py
matchToString
def matchToString(aaMatch, read1, read2, indent='', offsets=None): """ Format amino acid sequence match as a string. @param aaMatch: A C{dict} returned by C{compareAaReads}. @param read1: A C{Read} instance or an instance of one of its subclasses. @param read2: A C{Read} instance or an instance of ...
python
def matchToString(aaMatch, read1, read2, indent='', offsets=None): """ Format amino acid sequence match as a string. @param aaMatch: A C{dict} returned by C{compareAaReads}. @param read1: A C{Read} instance or an instance of one of its subclasses. @param read2: A C{Read} instance or an instance of ...
[ "def", "matchToString", "(", "aaMatch", ",", "read1", ",", "read2", ",", "indent", "=", "''", ",", "offsets", "=", "None", ")", ":", "match", "=", "aaMatch", "[", "'match'", "]", "matchCount", "=", "match", "[", "'matchCount'", "]", "gapMismatchCount", "...
Format amino acid sequence match as a string. @param aaMatch: A C{dict} returned by C{compareAaReads}. @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 indent: A C{str} to indent all returned lines...
[ "Format", "amino", "acid", "sequence", "match", "as", "a", "string", "." ]
train
https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/aa.py#L1108-L1162
acorg/dark-matter
dark/aa.py
compareAaReads
def compareAaReads(read1, read2, gapChars='-', offsets=None): """ Compare two amino acid 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 gapChars: An object supporting __contains__ ...
python
def compareAaReads(read1, read2, gapChars='-', offsets=None): """ Compare two amino acid 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 gapChars: An object supporting __contains__ ...
[ "def", "compareAaReads", "(", "read1", ",", "read2", ",", "gapChars", "=", "'-'", ",", "offsets", "=", "None", ")", ":", "matchCount", "=", "0", "gapMismatchCount", "=", "nonGapMismatchCount", "=", "gapGapMismatchCount", "=", "0", "read1ExtraCount", "=", "read...
Compare two amino acid 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 gapChars: An object supporting __contains__ with characters that should be considered to be gaps. @param o...
[ "Compare", "two", "amino", "acid", "sequences", "." ]
train
https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/aa.py#L1165-L1241
acorg/dark-matter
bin/noninteractive-alignment-panel.py
parseColors
def parseColors(colors, args): """ Parse read id color specification. @param colors: A C{list} of C{str}s. Each item is of the form, e.g., 'green X Y Z...', where each of X, Y, Z, ... etc. is either a read id or the name of a FASTA or FASTQ file containing reads whose ids should be ...
python
def parseColors(colors, args): """ Parse read id color specification. @param colors: A C{list} of C{str}s. Each item is of the form, e.g., 'green X Y Z...', where each of X, Y, Z, ... etc. is either a read id or the name of a FASTA or FASTQ file containing reads whose ids should be ...
[ "def", "parseColors", "(", "colors", ",", "args", ")", ":", "result", "=", "defaultdict", "(", "set", ")", "for", "colorInfo", "in", "colors", ":", "readIds", "=", "colorInfo", ".", "split", "(", ")", "color", "=", "readIds", ".", "pop", "(", "0", ")...
Parse read id color specification. @param colors: A C{list} of C{str}s. Each item is of the form, e.g., 'green X Y Z...', where each of X, Y, Z, ... etc. is either a read id or the name of a FASTA or FASTQ file containing reads whose ids should be displayed with the corresponding color. Not...
[ "Parse", "read", "id", "color", "specification", "." ]
train
https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/bin/noninteractive-alignment-panel.py#L35-L65
flo-compbio/genometools
genometools/ontology/util.py
download_release
def download_release(download_file, release=None): """Downloads the "go-basic.obo" file for the specified release.""" if release is None: release = get_latest_release() url = 'http://viewvc.geneontology.org/viewvc/GO-SVN/ontology-releases/%s/go-basic.obo' % release #download_file = 'go-basic_%s....
python
def download_release(download_file, release=None): """Downloads the "go-basic.obo" file for the specified release.""" if release is None: release = get_latest_release() url = 'http://viewvc.geneontology.org/viewvc/GO-SVN/ontology-releases/%s/go-basic.obo' % release #download_file = 'go-basic_%s....
[ "def", "download_release", "(", "download_file", ",", "release", "=", "None", ")", ":", "if", "release", "is", "None", ":", "release", "=", "get_latest_release", "(", ")", "url", "=", "'http://viewvc.geneontology.org/viewvc/GO-SVN/ontology-releases/%s/go-basic.obo'", "%...
Downloads the "go-basic.obo" file for the specified release.
[ "Downloads", "the", "go", "-", "basic", ".", "obo", "file", "for", "the", "specified", "release", "." ]
train
https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/ontology/util.py#L53-L59
flo-compbio/genometools
genometools/ontology/util.py
get_current_ontology_date
def get_current_ontology_date(): """Get the release date of the current Gene Ontolgo release.""" with closing(requests.get( 'http://geneontology.org/ontology/go-basic.obo', stream=True)) as r: for i, l in enumerate(r.iter_lines(decode_unicode=True)): if i == 1: ...
python
def get_current_ontology_date(): """Get the release date of the current Gene Ontolgo release.""" with closing(requests.get( 'http://geneontology.org/ontology/go-basic.obo', stream=True)) as r: for i, l in enumerate(r.iter_lines(decode_unicode=True)): if i == 1: ...
[ "def", "get_current_ontology_date", "(", ")", ":", "with", "closing", "(", "requests", ".", "get", "(", "'http://geneontology.org/ontology/go-basic.obo'", ",", "stream", "=", "True", ")", ")", "as", "r", ":", "for", "i", ",", "l", "in", "enumerate", "(", "r"...
Get the release date of the current Gene Ontolgo release.
[ "Get", "the", "release", "date", "of", "the", "current", "Gene", "Ontolgo", "release", "." ]
train
https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/ontology/util.py#L62-L73
invenia/Arbiter
arbiter/sync.py
execute
def execute(function, name): """ Execute a task, returning a TaskResult """ try: return TaskResult(name, True, None, function()) except Exception as exc: return TaskResult(name, False, exc, None)
python
def execute(function, name): """ Execute a task, returning a TaskResult """ try: return TaskResult(name, True, None, function()) except Exception as exc: return TaskResult(name, False, exc, None)
[ "def", "execute", "(", "function", ",", "name", ")", ":", "try", ":", "return", "TaskResult", "(", "name", ",", "True", ",", "None", ",", "function", "(", ")", ")", "except", "Exception", "as", "exc", ":", "return", "TaskResult", "(", "name", ",", "F...
Execute a task, returning a TaskResult
[ "Execute", "a", "task", "returning", "a", "TaskResult" ]
train
https://github.com/invenia/Arbiter/blob/51008393ae8797da85bcd67807259a157f941dfd/arbiter/sync.py#L19-L26
disqus/overseer
overseer/templatetags/overseer_helpers.py
truncatechars
def truncatechars(value, arg): """ Truncates a string after a certain number of chars. Argument: Number of chars to truncate after. """ try: length = int(arg) except ValueError: # Invalid literal for int(). return value # Fail silently. if len(value) > length: return...
python
def truncatechars(value, arg): """ Truncates a string after a certain number of chars. Argument: Number of chars to truncate after. """ try: length = int(arg) except ValueError: # Invalid literal for int(). return value # Fail silently. if len(value) > length: return...
[ "def", "truncatechars", "(", "value", ",", "arg", ")", ":", "try", ":", "length", "=", "int", "(", "arg", ")", "except", "ValueError", ":", "# Invalid literal for int().", "return", "value", "# Fail silently.", "if", "len", "(", "value", ")", ">", "length", ...
Truncates a string after a certain number of chars. Argument: Number of chars to truncate after.
[ "Truncates", "a", "string", "after", "a", "certain", "number", "of", "chars", "." ]
train
https://github.com/disqus/overseer/blob/b37573aba33b20aa86f89eb0c7e6f4d9905bedef/overseer/templatetags/overseer_helpers.py#L32-L44
disqus/overseer
example_project/urls.py
handler500
def handler500(request): """ 500 error handler. Templates: `500.html` Context: None """ from django.template import Context, loader from django.http import HttpResponseServerError from overseer.context_processors import default import logging import sys try: context ...
python
def handler500(request): """ 500 error handler. Templates: `500.html` Context: None """ from django.template import Context, loader from django.http import HttpResponseServerError from overseer.context_processors import default import logging import sys try: context ...
[ "def", "handler500", "(", "request", ")", ":", "from", "django", ".", "template", "import", "Context", ",", "loader", "from", "django", ".", "http", "import", "HttpResponseServerError", "from", "overseer", ".", "context_processors", "import", "default", "import", ...
500 error handler. Templates: `500.html` Context: None
[ "500", "error", "handler", "." ]
train
https://github.com/disqus/overseer/blob/b37573aba33b20aa86f89eb0c7e6f4d9905bedef/example_project/urls.py#L7-L28
flo-compbio/genometools
genometools/ensembl/cli/util.py
get_gtf_argument_parser
def get_gtf_argument_parser(desc, default_field_name='gene'): """Return an argument parser with basic options for reading GTF files. Parameters ---------- desc: str Description of the ArgumentParser default_field_name: str, optional Name of field in GTF file to look for. Return...
python
def get_gtf_argument_parser(desc, default_field_name='gene'): """Return an argument parser with basic options for reading GTF files. Parameters ---------- desc: str Description of the ArgumentParser default_field_name: str, optional Name of field in GTF file to look for. Return...
[ "def", "get_gtf_argument_parser", "(", "desc", ",", "default_field_name", "=", "'gene'", ")", ":", "parser", "=", "cli", ".", "get_argument_parser", "(", "desc", "=", "desc", ")", "parser", ".", "add_argument", "(", "'-a'", ",", "'--annotation-file'", ",", "de...
Return an argument parser with basic options for reading GTF files. Parameters ---------- desc: str Description of the ArgumentParser default_field_name: str, optional Name of field in GTF file to look for. Returns ------- `argparse.ArgumentParser` object The argume...
[ "Return", "an", "argument", "parser", "with", "basic", "options", "for", "reading", "GTF", "files", "." ]
train
https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/ensembl/cli/util.py#L30-L85
inveniosoftware/invenio-jsonschemas
invenio_jsonschemas/jsonresolver.py
jsonresolver_loader
def jsonresolver_loader(url_map): """JSON resolver plugin that loads the schema endpoint. Injected into Invenio-Records JSON resolver. """ from flask import current_app from . import current_jsonschemas url_map.add(Rule( "{0}/<path:path>".format(current_app.config['JSONSCHEMAS_ENDPOINT'...
python
def jsonresolver_loader(url_map): """JSON resolver plugin that loads the schema endpoint. Injected into Invenio-Records JSON resolver. """ from flask import current_app from . import current_jsonschemas url_map.add(Rule( "{0}/<path:path>".format(current_app.config['JSONSCHEMAS_ENDPOINT'...
[ "def", "jsonresolver_loader", "(", "url_map", ")", ":", "from", "flask", "import", "current_app", "from", ".", "import", "current_jsonschemas", "url_map", ".", "add", "(", "Rule", "(", "\"{0}/<path:path>\"", ".", "format", "(", "current_app", ".", "config", "[",...
JSON resolver plugin that loads the schema endpoint. Injected into Invenio-Records JSON resolver.
[ "JSON", "resolver", "plugin", "that", "loads", "the", "schema", "endpoint", "." ]
train
https://github.com/inveniosoftware/invenio-jsonschemas/blob/93019b8fe3bf549335e94c84198c9c0b76d8fde2/invenio_jsonschemas/jsonresolver.py#L18-L28
grabbles/grabbit
grabbit/core.py
merge_layouts
def merge_layouts(layouts): ''' Utility function for merging multiple layouts. Args: layouts (list): A list of BIDSLayout instances to merge. Returns: A BIDSLayout containing merged files and entities. Notes: Layouts will be merged in the order of the elements in the list. I.e.,...
python
def merge_layouts(layouts): ''' Utility function for merging multiple layouts. Args: layouts (list): A list of BIDSLayout instances to merge. Returns: A BIDSLayout containing merged files and entities. Notes: Layouts will be merged in the order of the elements in the list. I.e.,...
[ "def", "merge_layouts", "(", "layouts", ")", ":", "layout", "=", "layouts", "[", "0", "]", ".", "clone", "(", ")", "for", "l", "in", "layouts", "[", "1", ":", "]", ":", "layout", ".", "files", ".", "update", "(", "l", ".", "files", ")", "layout",...
Utility function for merging multiple layouts. Args: layouts (list): A list of BIDSLayout instances to merge. Returns: A BIDSLayout containing merged files and entities. Notes: Layouts will be merged in the order of the elements in the list. I.e., the first Layout will be up...
[ "Utility", "function", "for", "merging", "multiple", "layouts", "." ]
train
https://github.com/grabbles/grabbit/blob/83ff93df36019eaaee9d4e31f816a518e46cae07/grabbit/core.py#L1079-L1105
grabbles/grabbit
grabbit/core.py
File._matches
def _matches(self, entities=None, extensions=None, domains=None, regex_search=False): """ Checks whether the file matches all of the passed entities and extensions. Args: entities (dict): A dictionary of entity names -> regex patterns. extensions...
python
def _matches(self, entities=None, extensions=None, domains=None, regex_search=False): """ Checks whether the file matches all of the passed entities and extensions. Args: entities (dict): A dictionary of entity names -> regex patterns. extensions...
[ "def", "_matches", "(", "self", ",", "entities", "=", "None", ",", "extensions", "=", "None", ",", "domains", "=", "None", ",", "regex_search", "=", "False", ")", ":", "if", "extensions", "is", "not", "None", ":", "if", "isinstance", "(", "extensions", ...
Checks whether the file matches all of the passed entities and extensions. Args: entities (dict): A dictionary of entity names -> regex patterns. extensions (str, list): One or more file extensions to allow. domains (str, list): One or more domains the file must matc...
[ "Checks", "whether", "the", "file", "matches", "all", "of", "the", "passed", "entities", "and", "extensions", "." ]
train
https://github.com/grabbles/grabbit/blob/83ff93df36019eaaee9d4e31f816a518e46cae07/grabbit/core.py#L35-L88
grabbles/grabbit
grabbit/core.py
File.as_named_tuple
def as_named_tuple(self): """ Returns the File as a named tuple. The full path plus all entity key/value pairs are returned as attributes. """ keys = list(self.entities.keys()) replaced = [] for i, k in enumerate(keys): if iskeyword(k): ...
python
def as_named_tuple(self): """ Returns the File as a named tuple. The full path plus all entity key/value pairs are returned as attributes. """ keys = list(self.entities.keys()) replaced = [] for i, k in enumerate(keys): if iskeyword(k): ...
[ "def", "as_named_tuple", "(", "self", ")", ":", "keys", "=", "list", "(", "self", ".", "entities", ".", "keys", "(", ")", ")", "replaced", "=", "[", "]", "for", "i", ",", "k", "in", "enumerate", "(", "keys", ")", ":", "if", "iskeyword", "(", "k",...
Returns the File as a named tuple. The full path plus all entity key/value pairs are returned as attributes.
[ "Returns", "the", "File", "as", "a", "named", "tuple", ".", "The", "full", "path", "plus", "all", "entity", "key", "/", "value", "pairs", "are", "returned", "as", "attributes", "." ]
train
https://github.com/grabbles/grabbit/blob/83ff93df36019eaaee9d4e31f816a518e46cae07/grabbit/core.py#L90-L108
grabbles/grabbit
grabbit/core.py
File.copy
def copy(self, path_patterns, symbolic_link=False, root=None, conflicts='fail'): ''' Copy the contents of a file to a new location, with target filename defined by the current File's entities and the specified path_patterns. ''' new_filename = build_path(self.entities, path_...
python
def copy(self, path_patterns, symbolic_link=False, root=None, conflicts='fail'): ''' Copy the contents of a file to a new location, with target filename defined by the current File's entities and the specified path_patterns. ''' new_filename = build_path(self.entities, path_...
[ "def", "copy", "(", "self", ",", "path_patterns", ",", "symbolic_link", "=", "False", ",", "root", "=", "None", ",", "conflicts", "=", "'fail'", ")", ":", "new_filename", "=", "build_path", "(", "self", ".", "entities", ",", "path_patterns", ")", "if", "...
Copy the contents of a file to a new location, with target filename defined by the current File's entities and the specified path_patterns.
[ "Copy", "the", "contents", "of", "a", "file", "to", "a", "new", "location", "with", "target", "filename", "defined", "by", "the", "current", "File", "s", "entities", "and", "the", "specified", "path_patterns", "." ]
train
https://github.com/grabbles/grabbit/blob/83ff93df36019eaaee9d4e31f816a518e46cae07/grabbit/core.py#L110-L141
grabbles/grabbit
grabbit/core.py
Entity.match_file
def match_file(self, f, update_file=False): """ Determine whether the passed file matches the Entity. Args: f (File): The File instance to match against. Returns: the matched value if a match was found, otherwise None. """ if self.map_func is not None: ...
python
def match_file(self, f, update_file=False): """ Determine whether the passed file matches the Entity. Args: f (File): The File instance to match against. Returns: the matched value if a match was found, otherwise None. """ if self.map_func is not None: ...
[ "def", "match_file", "(", "self", ",", "f", ",", "update_file", "=", "False", ")", ":", "if", "self", ".", "map_func", "is", "not", "None", ":", "val", "=", "self", ".", "map_func", "(", "f", ")", "else", ":", "m", "=", "self", ".", "regex", ".",...
Determine whether the passed file matches the Entity. Args: f (File): The File instance to match against. Returns: the matched value if a match was found, otherwise None.
[ "Determine", "whether", "the", "passed", "file", "matches", "the", "Entity", "." ]
train
https://github.com/grabbles/grabbit/blob/83ff93df36019eaaee9d4e31f816a518e46cae07/grabbit/core.py#L261-L276
grabbles/grabbit
grabbit/core.py
Layout._get_or_load_domain
def _get_or_load_domain(self, domain): ''' Return a domain if one already exists, or create a new one if not. Args: domain (str, dict): Can be one of: - The name of the Domain to return (fails if none exists) - A path to the Domain configuration file ...
python
def _get_or_load_domain(self, domain): ''' Return a domain if one already exists, or create a new one if not. Args: domain (str, dict): Can be one of: - The name of the Domain to return (fails if none exists) - A path to the Domain configuration file ...
[ "def", "_get_or_load_domain", "(", "self", ",", "domain", ")", ":", "if", "isinstance", "(", "domain", ",", "six", ".", "string_types", ")", ":", "if", "domain", "in", "self", ".", "domains", ":", "return", "self", ".", "domains", "[", "domain", "]", "...
Return a domain if one already exists, or create a new one if not. Args: domain (str, dict): Can be one of: - The name of the Domain to return (fails if none exists) - A path to the Domain configuration file - A dictionary containing configuration inf...
[ "Return", "a", "domain", "if", "one", "already", "exists", "or", "create", "a", "new", "one", "if", "not", "." ]
train
https://github.com/grabbles/grabbit/blob/83ff93df36019eaaee9d4e31f816a518e46cae07/grabbit/core.py#L423-L457
grabbles/grabbit
grabbit/core.py
Layout._check_inclusions
def _check_inclusions(self, f, domains=None): ''' Check file or directory against regexes in config to determine if it should be included in the index ''' filename = f if isinstance(f, six.string_types) else f.path if domains is None: domains = list(self.domains.values(...
python
def _check_inclusions(self, f, domains=None): ''' Check file or directory against regexes in config to determine if it should be included in the index ''' filename = f if isinstance(f, six.string_types) else f.path if domains is None: domains = list(self.domains.values(...
[ "def", "_check_inclusions", "(", "self", ",", "f", ",", "domains", "=", "None", ")", ":", "filename", "=", "f", "if", "isinstance", "(", "f", ",", "six", ".", "string_types", ")", "else", "f", ".", "path", "if", "domains", "is", "None", ":", "domains...
Check file or directory against regexes in config to determine if it should be included in the index
[ "Check", "file", "or", "directory", "against", "regexes", "in", "config", "to", "determine", "if", "it", "should", "be", "included", "in", "the", "index" ]
train
https://github.com/grabbles/grabbit/blob/83ff93df36019eaaee9d4e31f816a518e46cae07/grabbit/core.py#L470-L495
grabbles/grabbit
grabbit/core.py
Layout._find_entity
def _find_entity(self, entity): ''' Find an Entity instance by name. Checks both name and id fields.''' if entity in self.entities: return self.entities[entity] _ent = [e for e in self.entities.values() if e.name == entity] if len(_ent) > 1: raise ValueError("Enti...
python
def _find_entity(self, entity): ''' Find an Entity instance by name. Checks both name and id fields.''' if entity in self.entities: return self.entities[entity] _ent = [e for e in self.entities.values() if e.name == entity] if len(_ent) > 1: raise ValueError("Enti...
[ "def", "_find_entity", "(", "self", ",", "entity", ")", ":", "if", "entity", "in", "self", ".", "entities", ":", "return", "self", ".", "entities", "[", "entity", "]", "_ent", "=", "[", "e", "for", "e", "in", "self", ".", "entities", ".", "values", ...
Find an Entity instance by name. Checks both name and id fields.
[ "Find", "an", "Entity", "instance", "by", "name", ".", "Checks", "both", "name", "and", "id", "fields", "." ]
train
https://github.com/grabbles/grabbit/blob/83ff93df36019eaaee9d4e31f816a518e46cae07/grabbit/core.py#L557-L570
grabbles/grabbit
grabbit/core.py
Layout.save_index
def save_index(self, filename): ''' Save the current Layout's index to a .json file. Args: filename (str): Filename to write to. Note: At the moment, this won't serialize directory-specific config files. This means reconstructed indexes will only work properly in ca...
python
def save_index(self, filename): ''' Save the current Layout's index to a .json file. Args: filename (str): Filename to write to. Note: At the moment, this won't serialize directory-specific config files. This means reconstructed indexes will only work properly in ca...
[ "def", "save_index", "(", "self", ",", "filename", ")", ":", "data", "=", "{", "}", "for", "f", "in", "self", ".", "files", ".", "values", "(", ")", ":", "entities", "=", "{", "v", ".", "entity", ".", "id", ":", "v", ".", "value", "for", "k", ...
Save the current Layout's index to a .json file. Args: filename (str): Filename to write to. Note: At the moment, this won't serialize directory-specific config files. This means reconstructed indexes will only work properly in cases where there aren't multiple layout specs...
[ "Save", "the", "current", "Layout", "s", "index", "to", "a", ".", "json", "file", "." ]
train
https://github.com/grabbles/grabbit/blob/83ff93df36019eaaee9d4e31f816a518e46cae07/grabbit/core.py#L613-L628
grabbles/grabbit
grabbit/core.py
Layout.load_index
def load_index(self, filename, reindex=False): ''' Load the Layout's index from a plaintext file. Args: filename (str): Path to the plaintext index file. reindex (bool): If True, discards entity values provided in the loaded index and instead re-indexes every fil...
python
def load_index(self, filename, reindex=False): ''' Load the Layout's index from a plaintext file. Args: filename (str): Path to the plaintext index file. reindex (bool): If True, discards entity values provided in the loaded index and instead re-indexes every fil...
[ "def", "load_index", "(", "self", ",", "filename", ",", "reindex", "=", "False", ")", ":", "self", ".", "_reset_index", "(", ")", "with", "open", "(", "filename", ",", "'r'", ")", "as", "fobj", ":", "data", "=", "json", ".", "load", "(", "fobj", ")...
Load the Layout's index from a plaintext file. Args: filename (str): Path to the plaintext index file. reindex (bool): If True, discards entity values provided in the loaded index and instead re-indexes every file in the loaded index against the entities ...
[ "Load", "the", "Layout", "s", "index", "from", "a", "plaintext", "file", "." ]
train
https://github.com/grabbles/grabbit/blob/83ff93df36019eaaee9d4e31f816a518e46cae07/grabbit/core.py#L630-L664
grabbles/grabbit
grabbit/core.py
Layout.add_entity
def add_entity(self, domain, **kwargs): ''' Add a new Entity to tracking. ''' # Set the entity's mapping func if one was specified map_func = kwargs.get('map_func', None) if map_func is not None and not callable(kwargs['map_func']): if self.entity_mapper is None: ...
python
def add_entity(self, domain, **kwargs): ''' Add a new Entity to tracking. ''' # Set the entity's mapping func if one was specified map_func = kwargs.get('map_func', None) if map_func is not None and not callable(kwargs['map_func']): if self.entity_mapper is None: ...
[ "def", "add_entity", "(", "self", ",", "domain", ",", "*", "*", "kwargs", ")", ":", "# Set the entity's mapping func if one was specified", "map_func", "=", "kwargs", ".", "get", "(", "'map_func'", ",", "None", ")", "if", "map_func", "is", "not", "None", "and"...
Add a new Entity to tracking.
[ "Add", "a", "new", "Entity", "to", "tracking", "." ]
train
https://github.com/grabbles/grabbit/blob/83ff93df36019eaaee9d4e31f816a518e46cae07/grabbit/core.py#L666-L697
grabbles/grabbit
grabbit/core.py
Layout.get
def get(self, return_type='tuple', target=None, extensions=None, domains=None, regex_search=None, **kwargs): """ Retrieve files and/or metadata from the current Layout. Args: return_type (str): Type of result to return. Valid values: 'tuple': returns a li...
python
def get(self, return_type='tuple', target=None, extensions=None, domains=None, regex_search=None, **kwargs): """ Retrieve files and/or metadata from the current Layout. Args: return_type (str): Type of result to return. Valid values: 'tuple': returns a li...
[ "def", "get", "(", "self", ",", "return_type", "=", "'tuple'", ",", "target", "=", "None", ",", "extensions", "=", "None", ",", "domains", "=", "None", ",", "regex_search", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "regex_search", "is", "...
Retrieve files and/or metadata from the current Layout. Args: return_type (str): Type of result to return. Valid values: 'tuple': returns a list of namedtuples containing file name as well as attribute/value pairs for all named entities. 'file': r...
[ "Retrieve", "files", "and", "/", "or", "metadata", "from", "the", "current", "Layout", "." ]
train
https://github.com/grabbles/grabbit/blob/83ff93df36019eaaee9d4e31f816a518e46cae07/grabbit/core.py#L699-L791
grabbles/grabbit
grabbit/core.py
Layout.count
def count(self, entity, files=False): """ Return the count of unique values or files for the named entity. Args: entity (str): The name of the entity. files (bool): If True, counts the number of filenames that contain at least one value of the entity, rat...
python
def count(self, entity, files=False): """ Return the count of unique values or files for the named entity. Args: entity (str): The name of the entity. files (bool): If True, counts the number of filenames that contain at least one value of the entity, rat...
[ "def", "count", "(", "self", ",", "entity", ",", "files", "=", "False", ")", ":", "return", "self", ".", "_find_entity", "(", "entity", ")", ".", "count", "(", "files", ")" ]
Return the count of unique values or files for the named entity. Args: entity (str): The name of the entity. files (bool): If True, counts the number of filenames that contain at least one value of the entity, rather than the number of unique values of th...
[ "Return", "the", "count", "of", "unique", "values", "or", "files", "for", "the", "named", "entity", "." ]
train
https://github.com/grabbles/grabbit/blob/83ff93df36019eaaee9d4e31f816a518e46cae07/grabbit/core.py#L802-L812
grabbles/grabbit
grabbit/core.py
Layout.as_data_frame
def as_data_frame(self, **kwargs): """ Return information for all Files tracked in the Layout as a pandas DataFrame. Args: kwargs: Optional keyword arguments passed on to get(). This allows one to easily select only a subset of files for export. Retur...
python
def as_data_frame(self, **kwargs): """ Return information for all Files tracked in the Layout as a pandas DataFrame. Args: kwargs: Optional keyword arguments passed on to get(). This allows one to easily select only a subset of files for export. Retur...
[ "def", "as_data_frame", "(", "self", ",", "*", "*", "kwargs", ")", ":", "try", ":", "import", "pandas", "as", "pd", "except", "ImportError", ":", "raise", "ImportError", "(", "\"What are you doing trying to export a Layout \"", "\"as a pandas DataFrame when you don't ha...
Return information for all Files tracked in the Layout as a pandas DataFrame. Args: kwargs: Optional keyword arguments passed on to get(). This allows one to easily select only a subset of files for export. Returns: A pandas DataFrame, where each row is a...
[ "Return", "information", "for", "all", "Files", "tracked", "in", "the", "Layout", "as", "a", "pandas", "DataFrame", "." ]
train
https://github.com/grabbles/grabbit/blob/83ff93df36019eaaee9d4e31f816a518e46cae07/grabbit/core.py#L814-L839
grabbles/grabbit
grabbit/core.py
Layout.get_nearest
def get_nearest(self, path, return_type='file', strict=True, all_=False, ignore_strict_entities=None, full_search=False, **kwargs): ''' Walk up the file tree from the specified path and return the nearest matching file(s). Args: path (str): The file to search fro...
python
def get_nearest(self, path, return_type='file', strict=True, all_=False, ignore_strict_entities=None, full_search=False, **kwargs): ''' Walk up the file tree from the specified path and return the nearest matching file(s). Args: path (str): The file to search fro...
[ "def", "get_nearest", "(", "self", ",", "path", ",", "return_type", "=", "'file'", ",", "strict", "=", "True", ",", "all_", "=", "False", ",", "ignore_strict_entities", "=", "None", ",", "full_search", "=", "False", ",", "*", "*", "kwargs", ")", ":", "...
Walk up the file tree from the specified path and return the nearest matching file(s). Args: path (str): The file to search from. return_type (str): What to return; must be one of 'file' (default) or 'tuple'. strict (bool): When True, all entities pre...
[ "Walk", "up", "the", "file", "tree", "from", "the", "specified", "path", "and", "return", "the", "nearest", "matching", "file", "(", "s", ")", "." ]
train
https://github.com/grabbles/grabbit/blob/83ff93df36019eaaee9d4e31f816a518e46cae07/grabbit/core.py#L845-L929
grabbles/grabbit
grabbit/core.py
Layout.build_path
def build_path(self, source, path_patterns=None, strict=False, domains=None): ''' Constructs a target filename for a file or dictionary of entities. Args: source (str, File, dict): The source data to use to construct the new file path. Must be one of: ...
python
def build_path(self, source, path_patterns=None, strict=False, domains=None): ''' Constructs a target filename for a file or dictionary of entities. Args: source (str, File, dict): The source data to use to construct the new file path. Must be one of: ...
[ "def", "build_path", "(", "self", ",", "source", ",", "path_patterns", "=", "None", ",", "strict", "=", "False", ",", "domains", "=", "None", ")", ":", "if", "isinstance", "(", "source", ",", "six", ".", "string_types", ")", ":", "if", "source", "not",...
Constructs a target filename for a file or dictionary of entities. Args: source (str, File, dict): The source data to use to construct the new file path. Must be one of: - A File object - A string giving the path of a File contained within the ...
[ "Constructs", "a", "target", "filename", "for", "a", "file", "or", "dictionary", "of", "entities", "." ]
train
https://github.com/grabbles/grabbit/blob/83ff93df36019eaaee9d4e31f816a518e46cae07/grabbit/core.py#L948-L989
grabbles/grabbit
grabbit/core.py
Layout.write_contents_to_file
def write_contents_to_file(self, entities, path_patterns=None, contents=None, link_to=None, content_mode='text', conflicts='fail', strict=False, domains=None, index=False, index_domains=None): ...
python
def write_contents_to_file(self, entities, path_patterns=None, contents=None, link_to=None, content_mode='text', conflicts='fail', strict=False, domains=None, index=False, index_domains=None): ...
[ "def", "write_contents_to_file", "(", "self", ",", "entities", ",", "path_patterns", "=", "None", ",", "contents", "=", "None", ",", "link_to", "=", "None", ",", "content_mode", "=", "'text'", ",", "conflicts", "=", "'fail'", ",", "strict", "=", "False", "...
Write arbitrary data to a file defined by the passed entities and path patterns. Args: entities (dict): A dictionary of entities, with Entity names in keys and values for the desired file in values. path_patterns (list): Optional path patterns to use when buildin...
[ "Write", "arbitrary", "data", "to", "a", "file", "defined", "by", "the", "passed", "entities", "and", "path", "patterns", "." ]
train
https://github.com/grabbles/grabbit/blob/83ff93df36019eaaee9d4e31f816a518e46cae07/grabbit/core.py#L1024-L1076
flo-compbio/genometools
genometools/misc/log.py
configure_logger
def configure_logger(name, log_stream=sys.stdout, log_file=None, log_level=logging.INFO, keep_old_handlers=False, propagate=False): """Configures and returns a logger. This function serves to simplify the configuration of a logger that writes to a file and/or to a ...
python
def configure_logger(name, log_stream=sys.stdout, log_file=None, log_level=logging.INFO, keep_old_handlers=False, propagate=False): """Configures and returns a logger. This function serves to simplify the configuration of a logger that writes to a file and/or to a ...
[ "def", "configure_logger", "(", "name", ",", "log_stream", "=", "sys", ".", "stdout", ",", "log_file", "=", "None", ",", "log_level", "=", "logging", ".", "INFO", ",", "keep_old_handlers", "=", "False", ",", "propagate", "=", "False", ")", ":", "# create a...
Configures and returns a logger. This function serves to simplify the configuration of a logger that writes to a file and/or to a stream (e.g., stdout). Parameters ---------- name: str The name of the logger. Typically set to ``__name__``. log_stream: a stream object, optional ...
[ "Configures", "and", "returns", "a", "logger", "." ]
train
https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/misc/log.py#L27-L106
flo-compbio/genometools
genometools/misc/log.py
get_logger
def get_logger(name='', log_stream=None, log_file=None, quiet=False, verbose=False): """Convenience function for getting a logger.""" # configure root logger log_level = logging.INFO if quiet: log_level = logging.WARNING elif verbose: log_level = logging.DEBUG if...
python
def get_logger(name='', log_stream=None, log_file=None, quiet=False, verbose=False): """Convenience function for getting a logger.""" # configure root logger log_level = logging.INFO if quiet: log_level = logging.WARNING elif verbose: log_level = logging.DEBUG if...
[ "def", "get_logger", "(", "name", "=", "''", ",", "log_stream", "=", "None", ",", "log_file", "=", "None", ",", "quiet", "=", "False", ",", "verbose", "=", "False", ")", ":", "# configure root logger", "log_level", "=", "logging", ".", "INFO", "if", "qui...
Convenience function for getting a logger.
[ "Convenience", "function", "for", "getting", "a", "logger", "." ]
train
https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/misc/log.py#L109-L126
srevenant/timeinterval
timeinterval/__init__.py
start
def start(milliseconds, func, *args, **kwargs): """ Call function every interval. Starts the timer at call time. Although this could also be a decorator, that would not initiate the time at the same time, so would require additional work. Arguments following function will be sent to function. Not...
python
def start(milliseconds, func, *args, **kwargs): """ Call function every interval. Starts the timer at call time. Although this could also be a decorator, that would not initiate the time at the same time, so would require additional work. Arguments following function will be sent to function. Not...
[ "def", "start", "(", "milliseconds", ",", "func", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "stopper", "=", "threading", ".", "Event", "(", ")", "def", "interval", "(", "seconds", ",", "func", ",", "*", "args", ",", "*", "*", "kwargs", ...
Call function every interval. Starts the timer at call time. Although this could also be a decorator, that would not initiate the time at the same time, so would require additional work. Arguments following function will be sent to function. Note that these args are part of the defining state, and un...
[ "Call", "function", "every", "interval", ".", "Starts", "the", "timer", "at", "call", "time", ".", "Although", "this", "could", "also", "be", "a", "decorator", "that", "would", "not", "initiate", "the", "time", "at", "the", "same", "time", "so", "would", ...
train
https://github.com/srevenant/timeinterval/blob/61ba4cb23530dc131ff9e2209fb84019663ee7f9/timeinterval/__init__.py#L40-L88
acorg/dark-matter
dark/codonDistance.py
codonInformation
def codonInformation(codons1, codons2): """ Take two C{list} of codons, and returns information about the min and max distance between them. @param codon1: a C{list} of codons. @param codon2: a C{list} of codons. @return: a dict whose keys are C{int} distances and whose values are lists ...
python
def codonInformation(codons1, codons2): """ Take two C{list} of codons, and returns information about the min and max distance between them. @param codon1: a C{list} of codons. @param codon2: a C{list} of codons. @return: a dict whose keys are C{int} distances and whose values are lists ...
[ "def", "codonInformation", "(", "codons1", ",", "codons2", ")", ":", "result", "=", "defaultdict", "(", "list", ")", "for", "c1", "in", "codons1", ":", "for", "c2", "in", "codons2", ":", "distance", "=", "findDistance", "(", "c1", ",", "c2", ")", "resu...
Take two C{list} of codons, and returns information about the min and max distance between them. @param codon1: a C{list} of codons. @param codon2: a C{list} of codons. @return: a dict whose keys are C{int} distances and whose values are lists of pairs of codons.
[ "Take", "two", "C", "{", "list", "}", "of", "codons", "and", "returns", "information", "about", "the", "min", "and", "max", "distance", "between", "them", "." ]
train
https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/codonDistance.py#L15-L32
vovanec/httputil
examples/http_client.py
example_async_client
def example_async_client(api_client): """Example async client. """ try: pprint((yield from api_client.echo())) except errors.RequestError as exc: log.exception('Exception occurred: %s', exc) yield gen.Task(lambda *args, **kwargs: ioloop.IOLoop.current().stop())
python
def example_async_client(api_client): """Example async client. """ try: pprint((yield from api_client.echo())) except errors.RequestError as exc: log.exception('Exception occurred: %s', exc) yield gen.Task(lambda *args, **kwargs: ioloop.IOLoop.current().stop())
[ "def", "example_async_client", "(", "api_client", ")", ":", "try", ":", "pprint", "(", "(", "yield", "from", "api_client", ".", "echo", "(", ")", ")", ")", "except", "errors", ".", "RequestError", "as", "exc", ":", "log", ".", "exception", "(", "'Excepti...
Example async client.
[ "Example", "async", "client", "." ]
train
https://github.com/vovanec/httputil/blob/0b8dab5a23166cceb7dbc2a1dbc802ab5b311347/examples/http_client.py#L65-L74
vovanec/httputil
examples/http_client.py
example_sync_client
def example_sync_client(api_client): """Example sync client use with. """ try: pprint(api_client.echo()) except errors.RequestError as exc: log.exception('Exception occurred: %s', exc)
python
def example_sync_client(api_client): """Example sync client use with. """ try: pprint(api_client.echo()) except errors.RequestError as exc: log.exception('Exception occurred: %s', exc)
[ "def", "example_sync_client", "(", "api_client", ")", ":", "try", ":", "pprint", "(", "api_client", ".", "echo", "(", ")", ")", "except", "errors", ".", "RequestError", "as", "exc", ":", "log", ".", "exception", "(", "'Exception occurred: %s'", ",", "exc", ...
Example sync client use with.
[ "Example", "sync", "client", "use", "with", "." ]
train
https://github.com/vovanec/httputil/blob/0b8dab5a23166cceb7dbc2a1dbc802ab5b311347/examples/http_client.py#L77-L84
vovanec/httputil
examples/http_client.py
main
def main(): """Run the examples. """ logging.basicConfig(level=logging.INFO) example_sync_client(SyncAPIClient()) example_async_client(AsyncAPIClient()) io_loop = ioloop.IOLoop.current() io_loop.start()
python
def main(): """Run the examples. """ logging.basicConfig(level=logging.INFO) example_sync_client(SyncAPIClient()) example_async_client(AsyncAPIClient()) io_loop = ioloop.IOLoop.current() io_loop.start()
[ "def", "main", "(", ")", ":", "logging", ".", "basicConfig", "(", "level", "=", "logging", ".", "INFO", ")", "example_sync_client", "(", "SyncAPIClient", "(", ")", ")", "example_async_client", "(", "AsyncAPIClient", "(", ")", ")", "io_loop", "=", "ioloop", ...
Run the examples.
[ "Run", "the", "examples", "." ]
train
https://github.com/vovanec/httputil/blob/0b8dab5a23166cceb7dbc2a1dbc802ab5b311347/examples/http_client.py#L87-L97
flo-compbio/genometools
genometools/ensembl/cli/extract_protein_coding_genes.py
main
def main(args=None): """Extract protein-coding genes and store in tab-delimited text file. Parameters ---------- args: argparse.Namespace object, optional The argument values. If not specified, the values will be obtained by parsing the command line arguments using the `argparse` module...
python
def main(args=None): """Extract protein-coding genes and store in tab-delimited text file. Parameters ---------- args: argparse.Namespace object, optional The argument values. If not specified, the values will be obtained by parsing the command line arguments using the `argparse` module...
[ "def", "main", "(", "args", "=", "None", ")", ":", "vinfo", "=", "sys", ".", "version_info", "if", "not", "vinfo", ">=", "(", "2", ",", "7", ")", ":", "raise", "SystemError", "(", "'Python interpreter version >= 2.7 required, '", "'found %d.%d instead.'", "%",...
Extract protein-coding genes and store in tab-delimited text file. Parameters ---------- args: argparse.Namespace object, optional The argument values. If not specified, the values will be obtained by parsing the command line arguments using the `argparse` module. Returns ------- ...
[ "Extract", "protein", "-", "coding", "genes", "and", "store", "in", "tab", "-", "delimited", "text", "file", "." ]
train
https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/ensembl/cli/extract_protein_coding_genes.py#L75-L140
shmir/PyIxExplorer
ixexplorer/ixe_statistics_view.py
IxePortsStats.read_stats
def read_stats(self, *stats): """ Read port statistics from chassis. :param stats: list of requested statistics to read, if empty - read all statistics. """ self.statistics = OrderedDict() for port in self.ports: port_stats = IxeStatTotal(port).get_attributes(FLAG_R...
python
def read_stats(self, *stats): """ Read port statistics from chassis. :param stats: list of requested statistics to read, if empty - read all statistics. """ self.statistics = OrderedDict() for port in self.ports: port_stats = IxeStatTotal(port).get_attributes(FLAG_R...
[ "def", "read_stats", "(", "self", ",", "*", "stats", ")", ":", "self", ".", "statistics", "=", "OrderedDict", "(", ")", "for", "port", "in", "self", ".", "ports", ":", "port_stats", "=", "IxeStatTotal", "(", "port", ")", ".", "get_attributes", "(", "FL...
Read port statistics from chassis. :param stats: list of requested statistics to read, if empty - read all statistics.
[ "Read", "port", "statistics", "from", "chassis", "." ]
train
https://github.com/shmir/PyIxExplorer/blob/d6946b9ce0e8961507cc912062e10c365d4beee2/ixexplorer/ixe_statistics_view.py#L195-L207
shmir/PyIxExplorer
ixexplorer/ixe_statistics_view.py
IxeStreamsStats.read_stats
def read_stats(self, *stats): """ Read stream statistics from chassis. :param stats: list of requested statistics to read, if empty - read all statistics. """ from ixexplorer.ixe_stream import IxePacketGroupStream sleep_time = 0.1 # in cases we only want few counters but very f...
python
def read_stats(self, *stats): """ Read stream statistics from chassis. :param stats: list of requested statistics to read, if empty - read all statistics. """ from ixexplorer.ixe_stream import IxePacketGroupStream sleep_time = 0.1 # in cases we only want few counters but very f...
[ "def", "read_stats", "(", "self", ",", "*", "stats", ")", ":", "from", "ixexplorer", ".", "ixe_stream", "import", "IxePacketGroupStream", "sleep_time", "=", "0.1", "# in cases we only want few counters but very fast we need a smaller sleep time", "if", "not", "stats", ":"...
Read stream statistics from chassis. :param stats: list of requested statistics to read, if empty - read all statistics.
[ "Read", "stream", "statistics", "from", "chassis", "." ]
train
https://github.com/shmir/PyIxExplorer/blob/d6946b9ce0e8961507cc912062e10c365d4beee2/ixexplorer/ixe_statistics_view.py#L242-L279
nkavaldj/myhdl_lib
myhdl_lib/arbiter.py
arbiter
def arbiter(rst, clk, req_vec, gnt_vec=None, gnt_idx=None, gnt_vld=None, gnt_rdy=None, ARBITER_TYPE="priority"): ''' Wrapper that provides common interface to all arbiters ''' if ARBITER_TYPE == "priority": _arb = arbiter_priority(req_vec, gnt_vec, gnt_idx, gnt_vld) elif (ARBITER_TYPE == "roundrobin...
python
def arbiter(rst, clk, req_vec, gnt_vec=None, gnt_idx=None, gnt_vld=None, gnt_rdy=None, ARBITER_TYPE="priority"): ''' Wrapper that provides common interface to all arbiters ''' if ARBITER_TYPE == "priority": _arb = arbiter_priority(req_vec, gnt_vec, gnt_idx, gnt_vld) elif (ARBITER_TYPE == "roundrobin...
[ "def", "arbiter", "(", "rst", ",", "clk", ",", "req_vec", ",", "gnt_vec", "=", "None", ",", "gnt_idx", "=", "None", ",", "gnt_vld", "=", "None", ",", "gnt_rdy", "=", "None", ",", "ARBITER_TYPE", "=", "\"priority\"", ")", ":", "if", "ARBITER_TYPE", "=="...
Wrapper that provides common interface to all arbiters
[ "Wrapper", "that", "provides", "common", "interface", "to", "all", "arbiters" ]
train
https://github.com/nkavaldj/myhdl_lib/blob/9902afd2031e7847373f692821b2135fd0810aa8/myhdl_lib/arbiter.py#L5-L14
nkavaldj/myhdl_lib
myhdl_lib/arbiter.py
arbiter_priority
def arbiter_priority(req_vec, gnt_vec=None, gnt_idx=None, gnt_vld=None): """ Static priority arbiter: grants the request with highest priority, which is the lower index req_vec - (i) vector of request signals, req_vec[0] is with the highest priority gnt_vec - (o) optional, vector of grants, ...
python
def arbiter_priority(req_vec, gnt_vec=None, gnt_idx=None, gnt_vld=None): """ Static priority arbiter: grants the request with highest priority, which is the lower index req_vec - (i) vector of request signals, req_vec[0] is with the highest priority gnt_vec - (o) optional, vector of grants, ...
[ "def", "arbiter_priority", "(", "req_vec", ",", "gnt_vec", "=", "None", ",", "gnt_idx", "=", "None", ",", "gnt_vld", "=", "None", ")", ":", "REQ_NUM", "=", "len", "(", "req_vec", ")", "gnt_vec_s", "=", "Signal", "(", "intbv", "(", "0", ")", "[", "REQ...
Static priority arbiter: grants the request with highest priority, which is the lower index req_vec - (i) vector of request signals, req_vec[0] is with the highest priority gnt_vec - (o) optional, vector of grants, one grant per request, only one grant can be active at at time gnt_id...
[ "Static", "priority", "arbiter", ":", "grants", "the", "request", "with", "highest", "priority", "which", "is", "the", "lower", "index", "req_vec", "-", "(", "i", ")", "vector", "of", "request", "signals", "req_vec", "[", "0", "]", "is", "with", "the", "...
train
https://github.com/nkavaldj/myhdl_lib/blob/9902afd2031e7847373f692821b2135fd0810aa8/myhdl_lib/arbiter.py#L17-L45
nkavaldj/myhdl_lib
myhdl_lib/arbiter.py
arbiter_roundrobin
def arbiter_roundrobin(rst, clk, req_vec, gnt_vec=None, gnt_idx=None, gnt_vld=None, gnt_rdy=None): """ Round Robin arbiter: finds the active request with highest priority and presents its index on the gnt_idx output. req_vec - (i) vector of request signals, priority changes dynamically gnt_v...
python
def arbiter_roundrobin(rst, clk, req_vec, gnt_vec=None, gnt_idx=None, gnt_vld=None, gnt_rdy=None): """ Round Robin arbiter: finds the active request with highest priority and presents its index on the gnt_idx output. req_vec - (i) vector of request signals, priority changes dynamically gnt_v...
[ "def", "arbiter_roundrobin", "(", "rst", ",", "clk", ",", "req_vec", ",", "gnt_vec", "=", "None", ",", "gnt_idx", "=", "None", ",", "gnt_vld", "=", "None", ",", "gnt_rdy", "=", "None", ")", ":", "REQ_NUM", "=", "len", "(", "req_vec", ")", "ptr", "=",...
Round Robin arbiter: finds the active request with highest priority and presents its index on the gnt_idx output. req_vec - (i) vector of request signals, priority changes dynamically gnt_vec - (o) optional, vector of grants, one grant per request, only one grant can be active at at time ...
[ "Round", "Robin", "arbiter", ":", "finds", "the", "active", "request", "with", "highest", "priority", "and", "presents", "its", "index", "on", "the", "gnt_idx", "output", ".", "req_vec", "-", "(", "i", ")", "vector", "of", "request", "signals", "priority", ...
train
https://github.com/nkavaldj/myhdl_lib/blob/9902afd2031e7847373f692821b2135fd0810aa8/myhdl_lib/arbiter.py#L48-L97
biocommons/bioutils
src/bioutils/digests.py
seq_seqhash
def seq_seqhash(seq, normalize=True): """returns 24-byte Truncated Digest sequence `seq` >>> seq_seqhash("") 'z4PhNX7vuL3xVChQ1m2AB9Yg5AULVxXc' >>> seq_seqhash("ACGT") 'aKF498dAxcJAqme6QYQ7EZ07-fiw8Kw2' >>> seq_seqhash("acgt") 'aKF498dAxcJAqme6QYQ7EZ07-fiw8Kw2' >>> seq_seqhash("acgt"...
python
def seq_seqhash(seq, normalize=True): """returns 24-byte Truncated Digest sequence `seq` >>> seq_seqhash("") 'z4PhNX7vuL3xVChQ1m2AB9Yg5AULVxXc' >>> seq_seqhash("ACGT") 'aKF498dAxcJAqme6QYQ7EZ07-fiw8Kw2' >>> seq_seqhash("acgt") 'aKF498dAxcJAqme6QYQ7EZ07-fiw8Kw2' >>> seq_seqhash("acgt"...
[ "def", "seq_seqhash", "(", "seq", ",", "normalize", "=", "True", ")", ":", "seq", "=", "normalize_sequence", "(", "seq", ")", "if", "normalize", "else", "seq", "return", "str", "(", "vmc_digest", "(", "seq", ",", "digest_size", "=", "24", ")", ")" ]
returns 24-byte Truncated Digest sequence `seq` >>> seq_seqhash("") 'z4PhNX7vuL3xVChQ1m2AB9Yg5AULVxXc' >>> seq_seqhash("ACGT") 'aKF498dAxcJAqme6QYQ7EZ07-fiw8Kw2' >>> seq_seqhash("acgt") 'aKF498dAxcJAqme6QYQ7EZ07-fiw8Kw2' >>> seq_seqhash("acgt", normalize=False) 'eFwawHHdibaZBDcs9kW3g...
[ "returns", "24", "-", "byte", "Truncated", "Digest", "sequence", "seq" ]
train
https://github.com/biocommons/bioutils/blob/88bcbdfa707268fed1110800e91b6d4f8e9475a0/src/bioutils/digests.py#L10-L28
biocommons/bioutils
src/bioutils/digests.py
seq_seguid
def seq_seguid(seq, normalize=True): """returns seguid for sequence `seq` This seguid is compatible with BioPython's seguid. >>> seq_seguid('') '2jmj7l5rSw0yVb/vlWAYkK/YBwk' >>> seq_seguid('ACGT') 'IQiZThf2zKn/I1KtqStlEdsHYDQ' >>> seq_seguid('acgt') 'IQiZThf2zKn/I1KtqStlEdsHYDQ' ...
python
def seq_seguid(seq, normalize=True): """returns seguid for sequence `seq` This seguid is compatible with BioPython's seguid. >>> seq_seguid('') '2jmj7l5rSw0yVb/vlWAYkK/YBwk' >>> seq_seguid('ACGT') 'IQiZThf2zKn/I1KtqStlEdsHYDQ' >>> seq_seguid('acgt') 'IQiZThf2zKn/I1KtqStlEdsHYDQ' ...
[ "def", "seq_seguid", "(", "seq", ",", "normalize", "=", "True", ")", ":", "seq", "=", "normalize_sequence", "(", "seq", ")", "if", "normalize", "else", "seq", "bseq", "=", "seq", ".", "encode", "(", "\"ascii\"", ")", "return", "base64", ".", "b64encode",...
returns seguid for sequence `seq` This seguid is compatible with BioPython's seguid. >>> seq_seguid('') '2jmj7l5rSw0yVb/vlWAYkK/YBwk' >>> seq_seguid('ACGT') 'IQiZThf2zKn/I1KtqStlEdsHYDQ' >>> seq_seguid('acgt') 'IQiZThf2zKn/I1KtqStlEdsHYDQ' >>> seq_seguid('acgt', normalize=False) ...
[ "returns", "seguid", "for", "sequence", "seq" ]
train
https://github.com/biocommons/bioutils/blob/88bcbdfa707268fed1110800e91b6d4f8e9475a0/src/bioutils/digests.py#L31-L52
biocommons/bioutils
src/bioutils/digests.py
seq_md5
def seq_md5(seq, normalize=True): """returns unicode md5 as hex digest for sequence `seq`. >>> seq_md5('') 'd41d8cd98f00b204e9800998ecf8427e' >>> seq_md5('ACGT') 'f1f8f4bf413b16ad135722aa4591043e' >>> seq_md5('ACGT*') 'f1f8f4bf413b16ad135722aa4591043e' >>> seq_md5(' A C G T ') 'f...
python
def seq_md5(seq, normalize=True): """returns unicode md5 as hex digest for sequence `seq`. >>> seq_md5('') 'd41d8cd98f00b204e9800998ecf8427e' >>> seq_md5('ACGT') 'f1f8f4bf413b16ad135722aa4591043e' >>> seq_md5('ACGT*') 'f1f8f4bf413b16ad135722aa4591043e' >>> seq_md5(' A C G T ') 'f...
[ "def", "seq_md5", "(", "seq", ",", "normalize", "=", "True", ")", ":", "seq", "=", "normalize_sequence", "(", "seq", ")", "if", "normalize", "else", "seq", "bseq", "=", "seq", ".", "encode", "(", "\"ascii\"", ")", "return", "hashlib", ".", "md5", "(", ...
returns unicode md5 as hex digest for sequence `seq`. >>> seq_md5('') 'd41d8cd98f00b204e9800998ecf8427e' >>> seq_md5('ACGT') 'f1f8f4bf413b16ad135722aa4591043e' >>> seq_md5('ACGT*') 'f1f8f4bf413b16ad135722aa4591043e' >>> seq_md5(' A C G T ') 'f1f8f4bf413b16ad135722aa4591043e' >>>...
[ "returns", "unicode", "md5", "as", "hex", "digest", "for", "sequence", "seq", "." ]
train
https://github.com/biocommons/bioutils/blob/88bcbdfa707268fed1110800e91b6d4f8e9475a0/src/bioutils/digests.py#L55-L79
biocommons/bioutils
src/bioutils/digests.py
seq_sha1
def seq_sha1(seq, normalize=True): """returns unicode sha1 hexdigest for sequence `seq`. >>> seq_sha1('') 'da39a3ee5e6b4b0d3255bfef95601890afd80709' >>> seq_sha1('ACGT') '2108994e17f6cca9ff2352ada92b6511db076034' >>> seq_sha1('acgt') '2108994e17f6cca9ff2352ada92b6511db076034' >>> seq...
python
def seq_sha1(seq, normalize=True): """returns unicode sha1 hexdigest for sequence `seq`. >>> seq_sha1('') 'da39a3ee5e6b4b0d3255bfef95601890afd80709' >>> seq_sha1('ACGT') '2108994e17f6cca9ff2352ada92b6511db076034' >>> seq_sha1('acgt') '2108994e17f6cca9ff2352ada92b6511db076034' >>> seq...
[ "def", "seq_sha1", "(", "seq", ",", "normalize", "=", "True", ")", ":", "seq", "=", "normalize_sequence", "(", "seq", ")", "if", "normalize", "else", "seq", "bseq", "=", "seq", ".", "encode", "(", "\"ascii\"", ")", "return", "hashlib", ".", "sha1", "("...
returns unicode sha1 hexdigest for sequence `seq`. >>> seq_sha1('') 'da39a3ee5e6b4b0d3255bfef95601890afd80709' >>> seq_sha1('ACGT') '2108994e17f6cca9ff2352ada92b6511db076034' >>> seq_sha1('acgt') '2108994e17f6cca9ff2352ada92b6511db076034' >>> seq_sha1('acgt', normalize=False) '948234...
[ "returns", "unicode", "sha1", "hexdigest", "for", "sequence", "seq", "." ]
train
https://github.com/biocommons/bioutils/blob/88bcbdfa707268fed1110800e91b6d4f8e9475a0/src/bioutils/digests.py#L82-L101
biocommons/bioutils
src/bioutils/digests.py
seq_sha512
def seq_sha512(seq, normalize=True): """returns unicode sequence sha512 hexdigest for sequence `seq`. >>> seq_sha512('') 'cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e' >>> seq_sha512('ACGT') '68a178f7c740c5c240aa67...
python
def seq_sha512(seq, normalize=True): """returns unicode sequence sha512 hexdigest for sequence `seq`. >>> seq_sha512('') 'cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e' >>> seq_sha512('ACGT') '68a178f7c740c5c240aa67...
[ "def", "seq_sha512", "(", "seq", ",", "normalize", "=", "True", ")", ":", "seq", "=", "normalize_sequence", "(", "seq", ")", "if", "normalize", "else", "seq", "bseq", "=", "seq", ".", "encode", "(", "\"ascii\"", ")", "return", "hashlib", ".", "sha512", ...
returns unicode sequence sha512 hexdigest for sequence `seq`. >>> seq_sha512('') 'cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e' >>> seq_sha512('ACGT') '68a178f7c740c5c240aa67ba41843b119d3bf9f8b0f0ac36cf701d26672964efbd...
[ "returns", "unicode", "sequence", "sha512", "hexdigest", "for", "sequence", "seq", "." ]
train
https://github.com/biocommons/bioutils/blob/88bcbdfa707268fed1110800e91b6d4f8e9475a0/src/bioutils/digests.py#L104-L123
biocommons/bioutils
src/bioutils/digests.py
seq_vmc_identifier
def seq_vmc_identifier(seq, normalize=True): """returns VMC identifier (record) for sequence `seq` See https://github.com/ga4gh/vmc >>> seq_vmc_identifier("") == {'namespace': 'VMC', 'accession': 'GS_z4PhNX7vuL3xVChQ1m2AB9Yg5AULVxXc'} True >>> seq_vmc_identifier("ACGT") == {'namespace': 'VMC', 'a...
python
def seq_vmc_identifier(seq, normalize=True): """returns VMC identifier (record) for sequence `seq` See https://github.com/ga4gh/vmc >>> seq_vmc_identifier("") == {'namespace': 'VMC', 'accession': 'GS_z4PhNX7vuL3xVChQ1m2AB9Yg5AULVxXc'} True >>> seq_vmc_identifier("ACGT") == {'namespace': 'VMC', 'a...
[ "def", "seq_vmc_identifier", "(", "seq", ",", "normalize", "=", "True", ")", ":", "seq", "=", "normalize_sequence", "(", "seq", ")", "if", "normalize", "else", "seq", "return", "{", "\"namespace\"", ":", "\"VMC\"", ",", "\"accession\"", ":", "\"GS_\"", "+", ...
returns VMC identifier (record) for sequence `seq` See https://github.com/ga4gh/vmc >>> seq_vmc_identifier("") == {'namespace': 'VMC', 'accession': 'GS_z4PhNX7vuL3xVChQ1m2AB9Yg5AULVxXc'} True >>> seq_vmc_identifier("ACGT") == {'namespace': 'VMC', 'accession': 'GS_aKF498dAxcJAqme6QYQ7EZ07-fiw8Kw2'} ...
[ "returns", "VMC", "identifier", "(", "record", ")", "for", "sequence", "seq" ]
train
https://github.com/biocommons/bioutils/blob/88bcbdfa707268fed1110800e91b6d4f8e9475a0/src/bioutils/digests.py#L148-L167
flo-compbio/genometools
genometools/gcloud/tasks/star.py
map_single_end
def map_single_end(credentials, instance_config, instance_name, script_dir, index_dir, fastq_file, output_dir, num_threads=None, seed_start_lmax=None, mismatch_nmax=None, multimap_nmax=None, splice_min_overhang=None, out_mult...
python
def map_single_end(credentials, instance_config, instance_name, script_dir, index_dir, fastq_file, output_dir, num_threads=None, seed_start_lmax=None, mismatch_nmax=None, multimap_nmax=None, splice_min_overhang=None, out_mult...
[ "def", "map_single_end", "(", "credentials", ",", "instance_config", ",", "instance_name", ",", "script_dir", ",", "index_dir", ",", "fastq_file", ",", "output_dir", ",", "num_threads", "=", "None", ",", "seed_start_lmax", "=", "None", ",", "mismatch_nmax", "=", ...
Maps single-end reads using STAR. Reads are expected in FASTQ format. By default, they are also expected to be compressed with gzip. - recommended machine type: "n1-standard-16" (60 GB of RAM, 16 vCPUs). - recommended disk size: depends on size of FASTQ files, at least 128 GB. TODO: docstring
[ "Maps", "single", "-", "end", "reads", "using", "STAR", "." ]
train
https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/gcloud/tasks/star.py#L39-L93
flo-compbio/genometools
genometools/gcloud/tasks/star.py
generate_index
def generate_index(credentials, instance_config, instance_name, script_dir, genome_file, output_dir, annotation_file=None, splice_overhang=100, num_threads=8, chromosome_bin_bits=18, genome_memory_limit=31000000000, self_dest...
python
def generate_index(credentials, instance_config, instance_name, script_dir, genome_file, output_dir, annotation_file=None, splice_overhang=100, num_threads=8, chromosome_bin_bits=18, genome_memory_limit=31000000000, self_dest...
[ "def", "generate_index", "(", "credentials", ",", "instance_config", ",", "instance_name", ",", "script_dir", ",", "genome_file", ",", "output_dir", ",", "annotation_file", "=", "None", ",", "splice_overhang", "=", "100", ",", "num_threads", "=", "8", ",", "chro...
Generates a STAR index. Recommended machine type: "n1-highmem-8" (52 GB of RAM, 8 vCPUs) TODO: docstring
[ "Generates", "a", "STAR", "index", "." ]
train
https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/gcloud/tasks/star.py#L162-L191
nkavaldj/myhdl_lib
myhdl_lib/fifo.py
fifo
def fifo(rst, clk, full, we, din, empty, re, dout, afull=None, aempty=None, afull_th=None, aempty_th=None, ovf=None, udf=None, count=None, count_max=None, depth=None, width=None): """ Synchronous FIFO Input interface: full, we, din Output interface: empty, re, dout It s possible to se...
python
def fifo(rst, clk, full, we, din, empty, re, dout, afull=None, aempty=None, afull_th=None, aempty_th=None, ovf=None, udf=None, count=None, count_max=None, depth=None, width=None): """ Synchronous FIFO Input interface: full, we, din Output interface: empty, re, dout It s possible to se...
[ "def", "fifo", "(", "rst", ",", "clk", ",", "full", ",", "we", ",", "din", ",", "empty", ",", "re", ",", "dout", ",", "afull", "=", "None", ",", "aempty", "=", "None", ",", "afull_th", "=", "None", ",", "aempty_th", "=", "None", ",", "ovf", "="...
Synchronous FIFO Input interface: full, we, din Output interface: empty, re, dout It s possible to set din and dout to None. Then the fifo width will be 0 and the fifo will contain no storage. Extra interface: afull (o) - almost full flag, asserted when the number of ...
[ "Synchronous", "FIFO" ]
train
https://github.com/nkavaldj/myhdl_lib/blob/9902afd2031e7847373f692821b2135fd0810aa8/myhdl_lib/fifo.py#L6-L210
flo-compbio/genometools
genometools/ensembl/util.py
get_file_checksums
def get_file_checksums(url, ftp=None): """Download and parse an Ensembl CHECKSUMS file and obtain checksums. Parameters ---------- url : str The URL of the CHECKSUM file. ftp : `ftplib.FTP` or `None`, optional An FTP connection. Returns ------- `collections.OrderedD...
python
def get_file_checksums(url, ftp=None): """Download and parse an Ensembl CHECKSUMS file and obtain checksums. Parameters ---------- url : str The URL of the CHECKSUM file. ftp : `ftplib.FTP` or `None`, optional An FTP connection. Returns ------- `collections.OrderedD...
[ "def", "get_file_checksums", "(", "url", ",", "ftp", "=", "None", ")", ":", "assert", "isinstance", "(", "url", ",", "(", "str", ",", "_oldstr", ")", ")", "if", "ftp", "is", "not", "None", ":", "assert", "isinstance", "(", "ftp", ",", "ftplib", ".", ...
Download and parse an Ensembl CHECKSUMS file and obtain checksums. Parameters ---------- url : str The URL of the CHECKSUM file. ftp : `ftplib.FTP` or `None`, optional An FTP connection. Returns ------- `collections.OrderedDict` An ordered dictionary containing ...
[ "Download", "and", "parse", "an", "Ensembl", "CHECKSUMS", "file", "and", "obtain", "checksums", "." ]
train
https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/ensembl/util.py#L77-L127
grabbles/grabbit
grabbit/utils.py
listify
def listify(obj, ignore=(list, tuple, type(None))): ''' Wraps all non-list or tuple objects in a list; provides a simple way to accept flexible arguments. ''' return obj if isinstance(obj, ignore) else [obj]
python
def listify(obj, ignore=(list, tuple, type(None))): ''' Wraps all non-list or tuple objects in a list; provides a simple way to accept flexible arguments. ''' return obj if isinstance(obj, ignore) else [obj]
[ "def", "listify", "(", "obj", ",", "ignore", "=", "(", "list", ",", "tuple", ",", "type", "(", "None", ")", ")", ")", ":", "return", "obj", "if", "isinstance", "(", "obj", ",", "ignore", ")", "else", "[", "obj", "]" ]
Wraps all non-list or tuple objects in a list; provides a simple way to accept flexible arguments.
[ "Wraps", "all", "non", "-", "list", "or", "tuple", "objects", "in", "a", "list", ";", "provides", "a", "simple", "way", "to", "accept", "flexible", "arguments", "." ]
train
https://github.com/grabbles/grabbit/blob/83ff93df36019eaaee9d4e31f816a518e46cae07/grabbit/utils.py#L34-L37
flo-compbio/genometools
genometools/ncbi/taxonomy.py
_get_divisions
def _get_divisions(taxdump_file): """Returns a dictionary mapping division names to division IDs.""" with tarfile.open(taxdump_file) as tf: with tf.extractfile('division.dmp') as fh: df = pd.read_csv(fh, header=None, sep='|', encoding='ascii') # only keep division ids and names...
python
def _get_divisions(taxdump_file): """Returns a dictionary mapping division names to division IDs.""" with tarfile.open(taxdump_file) as tf: with tf.extractfile('division.dmp') as fh: df = pd.read_csv(fh, header=None, sep='|', encoding='ascii') # only keep division ids and names...
[ "def", "_get_divisions", "(", "taxdump_file", ")", ":", "with", "tarfile", ".", "open", "(", "taxdump_file", ")", "as", "tf", ":", "with", "tf", ".", "extractfile", "(", "'division.dmp'", ")", "as", "fh", ":", "df", "=", "pd", ".", "read_csv", "(", "fh...
Returns a dictionary mapping division names to division IDs.
[ "Returns", "a", "dictionary", "mapping", "division", "names", "to", "division", "IDs", "." ]
train
https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/ncbi/taxonomy.py#L25-L43
flo-compbio/genometools
genometools/ncbi/taxonomy.py
_get_species_taxon_ids
def _get_species_taxon_ids(taxdump_file, select_divisions=None, exclude_divisions=None): """Get a list of species taxon IDs (allow filtering by division).""" if select_divisions and exclude_divisions: raise ValueError('Cannot specify "select_divisions" and ' ...
python
def _get_species_taxon_ids(taxdump_file, select_divisions=None, exclude_divisions=None): """Get a list of species taxon IDs (allow filtering by division).""" if select_divisions and exclude_divisions: raise ValueError('Cannot specify "select_divisions" and ' ...
[ "def", "_get_species_taxon_ids", "(", "taxdump_file", ",", "select_divisions", "=", "None", ",", "exclude_divisions", "=", "None", ")", ":", "if", "select_divisions", "and", "exclude_divisions", ":", "raise", "ValueError", "(", "'Cannot specify \"select_divisions\" and '"...
Get a list of species taxon IDs (allow filtering by division).
[ "Get", "a", "list", "of", "species", "taxon", "IDs", "(", "allow", "filtering", "by", "division", ")", "." ]
train
https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/ncbi/taxonomy.py#L46-L88
flo-compbio/genometools
genometools/ncbi/taxonomy.py
get_species
def get_species(taxdump_file, select_divisions=None, exclude_divisions=None, nrows=None): """Get a dataframe with species information.""" if select_divisions and exclude_divisions: raise ValueError('Cannot specify "select_divisions" and ' '"exclude_divisions...
python
def get_species(taxdump_file, select_divisions=None, exclude_divisions=None, nrows=None): """Get a dataframe with species information.""" if select_divisions and exclude_divisions: raise ValueError('Cannot specify "select_divisions" and ' '"exclude_divisions...
[ "def", "get_species", "(", "taxdump_file", ",", "select_divisions", "=", "None", ",", "exclude_divisions", "=", "None", ",", "nrows", "=", "None", ")", ":", "if", "select_divisions", "and", "exclude_divisions", ":", "raise", "ValueError", "(", "'Cannot specify \"s...
Get a dataframe with species information.
[ "Get", "a", "dataframe", "with", "species", "information", "." ]
train
https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/ncbi/taxonomy.py#L94-L143
shmir/PyIxExplorer
ixexplorer/ixe_object.py
IxeObject.set_attributes
def set_attributes(self, **attributes): """ Set group of attributes without calling set between attributes regardless of global auto_set. Set will be called only after all attributes are set based on global auto_set. :param attributes: dictionary of <attribute, value> to set. """ ...
python
def set_attributes(self, **attributes): """ Set group of attributes without calling set between attributes regardless of global auto_set. Set will be called only after all attributes are set based on global auto_set. :param attributes: dictionary of <attribute, value> to set. """ ...
[ "def", "set_attributes", "(", "self", ",", "*", "*", "attributes", ")", ":", "auto_set", "=", "IxeObject", ".", "get_auto_set", "(", ")", "IxeObject", ".", "set_auto_set", "(", "False", ")", "for", "name", ",", "value", "in", "attributes", ".", "items", ...
Set group of attributes without calling set between attributes regardless of global auto_set. Set will be called only after all attributes are set based on global auto_set. :param attributes: dictionary of <attribute, value> to set.
[ "Set", "group", "of", "attributes", "without", "calling", "set", "between", "attributes", "regardless", "of", "global", "auto_set", "." ]
train
https://github.com/shmir/PyIxExplorer/blob/d6946b9ce0e8961507cc912062e10c365d4beee2/ixexplorer/ixe_object.py#L64-L78
acorg/dark-matter
dark/consensus.py
consensusSequence
def consensusSequence(recordFilename, hitId, fastaFilename, eCutoff=None, db='nt', actualSequenceId=None): """ Build a consensus sequence against a target sequence. recordFilename: the BLAST XML output file. hitId: the str sequence id to examine the BLAST output for hits against. ...
python
def consensusSequence(recordFilename, hitId, fastaFilename, eCutoff=None, db='nt', actualSequenceId=None): """ Build a consensus sequence against a target sequence. recordFilename: the BLAST XML output file. hitId: the str sequence id to examine the BLAST output for hits against. ...
[ "def", "consensusSequence", "(", "recordFilename", ",", "hitId", ",", "fastaFilename", ",", "eCutoff", "=", "None", ",", "db", "=", "'nt'", ",", "actualSequenceId", "=", "None", ")", ":", "print", "(", "'TODO: This function is not finished yet.'", ")", "return", ...
Build a consensus sequence against a target sequence. recordFilename: the BLAST XML output file. hitId: the str sequence id to examine the BLAST output for hits against. fastaFilename: The name of the FASTA file containing query sequences, or a list of fasta sequences from SeqIO.parse eCutoff: ...
[ "Build", "a", "consensus", "sequence", "against", "a", "target", "sequence", "." ]
train
https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/consensus.py#L8-L102
jbochi/cep
cep/__init__.py
Correios.detalhe
def detalhe(self, posicao=0): """Retorna o detalhe de um CEP da última lista de resultados""" handle = self._url_open('detalheCEPAction.do', {'Metodo': 'detalhe', 'TipoCep': 2, 'Posicao': posi...
python
def detalhe(self, posicao=0): """Retorna o detalhe de um CEP da última lista de resultados""" handle = self._url_open('detalheCEPAction.do', {'Metodo': 'detalhe', 'TipoCep': 2, 'Posicao': posi...
[ "def", "detalhe", "(", "self", ",", "posicao", "=", "0", ")", ":", "handle", "=", "self", ".", "_url_open", "(", "'detalheCEPAction.do'", ",", "{", "'Metodo'", ":", "'detalhe'", ",", "'TipoCep'", ":", "2", ",", "'Posicao'", ":", "posicao", "+", "1", ",...
Retorna o detalhe de um CEP da última lista de resultados
[ "Retorna", "o", "detalhe", "de", "um", "CEP", "da", "última", "lista", "de", "resultados" ]
train
https://github.com/jbochi/cep/blob/8c9c334b63fe1685706065a72c69a66ddaa13392/cep/__init__.py#L72-L79
jbochi/cep
cep/__init__.py
Correios.consulta_faixa
def consulta_faixa(self, localidade, uf): """Consulta site e retorna faixa para localidade""" url = 'consultaFaixaCepAction.do' data = { 'UF': uf, 'Localidade': localidade.encode('cp1252'), 'cfm': '1', 'Metodo': 'listaFaixaCEP', 'TipoCo...
python
def consulta_faixa(self, localidade, uf): """Consulta site e retorna faixa para localidade""" url = 'consultaFaixaCepAction.do' data = { 'UF': uf, 'Localidade': localidade.encode('cp1252'), 'cfm': '1', 'Metodo': 'listaFaixaCEP', 'TipoCo...
[ "def", "consulta_faixa", "(", "self", ",", "localidade", ",", "uf", ")", ":", "url", "=", "'consultaFaixaCepAction.do'", "data", "=", "{", "'UF'", ":", "uf", ",", "'Localidade'", ":", "localidade", ".", "encode", "(", "'cp1252'", ")", ",", "'cfm'", ":", ...
Consulta site e retorna faixa para localidade
[ "Consulta", "site", "e", "retorna", "faixa", "para", "localidade" ]
train
https://github.com/jbochi/cep/blob/8c9c334b63fe1685706065a72c69a66ddaa13392/cep/__init__.py#L81-L94
jbochi/cep
cep/__init__.py
Correios.consulta
def consulta(self, endereco, primeiro=False, uf=None, localidade=None, tipo=None, numero=None): """Consulta site e retorna lista de resultados""" if uf is None: url = 'consultaEnderecoAction.do' data = { 'relaxation': endereco.encode('ISO-8859-1'...
python
def consulta(self, endereco, primeiro=False, uf=None, localidade=None, tipo=None, numero=None): """Consulta site e retorna lista de resultados""" if uf is None: url = 'consultaEnderecoAction.do' data = { 'relaxation': endereco.encode('ISO-8859-1'...
[ "def", "consulta", "(", "self", ",", "endereco", ",", "primeiro", "=", "False", ",", "uf", "=", "None", ",", "localidade", "=", "None", ",", "tipo", "=", "None", ",", "numero", "=", "None", ")", ":", "if", "uf", "is", "None", ":", "url", "=", "'c...
Consulta site e retorna lista de resultados
[ "Consulta", "site", "e", "retorna", "lista", "de", "resultados" ]
train
https://github.com/jbochi/cep/blob/8c9c334b63fe1685706065a72c69a66ddaa13392/cep/__init__.py#L96-L133
vovanec/httputil
httputil/request_engines/sync.py
SyncRequestEngine._request
def _request(self, url, *, method='GET', headers=None, data=None, result_callback=None): """Perform synchronous request. :param str url: request URL. :param str method: request method. :param object data: JSON-encodable object. :param object -> object result_cal...
python
def _request(self, url, *, method='GET', headers=None, data=None, result_callback=None): """Perform synchronous request. :param str url: request URL. :param str method: request method. :param object data: JSON-encodable object. :param object -> object result_cal...
[ "def", "_request", "(", "self", ",", "url", ",", "*", ",", "method", "=", "'GET'", ",", "headers", "=", "None", ",", "data", "=", "None", ",", "result_callback", "=", "None", ")", ":", "retries_left", "=", "self", ".", "_conn_retries", "while", "True",...
Perform synchronous request. :param str url: request URL. :param str method: request method. :param object data: JSON-encodable object. :param object -> object result_callback: result callback. :rtype: dict :raise: APIError
[ "Perform", "synchronous", "request", "." ]
train
https://github.com/vovanec/httputil/blob/0b8dab5a23166cceb7dbc2a1dbc802ab5b311347/httputil/request_engines/sync.py#L51-L121
vovanec/httputil
httputil/request_engines/sync.py
SyncRequestEngine._make_session
def _make_session(): """Create session object. :rtype: requests.Session """ sess = requests.Session() sess.mount('http://', requests.adapters.HTTPAdapter(max_retries=False)) sess.mount('https://', requests.adapters.HTTPAdapter(max_retries=False)) return sess
python
def _make_session(): """Create session object. :rtype: requests.Session """ sess = requests.Session() sess.mount('http://', requests.adapters.HTTPAdapter(max_retries=False)) sess.mount('https://', requests.adapters.HTTPAdapter(max_retries=False)) return sess
[ "def", "_make_session", "(", ")", ":", "sess", "=", "requests", ".", "Session", "(", ")", "sess", ".", "mount", "(", "'http://'", ",", "requests", ".", "adapters", ".", "HTTPAdapter", "(", "max_retries", "=", "False", ")", ")", "sess", ".", "mount", "(...
Create session object. :rtype: requests.Session
[ "Create", "session", "object", "." ]
train
https://github.com/vovanec/httputil/blob/0b8dab5a23166cceb7dbc2a1dbc802ab5b311347/httputil/request_engines/sync.py#L124-L134
flo-compbio/genometools
genometools/gdc/tcga.py
get_clinical_data
def get_clinical_data(tcga_id): """Get clinical data for a TCGA project. Parameters ---------- tcga_id : str The TCGA project ID. Returns ------- `pandas.DataFrame` The clinical data.abs Notes ----- Clinical data is associated with individual cases (pat...
python
def get_clinical_data(tcga_id): """Get clinical data for a TCGA project. Parameters ---------- tcga_id : str The TCGA project ID. Returns ------- `pandas.DataFrame` The clinical data.abs Notes ----- Clinical data is associated with individual cases (pat...
[ "def", "get_clinical_data", "(", "tcga_id", ")", ":", "payload", "=", "{", "'attachment'", ":", "'true'", ",", "\"filters\"", ":", "json", ".", "dumps", "(", "{", "\"op\"", ":", "\"and\"", ",", "\"content\"", ":", "[", "{", "\"op\"", ":", "\"in\"", ",", ...
Get clinical data for a TCGA project. Parameters ---------- tcga_id : str The TCGA project ID. Returns ------- `pandas.DataFrame` The clinical data.abs Notes ----- Clinical data is associated with individual cases (patients). These correspond to rows in...
[ "Get", "clinical", "data", "for", "a", "TCGA", "project", ".", "Parameters", "----------", "tcga_id", ":", "str", "The", "TCGA", "project", "ID", ".", "Returns", "-------", "pandas", ".", "DataFrame", "The", "clinical", "data", ".", "abs" ]
train
https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/gdc/tcga.py#L35-L95
flo-compbio/genometools
genometools/gdc/tcga.py
get_biospecimen_data
def get_biospecimen_data(tcga_id): """Get biospecimen data for a TCGA project. Parameters ---------- tcga_id : str The TCGA project ID. Returns ------- `pandas.DataFrame` The biospecmin data. Notes ----- Biospecimen data is associated with individual vi...
python
def get_biospecimen_data(tcga_id): """Get biospecimen data for a TCGA project. Parameters ---------- tcga_id : str The TCGA project ID. Returns ------- `pandas.DataFrame` The biospecmin data. Notes ----- Biospecimen data is associated with individual vi...
[ "def", "get_biospecimen_data", "(", "tcga_id", ")", ":", "payload", "=", "{", "'attachment'", ":", "'true'", ",", "\"filters\"", ":", "json", ".", "dumps", "(", "{", "\"op\"", ":", "\"and\"", ",", "\"content\"", ":", "[", "{", "\"op\"", ":", "\"in\"", ",...
Get biospecimen data for a TCGA project. Parameters ---------- tcga_id : str The TCGA project ID. Returns ------- `pandas.DataFrame` The biospecmin data. Notes ----- Biospecimen data is associated with individual vials. TCGA vials correspond to portions...
[ "Get", "biospecimen", "data", "for", "a", "TCGA", "project", ".", "Parameters", "----------", "tcga_id", ":", "str", "The", "TCGA", "project", "ID", ".", "Returns", "-------", "pandas", ".", "DataFrame", "The", "biospecmin", "data", "." ]
train
https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/gdc/tcga.py#L99-L170
flo-compbio/genometools
genometools/gdc/tcga.py
get_masked_cnv_manifest
def get_masked_cnv_manifest(tcga_id): """Get manifest for masked TCGA copy-number variation data. Params ------ tcga_id : str The TCGA project ID. download_file : str The path of the download file. Returns ------- `pandas.DataFrame` The manifest. ...
python
def get_masked_cnv_manifest(tcga_id): """Get manifest for masked TCGA copy-number variation data. Params ------ tcga_id : str The TCGA project ID. download_file : str The path of the download file. Returns ------- `pandas.DataFrame` The manifest. ...
[ "def", "get_masked_cnv_manifest", "(", "tcga_id", ")", ":", "payload", "=", "{", "\"filters\"", ":", "json", ".", "dumps", "(", "{", "\"op\"", ":", "\"and\"", ",", "\"content\"", ":", "[", "{", "\"op\"", ":", "\"in\"", ",", "\"content\"", ":", "{", "\"fi...
Get manifest for masked TCGA copy-number variation data. Params ------ tcga_id : str The TCGA project ID. download_file : str The path of the download file. Returns ------- `pandas.DataFrame` The manifest.
[ "Get", "manifest", "for", "masked", "TCGA", "copy", "-", "number", "variation", "data", ".", "Params", "------", "tcga_id", ":", "str", "The", "TCGA", "project", "ID", ".", "download_file", ":", "str", "The", "path", "of", "the", "download", "file", ".", ...
train
https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/gdc/tcga.py#L174-L221
flo-compbio/genometools
genometools/gdc/tcga.py
get_file_samples
def get_file_samples(file_ids): """Get TCGA associated sample barcodes for a list of file IDs. Params ------ file_ids : Iterable The file IDs. Returns ------- `pandas.Series` Series containing file IDs as index and corresponding sample barcodes. """ ass...
python
def get_file_samples(file_ids): """Get TCGA associated sample barcodes for a list of file IDs. Params ------ file_ids : Iterable The file IDs. Returns ------- `pandas.Series` Series containing file IDs as index and corresponding sample barcodes. """ ass...
[ "def", "get_file_samples", "(", "file_ids", ")", ":", "assert", "isinstance", "(", "file_ids", ",", "Iterable", ")", "# query TCGA API to get sample barcodes associated with file IDs", "payload", "=", "{", "\"filters\"", ":", "json", ".", "dumps", "(", "{", "\"op\"", ...
Get TCGA associated sample barcodes for a list of file IDs. Params ------ file_ids : Iterable The file IDs. Returns ------- `pandas.Series` Series containing file IDs as index and corresponding sample barcodes.
[ "Get", "TCGA", "associated", "sample", "barcodes", "for", "a", "list", "of", "file", "IDs", ".", "Params", "------", "file_ids", ":", "Iterable", "The", "file", "IDs", ".", "Returns", "-------", "pandas", ".", "Series", "Series", "containing", "file", "IDs",...
train
https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/gdc/tcga.py#L272-L314
flo-compbio/genometools
genometools/gdc/tcga.py
get_unique_sample_files
def get_unique_sample_files(file_samples): """Filter file_sample data frame to only keep one file per sample. Params ------ file_samples : `pandas.DataFrame` A data frame containing a mapping between file IDs and sample barcodes. This type of data frame is returned by :meth:`get_fil...
python
def get_unique_sample_files(file_samples): """Filter file_sample data frame to only keep one file per sample. Params ------ file_samples : `pandas.DataFrame` A data frame containing a mapping between file IDs and sample barcodes. This type of data frame is returned by :meth:`get_fil...
[ "def", "get_unique_sample_files", "(", "file_samples", ")", ":", "assert", "isinstance", "(", "file_samples", ",", "pd", ".", "DataFrame", ")", "df", "=", "file_samples", "# use shorter variable name", "# sort data frame by file ID", "df", "=", "df", ".", "sort_values...
Filter file_sample data frame to only keep one file per sample. Params ------ file_samples : `pandas.DataFrame` A data frame containing a mapping between file IDs and sample barcodes. This type of data frame is returned by :meth:`get_file_samples`. Returns ------- `...
[ "Filter", "file_sample", "data", "frame", "to", "only", "keep", "one", "file", "per", "sample", ".", "Params", "------", "file_samples", ":", "pandas", ".", "DataFrame", "A", "data", "frame", "containing", "a", "mapping", "between", "file", "IDs", "and", "sa...
train
https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/gdc/tcga.py#L317-L368
flo-compbio/genometools
genometools/gdc/tcga.py
get_fresh_primary_tumors
def get_fresh_primary_tumors(biospecimen): """Filter biospecimen data to only keep non-FFPE primary tumor samples. Parameters ---------- biospecimen : `pandas.DataFrame` The biospecimen data frame. This type of data frame is returned by :meth:`get_biospecimen_data`. Returns...
python
def get_fresh_primary_tumors(biospecimen): """Filter biospecimen data to only keep non-FFPE primary tumor samples. Parameters ---------- biospecimen : `pandas.DataFrame` The biospecimen data frame. This type of data frame is returned by :meth:`get_biospecimen_data`. Returns...
[ "def", "get_fresh_primary_tumors", "(", "biospecimen", ")", ":", "df", "=", "biospecimen", "# use shorter variable name", "# get rid of FFPE samples", "num_before", "=", "len", "(", "df", ".", "index", ")", "df", "=", "df", ".", "loc", "[", "~", "df", "[", "'i...
Filter biospecimen data to only keep non-FFPE primary tumor samples. Parameters ---------- biospecimen : `pandas.DataFrame` The biospecimen data frame. This type of data frame is returned by :meth:`get_biospecimen_data`. Returns ------- `pandas.DataFrame` The fi...
[ "Filter", "biospecimen", "data", "to", "only", "keep", "non", "-", "FFPE", "primary", "tumor", "samples", ".", "Parameters", "----------", "biospecimen", ":", "pandas", ".", "DataFrame", "The", "biospecimen", "data", "frame", ".", "This", "type", "of", "data",...
train
https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/gdc/tcga.py#L371-L401
acorg/dark-matter
dark/fasta.py
dedupFasta
def dedupFasta(reads): """ Remove sequence duplicates (based on sequence) from FASTA. @param reads: a C{dark.reads.Reads} instance. @return: a generator of C{dark.reads.Read} instances with no duplicates. """ seen = set() add = seen.add for read in reads: hash_ = md5(read.sequen...
python
def dedupFasta(reads): """ Remove sequence duplicates (based on sequence) from FASTA. @param reads: a C{dark.reads.Reads} instance. @return: a generator of C{dark.reads.Read} instances with no duplicates. """ seen = set() add = seen.add for read in reads: hash_ = md5(read.sequen...
[ "def", "dedupFasta", "(", "reads", ")", ":", "seen", "=", "set", "(", ")", "add", "=", "seen", ".", "add", "for", "read", "in", "reads", ":", "hash_", "=", "md5", "(", "read", ".", "sequence", ".", "encode", "(", "'UTF-8'", ")", ")", ".", "digest...
Remove sequence duplicates (based on sequence) from FASTA. @param reads: a C{dark.reads.Reads} instance. @return: a generator of C{dark.reads.Read} instances with no duplicates.
[ "Remove", "sequence", "duplicates", "(", "based", "on", "sequence", ")", "from", "FASTA", "." ]
train
https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/fasta.py#L17-L30
acorg/dark-matter
dark/fasta.py
dePrefixAndSuffixFasta
def dePrefixAndSuffixFasta(sequences): """ sequences: an iterator producing Bio.Seq sequences. return: a generator of sequences with no duplicates and no fully contained subsequences. """ sequences = sorted(sequences, key=lambda s: len(s.seq), reverse=True) seen = set() for s in seq...
python
def dePrefixAndSuffixFasta(sequences): """ sequences: an iterator producing Bio.Seq sequences. return: a generator of sequences with no duplicates and no fully contained subsequences. """ sequences = sorted(sequences, key=lambda s: len(s.seq), reverse=True) seen = set() for s in seq...
[ "def", "dePrefixAndSuffixFasta", "(", "sequences", ")", ":", "sequences", "=", "sorted", "(", "sequences", ",", "key", "=", "lambda", "s", ":", "len", "(", "s", ".", "seq", ")", ",", "reverse", "=", "True", ")", "seen", "=", "set", "(", ")", "for", ...
sequences: an iterator producing Bio.Seq sequences. return: a generator of sequences with no duplicates and no fully contained subsequences.
[ "sequences", ":", "an", "iterator", "producing", "Bio", ".", "Seq", "sequences", "." ]
train
https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/fasta.py#L33-L54
acorg/dark-matter
dark/fasta.py
fastaSubtract
def fastaSubtract(fastaFiles): """ Given a list of open file descriptors, each with FASTA content, remove the reads found in the 2nd, 3rd, etc files from the first file in the list. @param fastaFiles: a C{list} of FASTA filenames. @raises IndexError: if passed an empty list. @return: An ite...
python
def fastaSubtract(fastaFiles): """ Given a list of open file descriptors, each with FASTA content, remove the reads found in the 2nd, 3rd, etc files from the first file in the list. @param fastaFiles: a C{list} of FASTA filenames. @raises IndexError: if passed an empty list. @return: An ite...
[ "def", "fastaSubtract", "(", "fastaFiles", ")", ":", "reads", "=", "{", "}", "firstFile", "=", "fastaFiles", ".", "pop", "(", "0", ")", "for", "seq", "in", "SeqIO", ".", "parse", "(", "firstFile", ",", "'fasta'", ")", ":", "reads", "[", "seq", ".", ...
Given a list of open file descriptors, each with FASTA content, remove the reads found in the 2nd, 3rd, etc files from the first file in the list. @param fastaFiles: a C{list} of FASTA filenames. @raises IndexError: if passed an empty list. @return: An iterator producing C{Bio.SeqRecord} instances ...
[ "Given", "a", "list", "of", "open", "file", "descriptors", "each", "with", "FASTA", "content", "remove", "the", "reads", "found", "in", "the", "2nd", "3rd", "etc", "files", "from", "the", "first", "file", "in", "the", "list", "." ]
train
https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/fasta.py#L57-L81
acorg/dark-matter
dark/fasta.py
combineReads
def combineReads(filename, sequences, readClass=DNARead, upperCase=False, idPrefix='command-line-read-'): """ Combine FASTA reads from a file and/or sequence strings. @param filename: A C{str} file name containing FASTA reads. @param sequences: A C{list} of C{str} sequences. If a seque...
python
def combineReads(filename, sequences, readClass=DNARead, upperCase=False, idPrefix='command-line-read-'): """ Combine FASTA reads from a file and/or sequence strings. @param filename: A C{str} file name containing FASTA reads. @param sequences: A C{list} of C{str} sequences. If a seque...
[ "def", "combineReads", "(", "filename", ",", "sequences", ",", "readClass", "=", "DNARead", ",", "upperCase", "=", "False", ",", "idPrefix", "=", "'command-line-read-'", ")", ":", "# Read sequences from a FASTA file, if given.", "if", "filename", ":", "reads", "=", ...
Combine FASTA reads from a file and/or sequence strings. @param filename: A C{str} file name containing FASTA reads. @param sequences: A C{list} of C{str} sequences. If a sequence contains spaces, the last field (after splitting on spaces) will be used as the sequence and the first fields will ...
[ "Combine", "FASTA", "reads", "from", "a", "file", "and", "/", "or", "sequence", "strings", "." ]
train
https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/fasta.py#L184-L226
acorg/dark-matter
dark/fasta.py
FastaReads.iter
def iter(self): """ Iterate over the sequences in the files in self.files_, yielding each as an instance of the desired read class. """ count = 0 for _file in self._files: with asHandle(_file) as fp: # Duplicate some code here so as not to test...
python
def iter(self): """ Iterate over the sequences in the files in self.files_, yielding each as an instance of the desired read class. """ count = 0 for _file in self._files: with asHandle(_file) as fp: # Duplicate some code here so as not to test...
[ "def", "iter", "(", "self", ")", ":", "count", "=", "0", "for", "_file", "in", "self", ".", "_files", ":", "with", "asHandle", "(", "_file", ")", "as", "fp", ":", "# Duplicate some code here so as not to test", "# self._upperCase in the loop.", "if", "self", "...
Iterate over the sequences in the files in self.files_, yielding each as an instance of the desired read class.
[ "Iterate", "over", "the", "sequences", "in", "the", "files", "in", "self", ".", "files_", "yielding", "each", "as", "an", "instance", "of", "the", "desired", "read", "class", "." ]
train
https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/fasta.py#L111-L131
acorg/dark-matter
dark/fasta.py
FastaFaiReads.iter
def iter(self): """ Iterate over the sequences in the files in self.files_, yielding each as an instance of the desired read class. """ if self._upperCase: for id_ in self._fasta: yield self._readClass(id_, str(self._fasta[id_]).upper()) else: ...
python
def iter(self): """ Iterate over the sequences in the files in self.files_, yielding each as an instance of the desired read class. """ if self._upperCase: for id_ in self._fasta: yield self._readClass(id_, str(self._fasta[id_]).upper()) else: ...
[ "def", "iter", "(", "self", ")", ":", "if", "self", ".", "_upperCase", ":", "for", "id_", "in", "self", ".", "_fasta", ":", "yield", "self", ".", "_readClass", "(", "id_", ",", "str", "(", "self", ".", "_fasta", "[", "id_", "]", ")", ".", "upper"...
Iterate over the sequences in the files in self.files_, yielding each as an instance of the desired read class.
[ "Iterate", "over", "the", "sequences", "in", "the", "files", "in", "self", ".", "files_", "yielding", "each", "as", "an", "instance", "of", "the", "desired", "read", "class", "." ]
train
https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/fasta.py#L168-L178
acorg/dark-matter
dark/fasta.py
SqliteIndex._getFilename
def _getFilename(self, fileNumber): """ Given a file number, get its name (if any). @param fileNumber: An C{int} file number. @return: A C{str} file name or C{None} if a file with that number has not been added. """ cur = self._connection.cursor() cur...
python
def _getFilename(self, fileNumber): """ Given a file number, get its name (if any). @param fileNumber: An C{int} file number. @return: A C{str} file name or C{None} if a file with that number has not been added. """ cur = self._connection.cursor() cur...
[ "def", "_getFilename", "(", "self", ",", "fileNumber", ")", ":", "cur", "=", "self", ".", "_connection", ".", "cursor", "(", ")", "cur", ".", "execute", "(", "'SELECT name FROM files WHERE id = ?'", ",", "(", "fileNumber", ",", ")", ")", "row", "=", "cur",...
Given a file number, get its name (if any). @param fileNumber: An C{int} file number. @return: A C{str} file name or C{None} if a file with that number has not been added.
[ "Given", "a", "file", "number", "get", "its", "name", "(", "if", "any", ")", "." ]
train
https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/fasta.py#L265-L279
acorg/dark-matter
dark/fasta.py
SqliteIndex._getFileNumber
def _getFileNumber(self, filename): """ Given a file name, get its file number (if any). @param filename: A C{str} file name. @return: An C{int} file number or C{None} if no file with that name has been added. """ cur = self._connection.cursor() cur.e...
python
def _getFileNumber(self, filename): """ Given a file name, get its file number (if any). @param filename: A C{str} file name. @return: An C{int} file number or C{None} if no file with that name has been added. """ cur = self._connection.cursor() cur.e...
[ "def", "_getFileNumber", "(", "self", ",", "filename", ")", ":", "cur", "=", "self", ".", "_connection", ".", "cursor", "(", ")", "cur", ".", "execute", "(", "'SELECT id FROM files WHERE name = ?'", ",", "(", "filename", ",", ")", ")", "row", "=", "cur", ...
Given a file name, get its file number (if any). @param filename: A C{str} file name. @return: An C{int} file number or C{None} if no file with that name has been added.
[ "Given", "a", "file", "name", "get", "its", "file", "number", "(", "if", "any", ")", "." ]
train
https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/fasta.py#L281-L295
acorg/dark-matter
dark/fasta.py
SqliteIndex._addFilename
def _addFilename(self, filename): """ Add a new file name. @param filename: A C{str} file name. @raise ValueError: If a file with this name has already been added. @return: The C{int} id of the newly added file. """ cur = self._connection.cursor() try: ...
python
def _addFilename(self, filename): """ Add a new file name. @param filename: A C{str} file name. @raise ValueError: If a file with this name has already been added. @return: The C{int} id of the newly added file. """ cur = self._connection.cursor() try: ...
[ "def", "_addFilename", "(", "self", ",", "filename", ")", ":", "cur", "=", "self", ".", "_connection", ".", "cursor", "(", ")", "try", ":", "cur", ".", "execute", "(", "'INSERT INTO files(name) VALUES (?)'", ",", "(", "filename", ",", ")", ")", "except", ...
Add a new file name. @param filename: A C{str} file name. @raise ValueError: If a file with this name has already been added. @return: The C{int} id of the newly added file.
[ "Add", "a", "new", "file", "name", "." ]
train
https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/fasta.py#L297-L316
acorg/dark-matter
dark/fasta.py
SqliteIndex.addFile
def addFile(self, filename): """ Add a new FASTA file of sequences. @param filename: A C{str} file name, with the file in FASTA format. This file must (obviously) exist at indexing time. When __getitem__ is used to access sequences, it is possible to provide a ...
python
def addFile(self, filename): """ Add a new FASTA file of sequences. @param filename: A C{str} file name, with the file in FASTA format. This file must (obviously) exist at indexing time. When __getitem__ is used to access sequences, it is possible to provide a ...
[ "def", "addFile", "(", "self", ",", "filename", ")", ":", "endswith", "=", "filename", ".", "lower", "(", ")", ".", "endswith", "if", "endswith", "(", "'.bgz'", ")", "or", "endswith", "(", "'.gz'", ")", ":", "useBgzf", "=", "True", "elif", "endswith", ...
Add a new FASTA file of sequences. @param filename: A C{str} file name, with the file in FASTA format. This file must (obviously) exist at indexing time. When __getitem__ is used to access sequences, it is possible to provide a C{fastaDirectory} argument to our C{__init__} t...
[ "Add", "a", "new", "FASTA", "file", "of", "sequences", "." ]
train
https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/fasta.py#L318-L404
acorg/dark-matter
dark/fasta.py
SqliteIndex._find
def _find(self, id_): """ Find the filename and offset of a sequence, given its id. @param id_: A C{str} sequence id. @return: A 2-tuple, containing the C{str} file name and C{int} offset within that file of the sequence. """ cur = self._connection.cursor() ...
python
def _find(self, id_): """ Find the filename and offset of a sequence, given its id. @param id_: A C{str} sequence id. @return: A 2-tuple, containing the C{str} file name and C{int} offset within that file of the sequence. """ cur = self._connection.cursor() ...
[ "def", "_find", "(", "self", ",", "id_", ")", ":", "cur", "=", "self", ".", "_connection", ".", "cursor", "(", ")", "cur", ".", "execute", "(", "'SELECT fileNumber, offset FROM sequences WHERE id = ?'", ",", "(", "id_", ",", ")", ")", "row", "=", "cur", ...
Find the filename and offset of a sequence, given its id. @param id_: A C{str} sequence id. @return: A 2-tuple, containing the C{str} file name and C{int} offset within that file of the sequence.
[ "Find", "the", "filename", "and", "offset", "of", "a", "sequence", "given", "its", "id", "." ]
train
https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/fasta.py#L406-L421
flo-compbio/genometools
genometools/gtf.py
parse_attributes
def parse_attributes(s): """ Parses the ``attribute`` string of a GFF/GTF annotation. Parameters ---------- s : str The attribute string. Returns ------- dict A dictionary containing attribute name/value pairs. Notes ----- The ``attribute`` string is the 9th fi...
python
def parse_attributes(s): """ Parses the ``attribute`` string of a GFF/GTF annotation. Parameters ---------- s : str The attribute string. Returns ------- dict A dictionary containing attribute name/value pairs. Notes ----- The ``attribute`` string is the 9th fi...
[ "def", "parse_attributes", "(", "s", ")", ":", "# use regular expression with negative lookbehind to make sure we don't", "# split on escaped semicolons (\"\\;\")", "attr_sep", "=", "re", ".", "compile", "(", "r'(?<!\\\\)\\s*;\\s*'", ")", "attr", "=", "{", "}", "atts", "=",...
Parses the ``attribute`` string of a GFF/GTF annotation. Parameters ---------- s : str The attribute string. Returns ------- dict A dictionary containing attribute name/value pairs. Notes ----- The ``attribute`` string is the 9th field of each annotation (row), ...
[ "Parses", "the", "attribute", "string", "of", "a", "GFF", "/", "GTF", "annotation", "." ]
train
https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/gtf.py#L25-L56