repository_name
stringlengths
7
55
func_path_in_repository
stringlengths
4
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
75
104k
language
stringclasses
1 value
func_code_string
stringlengths
75
104k
func_code_tokens
listlengths
19
28.4k
func_documentation_string
stringlengths
1
46.9k
func_documentation_tokens
listlengths
1
1.97k
split_name
stringclasses
1 value
func_code_url
stringlengths
87
315
pescadores/pescador
examples/mux/mux_files_example.py
npz_generator
def npz_generator(npz_path): """Generate data from an npz file.""" npz_data = np.load(npz_path) X = npz_data['X'] # Y is a binary maxtrix with shape=(n, k), each y will have shape=(k,) y = npz_data['Y'] n = X.shape[0] while True: i = np.random.randint(0, n) yield {'X': X[i]...
python
def npz_generator(npz_path): """Generate data from an npz file.""" npz_data = np.load(npz_path) X = npz_data['X'] # Y is a binary maxtrix with shape=(n, k), each y will have shape=(k,) y = npz_data['Y'] n = X.shape[0] while True: i = np.random.randint(0, n) yield {'X': X[i]...
[ "def", "npz_generator", "(", "npz_path", ")", ":", "npz_data", "=", "np", ".", "load", "(", "npz_path", ")", "X", "=", "npz_data", "[", "'X'", "]", "# Y is a binary maxtrix with shape=(n, k), each y will have shape=(k,)", "y", "=", "npz_data", "[", "'Y'", "]", "...
Generate data from an npz file.
[ "Generate", "data", "from", "an", "npz", "file", "." ]
train
https://github.com/pescadores/pescador/blob/786e2b5f882d13ea563769fbc7ad0a0a10c3553d/examples/mux/mux_files_example.py#L60-L71
vanheeringen-lab/gimmemotifs
gimmemotifs/utils.py
phyper
def phyper(k, good, bad, N): """ Current hypergeometric implementation in scipy is broken, so here's the correct version """ pvalues = [phyper_single(x, good, bad, N) for x in range(k + 1, N + 1)] return np.sum(pvalues)
python
def phyper(k, good, bad, N): """ Current hypergeometric implementation in scipy is broken, so here's the correct version """ pvalues = [phyper_single(x, good, bad, N) for x in range(k + 1, N + 1)] return np.sum(pvalues)
[ "def", "phyper", "(", "k", ",", "good", ",", "bad", ",", "N", ")", ":", "pvalues", "=", "[", "phyper_single", "(", "x", ",", "good", ",", "bad", ",", "N", ")", "for", "x", "in", "range", "(", "k", "+", "1", ",", "N", "+", "1", ")", "]", "...
Current hypergeometric implementation in scipy is broken, so here's the correct version
[ "Current", "hypergeometric", "implementation", "in", "scipy", "is", "broken", "so", "here", "s", "the", "correct", "version" ]
train
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/utils.py#L77-L80
vanheeringen-lab/gimmemotifs
gimmemotifs/utils.py
write_equalwidth_bedfile
def write_equalwidth_bedfile(bedfile, width, outfile): """Read input from <bedfile>, set the width of all entries to <width> and write the result to <outfile>. Input file needs to be in BED or WIG format.""" BUFSIZE = 10000 f = open(bedfile) out = open(outfile, "w") lines = f.readlines(BUF...
python
def write_equalwidth_bedfile(bedfile, width, outfile): """Read input from <bedfile>, set the width of all entries to <width> and write the result to <outfile>. Input file needs to be in BED or WIG format.""" BUFSIZE = 10000 f = open(bedfile) out = open(outfile, "w") lines = f.readlines(BUF...
[ "def", "write_equalwidth_bedfile", "(", "bedfile", ",", "width", ",", "outfile", ")", ":", "BUFSIZE", "=", "10000", "f", "=", "open", "(", "bedfile", ")", "out", "=", "open", "(", "outfile", ",", "\"w\"", ")", "lines", "=", "f", ".", "readlines", "(", ...
Read input from <bedfile>, set the width of all entries to <width> and write the result to <outfile>. Input file needs to be in BED or WIG format.
[ "Read", "input", "from", "<bedfile", ">", "set", "the", "width", "of", "all", "entries", "to", "<width", ">", "and", "write", "the", "result", "to", "<outfile", ">", ".", "Input", "file", "needs", "to", "be", "in", "BED", "or", "WIG", "format", "." ]
train
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/utils.py#L143-L177
vanheeringen-lab/gimmemotifs
gimmemotifs/utils.py
calc_motif_enrichment
def calc_motif_enrichment(sample, background, mtc=None, len_sample=None, len_back=None): """Calculate enrichment based on hypergeometric distribution""" INF = "Inf" if mtc not in [None, "Bonferroni", "Benjamini-Hochberg", "None"]: raise RuntimeError("Unknown correction: %s" % mtc) sig = ...
python
def calc_motif_enrichment(sample, background, mtc=None, len_sample=None, len_back=None): """Calculate enrichment based on hypergeometric distribution""" INF = "Inf" if mtc not in [None, "Bonferroni", "Benjamini-Hochberg", "None"]: raise RuntimeError("Unknown correction: %s" % mtc) sig = ...
[ "def", "calc_motif_enrichment", "(", "sample", ",", "background", ",", "mtc", "=", "None", ",", "len_sample", "=", "None", ",", "len_back", "=", "None", ")", ":", "INF", "=", "\"Inf\"", "if", "mtc", "not", "in", "[", "None", ",", "\"Bonferroni\"", ",", ...
Calculate enrichment based on hypergeometric distribution
[ "Calculate", "enrichment", "based", "on", "hypergeometric", "distribution" ]
train
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/utils.py#L264-L321
vanheeringen-lab/gimmemotifs
gimmemotifs/utils.py
parse_cutoff
def parse_cutoff(motifs, cutoff, default=0.9): """ Provide either a file with one cutoff per motif or a single cutoff returns a hash with motif id as key and cutoff as value """ cutoffs = {} if os.path.isfile(str(cutoff)): for i,line in enumerate(open(cutoff)): if line !...
python
def parse_cutoff(motifs, cutoff, default=0.9): """ Provide either a file with one cutoff per motif or a single cutoff returns a hash with motif id as key and cutoff as value """ cutoffs = {} if os.path.isfile(str(cutoff)): for i,line in enumerate(open(cutoff)): if line !...
[ "def", "parse_cutoff", "(", "motifs", ",", "cutoff", ",", "default", "=", "0.9", ")", ":", "cutoffs", "=", "{", "}", "if", "os", ".", "path", ".", "isfile", "(", "str", "(", "cutoff", ")", ")", ":", "for", "i", ",", "line", "in", "enumerate", "("...
Provide either a file with one cutoff per motif or a single cutoff returns a hash with motif id as key and cutoff as value
[ "Provide", "either", "a", "file", "with", "one", "cutoff", "per", "motif", "or", "a", "single", "cutoff", "returns", "a", "hash", "with", "motif", "id", "as", "key", "and", "cutoff", "as", "value" ]
train
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/utils.py#L400-L424
vanheeringen-lab/gimmemotifs
gimmemotifs/utils.py
determine_file_type
def determine_file_type(fname): """ Detect file type. The following file types are supported: BED, narrowPeak, FASTA, list of chr:start-end regions If the extension is bed, fa, fasta or narrowPeak, we will believe this without checking! Parameters ---------- fname : str Fil...
python
def determine_file_type(fname): """ Detect file type. The following file types are supported: BED, narrowPeak, FASTA, list of chr:start-end regions If the extension is bed, fa, fasta or narrowPeak, we will believe this without checking! Parameters ---------- fname : str Fil...
[ "def", "determine_file_type", "(", "fname", ")", ":", "if", "not", "(", "isinstance", "(", "fname", ",", "str", ")", "or", "isinstance", "(", "fname", ",", "unicode", ")", ")", ":", "raise", "ValueError", "(", "\"{} is not a file name!\"", ",", "fname", ")...
Detect file type. The following file types are supported: BED, narrowPeak, FASTA, list of chr:start-end regions If the extension is bed, fa, fasta or narrowPeak, we will believe this without checking! Parameters ---------- fname : str File name. Returns ------- filetyp...
[ "Detect", "file", "type", "." ]
train
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/utils.py#L495-L562
vanheeringen-lab/gimmemotifs
gimmemotifs/utils.py
get_seqs_type
def get_seqs_type(seqs): """ automagically determine input type the following types are detected: - Fasta object - FASTA file - list of regions - region file - BED file """ region_p = re.compile(r'^(.+):(\d+)-(\d+)$') if isinstance(seqs, Fasta): re...
python
def get_seqs_type(seqs): """ automagically determine input type the following types are detected: - Fasta object - FASTA file - list of regions - region file - BED file """ region_p = re.compile(r'^(.+):(\d+)-(\d+)$') if isinstance(seqs, Fasta): re...
[ "def", "get_seqs_type", "(", "seqs", ")", ":", "region_p", "=", "re", ".", "compile", "(", "r'^(.+):(\\d+)-(\\d+)$'", ")", "if", "isinstance", "(", "seqs", ",", "Fasta", ")", ":", "return", "\"fasta\"", "elif", "isinstance", "(", "seqs", ",", "list", ")", ...
automagically determine input type the following types are detected: - Fasta object - FASTA file - list of regions - region file - BED file
[ "automagically", "determine", "input", "type", "the", "following", "types", "are", "detected", ":", "-", "Fasta", "object", "-", "FASTA", "file", "-", "list", "of", "regions", "-", "region", "file", "-", "BED", "file" ]
train
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/utils.py#L565-L598
vanheeringen-lab/gimmemotifs
gimmemotifs/utils.py
file_checksum
def file_checksum(fname): """Return md5 checksum of file. Note: only works for files < 4GB. Parameters ---------- filename : str File used to calculate checksum. Returns ------- checkum : str """ size = os.path.getsize(fname) with open(fname, "r+") as f: ...
python
def file_checksum(fname): """Return md5 checksum of file. Note: only works for files < 4GB. Parameters ---------- filename : str File used to calculate checksum. Returns ------- checkum : str """ size = os.path.getsize(fname) with open(fname, "r+") as f: ...
[ "def", "file_checksum", "(", "fname", ")", ":", "size", "=", "os", ".", "path", ".", "getsize", "(", "fname", ")", "with", "open", "(", "fname", ",", "\"r+\"", ")", "as", "f", ":", "checksum", "=", "hashlib", ".", "md5", "(", "mmap", ".", "mmap", ...
Return md5 checksum of file. Note: only works for files < 4GB. Parameters ---------- filename : str File used to calculate checksum. Returns ------- checkum : str
[ "Return", "md5", "checksum", "of", "file", "." ]
train
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/utils.py#L616-L633
vanheeringen-lab/gimmemotifs
gimmemotifs/genome_index.py
download_annotation
def download_annotation(genomebuild, gene_file): """ Download gene annotation from UCSC based on genomebuild. Will check UCSC, Ensembl and RefSeq annotation. Parameters ---------- genomebuild : str UCSC genome name. gene_file : str Output file name. """ pred_bin = ...
python
def download_annotation(genomebuild, gene_file): """ Download gene annotation from UCSC based on genomebuild. Will check UCSC, Ensembl and RefSeq annotation. Parameters ---------- genomebuild : str UCSC genome name. gene_file : str Output file name. """ pred_bin = ...
[ "def", "download_annotation", "(", "genomebuild", ",", "gene_file", ")", ":", "pred_bin", "=", "\"genePredToBed\"", "pred", "=", "find_executable", "(", "pred_bin", ")", "if", "not", "pred", ":", "sys", ".", "stderr", ".", "write", "(", "\"{} not found in path!\...
Download gene annotation from UCSC based on genomebuild. Will check UCSC, Ensembl and RefSeq annotation. Parameters ---------- genomebuild : str UCSC genome name. gene_file : str Output file name.
[ "Download", "gene", "annotation", "from", "UCSC", "based", "on", "genomebuild", "." ]
train
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/genome_index.py#L98-L157
vanheeringen-lab/gimmemotifs
gimmemotifs/genome_index.py
GenomeIndex._check_dir
def _check_dir(self, dirname): """ Check if dir exists, if not: give warning and die""" if not os.path.exists(dirname): print("Directory %s does not exist!" % dirname) sys.exit(1)
python
def _check_dir(self, dirname): """ Check if dir exists, if not: give warning and die""" if not os.path.exists(dirname): print("Directory %s does not exist!" % dirname) sys.exit(1)
[ "def", "_check_dir", "(", "self", ",", "dirname", ")", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "dirname", ")", ":", "print", "(", "\"Directory %s does not exist!\"", "%", "dirname", ")", "sys", ".", "exit", "(", "1", ")" ]
Check if dir exists, if not: give warning and die
[ "Check", "if", "dir", "exists", "if", "not", ":", "give", "warning", "and", "die" ]
train
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/genome_index.py#L278-L282
vanheeringen-lab/gimmemotifs
gimmemotifs/genome_index.py
GenomeIndex._make_index
def _make_index(self, fasta, index): """ Index a single, one-sequence fasta-file""" out = open(index, "wb") f = open(fasta) # Skip first line of fasta-file line = f.readline() offset = f.tell() line = f.readline() while line: out.write(pack(sel...
python
def _make_index(self, fasta, index): """ Index a single, one-sequence fasta-file""" out = open(index, "wb") f = open(fasta) # Skip first line of fasta-file line = f.readline() offset = f.tell() line = f.readline() while line: out.write(pack(sel...
[ "def", "_make_index", "(", "self", ",", "fasta", ",", "index", ")", ":", "out", "=", "open", "(", "index", ",", "\"wb\"", ")", "f", "=", "open", "(", "fasta", ")", "# Skip first line of fasta-file", "line", "=", "f", ".", "readline", "(", ")", "offset"...
Index a single, one-sequence fasta-file
[ "Index", "a", "single", "one", "-", "sequence", "fasta", "-", "file" ]
train
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/genome_index.py#L284-L297
vanheeringen-lab/gimmemotifs
gimmemotifs/genome_index.py
GenomeIndex.create_index
def create_index(self,fasta_dir=None, index_dir=None): """Index all fasta-files in fasta_dir (one sequence per file!) and store the results in index_dir""" # Use default directories if they are not supplied if not fasta_dir: fasta_dir = self.fasta_dir if not...
python
def create_index(self,fasta_dir=None, index_dir=None): """Index all fasta-files in fasta_dir (one sequence per file!) and store the results in index_dir""" # Use default directories if they are not supplied if not fasta_dir: fasta_dir = self.fasta_dir if not...
[ "def", "create_index", "(", "self", ",", "fasta_dir", "=", "None", ",", "index_dir", "=", "None", ")", ":", "# Use default directories if they are not supplied", "if", "not", "fasta_dir", ":", "fasta_dir", "=", "self", ".", "fasta_dir", "if", "not", "index_dir", ...
Index all fasta-files in fasta_dir (one sequence per file!) and store the results in index_dir
[ "Index", "all", "fasta", "-", "files", "in", "fasta_dir", "(", "one", "sequence", "per", "file!", ")", "and", "store", "the", "results", "in", "index_dir" ]
train
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/genome_index.py#L299-L398
vanheeringen-lab/gimmemotifs
gimmemotifs/genome_index.py
GenomeIndex._read_index_file
def _read_index_file(self): """read the param_file, index_dir should already be set """ param_file = os.path.join(self.index_dir, self.param_file) with open(param_file) as f: for line in f.readlines(): (name, fasta_file, index_file, line_size, total_size) = line.strip...
python
def _read_index_file(self): """read the param_file, index_dir should already be set """ param_file = os.path.join(self.index_dir, self.param_file) with open(param_file) as f: for line in f.readlines(): (name, fasta_file, index_file, line_size, total_size) = line.strip...
[ "def", "_read_index_file", "(", "self", ")", ":", "param_file", "=", "os", ".", "path", ".", "join", "(", "self", ".", "index_dir", ",", "self", ".", "param_file", ")", "with", "open", "(", "param_file", ")", "as", "f", ":", "for", "line", "in", "f",...
read the param_file, index_dir should already be set
[ "read", "the", "param_file", "index_dir", "should", "already", "be", "set" ]
train
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/genome_index.py#L400-L409
vanheeringen-lab/gimmemotifs
gimmemotifs/genome_index.py
GenomeIndex._read_seq_from_fasta
def _read_seq_from_fasta(self, fasta, offset, nr_lines): """ retrieve a number of lines from a fasta file-object, starting at offset""" fasta.seek(offset) lines = [fasta.readline().strip() for _ in range(nr_lines)] return "".join(lines)
python
def _read_seq_from_fasta(self, fasta, offset, nr_lines): """ retrieve a number of lines from a fasta file-object, starting at offset""" fasta.seek(offset) lines = [fasta.readline().strip() for _ in range(nr_lines)] return "".join(lines)
[ "def", "_read_seq_from_fasta", "(", "self", ",", "fasta", ",", "offset", ",", "nr_lines", ")", ":", "fasta", ".", "seek", "(", "offset", ")", "lines", "=", "[", "fasta", ".", "readline", "(", ")", ".", "strip", "(", ")", "for", "_", "in", "range", ...
retrieve a number of lines from a fasta file-object, starting at offset
[ "retrieve", "a", "number", "of", "lines", "from", "a", "fasta", "file", "-", "object", "starting", "at", "offset" ]
train
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/genome_index.py#L411-L415
vanheeringen-lab/gimmemotifs
gimmemotifs/genome_index.py
GenomeIndex.get_sequences
def get_sequences(self, chr, coords): """ Retrieve multiple sequences from same chr (RC not possible yet)""" # Check if we have an index_dir if not self.index_dir: print("Index dir is not defined!") sys.exit() # retrieve all information for this specific sequ...
python
def get_sequences(self, chr, coords): """ Retrieve multiple sequences from same chr (RC not possible yet)""" # Check if we have an index_dir if not self.index_dir: print("Index dir is not defined!") sys.exit() # retrieve all information for this specific sequ...
[ "def", "get_sequences", "(", "self", ",", "chr", ",", "coords", ")", ":", "# Check if we have an index_dir", "if", "not", "self", ".", "index_dir", ":", "print", "(", "\"Index dir is not defined!\"", ")", "sys", ".", "exit", "(", ")", "# retrieve all information f...
Retrieve multiple sequences from same chr (RC not possible yet)
[ "Retrieve", "multiple", "sequences", "from", "same", "chr", "(", "RC", "not", "possible", "yet", ")" ]
train
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/genome_index.py#L461-L495
vanheeringen-lab/gimmemotifs
gimmemotifs/genome_index.py
GenomeIndex.get_sequence
def get_sequence(self, chrom, start, end, strand=None): """ Retrieve a sequence """ # Check if we have an index_dir if not self.index_dir: print("Index dir is not defined!") sys.exit() # retrieve all information for this specific sequence fasta_file =...
python
def get_sequence(self, chrom, start, end, strand=None): """ Retrieve a sequence """ # Check if we have an index_dir if not self.index_dir: print("Index dir is not defined!") sys.exit() # retrieve all information for this specific sequence fasta_file =...
[ "def", "get_sequence", "(", "self", ",", "chrom", ",", "start", ",", "end", ",", "strand", "=", "None", ")", ":", "# Check if we have an index_dir", "if", "not", "self", ".", "index_dir", ":", "print", "(", "\"Index dir is not defined!\"", ")", "sys", ".", "...
Retrieve a sequence
[ "Retrieve", "a", "sequence" ]
train
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/genome_index.py#L498-L532
vanheeringen-lab/gimmemotifs
gimmemotifs/genome_index.py
GenomeIndex.get_size
def get_size(self, chrom=None): """ Return the sizes of all sequences in the index, or the size of chrom if specified as an optional argument """ if len(self.size) == 0: raise LookupError("no chromosomes in index, is the index correct?") if chrom: if chrom in sel...
python
def get_size(self, chrom=None): """ Return the sizes of all sequences in the index, or the size of chrom if specified as an optional argument """ if len(self.size) == 0: raise LookupError("no chromosomes in index, is the index correct?") if chrom: if chrom in sel...
[ "def", "get_size", "(", "self", ",", "chrom", "=", "None", ")", ":", "if", "len", "(", "self", ".", "size", ")", "==", "0", ":", "raise", "LookupError", "(", "\"no chromosomes in index, is the index correct?\"", ")", "if", "chrom", ":", "if", "chrom", "in"...
Return the sizes of all sequences in the index, or the size of chrom if specified as an optional argument
[ "Return", "the", "sizes", "of", "all", "sequences", "in", "the", "index", "or", "the", "size", "of", "chrom", "if", "specified", "as", "an", "optional", "argument" ]
train
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/genome_index.py#L538-L553
vanheeringen-lab/gimmemotifs
gimmemotifs/tools.py
get_tool
def get_tool(name): """ Returns an instance of a specific tool. Parameters ---------- name : str Name of the tool (case-insensitive). Returns ------- tool : MotifProgram instance """ tool = name.lower() if tool not in __tools__: raise ValueError("Tool {0} n...
python
def get_tool(name): """ Returns an instance of a specific tool. Parameters ---------- name : str Name of the tool (case-insensitive). Returns ------- tool : MotifProgram instance """ tool = name.lower() if tool not in __tools__: raise ValueError("Tool {0} n...
[ "def", "get_tool", "(", "name", ")", ":", "tool", "=", "name", ".", "lower", "(", ")", "if", "tool", "not", "in", "__tools__", ":", "raise", "ValueError", "(", "\"Tool {0} not found!\\n\"", ".", "format", "(", "name", ")", ")", "t", "=", "__tools__", "...
Returns an instance of a specific tool. Parameters ---------- name : str Name of the tool (case-insensitive). Returns ------- tool : MotifProgram instance
[ "Returns", "an", "instance", "of", "a", "specific", "tool", "." ]
train
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L33-L58
vanheeringen-lab/gimmemotifs
gimmemotifs/tools.py
locate_tool
def locate_tool(name, verbose=True): """ Returns the binary of a tool. Parameters ---------- name : str Name of the tool (case-insensitive). Returns ------- tool_bin : str Binary of tool. """ m = get_tool(name) tool_bin = which(m.cmd) if tool_bin: ...
python
def locate_tool(name, verbose=True): """ Returns the binary of a tool. Parameters ---------- name : str Name of the tool (case-insensitive). Returns ------- tool_bin : str Binary of tool. """ m = get_tool(name) tool_bin = which(m.cmd) if tool_bin: ...
[ "def", "locate_tool", "(", "name", ",", "verbose", "=", "True", ")", ":", "m", "=", "get_tool", "(", "name", ")", "tool_bin", "=", "which", "(", "m", ".", "cmd", ")", "if", "tool_bin", ":", "if", "verbose", ":", "print", "(", "\"Found {} in {}\"", "....
Returns the binary of a tool. Parameters ---------- name : str Name of the tool (case-insensitive). Returns ------- tool_bin : str Binary of tool.
[ "Returns", "the", "binary", "of", "a", "tool", "." ]
train
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L60-L81
vanheeringen-lab/gimmemotifs
gimmemotifs/tools.py
MotifProgram.bin
def bin(self): """ Get the command used to run the tool. Returns ------- command : str The tool system command. """ if self.local_bin: return self.local_bin else: return self.config.bin(self.name)
python
def bin(self): """ Get the command used to run the tool. Returns ------- command : str The tool system command. """ if self.local_bin: return self.local_bin else: return self.config.bin(self.name)
[ "def", "bin", "(", "self", ")", ":", "if", "self", ".", "local_bin", ":", "return", "self", ".", "local_bin", "else", ":", "return", "self", ".", "config", ".", "bin", "(", "self", ".", "name", ")" ]
Get the command used to run the tool. Returns ------- command : str The tool system command.
[ "Get", "the", "command", "used", "to", "run", "the", "tool", "." ]
train
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L93-L105
vanheeringen-lab/gimmemotifs
gimmemotifs/tools.py
MotifProgram.is_installed
def is_installed(self): """ Check if the tool is installed. Returns ------- is_installed : bool True if the tool is installed. """ return self.is_configured() and os.access(self.bin(), os.X_OK)
python
def is_installed(self): """ Check if the tool is installed. Returns ------- is_installed : bool True if the tool is installed. """ return self.is_configured() and os.access(self.bin(), os.X_OK)
[ "def", "is_installed", "(", "self", ")", ":", "return", "self", ".", "is_configured", "(", ")", "and", "os", ".", "access", "(", "self", ".", "bin", "(", ")", ",", "os", ".", "X_OK", ")" ]
Check if the tool is installed. Returns ------- is_installed : bool True if the tool is installed.
[ "Check", "if", "the", "tool", "is", "installed", ".", "Returns", "-------", "is_installed", ":", "bool", "True", "if", "the", "tool", "is", "installed", "." ]
train
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L129-L138
vanheeringen-lab/gimmemotifs
gimmemotifs/tools.py
MotifProgram.run
def run(self, fastafile, params=None, tmp=None): """ Run the tool and predict motifs from a FASTA file. Parameters ---------- fastafile : str Name of the FASTA input file. params : dict, optional Optional parameters. For some of the tools require...
python
def run(self, fastafile, params=None, tmp=None): """ Run the tool and predict motifs from a FASTA file. Parameters ---------- fastafile : str Name of the FASTA input file. params : dict, optional Optional parameters. For some of the tools require...
[ "def", "run", "(", "self", ",", "fastafile", ",", "params", "=", "None", ",", "tmp", "=", "None", ")", ":", "if", "not", "self", ".", "is_configured", "(", ")", ":", "raise", "ValueError", "(", "\"%s is not configured\"", "%", "self", ".", "name", ")",...
Run the tool and predict motifs from a FASTA file. Parameters ---------- fastafile : str Name of the FASTA input file. params : dict, optional Optional parameters. For some of the tools required parameters are passed using this dictionary. t...
[ "Run", "the", "tool", "and", "predict", "motifs", "from", "a", "FASTA", "file", "." ]
train
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L140-L179
vanheeringen-lab/gimmemotifs
gimmemotifs/tools.py
XXmotif._parse_params
def _parse_params(self, params=None): """ Parse parameters. Combine default and user-defined parameters. """ prm = self.default_params.copy() if params is not None: prm.update(params) if prm["background"]: # Absolute path, just to be su...
python
def _parse_params(self, params=None): """ Parse parameters. Combine default and user-defined parameters. """ prm = self.default_params.copy() if params is not None: prm.update(params) if prm["background"]: # Absolute path, just to be su...
[ "def", "_parse_params", "(", "self", ",", "params", "=", "None", ")", ":", "prm", "=", "self", ".", "default_params", ".", "copy", "(", ")", "if", "params", "is", "not", "None", ":", "prm", ".", "update", "(", "params", ")", "if", "prm", "[", "\"ba...
Parse parameters. Combine default and user-defined parameters.
[ "Parse", "parameters", "." ]
train
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L203-L223
vanheeringen-lab/gimmemotifs
gimmemotifs/tools.py
XXmotif._run_program
def _run_program(self, bin, fastafile, params=None): """ Run XXmotif and predict motifs from a FASTA file. Parameters ---------- bin : str Command used to run the tool. fastafile : str Name of the FASTA input file. params : dict,...
python
def _run_program(self, bin, fastafile, params=None): """ Run XXmotif and predict motifs from a FASTA file. Parameters ---------- bin : str Command used to run the tool. fastafile : str Name of the FASTA input file. params : dict,...
[ "def", "_run_program", "(", "self", ",", "bin", ",", "fastafile", ",", "params", "=", "None", ")", ":", "params", "=", "self", ".", "_parse_params", "(", "params", ")", "outfile", "=", "os", ".", "path", ".", "join", "(", "self", ".", "tmpdir", ",", ...
Run XXmotif and predict motifs from a FASTA file. Parameters ---------- bin : str Command used to run the tool. fastafile : str Name of the FASTA input file. params : dict, optional Optional parameters. For some of the tools required...
[ "Run", "XXmotif", "and", "predict", "motifs", "from", "a", "FASTA", "file", "." ]
train
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L225-L284
vanheeringen-lab/gimmemotifs
gimmemotifs/tools.py
Homer._parse_params
def _parse_params(self, params=None): """ Parse parameters. Combine default and user-defined parameters. """ prm = self.default_params.copy() if params is not None: prm.update(params) # Background file is essential! if not prm["background"]...
python
def _parse_params(self, params=None): """ Parse parameters. Combine default and user-defined parameters. """ prm = self.default_params.copy() if params is not None: prm.update(params) # Background file is essential! if not prm["background"]...
[ "def", "_parse_params", "(", "self", ",", "params", "=", "None", ")", ":", "prm", "=", "self", ".", "default_params", ".", "copy", "(", ")", "if", "params", "is", "not", "None", ":", "prm", ".", "update", "(", "params", ")", "# Background file is essenti...
Parse parameters. Combine default and user-defined parameters.
[ "Parse", "parameters", "." ]
train
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L305-L326
vanheeringen-lab/gimmemotifs
gimmemotifs/tools.py
Homer._run_program
def _run_program(self, bin, fastafile, params=None): """ Run Homer and predict motifs from a FASTA file. Parameters ---------- bin : str Command used to run the tool. fastafile : str Name of the FASTA input file. params : dict, o...
python
def _run_program(self, bin, fastafile, params=None): """ Run Homer and predict motifs from a FASTA file. Parameters ---------- bin : str Command used to run the tool. fastafile : str Name of the FASTA input file. params : dict, o...
[ "def", "_run_program", "(", "self", ",", "bin", ",", "fastafile", ",", "params", "=", "None", ")", ":", "params", "=", "self", ".", "_parse_params", "(", "params", ")", "outfile", "=", "NamedTemporaryFile", "(", "mode", "=", "\"w\"", ",", "dir", "=", "...
Run Homer and predict motifs from a FASTA file. Parameters ---------- bin : str Command used to run the tool. fastafile : str Name of the FASTA input file. params : dict, optional Optional parameters. For some of the tools required p...
[ "Run", "Homer", "and", "predict", "motifs", "from", "a", "FASTA", "file", "." ]
train
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L328-L387
vanheeringen-lab/gimmemotifs
gimmemotifs/tools.py
BioProspector.parse
def parse(self, fo): """ Convert BioProspector output to motifs Parameters ---------- fo : file-like File object containing BioProspector output. Returns ------- motifs : list List of Motif instances. """ m...
python
def parse(self, fo): """ Convert BioProspector output to motifs Parameters ---------- fo : file-like File object containing BioProspector output. Returns ------- motifs : list List of Motif instances. """ m...
[ "def", "parse", "(", "self", ",", "fo", ")", ":", "motifs", "=", "[", "]", "p", "=", "re", ".", "compile", "(", "r'^\\d+\\s+(\\d+\\.\\d+)\\s+(\\d+\\.\\d+)\\s+(\\d+\\.\\d+)\\s+(\\d+\\.\\d+)'", ")", "pwm", "=", "[", "]", "motif_id", "=", "\"\"", "for", "line", ...
Convert BioProspector output to motifs Parameters ---------- fo : file-like File object containing BioProspector output. Returns ------- motifs : list List of Motif instances.
[ "Convert", "BioProspector", "output", "to", "motifs", "Parameters", "----------", "fo", ":", "file", "-", "like", "File", "object", "containing", "BioProspector", "output", "." ]
train
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L488-L524
vanheeringen-lab/gimmemotifs
gimmemotifs/tools.py
Hms._run_program
def _run_program(self, bin, fastafile, params=None): """ Run HMS and predict motifs from a FASTA file. Parameters ---------- bin : str Command used to run the tool. fastafile : str Name of the FASTA input file. params : dict, opt...
python
def _run_program(self, bin, fastafile, params=None): """ Run HMS and predict motifs from a FASTA file. Parameters ---------- bin : str Command used to run the tool. fastafile : str Name of the FASTA input file. params : dict, opt...
[ "def", "_run_program", "(", "self", ",", "bin", ",", "fastafile", ",", "params", "=", "None", ")", ":", "params", "=", "self", ".", "_parse_params", "(", "params", ")", "default_params", "=", "{", "\"width\"", ":", "10", "}", "if", "params", "is", "not...
Run HMS and predict motifs from a FASTA file. Parameters ---------- bin : str Command used to run the tool. fastafile : str Name of the FASTA input file. params : dict, optional Optional parameters. For some of the tools required par...
[ "Run", "HMS", "and", "predict", "motifs", "from", "a", "FASTA", "file", "." ]
train
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L575-L631
vanheeringen-lab/gimmemotifs
gimmemotifs/tools.py
Hms.parse
def parse(self, fo): """ Convert HMS output to motifs Parameters ---------- fo : file-like File object containing HMS output. Returns ------- motifs : list List of Motif instances. """ motifs = [] m...
python
def parse(self, fo): """ Convert HMS output to motifs Parameters ---------- fo : file-like File object containing HMS output. Returns ------- motifs : list List of Motif instances. """ motifs = [] m...
[ "def", "parse", "(", "self", ",", "fo", ")", ":", "motifs", "=", "[", "]", "m", "=", "[", "[", "float", "(", "x", ")", "for", "x", "in", "fo", ".", "readline", "(", ")", ".", "strip", "(", ")", ".", "split", "(", "\" \"", ")", "]", "for", ...
Convert HMS output to motifs Parameters ---------- fo : file-like File object containing HMS output. Returns ------- motifs : list List of Motif instances.
[ "Convert", "HMS", "output", "to", "motifs", "Parameters", "----------", "fo", ":", "file", "-", "like", "File", "object", "containing", "HMS", "output", "." ]
train
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L633-L653
vanheeringen-lab/gimmemotifs
gimmemotifs/tools.py
Amd._run_program
def _run_program(self, bin, fastafile, params=None): """ Run AMD and predict motifs from a FASTA file. Parameters ---------- bin : str Command used to run the tool. fastafile : str Name of the FASTA input file. params : dict, opt...
python
def _run_program(self, bin, fastafile, params=None): """ Run AMD and predict motifs from a FASTA file. Parameters ---------- bin : str Command used to run the tool. fastafile : str Name of the FASTA input file. params : dict, opt...
[ "def", "_run_program", "(", "self", ",", "bin", ",", "fastafile", ",", "params", "=", "None", ")", ":", "params", "=", "self", ".", "_parse_params", "(", "params", ")", "fgfile", "=", "os", ".", "path", ".", "join", "(", "self", ".", "tmpdir", ",", ...
Run AMD and predict motifs from a FASTA file. Parameters ---------- bin : str Command used to run the tool. fastafile : str Name of the FASTA input file. params : dict, optional Optional parameters. For some of the tools required par...
[ "Run", "AMD", "and", "predict", "motifs", "from", "a", "FASTA", "file", "." ]
train
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L688-L744
vanheeringen-lab/gimmemotifs
gimmemotifs/tools.py
Amd.parse
def parse(self, fo): """ Convert AMD output to motifs Parameters ---------- fo : file-like File object containing AMD output. Returns ------- motifs : list List of Motif instances. """ motifs = [] ...
python
def parse(self, fo): """ Convert AMD output to motifs Parameters ---------- fo : file-like File object containing AMD output. Returns ------- motifs : list List of Motif instances. """ motifs = [] ...
[ "def", "parse", "(", "self", ",", "fo", ")", ":", "motifs", "=", "[", "]", "#160: 112 CACGTGC 7.25 chr14:32308489-32308689", "p", "=", "re", ".", "compile", "(", "r'\\d+\\s+([\\d.]+)\\s+([\\d.]+)\\s+([\\d.]+)\\s+([\\d.]+)'", ")", "wm", "=", "[", "]", "name"...
Convert AMD output to motifs Parameters ---------- fo : file-like File object containing AMD output. Returns ------- motifs : list List of Motif instances.
[ "Convert", "AMD", "output", "to", "motifs", "Parameters", "----------", "fo", ":", "file", "-", "like", "File", "object", "containing", "AMD", "output", "." ]
train
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L746-L781
vanheeringen-lab/gimmemotifs
gimmemotifs/tools.py
Improbizer.parse
def parse(self, fo): """ Convert Improbizer output to motifs Parameters ---------- fo : file-like File object containing Improbizer output. Returns ------- motifs : list List of Motif instances. """ motifs ...
python
def parse(self, fo): """ Convert Improbizer output to motifs Parameters ---------- fo : file-like File object containing Improbizer output. Returns ------- motifs : list List of Motif instances. """ motifs ...
[ "def", "parse", "(", "self", ",", "fo", ")", ":", "motifs", "=", "[", "]", "p", "=", "re", ".", "compile", "(", "r'\\d+\\s+@\\s+\\d+\\.\\d+\\s+sd\\s+\\d+\\.\\d+\\s+(\\w+)$'", ")", "line", "=", "fo", ".", "readline", "(", ")", "while", "line", "and", "line"...
Convert Improbizer output to motifs Parameters ---------- fo : file-like File object containing Improbizer output. Returns ------- motifs : list List of Motif instances.
[ "Convert", "Improbizer", "output", "to", "motifs", "Parameters", "----------", "fo", ":", "file", "-", "like", "File", "object", "containing", "Improbizer", "output", "." ]
train
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L873-L905
vanheeringen-lab/gimmemotifs
gimmemotifs/tools.py
Trawler._run_program
def _run_program(self, bin, fastafile, params=None): """ Run Trawler and predict motifs from a FASTA file. Parameters ---------- bin : str Command used to run the tool. fastafile : str Name of the FASTA input file. params : dict,...
python
def _run_program(self, bin, fastafile, params=None): """ Run Trawler and predict motifs from a FASTA file. Parameters ---------- bin : str Command used to run the tool. fastafile : str Name of the FASTA input file. params : dict,...
[ "def", "_run_program", "(", "self", ",", "bin", ",", "fastafile", ",", "params", "=", "None", ")", ":", "params", "=", "self", ".", "_parse_params", "(", "params", ")", "tmp", "=", "NamedTemporaryFile", "(", "mode", "=", "\"w\"", ",", "dir", "=", "self...
Run Trawler and predict motifs from a FASTA file. Parameters ---------- bin : str Command used to run the tool. fastafile : str Name of the FASTA input file. params : dict, optional Optional parameters. For some of the tools required...
[ "Run", "Trawler", "and", "predict", "motifs", "from", "a", "FASTA", "file", "." ]
train
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L945-L1023
vanheeringen-lab/gimmemotifs
gimmemotifs/tools.py
Weeder._run_program
def _run_program(self, bin,fastafile, params=None): """ Run Weeder and predict motifs from a FASTA file. Parameters ---------- bin : str Command used to run the tool. fastafile : str Name of the FASTA input file. params : dict, o...
python
def _run_program(self, bin,fastafile, params=None): """ Run Weeder and predict motifs from a FASTA file. Parameters ---------- bin : str Command used to run the tool. fastafile : str Name of the FASTA input file. params : dict, o...
[ "def", "_run_program", "(", "self", ",", "bin", ",", "fastafile", ",", "params", "=", "None", ")", ":", "params", "=", "self", ".", "_parse_params", "(", "params", ")", "organism", "=", "params", "[", "\"organism\"", "]", "weeder_organisms", "=", "{", "\...
Run Weeder and predict motifs from a FASTA file. Parameters ---------- bin : str Command used to run the tool. fastafile : str Name of the FASTA input file. params : dict, optional Optional parameters. For some of the tools required ...
[ "Run", "Weeder", "and", "predict", "motifs", "from", "a", "FASTA", "file", "." ]
train
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L1055-L1137
vanheeringen-lab/gimmemotifs
gimmemotifs/tools.py
MotifSampler._parse_params
def _parse_params(self, params=None): """ Parse parameters. Combine default and user-defined parameters. """ prm = self.default_params.copy() if params is not None: prm.update(params) if prm["background_model"]: # Absolute path, just to...
python
def _parse_params(self, params=None): """ Parse parameters. Combine default and user-defined parameters. """ prm = self.default_params.copy() if params is not None: prm.update(params) if prm["background_model"]: # Absolute path, just to...
[ "def", "_parse_params", "(", "self", ",", "params", "=", "None", ")", ":", "prm", "=", "self", ".", "default_params", ".", "copy", "(", ")", "if", "params", "is", "not", "None", ":", "prm", ".", "update", "(", "params", ")", "if", "prm", "[", "\"ba...
Parse parameters. Combine default and user-defined parameters.
[ "Parse", "parameters", "." ]
train
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L1173-L1206
vanheeringen-lab/gimmemotifs
gimmemotifs/tools.py
MotifSampler._run_program
def _run_program(self, bin, fastafile, params=None): """ Run MotifSampler and predict motifs from a FASTA file. Parameters ---------- bin : str Command used to run the tool. fastafile : str Name of the FASTA input file. params : ...
python
def _run_program(self, bin, fastafile, params=None): """ Run MotifSampler and predict motifs from a FASTA file. Parameters ---------- bin : str Command used to run the tool. fastafile : str Name of the FASTA input file. params : ...
[ "def", "_run_program", "(", "self", ",", "bin", ",", "fastafile", ",", "params", "=", "None", ")", ":", "params", "=", "self", ".", "_parse_params", "(", "params", ")", "# TODO: test organism", "#cmd = \"%s -f %s -b %s -m %s -w %s -n %s -o %s -s %s > /dev/null 2>&1\" % ...
Run MotifSampler and predict motifs from a FASTA file. Parameters ---------- bin : str Command used to run the tool. fastafile : str Name of the FASTA input file. params : dict, optional Optional parameters. For some of the tools req...
[ "Run", "MotifSampler", "and", "predict", "motifs", "from", "a", "FASTA", "file", "." ]
train
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L1208-L1264
vanheeringen-lab/gimmemotifs
gimmemotifs/tools.py
MotifSampler.parse
def parse(self, fo): """ Convert MotifSampler output to motifs Parameters ---------- fo : file-like File object containing MotifSampler output. Returns ------- motifs : list List of Motif instances. """ mot...
python
def parse(self, fo): """ Convert MotifSampler output to motifs Parameters ---------- fo : file-like File object containing MotifSampler output. Returns ------- motifs : list List of Motif instances. """ mot...
[ "def", "parse", "(", "self", ",", "fo", ")", ":", "motifs", "=", "[", "]", "pwm", "=", "[", "]", "info", "=", "{", "}", "for", "line", "in", "fo", ".", "readlines", "(", ")", ":", "if", "line", ".", "startswith", "(", "\"#\"", ")", ":", "vals...
Convert MotifSampler output to motifs Parameters ---------- fo : file-like File object containing MotifSampler output. Returns ------- motifs : list List of Motif instances.
[ "Convert", "MotifSampler", "output", "to", "motifs", "Parameters", "----------", "fo", ":", "file", "-", "like", "File", "object", "containing", "MotifSampler", "output", "." ]
train
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L1266-L1299
vanheeringen-lab/gimmemotifs
gimmemotifs/tools.py
MotifSampler.parse_out
def parse_out(self, fo): """ Convert MotifSampler output to motifs Parameters ---------- fo : file-like File object containing MotifSampler output. Returns ------- motifs : list List of Motif instances. """ ...
python
def parse_out(self, fo): """ Convert MotifSampler output to motifs Parameters ---------- fo : file-like File object containing MotifSampler output. Returns ------- motifs : list List of Motif instances. """ ...
[ "def", "parse_out", "(", "self", ",", "fo", ")", ":", "motifs", "=", "[", "]", "nucs", "=", "{", "\"A\"", ":", "0", ",", "\"C\"", ":", "1", ",", "\"G\"", ":", "2", ",", "\"T\"", ":", "3", "}", "pseudo", "=", "0.0", "# Should be 1/sqrt(# of seqs)", ...
Convert MotifSampler output to motifs Parameters ---------- fo : file-like File object containing MotifSampler output. Returns ------- motifs : list List of Motif instances.
[ "Convert", "MotifSampler", "output", "to", "motifs", "Parameters", "----------", "fo", ":", "file", "-", "like", "File", "object", "containing", "MotifSampler", "output", "." ]
train
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L1301-L1348
vanheeringen-lab/gimmemotifs
gimmemotifs/tools.py
MDmodule._run_program
def _run_program(self, bin, fastafile, params=None): """ Run MDmodule and predict motifs from a FASTA file. Parameters ---------- bin : str Command used to run the tool. fastafile : str Name of the FASTA input file. params : dict...
python
def _run_program(self, bin, fastafile, params=None): """ Run MDmodule and predict motifs from a FASTA file. Parameters ---------- bin : str Command used to run the tool. fastafile : str Name of the FASTA input file. params : dict...
[ "def", "_run_program", "(", "self", ",", "bin", ",", "fastafile", ",", "params", "=", "None", ")", ":", "default_params", "=", "{", "\"width\"", ":", "10", ",", "\"number\"", ":", "10", "}", "if", "params", "is", "not", "None", ":", "default_params", "...
Run MDmodule and predict motifs from a FASTA file. Parameters ---------- bin : str Command used to run the tool. fastafile : str Name of the FASTA input file. params : dict, optional Optional parameters. For some of the tools require...
[ "Run", "MDmodule", "and", "predict", "motifs", "from", "a", "FASTA", "file", "." ]
train
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L1378-L1436
vanheeringen-lab/gimmemotifs
gimmemotifs/tools.py
MDmodule.parse
def parse(self, fo): """ Convert MDmodule output to motifs Parameters ---------- fo : file-like File object containing MDmodule output. Returns ------- motifs : list List of Motif instances. """ motifs = []...
python
def parse(self, fo): """ Convert MDmodule output to motifs Parameters ---------- fo : file-like File object containing MDmodule output. Returns ------- motifs : list List of Motif instances. """ motifs = []...
[ "def", "parse", "(", "self", ",", "fo", ")", ":", "motifs", "=", "[", "]", "nucs", "=", "{", "\"A\"", ":", "0", ",", "\"C\"", ":", "1", ",", "\"G\"", ":", "2", ",", "\"T\"", ":", "3", "}", "p", "=", "re", ".", "compile", "(", "r'(\\d+)\\s+(\\...
Convert MDmodule output to motifs Parameters ---------- fo : file-like File object containing MDmodule output. Returns ------- motifs : list List of Motif instances.
[ "Convert", "MDmodule", "output", "to", "motifs", "Parameters", "----------", "fo", ":", "file", "-", "like", "File", "object", "containing", "MDmodule", "output", "." ]
train
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L1438-L1493
vanheeringen-lab/gimmemotifs
gimmemotifs/tools.py
ChIPMunk._parse_params
def _parse_params(self, params=None): """ Parse parameters. Combine default and user-defined parameters. """ prm = self.default_params.copy() if params is not None: prm.update(params) return prm
python
def _parse_params(self, params=None): """ Parse parameters. Combine default and user-defined parameters. """ prm = self.default_params.copy() if params is not None: prm.update(params) return prm
[ "def", "_parse_params", "(", "self", ",", "params", "=", "None", ")", ":", "prm", "=", "self", ".", "default_params", ".", "copy", "(", ")", "if", "params", "is", "not", "None", ":", "prm", ".", "update", "(", "params", ")", "return", "prm" ]
Parse parameters. Combine default and user-defined parameters.
[ "Parse", "parameters", "." ]
train
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L1509-L1519
vanheeringen-lab/gimmemotifs
gimmemotifs/tools.py
ChIPMunk._run_program
def _run_program(self, bin, fastafile, params=None): """ Run ChIPMunk and predict motifs from a FASTA file. Parameters ---------- bin : str Command used to run the tool. fastafile : str Name of the FASTA input file. params : dict...
python
def _run_program(self, bin, fastafile, params=None): """ Run ChIPMunk and predict motifs from a FASTA file. Parameters ---------- bin : str Command used to run the tool. fastafile : str Name of the FASTA input file. params : dict...
[ "def", "_run_program", "(", "self", ",", "bin", ",", "fastafile", ",", "params", "=", "None", ")", ":", "params", "=", "self", ".", "_parse_params", "(", "params", ")", "basename", "=", "\"munk_in.fa\"", "new_file", "=", "os", ".", "path", ".", "join", ...
Run ChIPMunk and predict motifs from a FASTA file. Parameters ---------- bin : str Command used to run the tool. fastafile : str Name of the FASTA input file. params : dict, optional Optional parameters. For some of the tools require...
[ "Run", "ChIPMunk", "and", "predict", "motifs", "from", "a", "FASTA", "file", "." ]
train
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L1521-L1596
vanheeringen-lab/gimmemotifs
gimmemotifs/tools.py
ChIPMunk.parse
def parse(self, fo): """ Convert ChIPMunk output to motifs Parameters ---------- fo : file-like File object containing ChIPMunk output. Returns ------- motifs : list List of Motif instances. """ #KDIC|6.124...
python
def parse(self, fo): """ Convert ChIPMunk output to motifs Parameters ---------- fo : file-like File object containing ChIPMunk output. Returns ------- motifs : list List of Motif instances. """ #KDIC|6.124...
[ "def", "parse", "(", "self", ",", "fo", ")", ":", "#KDIC|6.124756232026243", "#A|517.9999999999999 42.99999999999999 345.99999999999994 25.999999999999996 602.9999999999999 155.99999999999997 2.9999999999999996 91.99999999999999", "#C|5.999999999999999 4.999999999999999 2.9999999999999996 956.99...
Convert ChIPMunk output to motifs Parameters ---------- fo : file-like File object containing ChIPMunk output. Returns ------- motifs : list List of Motif instances.
[ "Convert", "ChIPMunk", "output", "to", "motifs", "Parameters", "----------", "fo", ":", "file", "-", "like", "File", "object", "containing", "ChIPMunk", "output", "." ]
train
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L1598-L1633
vanheeringen-lab/gimmemotifs
gimmemotifs/tools.py
Posmo._run_program
def _run_program(self, bin, fastafile, params=None): """ Run Posmo and predict motifs from a FASTA file. Parameters ---------- bin : str Command used to run the tool. fastafile : str Name of the FASTA input file. params : dict, o...
python
def _run_program(self, bin, fastafile, params=None): """ Run Posmo and predict motifs from a FASTA file. Parameters ---------- bin : str Command used to run the tool. fastafile : str Name of the FASTA input file. params : dict, o...
[ "def", "_run_program", "(", "self", ",", "bin", ",", "fastafile", ",", "params", "=", "None", ")", ":", "default_params", "=", "{", "}", "if", "params", "is", "not", "None", ":", "default_params", ".", "update", "(", "params", ")", "width", "=", "param...
Run Posmo and predict motifs from a FASTA file. Parameters ---------- bin : str Command used to run the tool. fastafile : str Name of the FASTA input file. params : dict, optional Optional parameters. For some of the tools required p...
[ "Run", "Posmo", "and", "predict", "motifs", "from", "a", "FASTA", "file", "." ]
train
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L1664-L1729
vanheeringen-lab/gimmemotifs
gimmemotifs/tools.py
Posmo.parse
def parse(self, fo, width, seed=None): """ Convert Posmo output to motifs Parameters ---------- fo : file-like File object containing Posmo output. Returns ------- motifs : list List of Motif instances. """ ...
python
def parse(self, fo, width, seed=None): """ Convert Posmo output to motifs Parameters ---------- fo : file-like File object containing Posmo output. Returns ------- motifs : list List of Motif instances. """ ...
[ "def", "parse", "(", "self", ",", "fo", ",", "width", ",", "seed", "=", "None", ")", ":", "motifs", "=", "[", "]", "lines", "=", "[", "fo", ".", "readline", "(", ")", "for", "x", "in", "range", "(", "6", ")", "]", "while", "lines", "[", "0", ...
Convert Posmo output to motifs Parameters ---------- fo : file-like File object containing Posmo output. Returns ------- motifs : list List of Motif instances.
[ "Convert", "Posmo", "output", "to", "motifs", "Parameters", "----------", "fo", ":", "file", "-", "like", "File", "object", "containing", "Posmo", "output", "." ]
train
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L1731-L1764
vanheeringen-lab/gimmemotifs
gimmemotifs/tools.py
Gadem.parse
def parse(self, fo): """ Convert GADEM output to motifs Parameters ---------- fo : file-like File object containing GADEM output. Returns ------- motifs : list List of Motif instances. """ motifs = [] ...
python
def parse(self, fo): """ Convert GADEM output to motifs Parameters ---------- fo : file-like File object containing GADEM output. Returns ------- motifs : list List of Motif instances. """ motifs = [] ...
[ "def", "parse", "(", "self", ",", "fo", ")", ":", "motifs", "=", "[", "]", "nucs", "=", "{", "\"A\"", ":", "0", ",", "\"C\"", ":", "1", ",", "\"G\"", ":", "2", ",", "\"T\"", ":", "3", "}", "lines", "=", "fo", ".", "readlines", "(", ")", "fo...
Convert GADEM output to motifs Parameters ---------- fo : file-like File object containing GADEM output. Returns ------- motifs : list List of Motif instances.
[ "Convert", "GADEM", "output", "to", "motifs", "Parameters", "----------", "fo", ":", "file", "-", "like", "File", "object", "containing", "GADEM", "output", "." ]
train
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L1847-L1896
vanheeringen-lab/gimmemotifs
gimmemotifs/tools.py
Jaspar._run_program
def _run_program(self, bin, fastafile, params=None): """ Get enriched JASPAR motifs in a FASTA file. Parameters ---------- bin : str Command used to run the tool. fastafile : str Name of the FASTA input file. params : dict, optio...
python
def _run_program(self, bin, fastafile, params=None): """ Get enriched JASPAR motifs in a FASTA file. Parameters ---------- bin : str Command used to run the tool. fastafile : str Name of the FASTA input file. params : dict, optio...
[ "def", "_run_program", "(", "self", ",", "bin", ",", "fastafile", ",", "params", "=", "None", ")", ":", "fname", "=", "os", ".", "path", ".", "join", "(", "self", ".", "config", ".", "get_motif_dir", "(", ")", ",", "\"JASPAR2010_vertebrate.pwm\"", ")", ...
Get enriched JASPAR motifs in a FASTA file. Parameters ---------- bin : str Command used to run the tool. fastafile : str Name of the FASTA input file. params : dict, optional Optional parameters. For some of the tools required param...
[ "Get", "enriched", "JASPAR", "motifs", "in", "a", "FASTA", "file", "." ]
train
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L1919-L1951
vanheeringen-lab/gimmemotifs
gimmemotifs/tools.py
Meme._run_program
def _run_program(self, bin, fastafile, params=None): """ Run MEME and predict motifs from a FASTA file. Parameters ---------- bin : str Command used to run the tool. fastafile : str Name of the FASTA input file. params : dict, op...
python
def _run_program(self, bin, fastafile, params=None): """ Run MEME and predict motifs from a FASTA file. Parameters ---------- bin : str Command used to run the tool. fastafile : str Name of the FASTA input file. params : dict, op...
[ "def", "_run_program", "(", "self", ",", "bin", ",", "fastafile", ",", "params", "=", "None", ")", ":", "default_params", "=", "{", "\"width\"", ":", "10", ",", "\"single\"", ":", "False", ",", "\"number\"", ":", "10", "}", "if", "params", "is", "not",...
Run MEME and predict motifs from a FASTA file. Parameters ---------- bin : str Command used to run the tool. fastafile : str Name of the FASTA input file. params : dict, optional Optional parameters. For some of the tools required pa...
[ "Run", "MEME", "and", "predict", "motifs", "from", "a", "FASTA", "file", "." ]
train
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L1981-L2033
vanheeringen-lab/gimmemotifs
gimmemotifs/tools.py
Meme.parse
def parse(self, fo): """ Convert MEME output to motifs Parameters ---------- fo : file-like File object containing MEME output. Returns ------- motifs : list List of Motif instances. """ motifs = [] ...
python
def parse(self, fo): """ Convert MEME output to motifs Parameters ---------- fo : file-like File object containing MEME output. Returns ------- motifs : list List of Motif instances. """ motifs = [] ...
[ "def", "parse", "(", "self", ",", "fo", ")", ":", "motifs", "=", "[", "]", "nucs", "=", "{", "\"A\"", ":", "0", ",", "\"C\"", ":", "1", ",", "\"G\"", ":", "2", ",", "\"T\"", ":", "3", "}", "p", "=", "re", ".", "compile", "(", "'MOTIF.+MEME-(\...
Convert MEME output to motifs Parameters ---------- fo : file-like File object containing MEME output. Returns ------- motifs : list List of Motif instances.
[ "Convert", "MEME", "output", "to", "motifs", "Parameters", "----------", "fo", ":", "file", "-", "like", "File", "object", "containing", "MEME", "output", "." ]
train
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L2035-L2084
vanheeringen-lab/gimmemotifs
gimmemotifs/maelstrom.py
scan_to_table
def scan_to_table(input_table, genome, scoring, pwmfile=None, ncpus=None): """Scan regions in input table with motifs. Parameters ---------- input_table : str Filename of input table. Can be either a text-separated tab file or a feather file. genome : str Genome name. C...
python
def scan_to_table(input_table, genome, scoring, pwmfile=None, ncpus=None): """Scan regions in input table with motifs. Parameters ---------- input_table : str Filename of input table. Can be either a text-separated tab file or a feather file. genome : str Genome name. C...
[ "def", "scan_to_table", "(", "input_table", ",", "genome", ",", "scoring", ",", "pwmfile", "=", "None", ",", "ncpus", "=", "None", ")", ":", "config", "=", "MotifConfig", "(", ")", "if", "pwmfile", "is", "None", ":", "pwmfile", "=", "config", ".", "get...
Scan regions in input table with motifs. Parameters ---------- input_table : str Filename of input table. Can be either a text-separated tab file or a feather file. genome : str Genome name. Can be either the name of a FASTA-formatted file or a genomepy genome name...
[ "Scan", "regions", "in", "input", "table", "with", "motifs", "." ]
train
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/maelstrom.py#L52-L123
vanheeringen-lab/gimmemotifs
gimmemotifs/maelstrom.py
run_maelstrom
def run_maelstrom(infile, genome, outdir, pwmfile=None, plot=True, cluster=False, score_table=None, count_table=None, methods=None, ncpus=None): """Run maelstrom on an input table. Parameters ---------- infile : str Filename of input table. Can be either a text-separated tab file o...
python
def run_maelstrom(infile, genome, outdir, pwmfile=None, plot=True, cluster=False, score_table=None, count_table=None, methods=None, ncpus=None): """Run maelstrom on an input table. Parameters ---------- infile : str Filename of input table. Can be either a text-separated tab file o...
[ "def", "run_maelstrom", "(", "infile", ",", "genome", ",", "outdir", ",", "pwmfile", "=", "None", ",", "plot", "=", "True", ",", "cluster", "=", "False", ",", "score_table", "=", "None", ",", "count_table", "=", "None", ",", "methods", "=", "None", ","...
Run maelstrom on an input table. Parameters ---------- infile : str Filename of input table. Can be either a text-separated tab file or a feather file. genome : str Genome name. Can be either the name of a FASTA-formatted file or a genomepy genome name. ...
[ "Run", "maelstrom", "on", "an", "input", "table", ".", "Parameters", "----------", "infile", ":", "str", "Filename", "of", "input", "table", ".", "Can", "be", "either", "a", "text", "-", "separated", "tab", "file", "or", "a", "feather", "file", ".", "gen...
train
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/maelstrom.py#L250-L428
vanheeringen-lab/gimmemotifs
gimmemotifs/maelstrom.py
MaelstromResult.plot_heatmap
def plot_heatmap(self, kind="final", min_freq=0.01, threshold=2, name=True, max_len=50, aspect=1, **kwargs): """Plot clustered heatmap of predicted motif activity. Parameters ---------- kind : str, optional Which data type to use for plotting. Default is 'final', whi...
python
def plot_heatmap(self, kind="final", min_freq=0.01, threshold=2, name=True, max_len=50, aspect=1, **kwargs): """Plot clustered heatmap of predicted motif activity. Parameters ---------- kind : str, optional Which data type to use for plotting. Default is 'final', whi...
[ "def", "plot_heatmap", "(", "self", ",", "kind", "=", "\"final\"", ",", "min_freq", "=", "0.01", ",", "threshold", "=", "2", ",", "name", "=", "True", ",", "max_len", "=", "50", ",", "aspect", "=", "1", ",", "*", "*", "kwargs", ")", ":", "filt", ...
Plot clustered heatmap of predicted motif activity. Parameters ---------- kind : str, optional Which data type to use for plotting. Default is 'final', which will plot the result of the rang aggregation. Other options are 'freq' for the motif frequencies, ...
[ "Plot", "clustered", "heatmap", "of", "predicted", "motif", "activity", ".", "Parameters", "----------", "kind", ":", "str", "optional", "Which", "data", "type", "to", "use", "for", "plotting", ".", "Default", "is", "final", "which", "will", "plot", "the", "...
train
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/maelstrom.py#L495-L558
vanheeringen-lab/gimmemotifs
gimmemotifs/maelstrom.py
MaelstromResult.plot_scores
def plot_scores(self, motifs, name=True, max_len=50): """Create motif scores boxplot of different clusters. Motifs can be specified as either motif or factor names. The motif scores will be scaled and plotted as z-scores. Parameters ---------- motifs : iterable o...
python
def plot_scores(self, motifs, name=True, max_len=50): """Create motif scores boxplot of different clusters. Motifs can be specified as either motif or factor names. The motif scores will be scaled and plotted as z-scores. Parameters ---------- motifs : iterable o...
[ "def", "plot_scores", "(", "self", ",", "motifs", ",", "name", "=", "True", ",", "max_len", "=", "50", ")", ":", "if", "self", ".", "input", ".", "shape", "[", "1", "]", "!=", "1", ":", "raise", "ValueError", "(", "\"Can't make a categorical plot with re...
Create motif scores boxplot of different clusters. Motifs can be specified as either motif or factor names. The motif scores will be scaled and plotted as z-scores. Parameters ---------- motifs : iterable or str List of motif or factor names. ...
[ "Create", "motif", "scores", "boxplot", "of", "different", "clusters", ".", "Motifs", "can", "be", "specified", "as", "either", "motif", "or", "factor", "names", ".", "The", "motif", "scores", "will", "be", "scaled", "and", "plotted", "as", "z", "-", "scor...
train
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/maelstrom.py#L561-L608
biosustain/swiglpk
scripts/find_swiglpk_version.py
get_version
def get_version(package, url_pattern=URL_PATTERN): """Return version of package on pypi.python.org using json. Adapted from https://stackoverflow.com/a/34366589""" req = requests.get(url_pattern.format(package=package)) version = parse('0') if req.status_code == requests.codes.ok: # j = json.loa...
python
def get_version(package, url_pattern=URL_PATTERN): """Return version of package on pypi.python.org using json. Adapted from https://stackoverflow.com/a/34366589""" req = requests.get(url_pattern.format(package=package)) version = parse('0') if req.status_code == requests.codes.ok: # j = json.loa...
[ "def", "get_version", "(", "package", ",", "url_pattern", "=", "URL_PATTERN", ")", ":", "req", "=", "requests", ".", "get", "(", "url_pattern", ".", "format", "(", "package", "=", "package", ")", ")", "version", "=", "parse", "(", "'0'", ")", "if", "re...
Return version of package on pypi.python.org using json. Adapted from https://stackoverflow.com/a/34366589
[ "Return", "version", "of", "package", "on", "pypi", ".", "python", ".", "org", "using", "json", ".", "Adapted", "from", "https", ":", "//", "stackoverflow", ".", "com", "/", "a", "/", "34366589" ]
train
https://github.com/biosustain/swiglpk/blob/a83bc5d0bb4bf7795756ba11a33fb5cb2c501bef/scripts/find_swiglpk_version.py#L13-L25
osantana/prettyconf
prettyconf/loaders.py
get_args
def get_args(parser): """ Converts arguments extracted from a parser to a dict, and will dismiss arguments which default to NOT_SET. :param parser: an ``argparse.ArgumentParser`` instance. :type parser: argparse.ArgumentParser :return: Dictionary with the configs found in the parsed CLI argumen...
python
def get_args(parser): """ Converts arguments extracted from a parser to a dict, and will dismiss arguments which default to NOT_SET. :param parser: an ``argparse.ArgumentParser`` instance. :type parser: argparse.ArgumentParser :return: Dictionary with the configs found in the parsed CLI argumen...
[ "def", "get_args", "(", "parser", ")", ":", "args", "=", "vars", "(", "parser", ".", "parse_args", "(", ")", ")", ".", "items", "(", ")", "return", "{", "key", ":", "val", "for", "key", ",", "val", "in", "args", "if", "not", "isinstance", "(", "v...
Converts arguments extracted from a parser to a dict, and will dismiss arguments which default to NOT_SET. :param parser: an ``argparse.ArgumentParser`` instance. :type parser: argparse.ArgumentParser :return: Dictionary with the configs found in the parsed CLI arguments. :rtype: dict
[ "Converts", "arguments", "extracted", "from", "a", "parser", "to", "a", "dict", "and", "will", "dismiss", "arguments", "which", "default", "to", "NOT_SET", "." ]
train
https://github.com/osantana/prettyconf/blob/ddbbc8a592ebd7d80d9c3f87c8671523e3692a0d/prettyconf/loaders.py#L22-L33
aouyar/PyMunin
pysysinfo/util.py
parse_value
def parse_value(val, parsebool=False): """Parse input string and return int, float or str depending on format. @param val: Input string. @param parsebool: If True parse yes / no, on / off as boolean. @return: Value of type int, float or str. """ try: return i...
python
def parse_value(val, parsebool=False): """Parse input string and return int, float or str depending on format. @param val: Input string. @param parsebool: If True parse yes / no, on / off as boolean. @return: Value of type int, float or str. """ try: return i...
[ "def", "parse_value", "(", "val", ",", "parsebool", "=", "False", ")", ":", "try", ":", "return", "int", "(", "val", ")", "except", "ValueError", ":", "pass", "try", ":", "return", "float", "(", "val", ")", "except", ":", "pass", "if", "parsebool", "...
Parse input string and return int, float or str depending on format. @param val: Input string. @param parsebool: If True parse yes / no, on / off as boolean. @return: Value of type int, float or str.
[ "Parse", "input", "string", "and", "return", "int", "float", "or", "str", "depending", "on", "format", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/util.py#L27-L48
aouyar/PyMunin
pysysinfo/util.py
socket_read
def socket_read(fp): """Buffered read from socket. Reads all data available from socket. @fp: File pointer for socket. @return: String of characters read from buffer. """ response = '' oldlen = 0 newlen = 0 while True: response += fp.read(buffSize) newlen = ...
python
def socket_read(fp): """Buffered read from socket. Reads all data available from socket. @fp: File pointer for socket. @return: String of characters read from buffer. """ response = '' oldlen = 0 newlen = 0 while True: response += fp.read(buffSize) newlen = ...
[ "def", "socket_read", "(", "fp", ")", ":", "response", "=", "''", "oldlen", "=", "0", "newlen", "=", "0", "while", "True", ":", "response", "+=", "fp", ".", "read", "(", "buffSize", ")", "newlen", "=", "len", "(", "response", ")", "if", "newlen", "...
Buffered read from socket. Reads all data available from socket. @fp: File pointer for socket. @return: String of characters read from buffer.
[ "Buffered", "read", "from", "socket", ".", "Reads", "all", "data", "available", "from", "socket", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/util.py#L64-L81
aouyar/PyMunin
pysysinfo/util.py
exec_command
def exec_command(args, env=None): """Convenience function that executes command and returns result. @param args: Tuple of command and arguments. @param env: Dictionary of environment variables. (Environment is not modified if None.) @return: Command output. """ t...
python
def exec_command(args, env=None): """Convenience function that executes command and returns result. @param args: Tuple of command and arguments. @param env: Dictionary of environment variables. (Environment is not modified if None.) @return: Command output. """ t...
[ "def", "exec_command", "(", "args", ",", "env", "=", "None", ")", ":", "try", ":", "cmd", "=", "subprocess", ".", "Popen", "(", "args", ",", "stdout", "=", "subprocess", ".", "PIPE", ",", "stderr", "=", "subprocess", ".", "PIPE", ",", "bufsize", "=",...
Convenience function that executes command and returns result. @param args: Tuple of command and arguments. @param env: Dictionary of environment variables. (Environment is not modified if None.) @return: Command output.
[ "Convenience", "function", "that", "executes", "command", "and", "returns", "result", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/util.py#L84-L106
aouyar/PyMunin
pysysinfo/util.py
NestedDict.set_nested
def set_nested(self, klist, value): """D.set_nested((k1, k2,k3, ...), v) -> D[k1][k2][k3] ... = v""" keys = list(klist) if len(keys) > 0: curr_dict = self last_key = keys.pop() for key in keys: if not curr_dict.has_key(key) or not isinstance(cu...
python
def set_nested(self, klist, value): """D.set_nested((k1, k2,k3, ...), v) -> D[k1][k2][k3] ... = v""" keys = list(klist) if len(keys) > 0: curr_dict = self last_key = keys.pop() for key in keys: if not curr_dict.has_key(key) or not isinstance(cu...
[ "def", "set_nested", "(", "self", ",", "klist", ",", "value", ")", ":", "keys", "=", "list", "(", "klist", ")", "if", "len", "(", "keys", ")", ">", "0", ":", "curr_dict", "=", "self", "last_key", "=", "keys", ".", "pop", "(", ")", "for", "key", ...
D.set_nested((k1, k2,k3, ...), v) -> D[k1][k2][k3] ... = v
[ "D", ".", "set_nested", "((", "k1", "k2", "k3", "...", ")", "v", ")", "-", ">", "D", "[", "k1", "]", "[", "k2", "]", "[", "k3", "]", "...", "=", "v" ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/util.py#L156-L167
aouyar/PyMunin
pysysinfo/util.py
TableFilter.registerFilter
def registerFilter(self, column, patterns, is_regex=False, ignore_case=False): """Register filter on a column of table. @param column: The column name. @param patterns: A single pattern or a list of patterns used for matching ...
python
def registerFilter(self, column, patterns, is_regex=False, ignore_case=False): """Register filter on a column of table. @param column: The column name. @param patterns: A single pattern or a list of patterns used for matching ...
[ "def", "registerFilter", "(", "self", ",", "column", ",", "patterns", ",", "is_regex", "=", "False", ",", "ignore_case", "=", "False", ")", ":", "if", "isinstance", "(", "patterns", ",", "basestring", ")", ":", "patt_list", "=", "(", "patterns", ",", ")"...
Register filter on a column of table. @param column: The column name. @param patterns: A single pattern or a list of patterns used for matching column values. @param is_regex: The patterns will be treated as regex if True, the ...
[ "Register", "filter", "on", "a", "column", "of", "table", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/util.py#L233-L264
aouyar/PyMunin
pysysinfo/util.py
TableFilter.unregisterFilter
def unregisterFilter(self, column): """Unregister filter on a column of the table. @param column: The column header. """ if self._filters.has_key(column): del self._filters[column]
python
def unregisterFilter(self, column): """Unregister filter on a column of the table. @param column: The column header. """ if self._filters.has_key(column): del self._filters[column]
[ "def", "unregisterFilter", "(", "self", ",", "column", ")", ":", "if", "self", ".", "_filters", ".", "has_key", "(", "column", ")", ":", "del", "self", ".", "_filters", "[", "column", "]" ]
Unregister filter on a column of the table. @param column: The column header.
[ "Unregister", "filter", "on", "a", "column", "of", "the", "table", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/util.py#L266-L273
aouyar/PyMunin
pysysinfo/util.py
TableFilter.registerFilters
def registerFilters(self, **kwargs): """Register multiple filters at once. @param **kwargs: Multiple filters are registered using keyword variables. Each keyword must correspond to a field name with an optional suffix: ...
python
def registerFilters(self, **kwargs): """Register multiple filters at once. @param **kwargs: Multiple filters are registered using keyword variables. Each keyword must correspond to a field name with an optional suffix: ...
[ "def", "registerFilters", "(", "self", ",", "*", "*", "kwargs", ")", ":", "for", "(", "key", ",", "patterns", ")", "in", "kwargs", ".", "items", "(", ")", ":", "if", "key", ".", "endswith", "(", "'_regex'", ")", ":", "col", "=", "key", "[", ":", ...
Register multiple filters at once. @param **kwargs: Multiple filters are registered using keyword variables. Each keyword must correspond to a field name with an optional suffix: field: Field equal to value or in list...
[ "Register", "multiple", "filters", "at", "once", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/util.py#L275-L304
aouyar/PyMunin
pysysinfo/util.py
TableFilter.applyFilters
def applyFilters(self, headers, table): """Apply filter on ps command result. @param headers: List of column headers. @param table: Nested list of rows and columns. @return: Nested list of rows and columns filtered using registered filters. ...
python
def applyFilters(self, headers, table): """Apply filter on ps command result. @param headers: List of column headers. @param table: Nested list of rows and columns. @return: Nested list of rows and columns filtered using registered filters. ...
[ "def", "applyFilters", "(", "self", ",", "headers", ",", "table", ")", ":", "result", "=", "[", "]", "column_idxs", "=", "{", "}", "for", "column", "in", "self", ".", "_filters", ".", "keys", "(", ")", ":", "try", ":", "column_idxs", "[", "column", ...
Apply filter on ps command result. @param headers: List of column headers. @param table: Nested list of rows and columns. @return: Nested list of rows and columns filtered using registered filters.
[ "Apply", "filter", "on", "ps", "command", "result", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/util.py#L306-L343
aouyar/PyMunin
pysysinfo/util.py
Telnet.open
def open(self, host=None, port=0, socket_file=None, timeout=socket.getdefaulttimeout()): """Connect to a host. With a host argument, it connects the instance using TCP; port number and timeout are optional, socket_file must be None. The port number defaults to the standar...
python
def open(self, host=None, port=0, socket_file=None, timeout=socket.getdefaulttimeout()): """Connect to a host. With a host argument, it connects the instance using TCP; port number and timeout are optional, socket_file must be None. The port number defaults to the standar...
[ "def", "open", "(", "self", ",", "host", "=", "None", ",", "port", "=", "0", ",", "socket_file", "=", "None", ",", "timeout", "=", "socket", ".", "getdefaulttimeout", "(", ")", ")", ":", "self", ".", "socket_file", "=", "socket_file", "if", "host", "...
Connect to a host. With a host argument, it connects the instance using TCP; port number and timeout are optional, socket_file must be None. The port number defaults to the standard telnet port (23). With a socket_file argument, it connects the instance using named soc...
[ "Connect", "to", "a", "host", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/util.py#L366-L395
ContextLab/quail
quail/analysis/analysis.py
analyze
def analyze(egg, subjgroup=None, listgroup=None, subjname='Subject', listname='List', analysis=None, position=0, permute=False, n_perms=1000, parallel=False, match='exact', distance='euclidean', features=None, ts=None): """ General analysis function that groups data by subjec...
python
def analyze(egg, subjgroup=None, listgroup=None, subjname='Subject', listname='List', analysis=None, position=0, permute=False, n_perms=1000, parallel=False, match='exact', distance='euclidean', features=None, ts=None): """ General analysis function that groups data by subjec...
[ "def", "analyze", "(", "egg", ",", "subjgroup", "=", "None", ",", "listgroup", "=", "None", ",", "subjname", "=", "'Subject'", ",", "listname", "=", "'List'", ",", "analysis", "=", "None", ",", "position", "=", "0", ",", "permute", "=", "False", ",", ...
General analysis function that groups data by subject/list number and performs analysis. Parameters ---------- egg : Egg data object The data to be analyzed subjgroup : list of strings or ints String/int variables indicating how to group over subjects. Must be the length of th...
[ "General", "analysis", "function", "that", "groups", "data", "by", "subject", "/", "list", "number", "and", "performs", "analysis", "." ]
train
https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/analysis/analysis.py#L31-L155
ContextLab/quail
quail/analysis/analysis.py
_analyze_chunk
def _analyze_chunk(data, subjgroup=None, subjname='Subject', listgroup=None, listname='List', analysis=None, analysis_type=None, pass_features=False, features=None, parallel=False, **kwargs): """ Private function that groups data by subject/list number an...
python
def _analyze_chunk(data, subjgroup=None, subjname='Subject', listgroup=None, listname='List', analysis=None, analysis_type=None, pass_features=False, features=None, parallel=False, **kwargs): """ Private function that groups data by subject/list number an...
[ "def", "_analyze_chunk", "(", "data", ",", "subjgroup", "=", "None", ",", "subjname", "=", "'Subject'", ",", "listgroup", "=", "None", ",", "listname", "=", "'List'", ",", "analysis", "=", "None", ",", "analysis_type", "=", "None", ",", "pass_features", "=...
Private function that groups data by subject/list number and performs analysis for a chunk of data. Parameters ---------- data : Egg data object The data to be analyzed subjgroup : list of strings or ints String/int variables indicating how to group over subjects. Must be ...
[ "Private", "function", "that", "groups", "data", "by", "subject", "/", "list", "number", "and", "performs", "analysis", "for", "a", "chunk", "of", "data", "." ]
train
https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/analysis/analysis.py#L157-L236
aouyar/PyMunin
pymunin/plugins/tomcatstats.py
MuninTomcatPlugin.retrieveVals
def retrieveVals(self): """Retrieve values for graphs.""" if self.hasGraph('tomcat_memory'): stats = self._tomcatInfo.getMemoryStats() self.setGraphVal('tomcat_memory', 'used', stats['total'] - stats['free']) self.setGraphVal('tomcat_memo...
python
def retrieveVals(self): """Retrieve values for graphs.""" if self.hasGraph('tomcat_memory'): stats = self._tomcatInfo.getMemoryStats() self.setGraphVal('tomcat_memory', 'used', stats['total'] - stats['free']) self.setGraphVal('tomcat_memo...
[ "def", "retrieveVals", "(", "self", ")", ":", "if", "self", ".", "hasGraph", "(", "'tomcat_memory'", ")", ":", "stats", "=", "self", ".", "_tomcatInfo", ".", "getMemoryStats", "(", ")", "self", ".", "setGraphVal", "(", "'tomcat_memory'", ",", "'used'", ","...
Retrieve values for graphs.
[ "Retrieve", "values", "for", "graphs", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/plugins/tomcatstats.py#L196-L225
dfm/acor
acor/acor.py
function
def function(data, maxt=None): """ Calculate the autocorrelation function for a 1D time series. Parameters ---------- data : numpy.ndarray (N,) The time series. Returns ------- rho : numpy.ndarray (N,) An autocorrelation function. """ data = np.atleast_1d(data)...
python
def function(data, maxt=None): """ Calculate the autocorrelation function for a 1D time series. Parameters ---------- data : numpy.ndarray (N,) The time series. Returns ------- rho : numpy.ndarray (N,) An autocorrelation function. """ data = np.atleast_1d(data)...
[ "def", "function", "(", "data", ",", "maxt", "=", "None", ")", ":", "data", "=", "np", ".", "atleast_1d", "(", "data", ")", "assert", "len", "(", "np", ".", "shape", "(", "data", ")", ")", "==", "1", ",", "\"The autocorrelation function can only by compu...
Calculate the autocorrelation function for a 1D time series. Parameters ---------- data : numpy.ndarray (N,) The time series. Returns ------- rho : numpy.ndarray (N,) An autocorrelation function.
[ "Calculate", "the", "autocorrelation", "function", "for", "a", "1D", "time", "series", "." ]
train
https://github.com/dfm/acor/blob/b55eb8efa7df6c73b6f3f0c9b64fa1c801e8f821/acor/acor.py#L36-L59
aouyar/PyMunin
pymunin/plugins/nginxstats.py
MuninNginxPlugin.retrieveVals
def retrieveVals(self): """Retrieve values for graphs.""" nginxInfo = NginxInfo(self._host, self._port, self._user, self._password, self._statuspath, self._ssl) stats = nginxInfo.getServerStats() if stats: if...
python
def retrieveVals(self): """Retrieve values for graphs.""" nginxInfo = NginxInfo(self._host, self._port, self._user, self._password, self._statuspath, self._ssl) stats = nginxInfo.getServerStats() if stats: if...
[ "def", "retrieveVals", "(", "self", ")", ":", "nginxInfo", "=", "NginxInfo", "(", "self", ".", "_host", ",", "self", ".", "_port", ",", "self", ".", "_user", ",", "self", ".", "_password", ",", "self", ".", "_statuspath", ",", "self", ".", "_ssl", ")...
Retrieve values for graphs.
[ "Retrieve", "values", "for", "graphs", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/plugins/nginxstats.py#L151-L186
aouyar/PyMunin
pymunin/plugins/nginxstats.py
MuninNginxPlugin.autoconf
def autoconf(self): """Implements Munin Plugin Auto-Configuration Option. @return: True if plugin can be auto-configured, False otherwise. """ nginxInfo = NginxInfo(self._host, self._port, self._user, self._password, ...
python
def autoconf(self): """Implements Munin Plugin Auto-Configuration Option. @return: True if plugin can be auto-configured, False otherwise. """ nginxInfo = NginxInfo(self._host, self._port, self._user, self._password, ...
[ "def", "autoconf", "(", "self", ")", ":", "nginxInfo", "=", "NginxInfo", "(", "self", ".", "_host", ",", "self", ".", "_port", ",", "self", ".", "_user", ",", "self", ".", "_password", ",", "self", ".", "_statuspath", ",", "self", ".", "_ssl", ")", ...
Implements Munin Plugin Auto-Configuration Option. @return: True if plugin can be auto-configured, False otherwise.
[ "Implements", "Munin", "Plugin", "Auto", "-", "Configuration", "Option", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/plugins/nginxstats.py#L188-L197
aouyar/PyMunin
pysysinfo/phpfpm.py
PHPfpmInfo.getStats
def getStats(self): """Query and parse Web Server Status Page. """ url = "%s://%s:%d/%s" % (self._proto, self._host, self._port, self._monpath) response = util.get_url(url, self._user, self._password) stats = {} for line in respo...
python
def getStats(self): """Query and parse Web Server Status Page. """ url = "%s://%s:%d/%s" % (self._proto, self._host, self._port, self._monpath) response = util.get_url(url, self._user, self._password) stats = {} for line in respo...
[ "def", "getStats", "(", "self", ")", ":", "url", "=", "\"%s://%s:%d/%s\"", "%", "(", "self", ".", "_proto", ",", "self", ".", "_host", ",", "self", ".", "_port", ",", "self", ".", "_monpath", ")", "response", "=", "util", ".", "get_url", "(", "url", ...
Query and parse Web Server Status Page.
[ "Query", "and", "parse", "Web", "Server", "Status", "Page", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/phpfpm.py#L65-L77
aouyar/PyMunin
pymunin/plugins/phpapcstats.py
MuninPHPapcPlugin.retrieveVals
def retrieveVals(self): """Retrieve values for graphs.""" apcinfo = APCinfo(self._host, self._port, self._user, self._password, self._monpath, self._ssl, self._extras) stats = apcinfo.getAllStats() if self.hasGraph('php_apc_memory') and stats: ...
python
def retrieveVals(self): """Retrieve values for graphs.""" apcinfo = APCinfo(self._host, self._port, self._user, self._password, self._monpath, self._ssl, self._extras) stats = apcinfo.getAllStats() if self.hasGraph('php_apc_memory') and stats: ...
[ "def", "retrieveVals", "(", "self", ")", ":", "apcinfo", "=", "APCinfo", "(", "self", ".", "_host", ",", "self", ".", "_port", ",", "self", ".", "_user", ",", "self", ".", "_password", ",", "self", ".", "_monpath", ",", "self", ".", "_ssl", ",", "s...
Retrieve values for graphs.
[ "Retrieve", "values", "for", "graphs", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/plugins/phpapcstats.py#L196-L246
aouyar/PyMunin
pymunin/plugins/phpapcstats.py
MuninPHPapcPlugin.autoconf
def autoconf(self): """Implements Munin Plugin Auto-Configuration Option. @return: True if plugin can be auto-configured, False otherwise. """ apcinfo = APCinfo(self._host, self._port, self._user, self._password, self._monpath, self....
python
def autoconf(self): """Implements Munin Plugin Auto-Configuration Option. @return: True if plugin can be auto-configured, False otherwise. """ apcinfo = APCinfo(self._host, self._port, self._user, self._password, self._monpath, self....
[ "def", "autoconf", "(", "self", ")", ":", "apcinfo", "=", "APCinfo", "(", "self", ".", "_host", ",", "self", ".", "_port", ",", "self", ".", "_user", ",", "self", ".", "_password", ",", "self", ".", "_monpath", ",", "self", ".", "_ssl", ")", "retur...
Implements Munin Plugin Auto-Configuration Option. @return: True if plugin can be auto-configured, False otherwise.
[ "Implements", "Munin", "Plugin", "Auto", "-", "Configuration", "Option", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/plugins/phpapcstats.py#L248-L256
aouyar/PyMunin
pysysinfo/varnish.py
VarnishInfo.getStats
def getStats(self): """Runs varnishstats command to get stats from Varnish Cache. @return: Dictionary of stats. """ info_dict = {} args = [varnishstatCmd, '-1'] if self._instance is not None: args.extend(['-n', self._instance]) output = util....
python
def getStats(self): """Runs varnishstats command to get stats from Varnish Cache. @return: Dictionary of stats. """ info_dict = {} args = [varnishstatCmd, '-1'] if self._instance is not None: args.extend(['-n', self._instance]) output = util....
[ "def", "getStats", "(", "self", ")", ":", "info_dict", "=", "{", "}", "args", "=", "[", "varnishstatCmd", ",", "'-1'", "]", "if", "self", ".", "_instance", "is", "not", "None", ":", "args", ".", "extend", "(", "[", "'-n'", ",", "self", ".", "_insta...
Runs varnishstats command to get stats from Varnish Cache. @return: Dictionary of stats.
[ "Runs", "varnishstats", "command", "to", "get", "stats", "from", "Varnish", "Cache", ".", "@return", ":", "Dictionary", "of", "stats", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/varnish.py#L39-L59
aouyar/PyMunin
pysysinfo/varnish.py
VarnishInfo.getDesc
def getDesc(self, entry): """Returns description for stat entry. @param entry: Entry name. @return: Description for entry. """ if len(self._descDict) == 0: self.getStats() return self._descDict.get(entry)
python
def getDesc(self, entry): """Returns description for stat entry. @param entry: Entry name. @return: Description for entry. """ if len(self._descDict) == 0: self.getStats() return self._descDict.get(entry)
[ "def", "getDesc", "(", "self", ",", "entry", ")", ":", "if", "len", "(", "self", ".", "_descDict", ")", "==", "0", ":", "self", ".", "getStats", "(", ")", "return", "self", ".", "_descDict", ".", "get", "(", "entry", ")" ]
Returns description for stat entry. @param entry: Entry name. @return: Description for entry.
[ "Returns", "description", "for", "stat", "entry", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/varnish.py#L71-L80
aouyar/PyMunin
pymunin/plugins/phpopcstats.py
MuninPHPOPCPlugin.retrieveVals
def retrieveVals(self): """Retrieve values for graphs.""" opcinfo = OPCinfo(self._host, self._port, self._user, self._password, self._monpath, self._ssl) stats = opcinfo.getAllStats() if self.hasGraph('php_opc_memory') and stats: mem = stat...
python
def retrieveVals(self): """Retrieve values for graphs.""" opcinfo = OPCinfo(self._host, self._port, self._user, self._password, self._monpath, self._ssl) stats = opcinfo.getAllStats() if self.hasGraph('php_opc_memory') and stats: mem = stat...
[ "def", "retrieveVals", "(", "self", ")", ":", "opcinfo", "=", "OPCinfo", "(", "self", ".", "_host", ",", "self", ".", "_port", ",", "self", ".", "_user", ",", "self", ".", "_password", ",", "self", ".", "_monpath", ",", "self", ".", "_ssl", ")", "s...
Retrieve values for graphs.
[ "Retrieve", "values", "for", "graphs", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/plugins/phpopcstats.py#L148-L177
aouyar/PyMunin
pymunin/plugins/phpopcstats.py
MuninPHPOPCPlugin.autoconf
def autoconf(self): """Implements Munin Plugin Auto-Configuration Option. @return: True if plugin can be auto-configured, False otherwise. """ opcinfo = OPCinfo(self._host, self._port, self._user, self._password, self._monpath, self....
python
def autoconf(self): """Implements Munin Plugin Auto-Configuration Option. @return: True if plugin can be auto-configured, False otherwise. """ opcinfo = OPCinfo(self._host, self._port, self._user, self._password, self._monpath, self....
[ "def", "autoconf", "(", "self", ")", ":", "opcinfo", "=", "OPCinfo", "(", "self", ".", "_host", ",", "self", ".", "_port", ",", "self", ".", "_user", ",", "self", ".", "_password", ",", "self", ".", "_monpath", ",", "self", ".", "_ssl", ")", "retur...
Implements Munin Plugin Auto-Configuration Option. @return: True if plugin can be auto-configured, False otherwise.
[ "Implements", "Munin", "Plugin", "Auto", "-", "Configuration", "Option", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/plugins/phpopcstats.py#L179-L187
ContextLab/quail
quail/analysis/clustering.py
fingerprint_helper
def fingerprint_helper(egg, permute=False, n_perms=1000, match='exact', distance='euclidean', features=None): """ Computes clustering along a set of feature dimensions Parameters ---------- egg : quail.Egg Data to analyze dist_funcs : dict Dictionary of d...
python
def fingerprint_helper(egg, permute=False, n_perms=1000, match='exact', distance='euclidean', features=None): """ Computes clustering along a set of feature dimensions Parameters ---------- egg : quail.Egg Data to analyze dist_funcs : dict Dictionary of d...
[ "def", "fingerprint_helper", "(", "egg", ",", "permute", "=", "False", ",", "n_perms", "=", "1000", ",", "match", "=", "'exact'", ",", "distance", "=", "'euclidean'", ",", "features", "=", "None", ")", ":", "if", "features", "is", "None", ":", "features"...
Computes clustering along a set of feature dimensions Parameters ---------- egg : quail.Egg Data to analyze dist_funcs : dict Dictionary of distance functions for feature clustering analyses Returns ---------- probabilities : Numpy array Each number represents cluste...
[ "Computes", "clustering", "along", "a", "set", "of", "feature", "dimensions" ]
train
https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/analysis/clustering.py#L9-L37
ContextLab/quail
quail/analysis/clustering.py
compute_feature_weights
def compute_feature_weights(pres_list, rec_list, feature_list, distances): """ Compute clustering scores along a set of feature dimensions Parameters ---------- pres_list : list list of presented words rec_list : list list of recalled words feature_list : list list...
python
def compute_feature_weights(pres_list, rec_list, feature_list, distances): """ Compute clustering scores along a set of feature dimensions Parameters ---------- pres_list : list list of presented words rec_list : list list of recalled words feature_list : list list...
[ "def", "compute_feature_weights", "(", "pres_list", ",", "rec_list", ",", "feature_list", ",", "distances", ")", ":", "# initialize the weights object for just this list", "weights", "=", "{", "}", "for", "feature", "in", "feature_list", "[", "0", "]", ":", "weights...
Compute clustering scores along a set of feature dimensions Parameters ---------- pres_list : list list of presented words rec_list : list list of recalled words feature_list : list list of feature dicts for presented words distances : dict dict of distance ma...
[ "Compute", "clustering", "scores", "along", "a", "set", "of", "feature", "dimensions" ]
train
https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/analysis/clustering.py#L137-L218
ContextLab/quail
quail/analysis/lagcrp.py
lagcrp_helper
def lagcrp_helper(egg, match='exact', distance='euclidean', ts=None, features=None): """ Computes probabilities for each transition distance (probability that a word recalled will be a given distance--in presentation order--from the previous recalled word). Parameters --------...
python
def lagcrp_helper(egg, match='exact', distance='euclidean', ts=None, features=None): """ Computes probabilities for each transition distance (probability that a word recalled will be a given distance--in presentation order--from the previous recalled word). Parameters --------...
[ "def", "lagcrp_helper", "(", "egg", ",", "match", "=", "'exact'", ",", "distance", "=", "'euclidean'", ",", "ts", "=", "None", ",", "features", "=", "None", ")", ":", "def", "lagcrp", "(", "rec", ",", "lstlen", ")", ":", "\"\"\"Computes lag-crp for a given...
Computes probabilities for each transition distance (probability that a word recalled will be a given distance--in presentation order--from the previous recalled word). Parameters ---------- egg : quail.Egg Data to analyze match : str (exact, best or smooth) Matching approach t...
[ "Computes", "probabilities", "for", "each", "transition", "distance", "(", "probability", "that", "a", "word", "recalled", "will", "be", "a", "given", "distance", "--", "in", "presentation", "order", "--", "from", "the", "previous", "recalled", "word", ")", "....
train
https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/analysis/lagcrp.py#L7-L129
aouyar/PyMunin
pymunin/plugins/diskiostats.py
MuninDiskIOplugin.retrieveVals
def retrieveVals(self): """Retrieve values for graphs.""" if self._diskList: self._fetchDevAll('disk', self._diskList, self._info.getDiskStats) if self._mdList: self._fetchDevAll('md', self._mdList, self._info....
python
def retrieveVals(self): """Retrieve values for graphs.""" if self._diskList: self._fetchDevAll('disk', self._diskList, self._info.getDiskStats) if self._mdList: self._fetchDevAll('md', self._mdList, self._info....
[ "def", "retrieveVals", "(", "self", ")", ":", "if", "self", ".", "_diskList", ":", "self", ".", "_fetchDevAll", "(", "'disk'", ",", "self", ".", "_diskList", ",", "self", ".", "_info", ".", "getDiskStats", ")", "if", "self", ".", "_mdList", ":", "self"...
Retrieve values for graphs.
[ "Retrieve", "values", "for", "graphs", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/plugins/diskiostats.py#L125-L140
aouyar/PyMunin
pymunin/plugins/diskiostats.py
MuninDiskIOplugin._configDevRequests
def _configDevRequests(self, namestr, titlestr, devlist): """Generate configuration for I/O Request stats. @param namestr: Field name component indicating device type. @param titlestr: Title component indicating device type. @param devlist: List of devices. ""...
python
def _configDevRequests(self, namestr, titlestr, devlist): """Generate configuration for I/O Request stats. @param namestr: Field name component indicating device type. @param titlestr: Title component indicating device type. @param devlist: List of devices. ""...
[ "def", "_configDevRequests", "(", "self", ",", "namestr", ",", "titlestr", ",", "devlist", ")", ":", "name", "=", "'diskio_%s_requests'", "%", "namestr", "if", "self", ".", "graphEnabled", "(", "name", ")", ":", "graph", "=", "MuninGraph", "(", "'Disk I/O - ...
Generate configuration for I/O Request stats. @param namestr: Field name component indicating device type. @param titlestr: Title component indicating device type. @param devlist: List of devices.
[ "Generate", "configuration", "for", "I", "/", "O", "Request", "stats", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/plugins/diskiostats.py#L142-L170
aouyar/PyMunin
pymunin/plugins/diskiostats.py
MuninDiskIOplugin._configDevActive
def _configDevActive(self, namestr, titlestr, devlist): """Generate configuration for I/O Queue Length. @param namestr: Field name component indicating device type. @param titlestr: Title component indicating device type. @param devlist: List of devices. """ ...
python
def _configDevActive(self, namestr, titlestr, devlist): """Generate configuration for I/O Queue Length. @param namestr: Field name component indicating device type. @param titlestr: Title component indicating device type. @param devlist: List of devices. """ ...
[ "def", "_configDevActive", "(", "self", ",", "namestr", ",", "titlestr", ",", "devlist", ")", ":", "name", "=", "'diskio_%s_active'", "%", "namestr", "if", "self", ".", "graphEnabled", "(", "name", ")", ":", "graph", "=", "MuninGraph", "(", "'Disk I/O - %s -...
Generate configuration for I/O Queue Length. @param namestr: Field name component indicating device type. @param titlestr: Title component indicating device type. @param devlist: List of devices.
[ "Generate", "configuration", "for", "I", "/", "O", "Queue", "Length", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/plugins/diskiostats.py#L202-L224
aouyar/PyMunin
pymunin/plugins/diskiostats.py
MuninDiskIOplugin._fetchDevAll
def _fetchDevAll(self, namestr, devlist, statsfunc): """Initialize I/O stats for devices. @param namestr: Field name component indicating device type. @param devlist: List of devices. @param statsfunc: Function for retrieving stats for device. """ fo...
python
def _fetchDevAll(self, namestr, devlist, statsfunc): """Initialize I/O stats for devices. @param namestr: Field name component indicating device type. @param devlist: List of devices. @param statsfunc: Function for retrieving stats for device. """ fo...
[ "def", "_fetchDevAll", "(", "self", ",", "namestr", ",", "devlist", ",", "statsfunc", ")", ":", "for", "dev", "in", "devlist", ":", "stats", "=", "statsfunc", "(", "dev", ")", "name", "=", "'diskio_%s_requests'", "%", "namestr", "if", "self", ".", "hasGr...
Initialize I/O stats for devices. @param namestr: Field name component indicating device type. @param devlist: List of devices. @param statsfunc: Function for retrieving stats for device.
[ "Initialize", "I", "/", "O", "stats", "for", "devices", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/plugins/diskiostats.py#L226-L246
aouyar/PyMunin
pymunin/plugins/redisstats.py
RedisPlugin.retrieveVals
def retrieveVals(self): """Retrieve values for graphs.""" for graph_name in self.getGraphList(): for field_name in self.getGraphFieldList(graph_name): self.setGraphVal(graph_name, field_name, self._stats.get(field_name))
python
def retrieveVals(self): """Retrieve values for graphs.""" for graph_name in self.getGraphList(): for field_name in self.getGraphFieldList(graph_name): self.setGraphVal(graph_name, field_name, self._stats.get(field_name))
[ "def", "retrieveVals", "(", "self", ")", ":", "for", "graph_name", "in", "self", ".", "getGraphList", "(", ")", ":", "for", "field_name", "in", "self", ".", "getGraphFieldList", "(", "graph_name", ")", ":", "self", ".", "setGraphVal", "(", "graph_name", ",...
Retrieve values for graphs.
[ "Retrieve", "values", "for", "graphs", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/plugins/redisstats.py#L296-L300
aouyar/PyMunin
pymunin/plugins/sysstats.py
MuninSysStatsPlugin.retrieveVals
def retrieveVals(self): """Retrieve values for graphs.""" if self.hasGraph('sys_loadavg'): self._loadstats = self._sysinfo.getLoadAvg() if self._loadstats: self.setGraphVal('sys_loadavg', 'load15min', self._loadstats[2]) self.setGraphVal('sys_loada...
python
def retrieveVals(self): """Retrieve values for graphs.""" if self.hasGraph('sys_loadavg'): self._loadstats = self._sysinfo.getLoadAvg() if self._loadstats: self.setGraphVal('sys_loadavg', 'load15min', self._loadstats[2]) self.setGraphVal('sys_loada...
[ "def", "retrieveVals", "(", "self", ")", ":", "if", "self", ".", "hasGraph", "(", "'sys_loadavg'", ")", ":", "self", ".", "_loadstats", "=", "self", ".", "_sysinfo", ".", "getLoadAvg", "(", ")", "if", "self", ".", "_loadstats", ":", "self", ".", "setGr...
Retrieve values for graphs.
[ "Retrieve", "values", "for", "graphs", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/plugins/sysstats.py#L211-L274
mattseymour/python-env
dotenv/__init__.py
get
def get(key, default=None): """ Searches os.environ. If a key is found try evaluating its type else; return the string. returns: k->value (type as defined by ast.literal_eval) """ try: # Attempt to evaluate into python literal return ast.literal_eval(os.environ.get(k...
python
def get(key, default=None): """ Searches os.environ. If a key is found try evaluating its type else; return the string. returns: k->value (type as defined by ast.literal_eval) """ try: # Attempt to evaluate into python literal return ast.literal_eval(os.environ.get(k...
[ "def", "get", "(", "key", ",", "default", "=", "None", ")", ":", "try", ":", "# Attempt to evaluate into python literal", "return", "ast", ".", "literal_eval", "(", "os", ".", "environ", ".", "get", "(", "key", ".", "upper", "(", ")", ",", "default", ")"...
Searches os.environ. If a key is found try evaluating its type else; return the string. returns: k->value (type as defined by ast.literal_eval)
[ "Searches", "os", ".", "environ", ".", "If", "a", "key", "is", "found", "try", "evaluating", "its", "type", "else", ";", "return", "the", "string", "." ]
train
https://github.com/mattseymour/python-env/blob/5ac09b1685fbba75c174c79cb40287aa49d0f208/dotenv/__init__.py#L17-L28
mattseymour/python-env
dotenv/__init__.py
save
def save(filepath=None, **kwargs): """ Saves a list of keyword arguments as environment variables to a file. If no filepath given will default to the default `.env` file. """ if filepath is None: filepath = os.path.join('.env') with open(filepath, 'wb') as file_handle: f...
python
def save(filepath=None, **kwargs): """ Saves a list of keyword arguments as environment variables to a file. If no filepath given will default to the default `.env` file. """ if filepath is None: filepath = os.path.join('.env') with open(filepath, 'wb') as file_handle: f...
[ "def", "save", "(", "filepath", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "filepath", "is", "None", ":", "filepath", "=", "os", ".", "path", ".", "join", "(", "'.env'", ")", "with", "open", "(", "filepath", ",", "'wb'", ")", "as", "fi...
Saves a list of keyword arguments as environment variables to a file. If no filepath given will default to the default `.env` file.
[ "Saves", "a", "list", "of", "keyword", "arguments", "as", "environment", "variables", "to", "a", "file", ".", "If", "no", "filepath", "given", "will", "default", "to", "the", "default", ".", "env", "file", "." ]
train
https://github.com/mattseymour/python-env/blob/5ac09b1685fbba75c174c79cb40287aa49d0f208/dotenv/__init__.py#L31-L43
mattseymour/python-env
dotenv/__init__.py
load
def load(filepath=None): """ Reads a .env file into os.environ. For a set filepath, open the file and read contents into os.environ. If filepath is not set then look in current dir for a .env file. """ if filepath and os.path.exists(filepath): pass else: if not o...
python
def load(filepath=None): """ Reads a .env file into os.environ. For a set filepath, open the file and read contents into os.environ. If filepath is not set then look in current dir for a .env file. """ if filepath and os.path.exists(filepath): pass else: if not o...
[ "def", "load", "(", "filepath", "=", "None", ")", ":", "if", "filepath", "and", "os", ".", "path", ".", "exists", "(", "filepath", ")", ":", "pass", "else", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "'.env'", ")", ":", "return", "F...
Reads a .env file into os.environ. For a set filepath, open the file and read contents into os.environ. If filepath is not set then look in current dir for a .env file.
[ "Reads", "a", ".", "env", "file", "into", "os", ".", "environ", "." ]
train
https://github.com/mattseymour/python-env/blob/5ac09b1685fbba75c174c79cb40287aa49d0f208/dotenv/__init__.py#L46-L64
mattseymour/python-env
dotenv/__init__.py
_get_line_
def _get_line_(filepath): """ Gets each line from the file and parse the data. Attempt to translate the value into a python type is possible (falls back to string). """ for line in open(filepath): line = line.strip() # allows for comments in the file if line.startswith('#...
python
def _get_line_(filepath): """ Gets each line from the file and parse the data. Attempt to translate the value into a python type is possible (falls back to string). """ for line in open(filepath): line = line.strip() # allows for comments in the file if line.startswith('#...
[ "def", "_get_line_", "(", "filepath", ")", ":", "for", "line", "in", "open", "(", "filepath", ")", ":", "line", "=", "line", ".", "strip", "(", ")", "# allows for comments in the file", "if", "line", ".", "startswith", "(", "'#'", ")", "or", "'='", "not"...
Gets each line from the file and parse the data. Attempt to translate the value into a python type is possible (falls back to string).
[ "Gets", "each", "line", "from", "the", "file", "and", "parse", "the", "data", ".", "Attempt", "to", "translate", "the", "value", "into", "a", "python", "type", "is", "possible", "(", "falls", "back", "to", "string", ")", "." ]
train
https://github.com/mattseymour/python-env/blob/5ac09b1685fbba75c174c79cb40287aa49d0f208/dotenv/__init__.py#L67-L94
aouyar/PyMunin
pysysinfo/apache.py
ApacheInfo.initStats
def initStats(self): """Query and parse Apache Web Server Status Page.""" url = "%s://%s:%d/%s?auto" % (self._proto, self._host, self._port, self._statuspath) response = util.get_url(url, self._user, self._password) self._statusDict = {} f...
python
def initStats(self): """Query and parse Apache Web Server Status Page.""" url = "%s://%s:%d/%s?auto" % (self._proto, self._host, self._port, self._statuspath) response = util.get_url(url, self._user, self._password) self._statusDict = {} f...
[ "def", "initStats", "(", "self", ")", ":", "url", "=", "\"%s://%s:%d/%s?auto\"", "%", "(", "self", ".", "_proto", ",", "self", ".", "_host", ",", "self", ".", "_port", ",", "self", ".", "_statuspath", ")", "response", "=", "util", ".", "get_url", "(", ...
Query and parse Apache Web Server Status Page.
[ "Query", "and", "parse", "Apache", "Web", "Server", "Status", "Page", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/apache.py#L68-L79
ContextLab/quail
quail/egg.py
Egg.get_pres_features
def get_pres_features(self, features=None): """ Returns a df of features for presented items """ if features is None: features = self.dist_funcs.keys() elif not isinstance(features, list): features = [features] return self.pres.applymap(lambda x: {...
python
def get_pres_features(self, features=None): """ Returns a df of features for presented items """ if features is None: features = self.dist_funcs.keys() elif not isinstance(features, list): features = [features] return self.pres.applymap(lambda x: {...
[ "def", "get_pres_features", "(", "self", ",", "features", "=", "None", ")", ":", "if", "features", "is", "None", ":", "features", "=", "self", ".", "dist_funcs", ".", "keys", "(", ")", "elif", "not", "isinstance", "(", "features", ",", "list", ")", ":"...
Returns a df of features for presented items
[ "Returns", "a", "df", "of", "features", "for", "presented", "items" ]
train
https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/egg.py#L220-L228
ContextLab/quail
quail/egg.py
Egg.get_rec_features
def get_rec_features(self, features=None): """ Returns a df of features for recalled items """ if features is None: features = self.dist_funcs.keys() elif not isinstance(features, list): features = [features] return self.rec.applymap(lambda x: {k:v...
python
def get_rec_features(self, features=None): """ Returns a df of features for recalled items """ if features is None: features = self.dist_funcs.keys() elif not isinstance(features, list): features = [features] return self.rec.applymap(lambda x: {k:v...
[ "def", "get_rec_features", "(", "self", ",", "features", "=", "None", ")", ":", "if", "features", "is", "None", ":", "features", "=", "self", ".", "dist_funcs", ".", "keys", "(", ")", "elif", "not", "isinstance", "(", "features", ",", "list", ")", ":",...
Returns a df of features for recalled items
[ "Returns", "a", "df", "of", "features", "for", "recalled", "items" ]
train
https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/egg.py#L236-L244
ContextLab/quail
quail/egg.py
Egg.info
def info(self): """ Print info about the data egg """ print('Number of subjects: ' + str(self.n_subjects)) print('Number of lists per subject: ' + str(self.n_lists)) print('Number of words per list: ' + str(self.list_length)) print('Date created: ' + str(self.date...
python
def info(self): """ Print info about the data egg """ print('Number of subjects: ' + str(self.n_subjects)) print('Number of lists per subject: ' + str(self.n_lists)) print('Number of words per list: ' + str(self.list_length)) print('Date created: ' + str(self.date...
[ "def", "info", "(", "self", ")", ":", "print", "(", "'Number of subjects: '", "+", "str", "(", "self", ".", "n_subjects", ")", ")", "print", "(", "'Number of lists per subject: '", "+", "str", "(", "self", ".", "n_lists", ")", ")", "print", "(", "'Number o...
Print info about the data egg
[ "Print", "info", "about", "the", "data", "egg" ]
train
https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/egg.py#L247-L255
ContextLab/quail
quail/egg.py
Egg.save
def save(self, fname, compression='blosc'): """ Save method for the Egg object The data will be saved as a 'egg' file, which is a dictionary containing the elements of a Egg saved in the hd5 format using `deepdish`. Parameters ---------- fname : str ...
python
def save(self, fname, compression='blosc'): """ Save method for the Egg object The data will be saved as a 'egg' file, which is a dictionary containing the elements of a Egg saved in the hd5 format using `deepdish`. Parameters ---------- fname : str ...
[ "def", "save", "(", "self", ",", "fname", ",", "compression", "=", "'blosc'", ")", ":", "# put egg vars into a dict", "egg", "=", "{", "'pres'", ":", "df2list", "(", "self", ".", "pres", ")", ",", "'rec'", ":", "df2list", "(", "self", ".", "rec", ")", ...
Save method for the Egg object The data will be saved as a 'egg' file, which is a dictionary containing the elements of a Egg saved in the hd5 format using `deepdish`. Parameters ---------- fname : str A name for the file. If the file extension (.egg) is n...
[ "Save", "method", "for", "the", "Egg", "object" ]
train
https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/egg.py#L257-L298
ContextLab/quail
quail/egg.py
FriedEgg.save
def save(self, fname, compression='blosc'): """ Save method for the FriedEgg object The data will be saved as a 'fegg' file, which is a dictionary containing the elements of a FriedEgg saved in the hd5 format using `deepdish`. Parameters ---------- fnam...
python
def save(self, fname, compression='blosc'): """ Save method for the FriedEgg object The data will be saved as a 'fegg' file, which is a dictionary containing the elements of a FriedEgg saved in the hd5 format using `deepdish`. Parameters ---------- fnam...
[ "def", "save", "(", "self", ",", "fname", ",", "compression", "=", "'blosc'", ")", ":", "egg", "=", "{", "'data'", ":", "self", ".", "data", ",", "'analysis'", ":", "self", ".", "analysis", ",", "'list_length'", ":", "self", ".", "list_length", ",", ...
Save method for the FriedEgg object The data will be saved as a 'fegg' file, which is a dictionary containing the elements of a FriedEgg saved in the hd5 format using `deepdish`. Parameters ---------- fname : str A name for the file. If the file extension ...
[ "Save", "method", "for", "the", "FriedEgg", "object" ]
train
https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/egg.py#L381-L418
ContextLab/quail
quail/analysis/pnr.py
pnr_helper
def pnr_helper(egg, position, match='exact', distance='euclidean', features=None): """ Computes probability of a word being recalled nth (in the appropriate recall list), given its presentation position. Note: zero indexed Parameters ---------- egg : quail.Egg Data to a...
python
def pnr_helper(egg, position, match='exact', distance='euclidean', features=None): """ Computes probability of a word being recalled nth (in the appropriate recall list), given its presentation position. Note: zero indexed Parameters ---------- egg : quail.Egg Data to a...
[ "def", "pnr_helper", "(", "egg", ",", "position", ",", "match", "=", "'exact'", ",", "distance", "=", "'euclidean'", ",", "features", "=", "None", ")", ":", "def", "pnr", "(", "lst", ",", "position", ")", ":", "return", "[", "1", "if", "pos", "==", ...
Computes probability of a word being recalled nth (in the appropriate recall list), given its presentation position. Note: zero indexed Parameters ---------- egg : quail.Egg Data to analyze position : int Position of item to be analyzed match : str (exact, best or smooth) ...
[ "Computes", "probability", "of", "a", "word", "being", "recalled", "nth", "(", "in", "the", "appropriate", "recall", "list", ")", "given", "its", "presentation", "position", ".", "Note", ":", "zero", "indexed" ]
train
https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/analysis/pnr.py#L4-L52
aouyar/PyMunin
pymunin/plugins/apachestats.py
MuninApachePlugin.retrieveVals
def retrieveVals(self): """Retrieve values for graphs.""" apacheInfo = ApacheInfo(self._host, self._port, self._user, self._password, self._statuspath, self._ssl) stats = apacheInfo.getServerStats() if self.hasGraph('apache...
python
def retrieveVals(self): """Retrieve values for graphs.""" apacheInfo = ApacheInfo(self._host, self._port, self._user, self._password, self._statuspath, self._ssl) stats = apacheInfo.getServerStats() if self.hasGraph('apache...
[ "def", "retrieveVals", "(", "self", ")", ":", "apacheInfo", "=", "ApacheInfo", "(", "self", ".", "_host", ",", "self", ".", "_port", ",", "self", ".", "_user", ",", "self", ".", "_password", ",", "self", ".", "_statuspath", ",", "self", ".", "_ssl", ...
Retrieve values for graphs.
[ "Retrieve", "values", "for", "graphs", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/plugins/apachestats.py#L124-L138
aouyar/PyMunin
pymunin/plugins/apachestats.py
MuninApachePlugin.autoconf
def autoconf(self): """Implements Munin Plugin Auto-Configuration Option. @return: True if plugin can be auto-configured, False otherwise. """ apacheInfo = ApacheInfo(self._host, self._port, self._user, self._password, ...
python
def autoconf(self): """Implements Munin Plugin Auto-Configuration Option. @return: True if plugin can be auto-configured, False otherwise. """ apacheInfo = ApacheInfo(self._host, self._port, self._user, self._password, ...
[ "def", "autoconf", "(", "self", ")", ":", "apacheInfo", "=", "ApacheInfo", "(", "self", ".", "_host", ",", "self", ".", "_port", ",", "self", ".", "_user", ",", "self", ".", "_password", ",", "self", ".", "_statuspath", ",", "self", ".", "_ssl", ")",...
Implements Munin Plugin Auto-Configuration Option. @return: True if plugin can be auto-configured, False otherwise.
[ "Implements", "Munin", "Plugin", "Auto", "-", "Configuration", "Option", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/plugins/apachestats.py#L140-L149
aouyar/PyMunin
pymunin/plugins/ntphostoffsets.py
MuninNTPhostOffsetsPlugin.retrieveVals
def retrieveVals(self): """Retrieve values for graphs.""" ntpinfo = NTPinfo() ntpstats = ntpinfo.getHostOffsets(self._remoteHosts) if ntpstats: for host in self._remoteHosts: hostkey = re.sub('\.', '_', host) hoststats = ntpstats.get(host) ...
python
def retrieveVals(self): """Retrieve values for graphs.""" ntpinfo = NTPinfo() ntpstats = ntpinfo.getHostOffsets(self._remoteHosts) if ntpstats: for host in self._remoteHosts: hostkey = re.sub('\.', '_', host) hoststats = ntpstats.get(host) ...
[ "def", "retrieveVals", "(", "self", ")", ":", "ntpinfo", "=", "NTPinfo", "(", ")", "ntpstats", "=", "ntpinfo", ".", "getHostOffsets", "(", "self", ".", "_remoteHosts", ")", "if", "ntpstats", ":", "for", "host", "in", "self", ".", "_remoteHosts", ":", "ho...
Retrieve values for graphs.
[ "Retrieve", "values", "for", "graphs", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/plugins/ntphostoffsets.py#L119-L136