partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
Diagnostic.geweke
Runs the Geweke diagnostic on the supplied chains. Parameters ---------- chain : int|str, optional Which chain to run the diagnostic on. By default, this is `None`, which will run the diagnostic on all chains. You can also supply and integer (the chain index)...
chainconsumer/diagnostic.py
def geweke(self, chain=None, first=0.1, last=0.5, threshold=0.05): """ Runs the Geweke diagnostic on the supplied chains. Parameters ---------- chain : int|str, optional Which chain to run the diagnostic on. By default, this is `None`, which will run the diagnost...
def geweke(self, chain=None, first=0.1, last=0.5, threshold=0.05): """ Runs the Geweke diagnostic on the supplied chains. Parameters ---------- chain : int|str, optional Which chain to run the diagnostic on. By default, this is `None`, which will run the diagnost...
[ "Runs", "the", "Geweke", "diagnostic", "on", "the", "supplied", "chains", "." ]
Samreay/ChainConsumer
python
https://github.com/Samreay/ChainConsumer/blob/902288e4d85c2677a9051a2172e03128a6169ad7/chainconsumer/diagnostic.py#L78-L128
[ "def", "geweke", "(", "self", ",", "chain", "=", "None", ",", "first", "=", "0.1", ",", "last", "=", "0.5", ",", "threshold", "=", "0.05", ")", ":", "if", "chain", "is", "None", ":", "return", "np", ".", "all", "(", "[", "self", ".", "geweke", ...
902288e4d85c2677a9051a2172e03128a6169ad7
train
Analysis.get_latex_table
Generates a LaTeX table from parameter summaries. Parameters ---------- parameters : list[str], optional A list of what parameters to include in the table. By default, includes all parameters transpose : bool, optional Defaults to False, which gives each column a...
chainconsumer/analysis.py
def get_latex_table(self, parameters=None, transpose=False, caption=None, label="tab:model_params", hlines=True, blank_fill="--"): # pragma: no cover """ Generates a LaTeX table from parameter summaries. Parameters ---------- parameters : list[str], optional ...
def get_latex_table(self, parameters=None, transpose=False, caption=None, label="tab:model_params", hlines=True, blank_fill="--"): # pragma: no cover """ Generates a LaTeX table from parameter summaries. Parameters ---------- parameters : list[str], optional ...
[ "Generates", "a", "LaTeX", "table", "from", "parameter", "summaries", "." ]
Samreay/ChainConsumer
python
https://github.com/Samreay/ChainConsumer/blob/902288e4d85c2677a9051a2172e03128a6169ad7/chainconsumer/analysis.py#L27-L107
[ "def", "get_latex_table", "(", "self", ",", "parameters", "=", "None", ",", "transpose", "=", "False", ",", "caption", "=", "None", ",", "label", "=", "\"tab:model_params\"", ",", "hlines", "=", "True", ",", "blank_fill", "=", "\"--\"", ")", ":", "# pragma...
902288e4d85c2677a9051a2172e03128a6169ad7
train
Analysis.get_summary
Gets a summary of the marginalised parameter distributions. Parameters ---------- squeeze : bool, optional Squeeze the summaries. If you only have one chain, squeeze will not return a length one list, just the single summary. If this is false, you will get a ...
chainconsumer/analysis.py
def get_summary(self, squeeze=True, parameters=None, chains=None): """ Gets a summary of the marginalised parameter distributions. Parameters ---------- squeeze : bool, optional Squeeze the summaries. If you only have one chain, squeeze will not return a length ...
def get_summary(self, squeeze=True, parameters=None, chains=None): """ Gets a summary of the marginalised parameter distributions. Parameters ---------- squeeze : bool, optional Squeeze the summaries. If you only have one chain, squeeze will not return a length ...
[ "Gets", "a", "summary", "of", "the", "marginalised", "parameter", "distributions", "." ]
Samreay/ChainConsumer
python
https://github.com/Samreay/ChainConsumer/blob/902288e4d85c2677a9051a2172e03128a6169ad7/chainconsumer/analysis.py#L109-L147
[ "def", "get_summary", "(", "self", ",", "squeeze", "=", "True", ",", "parameters", "=", "None", ",", "chains", "=", "None", ")", ":", "results", "=", "[", "]", "if", "chains", "is", "None", ":", "chains", "=", "self", ".", "parent", ".", "chains", ...
902288e4d85c2677a9051a2172e03128a6169ad7
train
Analysis.get_max_posteriors
Gets the maximum posterior point in parameter space from the passed parameters. Requires the chains to have set `posterior` values. Parameters ---------- parameters : str|list[str] The parameters to find squeeze : bool, optional Squeeze the summa...
chainconsumer/analysis.py
def get_max_posteriors(self, parameters=None, squeeze=True, chains=None): """ Gets the maximum posterior point in parameter space from the passed parameters. Requires the chains to have set `posterior` values. Parameters ---------- parameters : str|list[str] ...
def get_max_posteriors(self, parameters=None, squeeze=True, chains=None): """ Gets the maximum posterior point in parameter space from the passed parameters. Requires the chains to have set `posterior` values. Parameters ---------- parameters : str|list[str] ...
[ "Gets", "the", "maximum", "posterior", "point", "in", "parameter", "space", "from", "the", "passed", "parameters", ".", "Requires", "the", "chains", "to", "have", "set", "posterior", "values", "." ]
Samreay/ChainConsumer
python
https://github.com/Samreay/ChainConsumer/blob/902288e4d85c2677a9051a2172e03128a6169ad7/chainconsumer/analysis.py#L149-L195
[ "def", "get_max_posteriors", "(", "self", ",", "parameters", "=", "None", ",", "squeeze", "=", "True", ",", "chains", "=", "None", ")", ":", "results", "=", "[", "]", "if", "chains", "is", "None", ":", "chains", "=", "self", ".", "parent", ".", "chai...
902288e4d85c2677a9051a2172e03128a6169ad7
train
Analysis.get_correlations
Takes a chain and returns the correlation between chain parameters. Parameters ---------- chain : int|str, optional The chain index or name. Defaults to first chain. parameters : list[str], optional The list of parameters to compute correlations. Defaults to all ...
chainconsumer/analysis.py
def get_correlations(self, chain=0, parameters=None): """ Takes a chain and returns the correlation between chain parameters. Parameters ---------- chain : int|str, optional The chain index or name. Defaults to first chain. parameters : list[str], optional ...
def get_correlations(self, chain=0, parameters=None): """ Takes a chain and returns the correlation between chain parameters. Parameters ---------- chain : int|str, optional The chain index or name. Defaults to first chain. parameters : list[str], optional ...
[ "Takes", "a", "chain", "and", "returns", "the", "correlation", "between", "chain", "parameters", "." ]
Samreay/ChainConsumer
python
https://github.com/Samreay/ChainConsumer/blob/902288e4d85c2677a9051a2172e03128a6169ad7/chainconsumer/analysis.py#L204-L226
[ "def", "get_correlations", "(", "self", ",", "chain", "=", "0", ",", "parameters", "=", "None", ")", ":", "parameters", ",", "cov", "=", "self", ".", "get_covariance", "(", "chain", "=", "chain", ",", "parameters", "=", "parameters", ")", "diag", "=", ...
902288e4d85c2677a9051a2172e03128a6169ad7
train
Analysis.get_covariance
Takes a chain and returns the covariance between chain parameters. Parameters ---------- chain : int|str, optional The chain index or name. Defaults to first chain. parameters : list[str], optional The list of parameters to compute correlations. Defaults to all p...
chainconsumer/analysis.py
def get_covariance(self, chain=0, parameters=None): """ Takes a chain and returns the covariance between chain parameters. Parameters ---------- chain : int|str, optional The chain index or name. Defaults to first chain. parameters : list[str], optional ...
def get_covariance(self, chain=0, parameters=None): """ Takes a chain and returns the covariance between chain parameters. Parameters ---------- chain : int|str, optional The chain index or name. Defaults to first chain. parameters : list[str], optional ...
[ "Takes", "a", "chain", "and", "returns", "the", "covariance", "between", "chain", "parameters", "." ]
Samreay/ChainConsumer
python
https://github.com/Samreay/ChainConsumer/blob/902288e4d85c2677a9051a2172e03128a6169ad7/chainconsumer/analysis.py#L228-L255
[ "def", "get_covariance", "(", "self", ",", "chain", "=", "0", ",", "parameters", "=", "None", ")", ":", "index", "=", "self", ".", "parent", ".", "_get_chain", "(", "chain", ")", "assert", "len", "(", "index", ")", "==", "1", ",", "\"Please specify onl...
902288e4d85c2677a9051a2172e03128a6169ad7
train
Analysis.get_correlation_table
Gets a LaTeX table of parameter correlations. Parameters ---------- chain : int|str, optional The chain index or name. Defaults to first chain. parameters : list[str], optional The list of parameters to compute correlations. Defaults to all parameters ...
chainconsumer/analysis.py
def get_correlation_table(self, chain=0, parameters=None, caption="Parameter Correlations", label="tab:parameter_correlations"): """ Gets a LaTeX table of parameter correlations. Parameters ---------- chain : int|str, optional The chain ...
def get_correlation_table(self, chain=0, parameters=None, caption="Parameter Correlations", label="tab:parameter_correlations"): """ Gets a LaTeX table of parameter correlations. Parameters ---------- chain : int|str, optional The chain ...
[ "Gets", "a", "LaTeX", "table", "of", "parameter", "correlations", "." ]
Samreay/ChainConsumer
python
https://github.com/Samreay/ChainConsumer/blob/902288e4d85c2677a9051a2172e03128a6169ad7/chainconsumer/analysis.py#L257-L280
[ "def", "get_correlation_table", "(", "self", ",", "chain", "=", "0", ",", "parameters", "=", "None", ",", "caption", "=", "\"Parameter Correlations\"", ",", "label", "=", "\"tab:parameter_correlations\"", ")", ":", "parameters", ",", "cor", "=", "self", ".", "...
902288e4d85c2677a9051a2172e03128a6169ad7
train
Analysis.get_covariance_table
Gets a LaTeX table of parameter covariance. Parameters ---------- chain : int|str, optional The chain index or name. Defaults to first chain. parameters : list[str], optional The list of parameters to compute correlations. Defaults to all parameters f...
chainconsumer/analysis.py
def get_covariance_table(self, chain=0, parameters=None, caption="Parameter Covariance", label="tab:parameter_covariance"): """ Gets a LaTeX table of parameter covariance. Parameters ---------- chain : int|str, optional The chain index o...
def get_covariance_table(self, chain=0, parameters=None, caption="Parameter Covariance", label="tab:parameter_covariance"): """ Gets a LaTeX table of parameter covariance. Parameters ---------- chain : int|str, optional The chain index o...
[ "Gets", "a", "LaTeX", "table", "of", "parameter", "covariance", "." ]
Samreay/ChainConsumer
python
https://github.com/Samreay/ChainConsumer/blob/902288e4d85c2677a9051a2172e03128a6169ad7/chainconsumer/analysis.py#L282-L305
[ "def", "get_covariance_table", "(", "self", ",", "chain", "=", "0", ",", "parameters", "=", "None", ",", "caption", "=", "\"Parameter Covariance\"", ",", "label", "=", "\"tab:parameter_covariance\"", ")", ":", "parameters", ",", "cov", "=", "self", ".", "get_c...
902288e4d85c2677a9051a2172e03128a6169ad7
train
Analysis.get_parameter_text
Generates LaTeX appropriate text from marginalised parameter bounds. Parameters ---------- lower : float The lower bound on the parameter maximum : float The value of the parameter with maximum probability upper : float The upper bound on the ...
chainconsumer/analysis.py
def get_parameter_text(self, lower, maximum, upper, wrap=False): """ Generates LaTeX appropriate text from marginalised parameter bounds. Parameters ---------- lower : float The lower bound on the parameter maximum : float The value of the parameter with ...
def get_parameter_text(self, lower, maximum, upper, wrap=False): """ Generates LaTeX appropriate text from marginalised parameter bounds. Parameters ---------- lower : float The lower bound on the parameter maximum : float The value of the parameter with ...
[ "Generates", "LaTeX", "appropriate", "text", "from", "marginalised", "parameter", "bounds", "." ]
Samreay/ChainConsumer
python
https://github.com/Samreay/ChainConsumer/blob/902288e4d85c2677a9051a2172e03128a6169ad7/chainconsumer/analysis.py#L355-L429
[ "def", "get_parameter_text", "(", "self", ",", "lower", ",", "maximum", ",", "upper", ",", "wrap", "=", "False", ")", ":", "if", "lower", "is", "None", "or", "upper", "is", "None", ":", "return", "\"\"", "upper_error", "=", "upper", "-", "maximum", "lo...
902288e4d85c2677a9051a2172e03128a6169ad7
train
ChainConsumer.add_chain
Add a chain to the consumer. Parameters ---------- chain : str|ndarray|dict The chain to load. Normally a ``numpy.ndarray``. If a string is found, it interprets the string as a filename and attempts to load it in. If a ``dict`` is passed in, it assumes the di...
chainconsumer/chainconsumer.py
def add_chain(self, chain, parameters=None, name=None, weights=None, posterior=None, walkers=None, grid=False, num_eff_data_points=None, num_free_params=None, color=None, linewidth=None, linestyle=None, kde=None, shade=None, shade_alpha=None, power=None, marker_style=None, marker_siz...
def add_chain(self, chain, parameters=None, name=None, weights=None, posterior=None, walkers=None, grid=False, num_eff_data_points=None, num_free_params=None, color=None, linewidth=None, linestyle=None, kde=None, shade=None, shade_alpha=None, power=None, marker_style=None, marker_siz...
[ "Add", "a", "chain", "to", "the", "consumer", "." ]
Samreay/ChainConsumer
python
https://github.com/Samreay/ChainConsumer/blob/902288e4d85c2677a9051a2172e03128a6169ad7/chainconsumer/chainconsumer.py#L49-L234
[ "def", "add_chain", "(", "self", ",", "chain", ",", "parameters", "=", "None", ",", "name", "=", "None", ",", "weights", "=", "None", ",", "posterior", "=", "None", ",", "walkers", "=", "None", ",", "grid", "=", "False", ",", "num_eff_data_points", "="...
902288e4d85c2677a9051a2172e03128a6169ad7
train
ChainConsumer.remove_chain
Removes a chain from ChainConsumer. Calling this will require any configurations set to be redone! Parameters ---------- chain : int|str, list[str|int] The chain(s) to remove. You can pass in either the chain index, or the chain name, to remove it. By default removes the...
chainconsumer/chainconsumer.py
def remove_chain(self, chain=-1): """ Removes a chain from ChainConsumer. Calling this will require any configurations set to be redone! Parameters ---------- chain : int|str, list[str|int] The chain(s) to remove. You can pass in either the chain index, or the chain ...
def remove_chain(self, chain=-1): """ Removes a chain from ChainConsumer. Calling this will require any configurations set to be redone! Parameters ---------- chain : int|str, list[str|int] The chain(s) to remove. You can pass in either the chain index, or the chain ...
[ "Removes", "a", "chain", "from", "ChainConsumer", ".", "Calling", "this", "will", "require", "any", "configurations", "set", "to", "be", "redone!" ]
Samreay/ChainConsumer
python
https://github.com/Samreay/ChainConsumer/blob/902288e4d85c2677a9051a2172e03128a6169ad7/chainconsumer/chainconsumer.py#L236-L266
[ "def", "remove_chain", "(", "self", ",", "chain", "=", "-", "1", ")", ":", "if", "isinstance", "(", "chain", ",", "str", ")", "or", "isinstance", "(", "chain", ",", "int", ")", ":", "chain", "=", "[", "chain", "]", "chain", "=", "sorted", "(", "[...
902288e4d85c2677a9051a2172e03128a6169ad7
train
ChainConsumer.configure
r""" Configure the general plotting parameters common across the bar and contour plots. If you do not call this explicitly, the :func:`plot` method will invoke this method automatically. Please ensure that you call this method *after* adding all the relevant data to the chain c...
chainconsumer/chainconsumer.py
def configure(self, statistics="max", max_ticks=5, plot_hists=True, flip=True, serif=True, sigma2d=False, sigmas=None, summary=None, bins=None, rainbow=None, colors=None, linestyles=None, linewidths=None, kde=False, smooth=None, cloud=None, shade=None, shade_alpha=N...
def configure(self, statistics="max", max_ticks=5, plot_hists=True, flip=True, serif=True, sigma2d=False, sigmas=None, summary=None, bins=None, rainbow=None, colors=None, linestyles=None, linewidths=None, kde=False, smooth=None, cloud=None, shade=None, shade_alpha=N...
[ "r", "Configure", "the", "general", "plotting", "parameters", "common", "across", "the", "bar", "and", "contour", "plots", "." ]
Samreay/ChainConsumer
python
https://github.com/Samreay/ChainConsumer/blob/902288e4d85c2677a9051a2172e03128a6169ad7/chainconsumer/chainconsumer.py#L268-L750
[ "def", "configure", "(", "self", ",", "statistics", "=", "\"max\"", ",", "max_ticks", "=", "5", ",", "plot_hists", "=", "True", ",", "flip", "=", "True", ",", "serif", "=", "True", ",", "sigma2d", "=", "False", ",", "sigmas", "=", "None", ",", "summa...
902288e4d85c2677a9051a2172e03128a6169ad7
train
ChainConsumer.configure_truth
Configure the arguments passed to the ``axvline`` and ``axhline`` methods when plotting truth values. If you do not call this explicitly, the :func:`plot` method will invoke this method automatically. Recommended to set the parameters ``linestyle``, ``color`` and/or ``alpha`` i...
chainconsumer/chainconsumer.py
def configure_truth(self, **kwargs): # pragma: no cover """ Configure the arguments passed to the ``axvline`` and ``axhline`` methods when plotting truth values. If you do not call this explicitly, the :func:`plot` method will invoke this method automatically. Recommended to s...
def configure_truth(self, **kwargs): # pragma: no cover """ Configure the arguments passed to the ``axvline`` and ``axhline`` methods when plotting truth values. If you do not call this explicitly, the :func:`plot` method will invoke this method automatically. Recommended to s...
[ "Configure", "the", "arguments", "passed", "to", "the", "axvline", "and", "axhline", "methods", "when", "plotting", "truth", "values", "." ]
Samreay/ChainConsumer
python
https://github.com/Samreay/ChainConsumer/blob/902288e4d85c2677a9051a2172e03128a6169ad7/chainconsumer/chainconsumer.py#L752-L781
[ "def", "configure_truth", "(", "self", ",", "*", "*", "kwargs", ")", ":", "# pragma: no cover", "if", "kwargs", ".", "get", "(", "\"ls\"", ")", "is", "None", "and", "kwargs", ".", "get", "(", "\"linestyle\"", ")", "is", "None", ":", "kwargs", "[", "\"l...
902288e4d85c2677a9051a2172e03128a6169ad7
train
ChainConsumer.divide_chain
Returns a ChainConsumer instance containing all the walks of a given chain as individual chains themselves. This method might be useful if, for example, your chain was made using MCMC with 4 walkers. To check the sampling of all 4 walkers agree, you could call this to get a ChainConsume...
chainconsumer/chainconsumer.py
def divide_chain(self, chain=0): """ Returns a ChainConsumer instance containing all the walks of a given chain as individual chains themselves. This method might be useful if, for example, your chain was made using MCMC with 4 walkers. To check the sampling of all 4 walkers agr...
def divide_chain(self, chain=0): """ Returns a ChainConsumer instance containing all the walks of a given chain as individual chains themselves. This method might be useful if, for example, your chain was made using MCMC with 4 walkers. To check the sampling of all 4 walkers agr...
[ "Returns", "a", "ChainConsumer", "instance", "containing", "all", "the", "walks", "of", "a", "given", "chain", "as", "individual", "chains", "themselves", "." ]
Samreay/ChainConsumer
python
https://github.com/Samreay/ChainConsumer/blob/902288e4d85c2677a9051a2172e03128a6169ad7/chainconsumer/chainconsumer.py#L783-L816
[ "def", "divide_chain", "(", "self", ",", "chain", "=", "0", ")", ":", "indexes", "=", "self", ".", "_get_chain", "(", "chain", ")", "con", "=", "ChainConsumer", "(", ")", "for", "index", "in", "indexes", ":", "chain", "=", "self", ".", "chains", "[",...
902288e4d85c2677a9051a2172e03128a6169ad7
train
threshold
Calculate motif score threshold for a given FPR.
gimmemotifs/commands/threshold.py
def threshold(args): """Calculate motif score threshold for a given FPR.""" if args.fpr < 0 or args.fpr > 1: print("Please specify a FPR between 0 and 1") sys.exit(1) motifs = read_motifs(args.pwmfile) s = Scanner() s.set_motifs(args.pwmfile) s.set_threshold(args.fpr, filen...
def threshold(args): """Calculate motif score threshold for a given FPR.""" if args.fpr < 0 or args.fpr > 1: print("Please specify a FPR between 0 and 1") sys.exit(1) motifs = read_motifs(args.pwmfile) s = Scanner() s.set_motifs(args.pwmfile) s.set_threshold(args.fpr, filen...
[ "Calculate", "motif", "score", "threshold", "for", "a", "given", "FPR", "." ]
vanheeringen-lab/gimmemotifs
python
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/commands/threshold.py#L13-L34
[ "def", "threshold", "(", "args", ")", ":", "if", "args", ".", "fpr", "<", "0", "or", "args", ".", "fpr", ">", "1", ":", "print", "(", "\"Please specify a FPR between 0 and 1\"", ")", "sys", ".", "exit", "(", "1", ")", "motifs", "=", "read_motifs", "(",...
1dc0572179e5d0c8f96958060133c1f8d92c6675
train
values_to_labels
Convert two arrays of values to an array of labels and an array of scores. Parameters ---------- fg_vals : array_like The list of values for the positive set. bg_vals : array_like The list of values for the negative set. Returns ------- y_true : array Labels. y...
gimmemotifs/rocmetrics.py
def values_to_labels(fg_vals, bg_vals): """ Convert two arrays of values to an array of labels and an array of scores. Parameters ---------- fg_vals : array_like The list of values for the positive set. bg_vals : array_like The list of values for the negative set. Returns ...
def values_to_labels(fg_vals, bg_vals): """ Convert two arrays of values to an array of labels and an array of scores. Parameters ---------- fg_vals : array_like The list of values for the positive set. bg_vals : array_like The list of values for the negative set. Returns ...
[ "Convert", "two", "arrays", "of", "values", "to", "an", "array", "of", "labels", "and", "an", "array", "of", "scores", "." ]
vanheeringen-lab/gimmemotifs
python
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/rocmetrics.py#L42-L64
[ "def", "values_to_labels", "(", "fg_vals", ",", "bg_vals", ")", ":", "y_true", "=", "np", ".", "hstack", "(", "(", "np", ".", "ones", "(", "len", "(", "fg_vals", ")", ")", ",", "np", ".", "zeros", "(", "len", "(", "bg_vals", ")", ")", ")", ")", ...
1dc0572179e5d0c8f96958060133c1f8d92c6675
train
recall_at_fdr
Computes the recall at a specific FDR (default 10%). Parameters ---------- fg_vals : array_like The list of values for the positive set. bg_vals : array_like The list of values for the negative set. fdr : float, optional The FDR (between 0.0 and 1.0). Returns ...
gimmemotifs/rocmetrics.py
def recall_at_fdr(fg_vals, bg_vals, fdr_cutoff=0.1): """ Computes the recall at a specific FDR (default 10%). Parameters ---------- fg_vals : array_like The list of values for the positive set. bg_vals : array_like The list of values for the negative set. fdr : float, ...
def recall_at_fdr(fg_vals, bg_vals, fdr_cutoff=0.1): """ Computes the recall at a specific FDR (default 10%). Parameters ---------- fg_vals : array_like The list of values for the positive set. bg_vals : array_like The list of values for the negative set. fdr : float, ...
[ "Computes", "the", "recall", "at", "a", "specific", "FDR", "(", "default", "10%", ")", "." ]
vanheeringen-lab/gimmemotifs
python
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/rocmetrics.py#L67-L95
[ "def", "recall_at_fdr", "(", "fg_vals", ",", "bg_vals", ",", "fdr_cutoff", "=", "0.1", ")", ":", "if", "len", "(", "fg_vals", ")", "==", "0", ":", "return", "0.0", "y_true", ",", "y_score", "=", "values_to_labels", "(", "fg_vals", ",", "bg_vals", ")", ...
1dc0572179e5d0c8f96958060133c1f8d92c6675
train
matches_at_fpr
Computes the hypergeometric p-value at a specific FPR (default 1%). Parameters ---------- fg_vals : array_like The list of values for the positive set. bg_vals : array_like The list of values for the negative set. fpr : float, optional The FPR (between 0.0 and 1.0). ...
gimmemotifs/rocmetrics.py
def matches_at_fpr(fg_vals, bg_vals, fpr=0.01): """ Computes the hypergeometric p-value at a specific FPR (default 1%). Parameters ---------- fg_vals : array_like The list of values for the positive set. bg_vals : array_like The list of values for the negative set. fpr...
def matches_at_fpr(fg_vals, bg_vals, fpr=0.01): """ Computes the hypergeometric p-value at a specific FPR (default 1%). Parameters ---------- fg_vals : array_like The list of values for the positive set. bg_vals : array_like The list of values for the negative set. fpr...
[ "Computes", "the", "hypergeometric", "p", "-", "value", "at", "a", "specific", "FPR", "(", "default", "1%", ")", "." ]
vanheeringen-lab/gimmemotifs
python
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/rocmetrics.py#L98-L121
[ "def", "matches_at_fpr", "(", "fg_vals", ",", "bg_vals", ",", "fpr", "=", "0.01", ")", ":", "fg_vals", "=", "np", ".", "array", "(", "fg_vals", ")", "s", "=", "scoreatpercentile", "(", "bg_vals", ",", "100", "-", "fpr", "*", "100", ")", "return", "["...
1dc0572179e5d0c8f96958060133c1f8d92c6675
train
phyper_at_fpr
Computes the hypergeometric p-value at a specific FPR (default 1%). Parameters ---------- fg_vals : array_like The list of values for the positive set. bg_vals : array_like The list of values for the negative set. fpr : float, optional The FPR (between 0.0 and 1.0). ...
gimmemotifs/rocmetrics.py
def phyper_at_fpr(fg_vals, bg_vals, fpr=0.01): """ Computes the hypergeometric p-value at a specific FPR (default 1%). Parameters ---------- fg_vals : array_like The list of values for the positive set. bg_vals : array_like The list of values for the negative set. fpr ...
def phyper_at_fpr(fg_vals, bg_vals, fpr=0.01): """ Computes the hypergeometric p-value at a specific FPR (default 1%). Parameters ---------- fg_vals : array_like The list of values for the positive set. bg_vals : array_like The list of values for the negative set. fpr ...
[ "Computes", "the", "hypergeometric", "p", "-", "value", "at", "a", "specific", "FPR", "(", "default", "1%", ")", "." ]
vanheeringen-lab/gimmemotifs
python
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/rocmetrics.py#L124-L152
[ "def", "phyper_at_fpr", "(", "fg_vals", ",", "bg_vals", ",", "fpr", "=", "0.01", ")", ":", "fg_vals", "=", "np", ".", "array", "(", "fg_vals", ")", "s", "=", "scoreatpercentile", "(", "bg_vals", ",", "100", "-", "fpr", "*", "100", ")", "table", "=", ...
1dc0572179e5d0c8f96958060133c1f8d92c6675
train
fraction_fpr
Computes the fraction positives at a specific FPR (default 1%). Parameters ---------- fg_vals : array_like The list of values for the positive set. bg_vals : array_like The list of values for the negative set. fpr : float, optional The FPR (between 0.0 and 1.0). ...
gimmemotifs/rocmetrics.py
def fraction_fpr(fg_vals, bg_vals, fpr=0.01): """ Computes the fraction positives at a specific FPR (default 1%). Parameters ---------- fg_vals : array_like The list of values for the positive set. bg_vals : array_like The list of values for the negative set. fpr : flo...
def fraction_fpr(fg_vals, bg_vals, fpr=0.01): """ Computes the fraction positives at a specific FPR (default 1%). Parameters ---------- fg_vals : array_like The list of values for the positive set. bg_vals : array_like The list of values for the negative set. fpr : flo...
[ "Computes", "the", "fraction", "positives", "at", "a", "specific", "FPR", "(", "default", "1%", ")", "." ]
vanheeringen-lab/gimmemotifs
python
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/rocmetrics.py#L155-L177
[ "def", "fraction_fpr", "(", "fg_vals", ",", "bg_vals", ",", "fpr", "=", "0.01", ")", ":", "fg_vals", "=", "np", ".", "array", "(", "fg_vals", ")", "s", "=", "scoreatpercentile", "(", "bg_vals", ",", "100", "-", "100", "*", "fpr", ")", "return", "len"...
1dc0572179e5d0c8f96958060133c1f8d92c6675
train
score_at_fpr
Returns the motif score at a specific FPR (default 1%). Parameters ---------- fg_vals : array_like The list of values for the positive set. bg_vals : array_like The list of values for the negative set. fpr : float, optional The FPR (between 0.0 and 1.0). Retur...
gimmemotifs/rocmetrics.py
def score_at_fpr(fg_vals, bg_vals, fpr=0.01): """ Returns the motif score at a specific FPR (default 1%). Parameters ---------- fg_vals : array_like The list of values for the positive set. bg_vals : array_like The list of values for the negative set. fpr : float, opti...
def score_at_fpr(fg_vals, bg_vals, fpr=0.01): """ Returns the motif score at a specific FPR (default 1%). Parameters ---------- fg_vals : array_like The list of values for the positive set. bg_vals : array_like The list of values for the negative set. fpr : float, opti...
[ "Returns", "the", "motif", "score", "at", "a", "specific", "FPR", "(", "default", "1%", ")", "." ]
vanheeringen-lab/gimmemotifs
python
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/rocmetrics.py#L180-L201
[ "def", "score_at_fpr", "(", "fg_vals", ",", "bg_vals", ",", "fpr", "=", "0.01", ")", ":", "bg_vals", "=", "np", ".", "array", "(", "bg_vals", ")", "return", "scoreatpercentile", "(", "bg_vals", ",", "100", "-", "100", "*", "fpr", ")" ]
1dc0572179e5d0c8f96958060133c1f8d92c6675
train
enr_at_fpr
Computes the enrichment at a specific FPR (default 1%). Parameters ---------- fg_vals : array_like The list of values for the positive set. bg_vals : array_like The list of values for the negative set. fpr : float, optional The FPR (between 0.0 and 1.0). Retur...
gimmemotifs/rocmetrics.py
def enr_at_fpr(fg_vals, bg_vals, fpr=0.01): """ Computes the enrichment at a specific FPR (default 1%). Parameters ---------- fg_vals : array_like The list of values for the positive set. bg_vals : array_like The list of values for the negative set. fpr : float, option...
def enr_at_fpr(fg_vals, bg_vals, fpr=0.01): """ Computes the enrichment at a specific FPR (default 1%). Parameters ---------- fg_vals : array_like The list of values for the positive set. bg_vals : array_like The list of values for the negative set. fpr : float, option...
[ "Computes", "the", "enrichment", "at", "a", "specific", "FPR", "(", "default", "1%", ")", "." ]
vanheeringen-lab/gimmemotifs
python
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/rocmetrics.py#L204-L230
[ "def", "enr_at_fpr", "(", "fg_vals", ",", "bg_vals", ",", "fpr", "=", "0.01", ")", ":", "pos", "=", "np", ".", "array", "(", "fg_vals", ")", "neg", "=", "np", ".", "array", "(", "bg_vals", ")", "s", "=", "scoreatpercentile", "(", "neg", ",", "100",...
1dc0572179e5d0c8f96958060133c1f8d92c6675
train
max_enrichment
Computes the maximum enrichment. Parameters ---------- fg_vals : array_like The list of values for the positive set. bg_vals : array_like The list of values for the negative set. minbg : int, optional Minimum number of matches in background. The default is 2. ...
gimmemotifs/rocmetrics.py
def max_enrichment(fg_vals, bg_vals, minbg=2): """ Computes the maximum enrichment. Parameters ---------- fg_vals : array_like The list of values for the positive set. bg_vals : array_like The list of values for the negative set. minbg : int, optional Minimum n...
def max_enrichment(fg_vals, bg_vals, minbg=2): """ Computes the maximum enrichment. Parameters ---------- fg_vals : array_like The list of values for the positive set. bg_vals : array_like The list of values for the negative set. minbg : int, optional Minimum n...
[ "Computes", "the", "maximum", "enrichment", "." ]
vanheeringen-lab/gimmemotifs
python
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/rocmetrics.py#L233-L268
[ "def", "max_enrichment", "(", "fg_vals", ",", "bg_vals", ",", "minbg", "=", "2", ")", ":", "scores", "=", "np", ".", "hstack", "(", "(", "fg_vals", ",", "bg_vals", ")", ")", "idx", "=", "np", ".", "argsort", "(", "scores", ")", "x", "=", "np", "....
1dc0572179e5d0c8f96958060133c1f8d92c6675
train
mncp
Computes the Mean Normalized Conditional Probability (MNCP). MNCP is described in Clarke & Granek, Bioinformatics, 2003. Parameters ---------- fg_vals : array_like The list of values for the positive set. bg_vals : array_like The list of values for the negative set. Retur...
gimmemotifs/rocmetrics.py
def mncp(fg_vals, bg_vals): """ Computes the Mean Normalized Conditional Probability (MNCP). MNCP is described in Clarke & Granek, Bioinformatics, 2003. Parameters ---------- fg_vals : array_like The list of values for the positive set. bg_vals : array_like The list of val...
def mncp(fg_vals, bg_vals): """ Computes the Mean Normalized Conditional Probability (MNCP). MNCP is described in Clarke & Granek, Bioinformatics, 2003. Parameters ---------- fg_vals : array_like The list of values for the positive set. bg_vals : array_like The list of val...
[ "Computes", "the", "Mean", "Normalized", "Conditional", "Probability", "(", "MNCP", ")", "." ]
vanheeringen-lab/gimmemotifs
python
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/rocmetrics.py#L271-L307
[ "def", "mncp", "(", "fg_vals", ",", "bg_vals", ")", ":", "fg_len", "=", "len", "(", "fg_vals", ")", "total_len", "=", "len", "(", "fg_vals", ")", "+", "len", "(", "bg_vals", ")", "if", "not", "isinstance", "(", "fg_vals", ",", "np", ".", "ndarray", ...
1dc0572179e5d0c8f96958060133c1f8d92c6675
train
pr_auc
Computes the Precision-Recall Area Under Curve (PR AUC) Parameters ---------- fg_vals : array_like list of values for positive set bg_vals : array_like list of values for negative set Returns ------- score : float PR AUC score
gimmemotifs/rocmetrics.py
def pr_auc(fg_vals, bg_vals): """ Computes the Precision-Recall Area Under Curve (PR AUC) Parameters ---------- fg_vals : array_like list of values for positive set bg_vals : array_like list of values for negative set Returns ------- score : float PR AU...
def pr_auc(fg_vals, bg_vals): """ Computes the Precision-Recall Area Under Curve (PR AUC) Parameters ---------- fg_vals : array_like list of values for positive set bg_vals : array_like list of values for negative set Returns ------- score : float PR AU...
[ "Computes", "the", "Precision", "-", "Recall", "Area", "Under", "Curve", "(", "PR", "AUC", ")" ]
vanheeringen-lab/gimmemotifs
python
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/rocmetrics.py#L310-L330
[ "def", "pr_auc", "(", "fg_vals", ",", "bg_vals", ")", ":", "# Create y_labels", "y_true", ",", "y_score", "=", "values_to_labels", "(", "fg_vals", ",", "bg_vals", ")", "return", "average_precision_score", "(", "y_true", ",", "y_score", ")" ]
1dc0572179e5d0c8f96958060133c1f8d92c6675
train
roc_auc
Computes the ROC Area Under Curve (ROC AUC) Parameters ---------- fg_vals : array_like list of values for positive set bg_vals : array_like list of values for negative set Returns ------- score : float ROC AUC score
gimmemotifs/rocmetrics.py
def roc_auc(fg_vals, bg_vals): """ Computes the ROC Area Under Curve (ROC AUC) Parameters ---------- fg_vals : array_like list of values for positive set bg_vals : array_like list of values for negative set Returns ------- score : float ROC AUC score ...
def roc_auc(fg_vals, bg_vals): """ Computes the ROC Area Under Curve (ROC AUC) Parameters ---------- fg_vals : array_like list of values for positive set bg_vals : array_like list of values for negative set Returns ------- score : float ROC AUC score ...
[ "Computes", "the", "ROC", "Area", "Under", "Curve", "(", "ROC", "AUC", ")" ]
vanheeringen-lab/gimmemotifs
python
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/rocmetrics.py#L333-L353
[ "def", "roc_auc", "(", "fg_vals", ",", "bg_vals", ")", ":", "# Create y_labels", "y_true", ",", "y_score", "=", "values_to_labels", "(", "fg_vals", ",", "bg_vals", ")", "return", "roc_auc_score", "(", "y_true", ",", "y_score", ")" ]
1dc0572179e5d0c8f96958060133c1f8d92c6675
train
roc_auc_xlim
Computes the ROC Area Under Curve until a certain FPR value. Parameters ---------- fg_vals : array_like list of values for positive set bg_vals : array_like list of values for negative set xlim : float, optional FPR value Returns ------- score : float ...
gimmemotifs/rocmetrics.py
def roc_auc_xlim(x_bla, y_bla, xlim=0.1): """ Computes the ROC Area Under Curve until a certain FPR value. Parameters ---------- fg_vals : array_like list of values for positive set bg_vals : array_like list of values for negative set xlim : float, optional FPR val...
def roc_auc_xlim(x_bla, y_bla, xlim=0.1): """ Computes the ROC Area Under Curve until a certain FPR value. Parameters ---------- fg_vals : array_like list of values for positive set bg_vals : array_like list of values for negative set xlim : float, optional FPR val...
[ "Computes", "the", "ROC", "Area", "Under", "Curve", "until", "a", "certain", "FPR", "value", "." ]
vanheeringen-lab/gimmemotifs
python
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/rocmetrics.py#L357-L444
[ "def", "roc_auc_xlim", "(", "x_bla", ",", "y_bla", ",", "xlim", "=", "0.1", ")", ":", "x", "=", "x_bla", "[", ":", "]", "y", "=", "y_bla", "[", ":", "]", "x", ".", "sort", "(", ")", "y", ".", "sort", "(", ")", "u", "=", "{", "}", "for", "...
1dc0572179e5d0c8f96958060133c1f8d92c6675
train
roc_values
Return fpr (x) and tpr (y) of the ROC curve. Parameters ---------- fg_vals : array_like The list of values for the positive set. bg_vals : array_like The list of values for the negative set. Returns ------- fpr : array False positive rate. tpr : array T...
gimmemotifs/rocmetrics.py
def roc_values(fg_vals, bg_vals): """ Return fpr (x) and tpr (y) of the ROC curve. Parameters ---------- fg_vals : array_like The list of values for the positive set. bg_vals : array_like The list of values for the negative set. Returns ------- fpr : array ...
def roc_values(fg_vals, bg_vals): """ Return fpr (x) and tpr (y) of the ROC curve. Parameters ---------- fg_vals : array_like The list of values for the positive set. bg_vals : array_like The list of values for the negative set. Returns ------- fpr : array ...
[ "Return", "fpr", "(", "x", ")", "and", "tpr", "(", "y", ")", "of", "the", "ROC", "curve", "." ]
vanheeringen-lab/gimmemotifs
python
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/rocmetrics.py#L447-L473
[ "def", "roc_values", "(", "fg_vals", ",", "bg_vals", ")", ":", "if", "len", "(", "fg_vals", ")", "==", "0", ":", "return", "0", "y_true", ",", "y_score", "=", "values_to_labels", "(", "fg_vals", ",", "bg_vals", ")", "fpr", ",", "tpr", ",", "_thresholds...
1dc0572179e5d0c8f96958060133c1f8d92c6675
train
max_fmeasure
Computes the maximum F-measure. Parameters ---------- fg_vals : array_like The list of values for the positive set. bg_vals : array_like The list of values for the negative set. Returns ------- f : float Maximum f-measure.
gimmemotifs/rocmetrics.py
def max_fmeasure(fg_vals, bg_vals): """ Computes the maximum F-measure. Parameters ---------- fg_vals : array_like The list of values for the positive set. bg_vals : array_like The list of values for the negative set. Returns ------- f : float Maximum f...
def max_fmeasure(fg_vals, bg_vals): """ Computes the maximum F-measure. Parameters ---------- fg_vals : array_like The list of values for the positive set. bg_vals : array_like The list of values for the negative set. Returns ------- f : float Maximum f...
[ "Computes", "the", "maximum", "F", "-", "measure", "." ]
vanheeringen-lab/gimmemotifs
python
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/rocmetrics.py#L476-L506
[ "def", "max_fmeasure", "(", "fg_vals", ",", "bg_vals", ")", ":", "x", ",", "y", "=", "roc_values", "(", "fg_vals", ",", "bg_vals", ")", "x", ",", "y", "=", "x", "[", "1", ":", "]", ",", "y", "[", "1", ":", "]", "# don't include origin", "p", "=",...
1dc0572179e5d0c8f96958060133c1f8d92c6675
train
ks_pvalue
Computes the Kolmogorov-Smirnov p-value of position distribution. Parameters ---------- fg_pos : array_like The list of values for the positive set. bg_pos : array_like, optional The list of values for the negative set. Returns ------- p : float KS p-value.
gimmemotifs/rocmetrics.py
def ks_pvalue(fg_pos, bg_pos=None): """ Computes the Kolmogorov-Smirnov p-value of position distribution. Parameters ---------- fg_pos : array_like The list of values for the positive set. bg_pos : array_like, optional The list of values for the negative set. Returns ...
def ks_pvalue(fg_pos, bg_pos=None): """ Computes the Kolmogorov-Smirnov p-value of position distribution. Parameters ---------- fg_pos : array_like The list of values for the positive set. bg_pos : array_like, optional The list of values for the negative set. Returns ...
[ "Computes", "the", "Kolmogorov", "-", "Smirnov", "p", "-", "value", "of", "position", "distribution", "." ]
vanheeringen-lab/gimmemotifs
python
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/rocmetrics.py#L509-L530
[ "def", "ks_pvalue", "(", "fg_pos", ",", "bg_pos", "=", "None", ")", ":", "if", "len", "(", "fg_pos", ")", "==", "0", ":", "return", "1.0", "a", "=", "np", ".", "array", "(", "fg_pos", ",", "dtype", "=", "\"float\"", ")", "/", "max", "(", "fg_pos"...
1dc0572179e5d0c8f96958060133c1f8d92c6675
train
ks_significance
Computes the -log10 of Kolmogorov-Smirnov p-value of position distribution. Parameters ---------- fg_pos : array_like The list of values for the positive set. bg_pos : array_like, optional The list of values for the negative set. Returns ------- p : float -log1...
gimmemotifs/rocmetrics.py
def ks_significance(fg_pos, bg_pos=None): """ Computes the -log10 of Kolmogorov-Smirnov p-value of position distribution. Parameters ---------- fg_pos : array_like The list of values for the positive set. bg_pos : array_like, optional The list of values for the negative set. ...
def ks_significance(fg_pos, bg_pos=None): """ Computes the -log10 of Kolmogorov-Smirnov p-value of position distribution. Parameters ---------- fg_pos : array_like The list of values for the positive set. bg_pos : array_like, optional The list of values for the negative set. ...
[ "Computes", "the", "-", "log10", "of", "Kolmogorov", "-", "Smirnov", "p", "-", "value", "of", "position", "distribution", "." ]
vanheeringen-lab/gimmemotifs
python
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/rocmetrics.py#L533-L554
[ "def", "ks_significance", "(", "fg_pos", ",", "bg_pos", "=", "None", ")", ":", "p", "=", "ks_pvalue", "(", "fg_pos", ",", "max", "(", "fg_pos", ")", ")", "if", "p", ">", "0", ":", "return", "-", "np", ".", "log10", "(", "p", ")", "else", ":", "...
1dc0572179e5d0c8f96958060133c1f8d92c6675
train
setup_data
Load and shape data for training with Keras + Pescador. Returns ------- input_shape : tuple, len=3 Shape of each sample; adapts to channel configuration of Keras. X_train, y_train : np.ndarrays Images and labels for training. X_test, y_test : np.ndarrays Images and labels ...
examples/frameworks/keras_example.py
def setup_data(): """Load and shape data for training with Keras + Pescador. Returns ------- input_shape : tuple, len=3 Shape of each sample; adapts to channel configuration of Keras. X_train, y_train : np.ndarrays Images and labels for training. X_test, y_test : np.ndarrays ...
def setup_data(): """Load and shape data for training with Keras + Pescador. Returns ------- input_shape : tuple, len=3 Shape of each sample; adapts to channel configuration of Keras. X_train, y_train : np.ndarrays Images and labels for training. X_test, y_test : np.ndarrays ...
[ "Load", "and", "shape", "data", "for", "training", "with", "Keras", "+", "Pescador", "." ]
pescadores/pescador
python
https://github.com/pescadores/pescador/blob/786e2b5f882d13ea563769fbc7ad0a0a10c3553d/examples/frameworks/keras_example.py#L41-L79
[ "def", "setup_data", "(", ")", ":", "# The data, shuffled and split between train and test sets", "(", "x_train", ",", "y_train", ")", ",", "(", "x_test", ",", "y_test", ")", "=", "mnist", ".", "load_data", "(", ")", "if", "K", ".", "image_data_format", "(", "...
786e2b5f882d13ea563769fbc7ad0a0a10c3553d
train
build_model
Create a compiled Keras model. Parameters ---------- input_shape : tuple, len=3 Shape of each image sample. Returns ------- model : keras.Model Constructed model.
examples/frameworks/keras_example.py
def build_model(input_shape): """Create a compiled Keras model. Parameters ---------- input_shape : tuple, len=3 Shape of each image sample. Returns ------- model : keras.Model Constructed model. """ model = Sequential() model.add(Conv2D(32, kernel_size=(3, 3),...
def build_model(input_shape): """Create a compiled Keras model. Parameters ---------- input_shape : tuple, len=3 Shape of each image sample. Returns ------- model : keras.Model Constructed model. """ model = Sequential() model.add(Conv2D(32, kernel_size=(3, 3),...
[ "Create", "a", "compiled", "Keras", "model", "." ]
pescadores/pescador
python
https://github.com/pescadores/pescador/blob/786e2b5f882d13ea563769fbc7ad0a0a10c3553d/examples/frameworks/keras_example.py#L86-L117
[ "def", "build_model", "(", "input_shape", ")", ":", "model", "=", "Sequential", "(", ")", "model", ".", "add", "(", "Conv2D", "(", "32", ",", "kernel_size", "=", "(", "3", ",", "3", ")", ",", "activation", "=", "'relu'", ",", "input_shape", "=", "inp...
786e2b5f882d13ea563769fbc7ad0a0a10c3553d
train
sampler
A basic generator for sampling data. Parameters ---------- X : np.ndarray, len=n_samples, ndim=4 Image data. y : np.ndarray, len=n_samples, ndim=2 One-hot encoded class vectors. Yields ------ data : dict Single image sample, like {X: np.ndarray, y: np.ndarray}
examples/frameworks/keras_example.py
def sampler(X, y): '''A basic generator for sampling data. Parameters ---------- X : np.ndarray, len=n_samples, ndim=4 Image data. y : np.ndarray, len=n_samples, ndim=2 One-hot encoded class vectors. Yields ------ data : dict Single image sample, like {X: np.nd...
def sampler(X, y): '''A basic generator for sampling data. Parameters ---------- X : np.ndarray, len=n_samples, ndim=4 Image data. y : np.ndarray, len=n_samples, ndim=2 One-hot encoded class vectors. Yields ------ data : dict Single image sample, like {X: np.nd...
[ "A", "basic", "generator", "for", "sampling", "data", "." ]
pescadores/pescador
python
https://github.com/pescadores/pescador/blob/786e2b5f882d13ea563769fbc7ad0a0a10c3553d/examples/frameworks/keras_example.py#L124-L148
[ "def", "sampler", "(", "X", ",", "y", ")", ":", "X", "=", "np", ".", "atleast_2d", "(", "X", ")", "# y's are binary vectors, and should be of shape (10,) after this.", "y", "=", "np", ".", "atleast_1d", "(", "y", ")", "n", "=", "X", ".", "shape", "[", "0...
786e2b5f882d13ea563769fbc7ad0a0a10c3553d
train
additive_noise
Add noise to a data stream. Parameters ---------- stream : iterable A stream that yields data objects. key : string, default='X' Name of the field to add noise. scale : float, default=0.1 Scale factor for gaussian noise. Yields ------ data : dict Updat...
examples/frameworks/keras_example.py
def additive_noise(stream, key='X', scale=1e-1): '''Add noise to a data stream. Parameters ---------- stream : iterable A stream that yields data objects. key : string, default='X' Name of the field to add noise. scale : float, default=0.1 Scale factor for gaussian noi...
def additive_noise(stream, key='X', scale=1e-1): '''Add noise to a data stream. Parameters ---------- stream : iterable A stream that yields data objects. key : string, default='X' Name of the field to add noise. scale : float, default=0.1 Scale factor for gaussian noi...
[ "Add", "noise", "to", "a", "data", "stream", "." ]
pescadores/pescador
python
https://github.com/pescadores/pescador/blob/786e2b5f882d13ea563769fbc7ad0a0a10c3553d/examples/frameworks/keras_example.py#L155-L178
[ "def", "additive_noise", "(", "stream", ",", "key", "=", "'X'", ",", "scale", "=", "1e-1", ")", ":", "for", "data", "in", "stream", ":", "noise_shape", "=", "data", "[", "key", "]", ".", "shape", "noise", "=", "scale", "*", "np", ".", "random", "."...
786e2b5f882d13ea563769fbc7ad0a0a10c3553d
train
parse_denovo_params
Return default GimmeMotifs parameters. Defaults will be replaced with parameters defined in user_params. Parameters ---------- user_params : dict, optional User-defined parameters. Returns ------- params : dict
gimmemotifs/config.py
def parse_denovo_params(user_params=None): """Return default GimmeMotifs parameters. Defaults will be replaced with parameters defined in user_params. Parameters ---------- user_params : dict, optional User-defined parameters. Returns ------- params : dict """ config ...
def parse_denovo_params(user_params=None): """Return default GimmeMotifs parameters. Defaults will be replaced with parameters defined in user_params. Parameters ---------- user_params : dict, optional User-defined parameters. Returns ------- params : dict """ config ...
[ "Return", "default", "GimmeMotifs", "parameters", "." ]
vanheeringen-lab/gimmemotifs
python
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/config.py#L248-L296
[ "def", "parse_denovo_params", "(", "user_params", "=", "None", ")", ":", "config", "=", "MotifConfig", "(", ")", "if", "user_params", "is", "None", ":", "user_params", "=", "{", "}", "params", "=", "config", ".", "get_default_params", "(", ")", "params", "...
1dc0572179e5d0c8f96958060133c1f8d92c6675
train
rankagg_R
Return aggregated ranks as implemented in the RobustRankAgg R package. This function is now deprecated. References: Kolde et al., 2012, DOI: 10.1093/bioinformatics/btr709 Stuart et al., 2003, DOI: 10.1126/science.1087447 Parameters ---------- df : pandas.DataFrame DataFr...
gimmemotifs/rank.py
def rankagg_R(df, method="stuart"): """Return aggregated ranks as implemented in the RobustRankAgg R package. This function is now deprecated. References: Kolde et al., 2012, DOI: 10.1093/bioinformatics/btr709 Stuart et al., 2003, DOI: 10.1126/science.1087447 Parameters --------...
def rankagg_R(df, method="stuart"): """Return aggregated ranks as implemented in the RobustRankAgg R package. This function is now deprecated. References: Kolde et al., 2012, DOI: 10.1093/bioinformatics/btr709 Stuart et al., 2003, DOI: 10.1126/science.1087447 Parameters --------...
[ "Return", "aggregated", "ranks", "as", "implemented", "in", "the", "RobustRankAgg", "R", "package", "." ]
vanheeringen-lab/gimmemotifs
python
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/rank.py#L15-L53
[ "def", "rankagg_R", "(", "df", ",", "method", "=", "\"stuart\"", ")", ":", "tmpdf", "=", "NamedTemporaryFile", "(", ")", "tmpscript", "=", "NamedTemporaryFile", "(", "mode", "=", "\"w\"", ")", "tmpranks", "=", "NamedTemporaryFile", "(", ")", "df", ".", "to...
1dc0572179e5d0c8f96958060133c1f8d92c6675
train
rankagg
Return aggregated ranks. Implementation is ported from the RobustRankAggreg R package References: Kolde et al., 2012, DOI: 10.1093/bioinformatics/btr709 Stuart et al., 2003, DOI: 10.1126/science.1087447 Parameters ---------- df : pandas.DataFrame DataFrame with value...
gimmemotifs/rank.py
def rankagg(df, method="stuart"): """Return aggregated ranks. Implementation is ported from the RobustRankAggreg R package References: Kolde et al., 2012, DOI: 10.1093/bioinformatics/btr709 Stuart et al., 2003, DOI: 10.1126/science.1087447 Parameters ---------- df : pand...
def rankagg(df, method="stuart"): """Return aggregated ranks. Implementation is ported from the RobustRankAggreg R package References: Kolde et al., 2012, DOI: 10.1093/bioinformatics/btr709 Stuart et al., 2003, DOI: 10.1126/science.1087447 Parameters ---------- df : pand...
[ "Return", "aggregated", "ranks", "." ]
vanheeringen-lab/gimmemotifs
python
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/rank.py#L71-L100
[ "def", "rankagg", "(", "df", ",", "method", "=", "\"stuart\"", ")", ":", "rmat", "=", "pd", ".", "DataFrame", "(", "index", "=", "df", ".", "iloc", "[", ":", ",", "0", "]", ")", "step", "=", "1", "/", "rmat", ".", "shape", "[", "0", "]", "for...
1dc0572179e5d0c8f96958060133c1f8d92c6675
train
data_gen
Yield data, while optionally burning compute cycles. Parameters ---------- n_ops : int, default=100 Number of operations to run between yielding data. Returns ------- data : dict A object which looks like it might come from some machine learning problem, with X as featu...
examples/zmq_example.py
def data_gen(n_ops=100): """Yield data, while optionally burning compute cycles. Parameters ---------- n_ops : int, default=100 Number of operations to run between yielding data. Returns ------- data : dict A object which looks like it might come from some machine l...
def data_gen(n_ops=100): """Yield data, while optionally burning compute cycles. Parameters ---------- n_ops : int, default=100 Number of operations to run between yielding data. Returns ------- data : dict A object which looks like it might come from some machine l...
[ "Yield", "data", "while", "optionally", "burning", "compute", "cycles", "." ]
pescadores/pescador
python
https://github.com/pescadores/pescador/blob/786e2b5f882d13ea563769fbc7ad0a0a10c3553d/examples/zmq_example.py#L41-L58
[ "def", "data_gen", "(", "n_ops", "=", "100", ")", ":", "while", "True", ":", "X", "=", "np", ".", "random", ".", "uniform", "(", "size", "=", "(", "64", ",", "64", ")", ")", "yield", "dict", "(", "X", "=", "costly_function", "(", "X", ",", "n_o...
786e2b5f882d13ea563769fbc7ad0a0a10c3553d
train
mp_calc_stats
Parallel calculation of motif statistics.
gimmemotifs/prediction.py
def mp_calc_stats(motifs, fg_fa, bg_fa, bg_name=None): """Parallel calculation of motif statistics.""" try: stats = calc_stats(motifs, fg_fa, bg_fa, ncpus=1) except Exception as e: raise sys.stderr.write("ERROR: {}\n".format(str(e))) stats = {} if not bg_name: bg...
def mp_calc_stats(motifs, fg_fa, bg_fa, bg_name=None): """Parallel calculation of motif statistics.""" try: stats = calc_stats(motifs, fg_fa, bg_fa, ncpus=1) except Exception as e: raise sys.stderr.write("ERROR: {}\n".format(str(e))) stats = {} if not bg_name: bg...
[ "Parallel", "calculation", "of", "motif", "statistics", "." ]
vanheeringen-lab/gimmemotifs
python
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/prediction.py#L42-L54
[ "def", "mp_calc_stats", "(", "motifs", ",", "fg_fa", ",", "bg_fa", ",", "bg_name", "=", "None", ")", ":", "try", ":", "stats", "=", "calc_stats", "(", "motifs", ",", "fg_fa", ",", "bg_fa", ",", "ncpus", "=", "1", ")", "except", "Exception", "as", "e"...
1dc0572179e5d0c8f96958060133c1f8d92c6675
train
_run_tool
Parallel motif prediction.
gimmemotifs/prediction.py
def _run_tool(job_name, t, fastafile, params): """Parallel motif prediction.""" try: result = t.run(fastafile, params, mytmpdir()) except Exception as e: result = ([], "", "{} failed to run: {}".format(job_name, e)) return job_name, result
def _run_tool(job_name, t, fastafile, params): """Parallel motif prediction.""" try: result = t.run(fastafile, params, mytmpdir()) except Exception as e: result = ([], "", "{} failed to run: {}".format(job_name, e)) return job_name, result
[ "Parallel", "motif", "prediction", "." ]
vanheeringen-lab/gimmemotifs
python
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/prediction.py#L56-L63
[ "def", "_run_tool", "(", "job_name", ",", "t", ",", "fastafile", ",", "params", ")", ":", "try", ":", "result", "=", "t", ".", "run", "(", "fastafile", ",", "params", ",", "mytmpdir", "(", ")", ")", "except", "Exception", "as", "e", ":", "result", ...
1dc0572179e5d0c8f96958060133c1f8d92c6675
train
pp_predict_motifs
Parallel prediction of motifs. Utility function for gimmemotifs.denovo.gimme_motifs. Probably better to use that, instead of this function directly.
gimmemotifs/prediction.py
def pp_predict_motifs(fastafile, outfile, analysis="small", organism="hg18", single=False, background="", tools=None, job_server=None, ncpus=8, max_time=-1, stats_fg=None, stats_bg=None): """Parallel prediction of motifs. Utility function for gimmemotifs.denovo.gimme_motifs. Probably better to use that, i...
def pp_predict_motifs(fastafile, outfile, analysis="small", organism="hg18", single=False, background="", tools=None, job_server=None, ncpus=8, max_time=-1, stats_fg=None, stats_bg=None): """Parallel prediction of motifs. Utility function for gimmemotifs.denovo.gimme_motifs. Probably better to use that, i...
[ "Parallel", "prediction", "of", "motifs", "." ]
vanheeringen-lab/gimmemotifs
python
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/prediction.py#L163-L298
[ "def", "pp_predict_motifs", "(", "fastafile", ",", "outfile", ",", "analysis", "=", "\"small\"", ",", "organism", "=", "\"hg18\"", ",", "single", "=", "False", ",", "background", "=", "\"\"", ",", "tools", "=", "None", ",", "job_server", "=", "None", ",", ...
1dc0572179e5d0c8f96958060133c1f8d92c6675
train
predict_motifs
Predict motifs, input is a FASTA-file
gimmemotifs/prediction.py
def predict_motifs(infile, bgfile, outfile, params=None, stats_fg=None, stats_bg=None): """ Predict motifs, input is a FASTA-file""" # Parse parameters required_params = ["tools", "available_tools", "analysis", "genome", "use_strand", "max_time"] if params is None: ...
def predict_motifs(infile, bgfile, outfile, params=None, stats_fg=None, stats_bg=None): """ Predict motifs, input is a FASTA-file""" # Parse parameters required_params = ["tools", "available_tools", "analysis", "genome", "use_strand", "max_time"] if params is None: ...
[ "Predict", "motifs", "input", "is", "a", "FASTA", "-", "file" ]
vanheeringen-lab/gimmemotifs
python
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/prediction.py#L300-L350
[ "def", "predict_motifs", "(", "infile", ",", "bgfile", ",", "outfile", ",", "params", "=", "None", ",", "stats_fg", "=", "None", ",", "stats_bg", "=", "None", ")", ":", "# Parse parameters", "required_params", "=", "[", "\"tools\"", ",", "\"available_tools\"",...
1dc0572179e5d0c8f96958060133c1f8d92c6675
train
PredictionResult.add_motifs
Add motifs to the result object.
gimmemotifs/prediction.py
def add_motifs(self, args): """Add motifs to the result object.""" self.lock.acquire() # Callback function for motif programs if args is None or len(args) != 2 or len(args[1]) != 3: try: job = args[0] logger.warn("job %s failed", job) ...
def add_motifs(self, args): """Add motifs to the result object.""" self.lock.acquire() # Callback function for motif programs if args is None or len(args) != 2 or len(args[1]) != 3: try: job = args[0] logger.warn("job %s failed", job) ...
[ "Add", "motifs", "to", "the", "result", "object", "." ]
vanheeringen-lab/gimmemotifs
python
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/prediction.py#L90-L130
[ "def", "add_motifs", "(", "self", ",", "args", ")", ":", "self", ".", "lock", ".", "acquire", "(", ")", "# Callback function for motif programs", "if", "args", "is", "None", "or", "len", "(", "args", ")", "!=", "2", "or", "len", "(", "args", "[", "1", ...
1dc0572179e5d0c8f96958060133c1f8d92c6675
train
PredictionResult.wait_for_stats
Make sure all jobs are finished.
gimmemotifs/prediction.py
def wait_for_stats(self): """Make sure all jobs are finished.""" logging.debug("waiting for statistics to finish") for job in self.stat_jobs: job.get() sleep(2)
def wait_for_stats(self): """Make sure all jobs are finished.""" logging.debug("waiting for statistics to finish") for job in self.stat_jobs: job.get() sleep(2)
[ "Make", "sure", "all", "jobs", "are", "finished", "." ]
vanheeringen-lab/gimmemotifs
python
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/prediction.py#L132-L137
[ "def", "wait_for_stats", "(", "self", ")", ":", "logging", ".", "debug", "(", "\"waiting for statistics to finish\"", ")", "for", "job", "in", "self", ".", "stat_jobs", ":", "job", ".", "get", "(", ")", "sleep", "(", "2", ")" ]
1dc0572179e5d0c8f96958060133c1f8d92c6675
train
PredictionResult.add_stats
Callback to add motif statistics.
gimmemotifs/prediction.py
def add_stats(self, args): """Callback to add motif statistics.""" bg_name, stats = args logger.debug("Stats: %s %s", bg_name, stats) for motif_id in stats.keys(): if motif_id not in self.stats: self.stats[motif_id] = {} self.stat...
def add_stats(self, args): """Callback to add motif statistics.""" bg_name, stats = args logger.debug("Stats: %s %s", bg_name, stats) for motif_id in stats.keys(): if motif_id not in self.stats: self.stats[motif_id] = {} self.stat...
[ "Callback", "to", "add", "motif", "statistics", "." ]
vanheeringen-lab/gimmemotifs
python
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/prediction.py#L139-L148
[ "def", "add_stats", "(", "self", ",", "args", ")", ":", "bg_name", ",", "stats", "=", "args", "logger", ".", "debug", "(", "\"Stats: %s %s\"", ",", "bg_name", ",", "stats", ")", "for", "motif_id", "in", "stats", ".", "keys", "(", ")", ":", "if", "mot...
1dc0572179e5d0c8f96958060133c1f8d92c6675
train
prepare_denovo_input_narrowpeak
Prepare a narrowPeak file for de novo motif prediction. All regions to same size; split in test and validation set; converted to FASTA. Parameters ---------- inputfile : str BED file with input regions. params : dict Dictionary with parameters. outdir : str Output...
gimmemotifs/denovo.py
def prepare_denovo_input_narrowpeak(inputfile, params, outdir): """Prepare a narrowPeak file for de novo motif prediction. All regions to same size; split in test and validation set; converted to FASTA. Parameters ---------- inputfile : str BED file with input regions. params : di...
def prepare_denovo_input_narrowpeak(inputfile, params, outdir): """Prepare a narrowPeak file for de novo motif prediction. All regions to same size; split in test and validation set; converted to FASTA. Parameters ---------- inputfile : str BED file with input regions. params : di...
[ "Prepare", "a", "narrowPeak", "file", "for", "de", "novo", "motif", "prediction", "." ]
vanheeringen-lab/gimmemotifs
python
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/denovo.py#L50-L96
[ "def", "prepare_denovo_input_narrowpeak", "(", "inputfile", ",", "params", ",", "outdir", ")", ":", "bedfile", "=", "os", ".", "path", ".", "join", "(", "outdir", ",", "\"input.from.narrowpeak.bed\"", ")", "p", "=", "re", ".", "compile", "(", "r'^(#|track|brow...
1dc0572179e5d0c8f96958060133c1f8d92c6675
train
prepare_denovo_input_bed
Prepare a BED file for de novo motif prediction. All regions to same size; split in test and validation set; converted to FASTA. Parameters ---------- inputfile : str BED file with input regions. params : dict Dictionary with parameters. outdir : str Output direct...
gimmemotifs/denovo.py
def prepare_denovo_input_bed(inputfile, params, outdir): """Prepare a BED file for de novo motif prediction. All regions to same size; split in test and validation set; converted to FASTA. Parameters ---------- inputfile : str BED file with input regions. params : dict Dic...
def prepare_denovo_input_bed(inputfile, params, outdir): """Prepare a BED file for de novo motif prediction. All regions to same size; split in test and validation set; converted to FASTA. Parameters ---------- inputfile : str BED file with input regions. params : dict Dic...
[ "Prepare", "a", "BED", "file", "for", "de", "novo", "motif", "prediction", "." ]
vanheeringen-lab/gimmemotifs
python
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/denovo.py#L98-L151
[ "def", "prepare_denovo_input_bed", "(", "inputfile", ",", "params", ",", "outdir", ")", ":", "logger", ".", "info", "(", "\"preparing input (BED)\"", ")", "# Create BED file with regions of equal size", "width", "=", "int", "(", "params", "[", "\"width\"", "]", ")",...
1dc0572179e5d0c8f96958060133c1f8d92c6675
train
prepare_denovo_input_fa
Create all the FASTA files for de novo motif prediction and validation. Parameters ----------
gimmemotifs/denovo.py
def prepare_denovo_input_fa(inputfile, params, outdir): """Create all the FASTA files for de novo motif prediction and validation. Parameters ---------- """ fraction = float(params["fraction"]) abs_max = int(params["abs_max"]) logger.info("preparing input (FASTA)") pred_fa = os.pa...
def prepare_denovo_input_fa(inputfile, params, outdir): """Create all the FASTA files for de novo motif prediction and validation. Parameters ---------- """ fraction = float(params["fraction"]) abs_max = int(params["abs_max"]) logger.info("preparing input (FASTA)") pred_fa = os.pa...
[ "Create", "all", "the", "FASTA", "files", "for", "de", "novo", "motif", "prediction", "and", "validation", ".", "Parameters", "----------" ]
vanheeringen-lab/gimmemotifs
python
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/denovo.py#L153-L183
[ "def", "prepare_denovo_input_fa", "(", "inputfile", ",", "params", ",", "outdir", ")", ":", "fraction", "=", "float", "(", "params", "[", "\"fraction\"", "]", ")", "abs_max", "=", "int", "(", "params", "[", "\"abs_max\"", "]", ")", "logger", ".", "info", ...
1dc0572179e5d0c8f96958060133c1f8d92c6675
train
create_background
Create background of a specific type. Parameters ---------- bg_type : str Name of background type. fafile : str Name of input FASTA file. outfile : str Name of output FASTA file. genome : str, optional Genome name. width : int, optional Size of re...
gimmemotifs/denovo.py
def create_background(bg_type, fafile, outfile, genome="hg18", width=200, nr_times=10, custom_background=None): """Create background of a specific type. Parameters ---------- bg_type : str Name of background type. fafile : str Name of input FASTA file. outfile : str Na...
def create_background(bg_type, fafile, outfile, genome="hg18", width=200, nr_times=10, custom_background=None): """Create background of a specific type. Parameters ---------- bg_type : str Name of background type. fafile : str Name of input FASTA file. outfile : str Na...
[ "Create", "background", "of", "a", "specific", "type", "." ]
vanheeringen-lab/gimmemotifs
python
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/denovo.py#L185-L273
[ "def", "create_background", "(", "bg_type", ",", "fafile", ",", "outfile", ",", "genome", "=", "\"hg18\"", ",", "width", "=", "200", ",", "nr_times", "=", "10", ",", "custom_background", "=", "None", ")", ":", "width", "=", "int", "(", "width", ")", "c...
1dc0572179e5d0c8f96958060133c1f8d92c6675
train
create_backgrounds
Create different backgrounds for motif prediction and validation. Parameters ---------- outdir : str Directory to save results. background : list, optional Background types to create, default is 'random'. genome : str, optional Genome name (for genomic and gc backgroun...
gimmemotifs/denovo.py
def create_backgrounds(outdir, background=None, genome="hg38", width=200, custom_background=None): """Create different backgrounds for motif prediction and validation. Parameters ---------- outdir : str Directory to save results. background : list, optional Background types to ...
def create_backgrounds(outdir, background=None, genome="hg38", width=200, custom_background=None): """Create different backgrounds for motif prediction and validation. Parameters ---------- outdir : str Directory to save results. background : list, optional Background types to ...
[ "Create", "different", "backgrounds", "for", "motif", "prediction", "and", "validation", "." ]
vanheeringen-lab/gimmemotifs
python
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/denovo.py#L275-L329
[ "def", "create_backgrounds", "(", "outdir", ",", "background", "=", "None", ",", "genome", "=", "\"hg38\"", ",", "width", "=", "200", ",", "custom_background", "=", "None", ")", ":", "if", "background", "is", "None", ":", "background", "=", "[", "\"random\...
1dc0572179e5d0c8f96958060133c1f8d92c6675
train
_is_significant
Filter significant motifs based on several statistics. Parameters ---------- stats : dict Statistics disctionary object. metrics : sequence Metric with associated minimum values. The default is (("max_enrichment", 3), ("roc_auc", 0.55), ("enr_at_fpr", 0.55)) Return...
gimmemotifs/denovo.py
def _is_significant(stats, metrics=None): """Filter significant motifs based on several statistics. Parameters ---------- stats : dict Statistics disctionary object. metrics : sequence Metric with associated minimum values. The default is (("max_enrichment", 3), ("roc_a...
def _is_significant(stats, metrics=None): """Filter significant motifs based on several statistics. Parameters ---------- stats : dict Statistics disctionary object. metrics : sequence Metric with associated minimum values. The default is (("max_enrichment", 3), ("roc_a...
[ "Filter", "significant", "motifs", "based", "on", "several", "statistics", ".", "Parameters", "----------", "stats", ":", "dict", "Statistics", "disctionary", "object", "." ]
vanheeringen-lab/gimmemotifs
python
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/denovo.py#L332-L355
[ "def", "_is_significant", "(", "stats", ",", "metrics", "=", "None", ")", ":", "if", "metrics", "is", "None", ":", "metrics", "=", "(", "(", "\"max_enrichment\"", ",", "3", ")", ",", "(", "\"roc_auc\"", ",", "0.55", ")", ",", "(", "\"enr_at_fpr\"", ","...
1dc0572179e5d0c8f96958060133c1f8d92c6675
train
filter_significant_motifs
Filter significant motifs based on several statistics. Parameters ---------- fname : str Filename of output file were significant motifs will be saved. result : PredictionResult instance Contains motifs and associated statistics. bg : str Name of background type to use. ...
gimmemotifs/denovo.py
def filter_significant_motifs(fname, result, bg, metrics=None): """Filter significant motifs based on several statistics. Parameters ---------- fname : str Filename of output file were significant motifs will be saved. result : PredictionResult instance Contains motifs and associat...
def filter_significant_motifs(fname, result, bg, metrics=None): """Filter significant motifs based on several statistics. Parameters ---------- fname : str Filename of output file were significant motifs will be saved. result : PredictionResult instance Contains motifs and associat...
[ "Filter", "significant", "motifs", "based", "on", "several", "statistics", "." ]
vanheeringen-lab/gimmemotifs
python
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/denovo.py#L357-L393
[ "def", "filter_significant_motifs", "(", "fname", ",", "result", ",", "bg", ",", "metrics", "=", "None", ")", ":", "sig_motifs", "=", "[", "]", "with", "open", "(", "fname", ",", "\"w\"", ")", "as", "f", ":", "for", "motif", "in", "result", ".", "mot...
1dc0572179e5d0c8f96958060133c1f8d92c6675
train
best_motif_in_cluster
Return the best motif per cluster for a clustering results. The motif can be either the average motif or one of the clustered motifs. Parameters ---------- single_pwm : str Filename of motifs. clus_pwm : str Filename of motifs. clusters : Motif clustering result. ...
gimmemotifs/denovo.py
def best_motif_in_cluster(single_pwm, clus_pwm, clusters, fg_fa, background, stats=None, metrics=("roc_auc", "recall_at_fdr")): """Return the best motif per cluster for a clustering results. The motif can be either the average motif or one of the clustered motifs. Parameters ---------- single_pwm ...
def best_motif_in_cluster(single_pwm, clus_pwm, clusters, fg_fa, background, stats=None, metrics=("roc_auc", "recall_at_fdr")): """Return the best motif per cluster for a clustering results. The motif can be either the average motif or one of the clustered motifs. Parameters ---------- single_pwm ...
[ "Return", "the", "best", "motif", "per", "cluster", "for", "a", "clustering", "results", "." ]
vanheeringen-lab/gimmemotifs
python
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/denovo.py#L395-L466
[ "def", "best_motif_in_cluster", "(", "single_pwm", ",", "clus_pwm", ",", "clusters", ",", "fg_fa", ",", "background", ",", "stats", "=", "None", ",", "metrics", "=", "(", "\"roc_auc\"", ",", "\"recall_at_fdr\"", ")", ")", ":", "# combine original and clustered mot...
1dc0572179e5d0c8f96958060133c1f8d92c6675
train
rename_motifs
Rename motifs to GimmeMotifs_1..GimmeMotifs_N. If stats object is passed, stats will be copied.
gimmemotifs/denovo.py
def rename_motifs(motifs, stats=None): """Rename motifs to GimmeMotifs_1..GimmeMotifs_N. If stats object is passed, stats will be copied.""" final_motifs = [] for i, motif in enumerate(motifs): old = str(motif) motif.id = "GimmeMotifs_{}".format(i + 1) final_motifs.append(mo...
def rename_motifs(motifs, stats=None): """Rename motifs to GimmeMotifs_1..GimmeMotifs_N. If stats object is passed, stats will be copied.""" final_motifs = [] for i, motif in enumerate(motifs): old = str(motif) motif.id = "GimmeMotifs_{}".format(i + 1) final_motifs.append(mo...
[ "Rename", "motifs", "to", "GimmeMotifs_1", "..", "GimmeMotifs_N", ".", "If", "stats", "object", "is", "passed", "stats", "will", "be", "copied", "." ]
vanheeringen-lab/gimmemotifs
python
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/denovo.py#L468-L483
[ "def", "rename_motifs", "(", "motifs", ",", "stats", "=", "None", ")", ":", "final_motifs", "=", "[", "]", "for", "i", ",", "motif", "in", "enumerate", "(", "motifs", ")", ":", "old", "=", "str", "(", "motif", ")", "motif", ".", "id", "=", "\"Gimme...
1dc0572179e5d0c8f96958060133c1f8d92c6675
train
gimme_motifs
De novo motif prediction based on an ensemble of different tools. Parameters ---------- inputfile : str Filename of input. Can be either BED, narrowPeak or FASTA. outdir : str Name of output directory. params : dict, optional Optional parameters. filter_significant : ...
gimmemotifs/denovo.py
def gimme_motifs(inputfile, outdir, params=None, filter_significant=True, cluster=True, create_report=True): """De novo motif prediction based on an ensemble of different tools. Parameters ---------- inputfile : str Filename of input. Can be either BED, narrowPeak or FASTA. outdir : str ...
def gimme_motifs(inputfile, outdir, params=None, filter_significant=True, cluster=True, create_report=True): """De novo motif prediction based on an ensemble of different tools. Parameters ---------- inputfile : str Filename of input. Can be either BED, narrowPeak or FASTA. outdir : str ...
[ "De", "novo", "motif", "prediction", "based", "on", "an", "ensemble", "of", "different", "tools", "." ]
vanheeringen-lab/gimmemotifs
python
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/denovo.py#L485-L661
[ "def", "gimme_motifs", "(", "inputfile", ",", "outdir", ",", "params", "=", "None", ",", "filter_significant", "=", "True", ",", "cluster", "=", "True", ",", "create_report", "=", "True", ")", ":", "if", "outdir", "is", "None", ":", "outdir", "=", "\"gim...
1dc0572179e5d0c8f96958060133c1f8d92c6675
train
MotifDb.register_db
Register method to keep list of dbs.
gimmemotifs/db/__init__.py
def register_db(cls, dbname): """Register method to keep list of dbs.""" def decorator(subclass): """Register as decorator function.""" cls._dbs[dbname] = subclass subclass.name = dbname return subclass return decorator
def register_db(cls, dbname): """Register method to keep list of dbs.""" def decorator(subclass): """Register as decorator function.""" cls._dbs[dbname] = subclass subclass.name = dbname return subclass return decorator
[ "Register", "method", "to", "keep", "list", "of", "dbs", "." ]
vanheeringen-lab/gimmemotifs
python
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/db/__init__.py#L53-L60
[ "def", "register_db", "(", "cls", ",", "dbname", ")", ":", "def", "decorator", "(", "subclass", ")", ":", "\"\"\"Register as decorator function.\"\"\"", "cls", ".", "_dbs", "[", "dbname", "]", "=", "subclass", "subclass", ".", "name", "=", "dbname", "return", ...
1dc0572179e5d0c8f96958060133c1f8d92c6675
train
moap
Run a single motif activity prediction algorithm. Parameters ---------- inputfile : str :1File with regions (chr:start-end) in first column and either cluster name in second column or a table with values. method : str, optional Motif activity method to use. Any of 'hyp...
gimmemotifs/moap.py
def moap(inputfile, method="hypergeom", scoring=None, outfile=None, motiffile=None, pwmfile=None, genome=None, fpr=0.01, ncpus=None, subsample=None): """Run a single motif activity prediction algorithm. Parameters ---------- inputfile : str :1File with regions (chr:start-end) in fir...
def moap(inputfile, method="hypergeom", scoring=None, outfile=None, motiffile=None, pwmfile=None, genome=None, fpr=0.01, ncpus=None, subsample=None): """Run a single motif activity prediction algorithm. Parameters ---------- inputfile : str :1File with regions (chr:start-end) in fir...
[ "Run", "a", "single", "motif", "activity", "prediction", "algorithm", ".", "Parameters", "----------", "inputfile", ":", "str", ":", "1File", "with", "regions", "(", "chr", ":", "start", "-", "end", ")", "in", "first", "column", "and", "either", "cluster", ...
vanheeringen-lab/gimmemotifs
python
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/moap.py#L817-L955
[ "def", "moap", "(", "inputfile", ",", "method", "=", "\"hypergeom\"", ",", "scoring", "=", "None", ",", "outfile", "=", "None", ",", "motiffile", "=", "None", ",", "pwmfile", "=", "None", ",", "genome", "=", "None", ",", "fpr", "=", "0.01", ",", "ncp...
1dc0572179e5d0c8f96958060133c1f8d92c6675
train
Moap.create
Create a Moap instance based on the predictor name. Parameters ---------- name : str Name of the predictor (eg. Xgboost, BayesianRidge, ...) ncpus : int, optional Number of threads. Default is the number specified in the config. Returns ...
gimmemotifs/moap.py
def create(cls, name, ncpus=None): """Create a Moap instance based on the predictor name. Parameters ---------- name : str Name of the predictor (eg. Xgboost, BayesianRidge, ...) ncpus : int, optional Number of threads. Default is the number spec...
def create(cls, name, ncpus=None): """Create a Moap instance based on the predictor name. Parameters ---------- name : str Name of the predictor (eg. Xgboost, BayesianRidge, ...) ncpus : int, optional Number of threads. Default is the number spec...
[ "Create", "a", "Moap", "instance", "based", "on", "the", "predictor", "name", "." ]
vanheeringen-lab/gimmemotifs
python
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/moap.py#L65-L84
[ "def", "create", "(", "cls", ",", "name", ",", "ncpus", "=", "None", ")", ":", "try", ":", "return", "cls", ".", "_predictors", "[", "name", ".", "lower", "(", ")", "]", "(", "ncpus", "=", "ncpus", ")", "except", "KeyError", ":", "raise", "Exceptio...
1dc0572179e5d0c8f96958060133c1f8d92c6675
train
Moap.register_predictor
Register method to keep list of predictors.
gimmemotifs/moap.py
def register_predictor(cls, name): """Register method to keep list of predictors.""" def decorator(subclass): """Register as decorator function.""" cls._predictors[name.lower()] = subclass subclass.name = name.lower() return subclass return decorat...
def register_predictor(cls, name): """Register method to keep list of predictors.""" def decorator(subclass): """Register as decorator function.""" cls._predictors[name.lower()] = subclass subclass.name = name.lower() return subclass return decorat...
[ "Register", "method", "to", "keep", "list", "of", "predictors", "." ]
vanheeringen-lab/gimmemotifs
python
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/moap.py#L87-L94
[ "def", "register_predictor", "(", "cls", ",", "name", ")", ":", "def", "decorator", "(", "subclass", ")", ":", "\"\"\"Register as decorator function.\"\"\"", "cls", ".", "_predictors", "[", "name", ".", "lower", "(", ")", "]", "=", "subclass", "subclass", ".",...
1dc0572179e5d0c8f96958060133c1f8d92c6675
train
Moap.list_classification_predictors
List available classification predictors.
gimmemotifs/moap.py
def list_classification_predictors(self): """List available classification predictors.""" preds = [self.create(x) for x in self._predictors.keys()] return [x.name for x in preds if x.ptype == "classification"]
def list_classification_predictors(self): """List available classification predictors.""" preds = [self.create(x) for x in self._predictors.keys()] return [x.name for x in preds if x.ptype == "classification"]
[ "List", "available", "classification", "predictors", "." ]
vanheeringen-lab/gimmemotifs
python
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/moap.py#L102-L105
[ "def", "list_classification_predictors", "(", "self", ")", ":", "preds", "=", "[", "self", ".", "create", "(", "x", ")", "for", "x", "in", "self", ".", "_predictors", ".", "keys", "(", ")", "]", "return", "[", "x", ".", "name", "for", "x", "in", "p...
1dc0572179e5d0c8f96958060133c1f8d92c6675
train
Streamer._activate
Activates the stream.
pescador/core.py
def _activate(self): """Activates the stream.""" if six.callable(self.streamer): # If it's a function, create the stream. self.stream_ = self.streamer(*(self.args), **(self.kwargs)) else: # If it's iterable, use it directly. self.stream_ = iter(se...
def _activate(self): """Activates the stream.""" if six.callable(self.streamer): # If it's a function, create the stream. self.stream_ = self.streamer(*(self.args), **(self.kwargs)) else: # If it's iterable, use it directly. self.stream_ = iter(se...
[ "Activates", "the", "stream", "." ]
pescadores/pescador
python
https://github.com/pescadores/pescador/blob/786e2b5f882d13ea563769fbc7ad0a0a10c3553d/pescador/core.py#L169-L177
[ "def", "_activate", "(", "self", ")", ":", "if", "six", ".", "callable", "(", "self", ".", "streamer", ")", ":", "# If it's a function, create the stream.", "self", ".", "stream_", "=", "self", ".", "streamer", "(", "*", "(", "self", ".", "args", ")", ",...
786e2b5f882d13ea563769fbc7ad0a0a10c3553d
train
Streamer.iterate
Instantiate an iterator. Parameters ---------- max_iter : None or int > 0 Maximum number of iterations to yield. If ``None``, exhaust the stream. Yields ------ obj : Objects yielded by the streamer provided on init. See Also ----...
pescador/core.py
def iterate(self, max_iter=None): '''Instantiate an iterator. Parameters ---------- max_iter : None or int > 0 Maximum number of iterations to yield. If ``None``, exhaust the stream. Yields ------ obj : Objects yielded by the streamer pro...
def iterate(self, max_iter=None): '''Instantiate an iterator. Parameters ---------- max_iter : None or int > 0 Maximum number of iterations to yield. If ``None``, exhaust the stream. Yields ------ obj : Objects yielded by the streamer pro...
[ "Instantiate", "an", "iterator", "." ]
pescadores/pescador
python
https://github.com/pescadores/pescador/blob/786e2b5f882d13ea563769fbc7ad0a0a10c3553d/pescador/core.py#L179-L202
[ "def", "iterate", "(", "self", ",", "max_iter", "=", "None", ")", ":", "# Use self as context manager / calls __enter__() => _activate()", "with", "self", "as", "active_streamer", ":", "for", "n", ",", "obj", "in", "enumerate", "(", "active_streamer", ".", "stream_"...
786e2b5f882d13ea563769fbc7ad0a0a10c3553d
train
Streamer.cycle
Iterate from the streamer infinitely. This function will force an infinite stream, restarting the streamer even if a StopIteration is raised. Parameters ---------- max_iter : None or int > 0 Maximum number of iterations to yield. If `None`, iterate indef...
pescador/core.py
def cycle(self, max_iter=None): '''Iterate from the streamer infinitely. This function will force an infinite stream, restarting the streamer even if a StopIteration is raised. Parameters ---------- max_iter : None or int > 0 Maximum number of iterations to ...
def cycle(self, max_iter=None): '''Iterate from the streamer infinitely. This function will force an infinite stream, restarting the streamer even if a StopIteration is raised. Parameters ---------- max_iter : None or int > 0 Maximum number of iterations to ...
[ "Iterate", "from", "the", "streamer", "infinitely", "." ]
pescadores/pescador
python
https://github.com/pescadores/pescador/blob/786e2b5f882d13ea563769fbc7ad0a0a10c3553d/pescador/core.py#L204-L227
[ "def", "cycle", "(", "self", ",", "max_iter", "=", "None", ")", ":", "count", "=", "0", "while", "True", ":", "for", "obj", "in", "self", ".", "iterate", "(", ")", ":", "count", "+=", "1", "if", "max_iter", "is", "not", "None", "and", "count", ">...
786e2b5f882d13ea563769fbc7ad0a0a10c3553d
train
calc_stats_iterator
Calculate motif enrichment metrics. Parameters ---------- motifs : str, list or Motif instance A file with motifs in pwm format, a list of Motif instances or a single Motif instance. fg_file : str Filename of a FASTA, BED or region file with positive sequences. bg_file : ...
gimmemotifs/stats.py
def calc_stats_iterator(motifs, fg_file, bg_file, genome=None, stats=None, ncpus=None): """Calculate motif enrichment metrics. Parameters ---------- motifs : str, list or Motif instance A file with motifs in pwm format, a list of Motif instances or a single Motif instance. fg_file...
def calc_stats_iterator(motifs, fg_file, bg_file, genome=None, stats=None, ncpus=None): """Calculate motif enrichment metrics. Parameters ---------- motifs : str, list or Motif instance A file with motifs in pwm format, a list of Motif instances or a single Motif instance. fg_file...
[ "Calculate", "motif", "enrichment", "metrics", "." ]
vanheeringen-lab/gimmemotifs
python
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/stats.py#L16-L82
[ "def", "calc_stats_iterator", "(", "motifs", ",", "fg_file", ",", "bg_file", ",", "genome", "=", "None", ",", "stats", "=", "None", ",", "ncpus", "=", "None", ")", ":", "if", "not", "stats", ":", "stats", "=", "rocmetrics", ".", "__all__", "if", "isins...
1dc0572179e5d0c8f96958060133c1f8d92c6675
train
calc_stats
Calculate motif enrichment metrics. Parameters ---------- motifs : str, list or Motif instance A file with motifs in pwm format, a list of Motif instances or a single Motif instance. fg_file : str Filename of a FASTA, BED or region file with positive sequences. bg_file : ...
gimmemotifs/stats.py
def calc_stats(motifs, fg_file, bg_file, genome=None, stats=None, ncpus=None): """Calculate motif enrichment metrics. Parameters ---------- motifs : str, list or Motif instance A file with motifs in pwm format, a list of Motif instances or a single Motif instance. fg_file : str ...
def calc_stats(motifs, fg_file, bg_file, genome=None, stats=None, ncpus=None): """Calculate motif enrichment metrics. Parameters ---------- motifs : str, list or Motif instance A file with motifs in pwm format, a list of Motif instances or a single Motif instance. fg_file : str ...
[ "Calculate", "motif", "enrichment", "metrics", "." ]
vanheeringen-lab/gimmemotifs
python
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/stats.py#L84-L122
[ "def", "calc_stats", "(", "motifs", ",", "fg_file", ",", "bg_file", ",", "genome", "=", "None", ",", "stats", "=", "None", ",", "ncpus", "=", "None", ")", ":", "result", "=", "{", "}", "for", "batch_result", "in", "calc_stats_iterator", "(", "motifs", ...
1dc0572179e5d0c8f96958060133c1f8d92c6675
train
rank_motifs
Determine mean rank of motifs based on metrics.
gimmemotifs/stats.py
def rank_motifs(stats, metrics=("roc_auc", "recall_at_fdr")): """Determine mean rank of motifs based on metrics.""" rank = {} combined_metrics = [] motif_ids = stats.keys() background = list(stats.values())[0].keys() for metric in metrics: mean_metric_stats = [np.mean( [stats...
def rank_motifs(stats, metrics=("roc_auc", "recall_at_fdr")): """Determine mean rank of motifs based on metrics.""" rank = {} combined_metrics = [] motif_ids = stats.keys() background = list(stats.values())[0].keys() for metric in metrics: mean_metric_stats = [np.mean( [stats...
[ "Determine", "mean", "rank", "of", "motifs", "based", "on", "metrics", "." ]
vanheeringen-lab/gimmemotifs
python
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/stats.py#L202-L217
[ "def", "rank_motifs", "(", "stats", ",", "metrics", "=", "(", "\"roc_auc\"", ",", "\"recall_at_fdr\"", ")", ")", ":", "rank", "=", "{", "}", "combined_metrics", "=", "[", "]", "motif_ids", "=", "stats", ".", "keys", "(", ")", "background", "=", "list", ...
1dc0572179e5d0c8f96958060133c1f8d92c6675
train
write_stats
write motif statistics to text file.
gimmemotifs/stats.py
def write_stats(stats, fname, header=None): """write motif statistics to text file.""" # Write stats output to file for bg in list(stats.values())[0].keys(): f = open(fname.format(bg), "w") if header: f.write(header) stat_keys = sorted(list(list(stats.values())[...
def write_stats(stats, fname, header=None): """write motif statistics to text file.""" # Write stats output to file for bg in list(stats.values())[0].keys(): f = open(fname.format(bg), "w") if header: f.write(header) stat_keys = sorted(list(list(stats.values())[...
[ "write", "motif", "statistics", "to", "text", "file", "." ]
vanheeringen-lab/gimmemotifs
python
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/stats.py#L219-L243
[ "def", "write_stats", "(", "stats", ",", "fname", ",", "header", "=", "None", ")", ":", "# Write stats output to file", "for", "bg", "in", "list", "(", "stats", ".", "values", "(", ")", ")", "[", "0", "]", ".", "keys", "(", ")", ":", "f", "=", "ope...
1dc0572179e5d0c8f96958060133c1f8d92c6675
train
get_roc_values
Calculate ROC AUC values for ROC plots.
gimmemotifs/report.py
def get_roc_values(motif, fg_file, bg_file): """Calculate ROC AUC values for ROC plots.""" #print(calc_stats(motif, fg_file, bg_file, stats=["roc_values"], ncpus=1)) #["roc_values"]) try: # fg_result = motif.pwm_scan_score(Fasta(fg_file), cutoff=0.0, nreport=1) # fg_vals = [sorted(x)[...
def get_roc_values(motif, fg_file, bg_file): """Calculate ROC AUC values for ROC plots.""" #print(calc_stats(motif, fg_file, bg_file, stats=["roc_values"], ncpus=1)) #["roc_values"]) try: # fg_result = motif.pwm_scan_score(Fasta(fg_file), cutoff=0.0, nreport=1) # fg_vals = [sorted(x)[...
[ "Calculate", "ROC", "AUC", "values", "for", "ROC", "plots", "." ]
vanheeringen-lab/gimmemotifs
python
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/report.py#L33-L54
[ "def", "get_roc_values", "(", "motif", ",", "fg_file", ",", "bg_file", ")", ":", "#print(calc_stats(motif, fg_file, bg_file, stats=[\"roc_values\"], ncpus=1))", "#[\"roc_values\"])", "try", ":", "# fg_result = motif.pwm_scan_score(Fasta(fg_file), cutoff=0.0, nreport=1)", "# ...
1dc0572179e5d0c8f96958060133c1f8d92c6675
train
create_roc_plots
Make ROC plots for all motifs.
gimmemotifs/report.py
def create_roc_plots(pwmfile, fgfa, background, outdir): """Make ROC plots for all motifs.""" motifs = read_motifs(pwmfile, fmt="pwm", as_dict=True) ncpus = int(MotifConfig().get_default_params()['ncpus']) pool = Pool(processes=ncpus) jobs = {} for bg,fname in background.items(): for m_i...
def create_roc_plots(pwmfile, fgfa, background, outdir): """Make ROC plots for all motifs.""" motifs = read_motifs(pwmfile, fmt="pwm", as_dict=True) ncpus = int(MotifConfig().get_default_params()['ncpus']) pool = Pool(processes=ncpus) jobs = {} for bg,fname in background.items(): for m_i...
[ "Make", "ROC", "plots", "for", "all", "motifs", "." ]
vanheeringen-lab/gimmemotifs
python
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/report.py#L56-L84
[ "def", "create_roc_plots", "(", "pwmfile", ",", "fgfa", ",", "background", ",", "outdir", ")", ":", "motifs", "=", "read_motifs", "(", "pwmfile", ",", "fmt", "=", "\"pwm\"", ",", "as_dict", "=", "True", ")", "ncpus", "=", "int", "(", "MotifConfig", "(", ...
1dc0572179e5d0c8f96958060133c1f8d92c6675
train
_create_text_report
Create text report of motifs with statistics and database match.
gimmemotifs/report.py
def _create_text_report(inputfile, motifs, closest_match, stats, outdir): """Create text report of motifs with statistics and database match.""" my_stats = {} for motif in motifs: match = closest_match[motif.id] my_stats[str(motif)] = {} for bg in list(stats.values())[0].keys(): ...
def _create_text_report(inputfile, motifs, closest_match, stats, outdir): """Create text report of motifs with statistics and database match.""" my_stats = {} for motif in motifs: match = closest_match[motif.id] my_stats[str(motif)] = {} for bg in list(stats.values())[0].keys(): ...
[ "Create", "text", "report", "of", "motifs", "with", "statistics", "and", "database", "match", "." ]
vanheeringen-lab/gimmemotifs
python
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/report.py#L86-L108
[ "def", "_create_text_report", "(", "inputfile", ",", "motifs", ",", "closest_match", ",", "stats", ",", "outdir", ")", ":", "my_stats", "=", "{", "}", "for", "motif", "in", "motifs", ":", "match", "=", "closest_match", "[", "motif", ".", "id", "]", "my_s...
1dc0572179e5d0c8f96958060133c1f8d92c6675
train
_create_graphical_report
Create main gimme_motifs output html report.
gimmemotifs/report.py
def _create_graphical_report(inputfile, pwm, background, closest_match, outdir, stats, best_id=None): """Create main gimme_motifs output html report.""" if best_id is None: best_id = {} logger.debug("Creating graphical report") class ReportMotif(object): """Placeholder for motif st...
def _create_graphical_report(inputfile, pwm, background, closest_match, outdir, stats, best_id=None): """Create main gimme_motifs output html report.""" if best_id is None: best_id = {} logger.debug("Creating graphical report") class ReportMotif(object): """Placeholder for motif st...
[ "Create", "main", "gimme_motifs", "output", "html", "report", "." ]
vanheeringen-lab/gimmemotifs
python
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/report.py#L110-L194
[ "def", "_create_graphical_report", "(", "inputfile", ",", "pwm", ",", "background", ",", "closest_match", ",", "outdir", ",", "stats", ",", "best_id", "=", "None", ")", ":", "if", "best_id", "is", "None", ":", "best_id", "=", "{", "}", "logger", ".", "de...
1dc0572179e5d0c8f96958060133c1f8d92c6675
train
create_denovo_motif_report
Create text and graphical (.html) motif reports.
gimmemotifs/report.py
def create_denovo_motif_report(inputfile, pwmfile, fgfa, background, locfa, outdir, params, stats=None): """Create text and graphical (.html) motif reports.""" logger.info("creating reports") motifs = read_motifs(pwmfile, fmt="pwm") # ROC plots create_roc_plots(pwmfile, fgfa, background, outdi...
def create_denovo_motif_report(inputfile, pwmfile, fgfa, background, locfa, outdir, params, stats=None): """Create text and graphical (.html) motif reports.""" logger.info("creating reports") motifs = read_motifs(pwmfile, fmt="pwm") # ROC plots create_roc_plots(pwmfile, fgfa, background, outdi...
[ "Create", "text", "and", "graphical", "(", ".", "html", ")", "motif", "reports", "." ]
vanheeringen-lab/gimmemotifs
python
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/report.py#L196-L233
[ "def", "create_denovo_motif_report", "(", "inputfile", ",", "pwmfile", ",", "fgfa", ",", "background", ",", "locfa", ",", "outdir", ",", "params", ",", "stats", "=", "None", ")", ":", "logger", ".", "info", "(", "\"creating reports\"", ")", "motifs", "=", ...
1dc0572179e5d0c8f96958060133c1f8d92c6675
train
axes_off
Get rid of all axis ticks, lines, etc.
gimmemotifs/plot.py
def axes_off(ax): """Get rid of all axis ticks, lines, etc. """ ax.set_frame_on(False) ax.axes.get_yaxis().set_visible(False) ax.axes.get_xaxis().set_visible(False)
def axes_off(ax): """Get rid of all axis ticks, lines, etc. """ ax.set_frame_on(False) ax.axes.get_yaxis().set_visible(False) ax.axes.get_xaxis().set_visible(False)
[ "Get", "rid", "of", "all", "axis", "ticks", "lines", "etc", "." ]
vanheeringen-lab/gimmemotifs
python
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/plot.py#L33-L38
[ "def", "axes_off", "(", "ax", ")", ":", "ax", ".", "set_frame_on", "(", "False", ")", "ax", ".", "axes", ".", "get_yaxis", "(", ")", ".", "set_visible", "(", "False", ")", "ax", ".", "axes", ".", "get_xaxis", "(", ")", ".", "set_visible", "(", "Fal...
1dc0572179e5d0c8f96958060133c1f8d92c6675
train
match_plot
Plot list of motifs with database match and p-value "param plotdata: list of (motif, dbmotif, pval)
gimmemotifs/plot.py
def match_plot(plotdata, outfile): """Plot list of motifs with database match and p-value "param plotdata: list of (motif, dbmotif, pval) """ fig_h = 2 fig_w = 7 nrows = len(plotdata) ncols = 2 fig = plt.figure(figsize=(fig_w, nrows * fig_h)) for i, (motif, dbmotif, pval) in e...
def match_plot(plotdata, outfile): """Plot list of motifs with database match and p-value "param plotdata: list of (motif, dbmotif, pval) """ fig_h = 2 fig_w = 7 nrows = len(plotdata) ncols = 2 fig = plt.figure(figsize=(fig_w, nrows * fig_h)) for i, (motif, dbmotif, pval) in e...
[ "Plot", "list", "of", "motifs", "with", "database", "match", "and", "p", "-", "value", "param", "plotdata", ":", "list", "of", "(", "motif", "dbmotif", "pval", ")" ]
vanheeringen-lab/gimmemotifs
python
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/plot.py#L94-L132
[ "def", "match_plot", "(", "plotdata", ",", "outfile", ")", ":", "fig_h", "=", "2", "fig_w", "=", "7", "nrows", "=", "len", "(", "plotdata", ")", "ncols", "=", "2", "fig", "=", "plt", ".", "figure", "(", "figsize", "=", "(", "fig_w", ",", "nrows", ...
1dc0572179e5d0c8f96958060133c1f8d92c6675
train
motif_tree_plot
Plot a "phylogenetic" tree
gimmemotifs/plot.py
def motif_tree_plot(outfile, tree, data, circle=True, vmin=None, vmax=None, dpi=300): """ Plot a "phylogenetic" tree """ try: from ete3 import Tree, faces, AttrFace, TreeStyle, NodeStyle except ImportError: print("Please install ete3 to use this functionality") sys.exit(1) ...
def motif_tree_plot(outfile, tree, data, circle=True, vmin=None, vmax=None, dpi=300): """ Plot a "phylogenetic" tree """ try: from ete3 import Tree, faces, AttrFace, TreeStyle, NodeStyle except ImportError: print("Please install ete3 to use this functionality") sys.exit(1) ...
[ "Plot", "a", "phylogenetic", "tree" ]
vanheeringen-lab/gimmemotifs
python
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/plot.py#L349-L370
[ "def", "motif_tree_plot", "(", "outfile", ",", "tree", ",", "data", ",", "circle", "=", "True", ",", "vmin", "=", "None", ",", "vmax", "=", "None", ",", "dpi", "=", "300", ")", ":", "try", ":", "from", "ete3", "import", "Tree", ",", "faces", ",", ...
1dc0572179e5d0c8f96958060133c1f8d92c6675
train
check_bed_file
Check if the inputfile is a valid bed-file
gimmemotifs/validation.py
def check_bed_file(fname): """ Check if the inputfile is a valid bed-file """ if not os.path.exists(fname): logger.error("Inputfile %s does not exist!", fname) sys.exit(1) for i, line in enumerate(open(fname)): if line.startswith("#") or line.startswith("track") or line.startswith("...
def check_bed_file(fname): """ Check if the inputfile is a valid bed-file """ if not os.path.exists(fname): logger.error("Inputfile %s does not exist!", fname) sys.exit(1) for i, line in enumerate(open(fname)): if line.startswith("#") or line.startswith("track") or line.startswith("...
[ "Check", "if", "the", "inputfile", "is", "a", "valid", "bed", "-", "file" ]
vanheeringen-lab/gimmemotifs
python
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/validation.py#L13-L37
[ "def", "check_bed_file", "(", "fname", ")", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "fname", ")", ":", "logger", ".", "error", "(", "\"Inputfile %s does not exist!\"", ",", "fname", ")", "sys", ".", "exit", "(", "1", ")", "for", "i", ...
1dc0572179e5d0c8f96958060133c1f8d92c6675
train
check_denovo_input
Check if an input file is valid, which means BED, narrowPeak or FASTA
gimmemotifs/validation.py
def check_denovo_input(inputfile, params): """ Check if an input file is valid, which means BED, narrowPeak or FASTA """ background = params["background"] input_type = determine_file_type(inputfile) if input_type == "fasta": valid_bg = FA_VALID_BGS elif input_type in ["...
def check_denovo_input(inputfile, params): """ Check if an input file is valid, which means BED, narrowPeak or FASTA """ background = params["background"] input_type = determine_file_type(inputfile) if input_type == "fasta": valid_bg = FA_VALID_BGS elif input_type in ["...
[ "Check", "if", "an", "input", "file", "is", "valid", "which", "means", "BED", "narrowPeak", "or", "FASTA" ]
vanheeringen-lab/gimmemotifs
python
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/validation.py#L41-L74
[ "def", "check_denovo_input", "(", "inputfile", ",", "params", ")", ":", "background", "=", "params", "[", "\"background\"", "]", "input_type", "=", "determine_file_type", "(", "inputfile", ")", "if", "input_type", "==", "\"fasta\"", ":", "valid_bg", "=", "FA_VAL...
1dc0572179e5d0c8f96958060133c1f8d92c6675
train
scan_to_best_match
Scan a FASTA file with motifs. Scan a FASTA file and return a dictionary with the best match per motif. Parameters ---------- fname : str Filename of a sequence file in FASTA format. motifs : list List of motif instances. Returns ------- result : dict Dictiona...
gimmemotifs/scanner.py
def scan_to_best_match(fname, motifs, ncpus=None, genome=None, score=False): """Scan a FASTA file with motifs. Scan a FASTA file and return a dictionary with the best match per motif. Parameters ---------- fname : str Filename of a sequence file in FASTA format. motifs : list ...
def scan_to_best_match(fname, motifs, ncpus=None, genome=None, score=False): """Scan a FASTA file with motifs. Scan a FASTA file and return a dictionary with the best match per motif. Parameters ---------- fname : str Filename of a sequence file in FASTA format. motifs : list ...
[ "Scan", "a", "FASTA", "file", "with", "motifs", "." ]
vanheeringen-lab/gimmemotifs
python
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/scanner.py#L55-L96
[ "def", "scan_to_best_match", "(", "fname", ",", "motifs", ",", "ncpus", "=", "None", ",", "genome", "=", "None", ",", "score", "=", "False", ")", ":", "# Initialize scanner", "s", "=", "Scanner", "(", "ncpus", "=", "ncpus", ")", "s", ".", "set_motifs", ...
1dc0572179e5d0c8f96958060133c1f8d92c6675
train
Scanner.set_background
Set the background to use for FPR and z-score calculations. Background can be specified either as a genome name or as the name of a FASTA file. Parameters ---------- fname : str, optional Name of FASTA file to use as background. genome : str, optio...
gimmemotifs/scanner.py
def set_background(self, fname=None, genome=None, length=200, nseq=10000): """Set the background to use for FPR and z-score calculations. Background can be specified either as a genome name or as the name of a FASTA file. Parameters ---------- fname : str, opti...
def set_background(self, fname=None, genome=None, length=200, nseq=10000): """Set the background to use for FPR and z-score calculations. Background can be specified either as a genome name or as the name of a FASTA file. Parameters ---------- fname : str, opti...
[ "Set", "the", "background", "to", "use", "for", "FPR", "and", "z", "-", "score", "calculations", "." ]
vanheeringen-lab/gimmemotifs
python
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/scanner.py#L378-L428
[ "def", "set_background", "(", "self", ",", "fname", "=", "None", ",", "genome", "=", "None", ",", "length", "=", "200", ",", "nseq", "=", "10000", ")", ":", "length", "=", "int", "(", "length", ")", "if", "genome", "and", "fname", ":", "raise", "Va...
1dc0572179e5d0c8f96958060133c1f8d92c6675
train
Scanner.set_threshold
Set motif scanning threshold based on background sequences. Parameters ---------- fpr : float, optional Desired FPR, between 0.0 and 1.0. threshold : float or str, optional Desired motif threshold, expressed as the fraction of the difference between...
gimmemotifs/scanner.py
def set_threshold(self, fpr=None, threshold=None): """Set motif scanning threshold based on background sequences. Parameters ---------- fpr : float, optional Desired FPR, between 0.0 and 1.0. threshold : float or str, optional Desired motif threshold, ex...
def set_threshold(self, fpr=None, threshold=None): """Set motif scanning threshold based on background sequences. Parameters ---------- fpr : float, optional Desired FPR, between 0.0 and 1.0. threshold : float or str, optional Desired motif threshold, ex...
[ "Set", "motif", "scanning", "threshold", "based", "on", "background", "sequences", "." ]
vanheeringen-lab/gimmemotifs
python
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/scanner.py#L430-L499
[ "def", "set_threshold", "(", "self", ",", "fpr", "=", "None", ",", "threshold", "=", "None", ")", ":", "if", "threshold", "and", "fpr", ":", "raise", "ValueError", "(", "\"Need either fpr or threshold.\"", ")", "if", "fpr", ":", "fpr", "=", "float", "(", ...
1dc0572179e5d0c8f96958060133c1f8d92c6675
train
Scanner.count
count the number of matches above the cutoff returns an iterator of lists containing integer counts
gimmemotifs/scanner.py
def count(self, seqs, nreport=100, scan_rc=True): """ count the number of matches above the cutoff returns an iterator of lists containing integer counts """ for matches in self.scan(seqs, nreport, scan_rc): counts = [len(m) for m in matches] yield counts
def count(self, seqs, nreport=100, scan_rc=True): """ count the number of matches above the cutoff returns an iterator of lists containing integer counts """ for matches in self.scan(seqs, nreport, scan_rc): counts = [len(m) for m in matches] yield counts
[ "count", "the", "number", "of", "matches", "above", "the", "cutoff", "returns", "an", "iterator", "of", "lists", "containing", "integer", "counts" ]
vanheeringen-lab/gimmemotifs
python
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/scanner.py#L515-L522
[ "def", "count", "(", "self", ",", "seqs", ",", "nreport", "=", "100", ",", "scan_rc", "=", "True", ")", ":", "for", "matches", "in", "self", ".", "scan", "(", "seqs", ",", "nreport", ",", "scan_rc", ")", ":", "counts", "=", "[", "len", "(", "m", ...
1dc0572179e5d0c8f96958060133c1f8d92c6675
train
Scanner.total_count
count the number of matches above the cutoff returns an iterator of lists containing integer counts
gimmemotifs/scanner.py
def total_count(self, seqs, nreport=100, scan_rc=True): """ count the number of matches above the cutoff returns an iterator of lists containing integer counts """ count_table = [counts for counts in self.count(seqs, nreport, scan_rc)] return np.sum(np.array(coun...
def total_count(self, seqs, nreport=100, scan_rc=True): """ count the number of matches above the cutoff returns an iterator of lists containing integer counts """ count_table = [counts for counts in self.count(seqs, nreport, scan_rc)] return np.sum(np.array(coun...
[ "count", "the", "number", "of", "matches", "above", "the", "cutoff", "returns", "an", "iterator", "of", "lists", "containing", "integer", "counts" ]
vanheeringen-lab/gimmemotifs
python
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/scanner.py#L524-L531
[ "def", "total_count", "(", "self", ",", "seqs", ",", "nreport", "=", "100", ",", "scan_rc", "=", "True", ")", ":", "count_table", "=", "[", "counts", "for", "counts", "in", "self", ".", "count", "(", "seqs", ",", "nreport", ",", "scan_rc", ")", "]", ...
1dc0572179e5d0c8f96958060133c1f8d92c6675
train
Scanner.best_score
give the score of the best match of each motif in each sequence returns an iterator of lists containing floats
gimmemotifs/scanner.py
def best_score(self, seqs, scan_rc=True, normalize=False): """ give the score of the best match of each motif in each sequence returns an iterator of lists containing floats """ self.set_threshold(threshold=0.0) if normalize and len(self.meanstd) == 0: self.se...
def best_score(self, seqs, scan_rc=True, normalize=False): """ give the score of the best match of each motif in each sequence returns an iterator of lists containing floats """ self.set_threshold(threshold=0.0) if normalize and len(self.meanstd) == 0: self.se...
[ "give", "the", "score", "of", "the", "best", "match", "of", "each", "motif", "in", "each", "sequence", "returns", "an", "iterator", "of", "lists", "containing", "floats" ]
vanheeringen-lab/gimmemotifs
python
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/scanner.py#L533-L548
[ "def", "best_score", "(", "self", ",", "seqs", ",", "scan_rc", "=", "True", ",", "normalize", "=", "False", ")", ":", "self", ".", "set_threshold", "(", "threshold", "=", "0.0", ")", "if", "normalize", "and", "len", "(", "self", ".", "meanstd", ")", ...
1dc0572179e5d0c8f96958060133c1f8d92c6675
train
Scanner.best_match
give the best match of each motif in each sequence returns an iterator of nested lists containing tuples: (score, position, strand)
gimmemotifs/scanner.py
def best_match(self, seqs, scan_rc=True): """ give the best match of each motif in each sequence returns an iterator of nested lists containing tuples: (score, position, strand) """ self.set_threshold(threshold=0.0) for matches in self.scan(seqs, 1, scan_rc): ...
def best_match(self, seqs, scan_rc=True): """ give the best match of each motif in each sequence returns an iterator of nested lists containing tuples: (score, position, strand) """ self.set_threshold(threshold=0.0) for matches in self.scan(seqs, 1, scan_rc): ...
[ "give", "the", "best", "match", "of", "each", "motif", "in", "each", "sequence", "returns", "an", "iterator", "of", "nested", "lists", "containing", "tuples", ":", "(", "score", "position", "strand", ")" ]
vanheeringen-lab/gimmemotifs
python
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/scanner.py#L550-L558
[ "def", "best_match", "(", "self", ",", "seqs", ",", "scan_rc", "=", "True", ")", ":", "self", ".", "set_threshold", "(", "threshold", "=", "0.0", ")", "for", "matches", "in", "self", ".", "scan", "(", "seqs", ",", "1", ",", "scan_rc", ")", ":", "yi...
1dc0572179e5d0c8f96958060133c1f8d92c6675
train
Scanner.scan
scan a set of regions / sequences
gimmemotifs/scanner.py
def scan(self, seqs, nreport=100, scan_rc=True, normalize=False): """ scan a set of regions / sequences """ if not self.threshold: sys.stderr.write( "Using default threshold of 0.95. " "This is likely not optimal!\n" ) ...
def scan(self, seqs, nreport=100, scan_rc=True, normalize=False): """ scan a set of regions / sequences """ if not self.threshold: sys.stderr.write( "Using default threshold of 0.95. " "This is likely not optimal!\n" ) ...
[ "scan", "a", "set", "of", "regions", "/", "sequences" ]
vanheeringen-lab/gimmemotifs
python
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/scanner.py#L560-L593
[ "def", "scan", "(", "self", ",", "seqs", ",", "nreport", "=", "100", ",", "scan_rc", "=", "True", ",", "normalize", "=", "False", ")", ":", "if", "not", "self", ".", "threshold", ":", "sys", ".", "stderr", ".", "write", "(", "\"Using default threshold ...
1dc0572179e5d0c8f96958060133c1f8d92c6675
train
roc
Calculate ROC_AUC and other metrics and optionally plot ROC curve.
gimmemotifs/commands/roc.py
def roc(args): """ Calculate ROC_AUC and other metrics and optionally plot ROC curve.""" outputfile = args.outfile # Default extension for image if outputfile and not outputfile.endswith(".png"): outputfile += ".png" motifs = read_motifs(args.pwmfile, fmt="pwm") ids = [] if arg...
def roc(args): """ Calculate ROC_AUC and other metrics and optionally plot ROC curve.""" outputfile = args.outfile # Default extension for image if outputfile and not outputfile.endswith(".png"): outputfile += ".png" motifs = read_motifs(args.pwmfile, fmt="pwm") ids = [] if arg...
[ "Calculate", "ROC_AUC", "and", "other", "metrics", "and", "optionally", "plot", "ROC", "curve", "." ]
vanheeringen-lab/gimmemotifs
python
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/commands/roc.py#L85-L161
[ "def", "roc", "(", "args", ")", ":", "outputfile", "=", "args", ".", "outfile", "# Default extension for image", "if", "outputfile", "and", "not", "outputfile", ".", "endswith", "(", "\".png\"", ")", ":", "outputfile", "+=", "\".png\"", "motifs", "=", "read_mo...
1dc0572179e5d0c8f96958060133c1f8d92c6675
train
ssd
Calculates motif position similarity based on sum of squared distances. Parameters ---------- p1 : list Motif position 1. p2 : list Motif position 2. Returns ------- score : float
gimmemotifs/comparison.py
def ssd(p1, p2): """Calculates motif position similarity based on sum of squared distances. Parameters ---------- p1 : list Motif position 1. p2 : list Motif position 2. Returns ------- score : float """ return 2 - np.sum([(a-b)**2 for a,b in zip(p1...
def ssd(p1, p2): """Calculates motif position similarity based on sum of squared distances. Parameters ---------- p1 : list Motif position 1. p2 : list Motif position 2. Returns ------- score : float """ return 2 - np.sum([(a-b)**2 for a,b in zip(p1...
[ "Calculates", "motif", "position", "similarity", "based", "on", "sum", "of", "squared", "distances", ".", "Parameters", "----------", "p1", ":", "list", "Motif", "position", "1", ".", "p2", ":", "list", "Motif", "position", "2", ".", "Returns", "-------", "s...
vanheeringen-lab/gimmemotifs
python
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/comparison.py#L196-L211
[ "def", "ssd", "(", "p1", ",", "p2", ")", ":", "return", "2", "-", "np", ".", "sum", "(", "[", "(", "a", "-", "b", ")", "**", "2", "for", "a", ",", "b", "in", "zip", "(", "p1", ",", "p2", ")", "]", ")" ]
1dc0572179e5d0c8f96958060133c1f8d92c6675
train
seqcor
Calculates motif similarity based on Pearson correlation of scores. Based on Kielbasa (2015) and Grau (2015). Scores are calculated based on scanning a de Bruijn sequence of 7-mers. This sequence is taken from ShortCAKE (Orenstein & Shamir, 2015). Optionally another sequence can be given as an argumen...
gimmemotifs/comparison.py
def seqcor(m1, m2, seq=None): """Calculates motif similarity based on Pearson correlation of scores. Based on Kielbasa (2015) and Grau (2015). Scores are calculated based on scanning a de Bruijn sequence of 7-mers. This sequence is taken from ShortCAKE (Orenstein & Shamir, 2015). Optionally anothe...
def seqcor(m1, m2, seq=None): """Calculates motif similarity based on Pearson correlation of scores. Based on Kielbasa (2015) and Grau (2015). Scores are calculated based on scanning a de Bruijn sequence of 7-mers. This sequence is taken from ShortCAKE (Orenstein & Shamir, 2015). Optionally anothe...
[ "Calculates", "motif", "similarity", "based", "on", "Pearson", "correlation", "of", "scores", "." ]
vanheeringen-lab/gimmemotifs
python
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/comparison.py#L213-L266
[ "def", "seqcor", "(", "m1", ",", "m2", ",", "seq", "=", "None", ")", ":", "l1", "=", "len", "(", "m1", ")", "l2", "=", "len", "(", "m2", ")", "l", "=", "max", "(", "l1", ",", "l2", ")", "if", "seq", "is", "None", ":", "seq", "=", "RCDB", ...
1dc0572179e5d0c8f96958060133c1f8d92c6675
train
MotifComparer.compare_motifs
Compare two motifs. The similarity metric can be any of seqcor, pcc, ed, distance, wic, chisq, akl or ssd. If match is 'total' the similarity score is calculated for the whole match, including positions that are not present in both motifs. If match is partial or subtotal, onl...
gimmemotifs/comparison.py
def compare_motifs(self, m1, m2, match="total", metric="wic", combine="mean", pval=False): """Compare two motifs. The similarity metric can be any of seqcor, pcc, ed, distance, wic, chisq, akl or ssd. If match is 'total' the similarity score is calculated for the whole match, ...
def compare_motifs(self, m1, m2, match="total", metric="wic", combine="mean", pval=False): """Compare two motifs. The similarity metric can be any of seqcor, pcc, ed, distance, wic, chisq, akl or ssd. If match is 'total' the similarity score is calculated for the whole match, ...
[ "Compare", "two", "motifs", ".", "The", "similarity", "metric", "can", "be", "any", "of", "seqcor", "pcc", "ed", "distance", "wic", "chisq", "akl", "or", "ssd", ".", "If", "match", "is", "total", "the", "similarity", "score", "is", "calculated", "for", "...
vanheeringen-lab/gimmemotifs
python
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/comparison.py#L322-L386
[ "def", "compare_motifs", "(", "self", ",", "m1", ",", "m2", ",", "match", "=", "\"total\"", ",", "metric", "=", "\"wic\"", ",", "combine", "=", "\"mean\"", ",", "pval", "=", "False", ")", ":", "if", "metric", "==", "\"seqcor\"", ":", "return", "seqcor"...
1dc0572179e5d0c8f96958060133c1f8d92c6675
train
MotifComparer.get_all_scores
Pairwise comparison of a set of motifs compared to reference motifs. Parameters ---------- motifs : list List of Motif instances. dbmotifs : list List of Motif instances. match : str Match can be "partial", "subtotal" or "total". Not all met...
gimmemotifs/comparison.py
def get_all_scores(self, motifs, dbmotifs, match, metric, combine, pval=False, parallel=True, trim=None, ncpus=None): """Pairwise comparison of a set of motifs compared to reference motifs. Parameters ---------- motifs : list List of Motif instan...
def get_all_scores(self, motifs, dbmotifs, match, metric, combine, pval=False, parallel=True, trim=None, ncpus=None): """Pairwise comparison of a set of motifs compared to reference motifs. Parameters ---------- motifs : list List of Motif instan...
[ "Pairwise", "comparison", "of", "a", "set", "of", "motifs", "compared", "to", "reference", "motifs", "." ]
vanheeringen-lab/gimmemotifs
python
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/comparison.py#L574-L660
[ "def", "get_all_scores", "(", "self", ",", "motifs", ",", "dbmotifs", ",", "match", ",", "metric", ",", "combine", ",", "pval", "=", "False", ",", "parallel", "=", "True", ",", "trim", "=", "None", ",", "ncpus", "=", "None", ")", ":", "# trim motifs fi...
1dc0572179e5d0c8f96958060133c1f8d92c6675
train
MotifComparer.get_closest_match
Return best match in database for motifs. Parameters ---------- motifs : list or str Filename of motifs or list of motifs. dbmotifs : list or str, optional Database motifs, default will be used if not specified. match : str, optional metric : s...
gimmemotifs/comparison.py
def get_closest_match(self, motifs, dbmotifs=None, match="partial", metric="wic",combine="mean", parallel=True, ncpus=None): """Return best match in database for motifs. Parameters ---------- motifs : list or str Filename of motifs or list of motifs. dbmotifs : list...
def get_closest_match(self, motifs, dbmotifs=None, match="partial", metric="wic",combine="mean", parallel=True, ncpus=None): """Return best match in database for motifs. Parameters ---------- motifs : list or str Filename of motifs or list of motifs. dbmotifs : list...
[ "Return", "best", "match", "in", "database", "for", "motifs", "." ]
vanheeringen-lab/gimmemotifs
python
https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/comparison.py#L662-L711
[ "def", "get_closest_match", "(", "self", ",", "motifs", ",", "dbmotifs", "=", "None", ",", "match", "=", "\"partial\"", ",", "metric", "=", "\"wic\"", ",", "combine", "=", "\"mean\"", ",", "parallel", "=", "True", ",", "ncpus", "=", "None", ")", ":", "...
1dc0572179e5d0c8f96958060133c1f8d92c6675
train
list_regions
List regions for the service
aws/main.py
def list_regions(service): """ List regions for the service """ for region in service.regions(): print '%(name)s: %(endpoint)s' % { 'name': region.name, 'endpoint': region.endpoint, }
def list_regions(service): """ List regions for the service """ for region in service.regions(): print '%(name)s: %(endpoint)s' % { 'name': region.name, 'endpoint': region.endpoint, }
[ "List", "regions", "for", "the", "service" ]
eofs/aws
python
https://github.com/eofs/aws/blob/479cbe27a9f289b43f32f8e3de7d048a4a8993fe/aws/main.py#L18-L26
[ "def", "list_regions", "(", "service", ")", ":", "for", "region", "in", "service", ".", "regions", "(", ")", ":", "print", "'%(name)s: %(endpoint)s'", "%", "{", "'name'", ":", "region", ".", "name", ",", "'endpoint'", ":", "region", ".", "endpoint", ",", ...
479cbe27a9f289b43f32f8e3de7d048a4a8993fe
train
elb_table
Print nice looking table of information from list of load balancers
aws/main.py
def elb_table(balancers): """ Print nice looking table of information from list of load balancers """ t = prettytable.PrettyTable(['Name', 'DNS', 'Ports', 'Zones', 'Created']) t.align = 'l' for b in balancers: ports = ['%s: %s -> %s' % (l[2], l[0], l[1]) for l in b.listeners] por...
def elb_table(balancers): """ Print nice looking table of information from list of load balancers """ t = prettytable.PrettyTable(['Name', 'DNS', 'Ports', 'Zones', 'Created']) t.align = 'l' for b in balancers: ports = ['%s: %s -> %s' % (l[2], l[0], l[1]) for l in b.listeners] por...
[ "Print", "nice", "looking", "table", "of", "information", "from", "list", "of", "load", "balancers" ]
eofs/aws
python
https://github.com/eofs/aws/blob/479cbe27a9f289b43f32f8e3de7d048a4a8993fe/aws/main.py#L29-L40
[ "def", "elb_table", "(", "balancers", ")", ":", "t", "=", "prettytable", ".", "PrettyTable", "(", "[", "'Name'", ",", "'DNS'", ",", "'Ports'", ",", "'Zones'", ",", "'Created'", "]", ")", "t", ".", "align", "=", "'l'", "for", "b", "in", "balancers", "...
479cbe27a9f289b43f32f8e3de7d048a4a8993fe
train
ec2_table
Print nice looking table of information from list of instances
aws/main.py
def ec2_table(instances): """ Print nice looking table of information from list of instances """ t = prettytable.PrettyTable(['ID', 'State', 'Monitored', 'Image', 'Name', 'Type', 'SSH key', 'DNS']) t.align = 'l' for i in instances: name = i.tags.get('Name', '') t.add_row([i.id, i...
def ec2_table(instances): """ Print nice looking table of information from list of instances """ t = prettytable.PrettyTable(['ID', 'State', 'Monitored', 'Image', 'Name', 'Type', 'SSH key', 'DNS']) t.align = 'l' for i in instances: name = i.tags.get('Name', '') t.add_row([i.id, i...
[ "Print", "nice", "looking", "table", "of", "information", "from", "list", "of", "instances" ]
eofs/aws
python
https://github.com/eofs/aws/blob/479cbe27a9f289b43f32f8e3de7d048a4a8993fe/aws/main.py#L43-L52
[ "def", "ec2_table", "(", "instances", ")", ":", "t", "=", "prettytable", ".", "PrettyTable", "(", "[", "'ID'", ",", "'State'", ",", "'Monitored'", ",", "'Image'", ",", "'Name'", ",", "'Type'", ",", "'SSH key'", ",", "'DNS'", "]", ")", "t", ".", "align"...
479cbe27a9f289b43f32f8e3de7d048a4a8993fe
train
ec2_image_table
Print nice looking table of information from images
aws/main.py
def ec2_image_table(images): """ Print nice looking table of information from images """ t = prettytable.PrettyTable(['ID', 'State', 'Name', 'Owner', 'Root device', 'Is public', 'Description']) t.align = 'l' for i in images: t.add_row([i.id, i.state, i.name, i.ownerId, i.root_device_type...
def ec2_image_table(images): """ Print nice looking table of information from images """ t = prettytable.PrettyTable(['ID', 'State', 'Name', 'Owner', 'Root device', 'Is public', 'Description']) t.align = 'l' for i in images: t.add_row([i.id, i.state, i.name, i.ownerId, i.root_device_type...
[ "Print", "nice", "looking", "table", "of", "information", "from", "images" ]
eofs/aws
python
https://github.com/eofs/aws/blob/479cbe27a9f289b43f32f8e3de7d048a4a8993fe/aws/main.py#L54-L62
[ "def", "ec2_image_table", "(", "images", ")", ":", "t", "=", "prettytable", ".", "PrettyTable", "(", "[", "'ID'", ",", "'State'", ",", "'Name'", ",", "'Owner'", ",", "'Root device'", ",", "'Is public'", ",", "'Description'", "]", ")", "t", ".", "align", ...
479cbe27a9f289b43f32f8e3de7d048a4a8993fe
train
ec2_fab
Run Fabric commands against EC2 instances
aws/main.py
def ec2_fab(service, args): """ Run Fabric commands against EC2 instances """ instance_ids = args.instances instances = service.list(elb=args.elb, instance_ids=instance_ids) hosts = service.resolve_hosts(instances) fab.env.hosts = hosts fab.env.key_filename = settings.get('SSH', 'KEY_FI...
def ec2_fab(service, args): """ Run Fabric commands against EC2 instances """ instance_ids = args.instances instances = service.list(elb=args.elb, instance_ids=instance_ids) hosts = service.resolve_hosts(instances) fab.env.hosts = hosts fab.env.key_filename = settings.get('SSH', 'KEY_FI...
[ "Run", "Fabric", "commands", "against", "EC2", "instances" ]
eofs/aws
python
https://github.com/eofs/aws/blob/479cbe27a9f289b43f32f8e3de7d048a4a8993fe/aws/main.py#L64-L92
[ "def", "ec2_fab", "(", "service", ",", "args", ")", ":", "instance_ids", "=", "args", ".", "instances", "instances", "=", "service", ".", "list", "(", "elb", "=", "args", ".", "elb", ",", "instance_ids", "=", "instance_ids", ")", "hosts", "=", "service",...
479cbe27a9f289b43f32f8e3de7d048a4a8993fe
train
main
AWS support script's main method
aws/main.py
def main(): """ AWS support script's main method """ p = argparse.ArgumentParser(description='Manage Amazon AWS services', prog='aws', version=__version__) subparsers = p.add_subparsers(help='Select Amazon AWS service to use') # Au...
def main(): """ AWS support script's main method """ p = argparse.ArgumentParser(description='Manage Amazon AWS services', prog='aws', version=__version__) subparsers = p.add_subparsers(help='Select Amazon AWS service to use') # Au...
[ "AWS", "support", "script", "s", "main", "method" ]
eofs/aws
python
https://github.com/eofs/aws/blob/479cbe27a9f289b43f32f8e3de7d048a4a8993fe/aws/main.py#L222-L330
[ "def", "main", "(", ")", ":", "p", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "'Manage Amazon AWS services'", ",", "prog", "=", "'aws'", ",", "version", "=", "__version__", ")", "subparsers", "=", "p", ".", "add_subparsers", "(", "help"...
479cbe27a9f289b43f32f8e3de7d048a4a8993fe
train
buffer_stream
Buffer "data" from an stream into one data object. Parameters ---------- stream : stream The stream to buffer buffer_size : int > 0 The number of examples to retain per batch. partial : bool, default=False If True, yield a final partial batch on under-run. axis : int ...
pescador/maps.py
def buffer_stream(stream, buffer_size, partial=False, axis=None): '''Buffer "data" from an stream into one data object. Parameters ---------- stream : stream The stream to buffer buffer_size : int > 0 The number of examples to retain per batch. partial : bool, default=False ...
def buffer_stream(stream, buffer_size, partial=False, axis=None): '''Buffer "data" from an stream into one data object. Parameters ---------- stream : stream The stream to buffer buffer_size : int > 0 The number of examples to retain per batch. partial : bool, default=False ...
[ "Buffer", "data", "from", "an", "stream", "into", "one", "data", "object", "." ]
pescadores/pescador
python
https://github.com/pescadores/pescador/blob/786e2b5f882d13ea563769fbc7ad0a0a10c3553d/pescador/maps.py#L34-L84
[ "def", "buffer_stream", "(", "stream", ",", "buffer_size", ",", "partial", "=", "False", ",", "axis", "=", "None", ")", ":", "data", "=", "[", "]", "count", "=", "0", "for", "item", "in", "stream", ":", "data", ".", "append", "(", "item", ")", "cou...
786e2b5f882d13ea563769fbc7ad0a0a10c3553d
train
tuples
Reformat data as tuples. Parameters ---------- stream : iterable Stream of data objects. *keys : strings Keys to use for ordering data. Yields ------ items : tuple of np.ndarrays Data object reformated as a tuple. Raises ------ DataError If the...
pescador/maps.py
def tuples(stream, *keys): """Reformat data as tuples. Parameters ---------- stream : iterable Stream of data objects. *keys : strings Keys to use for ordering data. Yields ------ items : tuple of np.ndarrays Data object reformated as a tuple. Raises -...
def tuples(stream, *keys): """Reformat data as tuples. Parameters ---------- stream : iterable Stream of data objects. *keys : strings Keys to use for ordering data. Yields ------ items : tuple of np.ndarrays Data object reformated as a tuple. Raises -...
[ "Reformat", "data", "as", "tuples", "." ]
pescadores/pescador
python
https://github.com/pescadores/pescador/blob/786e2b5f882d13ea563769fbc7ad0a0a10c3553d/pescador/maps.py#L87-L117
[ "def", "tuples", "(", "stream", ",", "*", "keys", ")", ":", "if", "not", "keys", ":", "raise", "PescadorError", "(", "'Unable to generate tuples from '", "'an empty item set'", ")", "for", "data", "in", "stream", ":", "try", ":", "yield", "tuple", "(", "data...
786e2b5f882d13ea563769fbc7ad0a0a10c3553d