repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
brutasse/graphite-api
graphite_api/functions.py
_getPercentile
def _getPercentile(points, n, interpolate=False): """ Percentile is calculated using the method outlined in the NIST Engineering Statistics Handbook: http://www.itl.nist.gov/div898/handbook/prc/section2/prc252.htm """ sortedPoints = sorted(not_none(points)) if len(sortedPoints) == 0: ...
python
def _getPercentile(points, n, interpolate=False): """ Percentile is calculated using the method outlined in the NIST Engineering Statistics Handbook: http://www.itl.nist.gov/div898/handbook/prc/section2/prc252.htm """ sortedPoints = sorted(not_none(points)) if len(sortedPoints) == 0: ...
[ "def", "_getPercentile", "(", "points", ",", "n", ",", "interpolate", "=", "False", ")", ":", "sortedPoints", "=", "sorted", "(", "not_none", "(", "points", ")", ")", "if", "len", "(", "sortedPoints", ")", "==", "0", ":", "return", "None", "fractionalRan...
Percentile is calculated using the method outlined in the NIST Engineering Statistics Handbook: http://www.itl.nist.gov/div898/handbook/prc/section2/prc252.htm
[ "Percentile", "is", "calculated", "using", "the", "method", "outlined", "in", "the", "NIST", "Engineering", "Statistics", "Handbook", ":", "http", ":", "//", "www", ".", "itl", ".", "nist", ".", "gov", "/", "div898", "/", "handbook", "/", "prc", "/", "se...
train
https://github.com/brutasse/graphite-api/blob/0886b7adcf985a1e8bcb084f6dd1dc166a3f3dff/graphite_api/functions.py#L2340-L2368
brutasse/graphite-api
graphite_api/functions.py
nPercentile
def nPercentile(requestContext, seriesList, n): """Returns n-percent of each series in the seriesList.""" assert n, 'The requested percent is required to be greater than 0' results = [] for s in seriesList: # Create a sorted copy of the TimeSeries excluding None values in the # values l...
python
def nPercentile(requestContext, seriesList, n): """Returns n-percent of each series in the seriesList.""" assert n, 'The requested percent is required to be greater than 0' results = [] for s in seriesList: # Create a sorted copy of the TimeSeries excluding None values in the # values l...
[ "def", "nPercentile", "(", "requestContext", ",", "seriesList", ",", "n", ")", ":", "assert", "n", ",", "'The requested percent is required to be greater than 0'", "results", "=", "[", "]", "for", "s", "in", "seriesList", ":", "# Create a sorted copy of the TimeSeries e...
Returns n-percent of each series in the seriesList.
[ "Returns", "n", "-", "percent", "of", "each", "series", "in", "the", "seriesList", "." ]
train
https://github.com/brutasse/graphite-api/blob/0886b7adcf985a1e8bcb084f6dd1dc166a3f3dff/graphite_api/functions.py#L2371-L2392
brutasse/graphite-api
graphite_api/functions.py
averageOutsidePercentile
def averageOutsidePercentile(requestContext, seriesList, n): """ Removes functions lying inside an average percentile interval """ averages = [safeAvg(s) for s in seriesList] if n < 50: n = 100 - n lowPercentile = _getPercentile(averages, 100 - n) highPercentile = _getPercentile(av...
python
def averageOutsidePercentile(requestContext, seriesList, n): """ Removes functions lying inside an average percentile interval """ averages = [safeAvg(s) for s in seriesList] if n < 50: n = 100 - n lowPercentile = _getPercentile(averages, 100 - n) highPercentile = _getPercentile(av...
[ "def", "averageOutsidePercentile", "(", "requestContext", ",", "seriesList", ",", "n", ")", ":", "averages", "=", "[", "safeAvg", "(", "s", ")", "for", "s", "in", "seriesList", "]", "if", "n", "<", "50", ":", "n", "=", "100", "-", "n", "lowPercentile",...
Removes functions lying inside an average percentile interval
[ "Removes", "functions", "lying", "inside", "an", "average", "percentile", "interval" ]
train
https://github.com/brutasse/graphite-api/blob/0886b7adcf985a1e8bcb084f6dd1dc166a3f3dff/graphite_api/functions.py#L2395-L2408
brutasse/graphite-api
graphite_api/functions.py
removeBetweenPercentile
def removeBetweenPercentile(requestContext, seriesList, n): """ Removes lines who do not have an value lying in the x-percentile of all the values at a moment """ if n < 50: n = 100 - n transposed = list(zip_longest(*seriesList)) lowPercentiles = [_getPercentile(col, 100-n) for col...
python
def removeBetweenPercentile(requestContext, seriesList, n): """ Removes lines who do not have an value lying in the x-percentile of all the values at a moment """ if n < 50: n = 100 - n transposed = list(zip_longest(*seriesList)) lowPercentiles = [_getPercentile(col, 100-n) for col...
[ "def", "removeBetweenPercentile", "(", "requestContext", ",", "seriesList", ",", "n", ")", ":", "if", "n", "<", "50", ":", "n", "=", "100", "-", "n", "transposed", "=", "list", "(", "zip_longest", "(", "*", "seriesList", ")", ")", "lowPercentiles", "=", ...
Removes lines who do not have an value lying in the x-percentile of all the values at a moment
[ "Removes", "lines", "who", "do", "not", "have", "an", "value", "lying", "in", "the", "x", "-", "percentile", "of", "all", "the", "values", "at", "a", "moment" ]
train
https://github.com/brutasse/graphite-api/blob/0886b7adcf985a1e8bcb084f6dd1dc166a3f3dff/graphite_api/functions.py#L2411-L2426
brutasse/graphite-api
graphite_api/functions.py
removeAboveValue
def removeAboveValue(requestContext, seriesList, n): """ Removes data above the given threshold from the series or list of series provided. Values above this threshold are assigned a value of None. """ for s in seriesList: s.name = 'removeAboveValue(%s, %g)' % (s.name, n) s.pathExpre...
python
def removeAboveValue(requestContext, seriesList, n): """ Removes data above the given threshold from the series or list of series provided. Values above this threshold are assigned a value of None. """ for s in seriesList: s.name = 'removeAboveValue(%s, %g)' % (s.name, n) s.pathExpre...
[ "def", "removeAboveValue", "(", "requestContext", ",", "seriesList", ",", "n", ")", ":", "for", "s", "in", "seriesList", ":", "s", ".", "name", "=", "'removeAboveValue(%s, %g)'", "%", "(", "s", ".", "name", ",", "n", ")", "s", ".", "pathExpression", "=",...
Removes data above the given threshold from the series or list of series provided. Values above this threshold are assigned a value of None.
[ "Removes", "data", "above", "the", "given", "threshold", "from", "the", "series", "or", "list", "of", "series", "provided", ".", "Values", "above", "this", "threshold", "are", "assigned", "a", "value", "of", "None", "." ]
train
https://github.com/brutasse/graphite-api/blob/0886b7adcf985a1e8bcb084f6dd1dc166a3f3dff/graphite_api/functions.py#L2450-L2464
brutasse/graphite-api
graphite_api/functions.py
removeBelowPercentile
def removeBelowPercentile(requestContext, seriesList, n): """ Removes data below the nth percentile from the series or list of series provided. Values below this percentile are assigned a value of None. """ for s in seriesList: s.name = 'removeBelowPercentile(%s, %g)' % (s.name, n) s...
python
def removeBelowPercentile(requestContext, seriesList, n): """ Removes data below the nth percentile from the series or list of series provided. Values below this percentile are assigned a value of None. """ for s in seriesList: s.name = 'removeBelowPercentile(%s, %g)' % (s.name, n) s...
[ "def", "removeBelowPercentile", "(", "requestContext", ",", "seriesList", ",", "n", ")", ":", "for", "s", "in", "seriesList", ":", "s", ".", "name", "=", "'removeBelowPercentile(%s, %g)'", "%", "(", "s", ".", "name", ",", "n", ")", "s", ".", "pathExpressio...
Removes data below the nth percentile from the series or list of series provided. Values below this percentile are assigned a value of None.
[ "Removes", "data", "below", "the", "nth", "percentile", "from", "the", "series", "or", "list", "of", "series", "provided", ".", "Values", "below", "this", "percentile", "are", "assigned", "a", "value", "of", "None", "." ]
train
https://github.com/brutasse/graphite-api/blob/0886b7adcf985a1e8bcb084f6dd1dc166a3f3dff/graphite_api/functions.py#L2467-L2485
brutasse/graphite-api
graphite_api/functions.py
sortByName
def sortByName(requestContext, seriesList, natural=False): """ Takes one metric or a wildcard seriesList. Sorts the list of metrics by the metric name using either alphabetical order or natural sorting. Natural sorting allows names containing numbers to be sorted more naturally, e.g: - Alphabe...
python
def sortByName(requestContext, seriesList, natural=False): """ Takes one metric or a wildcard seriesList. Sorts the list of metrics by the metric name using either alphabetical order or natural sorting. Natural sorting allows names containing numbers to be sorted more naturally, e.g: - Alphabe...
[ "def", "sortByName", "(", "requestContext", ",", "seriesList", ",", "natural", "=", "False", ")", ":", "if", "natural", ":", "return", "list", "(", "sorted", "(", "seriesList", ",", "key", "=", "lambda", "x", ":", "paddedName", "(", "x", ".", "name", "...
Takes one metric or a wildcard seriesList. Sorts the list of metrics by the metric name using either alphabetical order or natural sorting. Natural sorting allows names containing numbers to be sorted more naturally, e.g: - Alphabetical sorting: server1, server11, server12, server2 - Natural sorti...
[ "Takes", "one", "metric", "or", "a", "wildcard", "seriesList", "." ]
train
https://github.com/brutasse/graphite-api/blob/0886b7adcf985a1e8bcb084f6dd1dc166a3f3dff/graphite_api/functions.py#L2526-L2541
brutasse/graphite-api
graphite_api/functions.py
sortByTotal
def sortByTotal(requestContext, seriesList): """ Takes one metric or a wildcard seriesList. Sorts the list of metrics by the sum of values across the time period specified. """ return list(sorted(seriesList, key=safeSum, reverse=True))
python
def sortByTotal(requestContext, seriesList): """ Takes one metric or a wildcard seriesList. Sorts the list of metrics by the sum of values across the time period specified. """ return list(sorted(seriesList, key=safeSum, reverse=True))
[ "def", "sortByTotal", "(", "requestContext", ",", "seriesList", ")", ":", "return", "list", "(", "sorted", "(", "seriesList", ",", "key", "=", "safeSum", ",", "reverse", "=", "True", ")", ")" ]
Takes one metric or a wildcard seriesList. Sorts the list of metrics by the sum of values across the time period specified.
[ "Takes", "one", "metric", "or", "a", "wildcard", "seriesList", "." ]
train
https://github.com/brutasse/graphite-api/blob/0886b7adcf985a1e8bcb084f6dd1dc166a3f3dff/graphite_api/functions.py#L2544-L2551
brutasse/graphite-api
graphite_api/functions.py
useSeriesAbove
def useSeriesAbove(requestContext, seriesList, value, search, replace): """ Compares the maximum of each series against the given `value`. If the series maximum is greater than `value`, the regular expression search and replace is applied against the series name to plot a related metric. e.g. given...
python
def useSeriesAbove(requestContext, seriesList, value, search, replace): """ Compares the maximum of each series against the given `value`. If the series maximum is greater than `value`, the regular expression search and replace is applied against the series name to plot a related metric. e.g. given...
[ "def", "useSeriesAbove", "(", "requestContext", ",", "seriesList", ",", "value", ",", "search", ",", "replace", ")", ":", "newSeries", "=", "[", "]", "for", "series", "in", "seriesList", ":", "newname", "=", "re", ".", "sub", "(", "search", ",", "replace...
Compares the maximum of each series against the given `value`. If the series maximum is greater than `value`, the regular expression search and replace is applied against the series name to plot a related metric. e.g. given useSeriesAbove(ganglia.metric1.reqs,10,'reqs','time'), the response time metric...
[ "Compares", "the", "maximum", "of", "each", "series", "against", "the", "given", "value", ".", "If", "the", "series", "maximum", "is", "greater", "than", "value", "the", "regular", "expression", "search", "and", "replace", "is", "applied", "against", "the", ...
train
https://github.com/brutasse/graphite-api/blob/0886b7adcf985a1e8bcb084f6dd1dc166a3f3dff/graphite_api/functions.py#L2585-L2608
brutasse/graphite-api
graphite_api/functions.py
mostDeviant
def mostDeviant(requestContext, seriesList, n): """ Takes one metric or a wildcard seriesList followed by an integer N. Draws the N most deviant metrics. To find the deviants, the standard deviation (sigma) of each series is taken and ranked. The top N standard deviations are returned. Example:...
python
def mostDeviant(requestContext, seriesList, n): """ Takes one metric or a wildcard seriesList followed by an integer N. Draws the N most deviant metrics. To find the deviants, the standard deviation (sigma) of each series is taken and ranked. The top N standard deviations are returned. Example:...
[ "def", "mostDeviant", "(", "requestContext", ",", "seriesList", ",", "n", ")", ":", "deviants", "=", "[", "]", "for", "series", "in", "seriesList", ":", "mean", "=", "safeAvg", "(", "series", ")", "if", "mean", "is", "None", ":", "continue", "square_sum"...
Takes one metric or a wildcard seriesList followed by an integer N. Draws the N most deviant metrics. To find the deviants, the standard deviation (sigma) of each series is taken and ranked. The top N standard deviations are returned. Example:: &target=mostDeviant(server*.instance*.memory.free...
[ "Takes", "one", "metric", "or", "a", "wildcard", "seriesList", "followed", "by", "an", "integer", "N", ".", "Draws", "the", "N", "most", "deviant", "metrics", ".", "To", "find", "the", "deviants", "the", "standard", "deviation", "(", "sigma", ")", "of", ...
train
https://github.com/brutasse/graphite-api/blob/0886b7adcf985a1e8bcb084f6dd1dc166a3f3dff/graphite_api/functions.py#L2629-L2656
brutasse/graphite-api
graphite_api/functions.py
stdev
def stdev(requestContext, seriesList, points, windowTolerance=0.1): """ Takes one metric or a wildcard seriesList followed by an integer N. Draw the Standard Deviation of all metrics passed for the past N datapoints. If the ratio of null points in the window is greater than windowTolerance, skip the...
python
def stdev(requestContext, seriesList, points, windowTolerance=0.1): """ Takes one metric or a wildcard seriesList followed by an integer N. Draw the Standard Deviation of all metrics passed for the past N datapoints. If the ratio of null points in the window is greater than windowTolerance, skip the...
[ "def", "stdev", "(", "requestContext", ",", "seriesList", ",", "points", ",", "windowTolerance", "=", "0.1", ")", ":", "# For this we take the standard deviation in terms of the moving average", "# and the moving average of series squares.", "for", "seriesIndex", ",", "series",...
Takes one metric or a wildcard seriesList followed by an integer N. Draw the Standard Deviation of all metrics passed for the past N datapoints. If the ratio of null points in the window is greater than windowTolerance, skip the calculation. The default for windowTolerance is 0.1 (up to 10% of points in...
[ "Takes", "one", "metric", "or", "a", "wildcard", "seriesList", "followed", "by", "an", "integer", "N", ".", "Draw", "the", "Standard", "Deviation", "of", "all", "metrics", "passed", "for", "the", "past", "N", "datapoints", ".", "If", "the", "ratio", "of", ...
train
https://github.com/brutasse/graphite-api/blob/0886b7adcf985a1e8bcb084f6dd1dc166a3f3dff/graphite_api/functions.py#L2659-L2728
brutasse/graphite-api
graphite_api/functions.py
secondYAxis
def secondYAxis(requestContext, seriesList): """ Graph the series on the secondary Y axis. """ for series in seriesList: series.options['secondYAxis'] = True series.name = 'secondYAxis(%s)' % series.name return seriesList
python
def secondYAxis(requestContext, seriesList): """ Graph the series on the secondary Y axis. """ for series in seriesList: series.options['secondYAxis'] = True series.name = 'secondYAxis(%s)' % series.name return seriesList
[ "def", "secondYAxis", "(", "requestContext", ",", "seriesList", ")", ":", "for", "series", "in", "seriesList", ":", "series", ".", "options", "[", "'secondYAxis'", "]", "=", "True", "series", ".", "name", "=", "'secondYAxis(%s)'", "%", "series", ".", "name",...
Graph the series on the secondary Y axis.
[ "Graph", "the", "series", "on", "the", "secondary", "Y", "axis", "." ]
train
https://github.com/brutasse/graphite-api/blob/0886b7adcf985a1e8bcb084f6dd1dc166a3f3dff/graphite_api/functions.py#L2731-L2738
brutasse/graphite-api
graphite_api/functions.py
holtWintersForecast
def holtWintersForecast(requestContext, seriesList): """ Performs a Holt-Winters forecast using the series as input data. Data from one week previous to the series is used to bootstrap the initial forecast. """ previewSeconds = 7 * 86400 # 7 days # ignore original data and pull new, including o...
python
def holtWintersForecast(requestContext, seriesList): """ Performs a Holt-Winters forecast using the series as input data. Data from one week previous to the series is used to bootstrap the initial forecast. """ previewSeconds = 7 * 86400 # 7 days # ignore original data and pull new, including o...
[ "def", "holtWintersForecast", "(", "requestContext", ",", "seriesList", ")", ":", "previewSeconds", "=", "7", "*", "86400", "# 7 days", "# ignore original data and pull new, including our preview", "newContext", "=", "requestContext", ".", "copy", "(", ")", "newContext", ...
Performs a Holt-Winters forecast using the series as input data. Data from one week previous to the series is used to bootstrap the initial forecast.
[ "Performs", "a", "Holt", "-", "Winters", "forecast", "using", "the", "series", "as", "input", "data", ".", "Data", "from", "one", "week", "previous", "to", "the", "series", "is", "used", "to", "bootstrap", "the", "initial", "forecast", "." ]
train
https://github.com/brutasse/graphite-api/blob/0886b7adcf985a1e8bcb084f6dd1dc166a3f3dff/graphite_api/functions.py#L2854-L2876
brutasse/graphite-api
graphite_api/functions.py
holtWintersConfidenceBands
def holtWintersConfidenceBands(requestContext, seriesList, delta=3): """ Performs a Holt-Winters forecast using the series as input data and plots upper and lower bands with the predicted forecast deviations. """ previewSeconds = 7 * 86400 # 7 days # ignore original data and pull new, including...
python
def holtWintersConfidenceBands(requestContext, seriesList, delta=3): """ Performs a Holt-Winters forecast using the series as input data and plots upper and lower bands with the predicted forecast deviations. """ previewSeconds = 7 * 86400 # 7 days # ignore original data and pull new, including...
[ "def", "holtWintersConfidenceBands", "(", "requestContext", ",", "seriesList", ",", "delta", "=", "3", ")", ":", "previewSeconds", "=", "7", "*", "86400", "# 7 days", "# ignore original data and pull new, including our preview", "newContext", "=", "requestContext", ".", ...
Performs a Holt-Winters forecast using the series as input data and plots upper and lower bands with the predicted forecast deviations.
[ "Performs", "a", "Holt", "-", "Winters", "forecast", "using", "the", "series", "as", "input", "data", "and", "plots", "upper", "and", "lower", "bands", "with", "the", "predicted", "forecast", "deviations", "." ]
train
https://github.com/brutasse/graphite-api/blob/0886b7adcf985a1e8bcb084f6dd1dc166a3f3dff/graphite_api/functions.py#L2879-L2932
brutasse/graphite-api
graphite_api/functions.py
holtWintersAberration
def holtWintersAberration(requestContext, seriesList, delta=3): """ Performs a Holt-Winters forecast using the series as input data and plots the positive or negative deviation of the series data from the forecast. """ results = [] for series in seriesList: confidenceBands = holtWintersC...
python
def holtWintersAberration(requestContext, seriesList, delta=3): """ Performs a Holt-Winters forecast using the series as input data and plots the positive or negative deviation of the series data from the forecast. """ results = [] for series in seriesList: confidenceBands = holtWintersC...
[ "def", "holtWintersAberration", "(", "requestContext", ",", "seriesList", ",", "delta", "=", "3", ")", ":", "results", "=", "[", "]", "for", "series", "in", "seriesList", ":", "confidenceBands", "=", "holtWintersConfidenceBands", "(", "requestContext", ",", "[",...
Performs a Holt-Winters forecast using the series as input data and plots the positive or negative deviation of the series data from the forecast.
[ "Performs", "a", "Holt", "-", "Winters", "forecast", "using", "the", "series", "as", "input", "data", "and", "plots", "the", "positive", "or", "negative", "deviation", "of", "the", "series", "data", "from", "the", "forecast", "." ]
train
https://github.com/brutasse/graphite-api/blob/0886b7adcf985a1e8bcb084f6dd1dc166a3f3dff/graphite_api/functions.py#L2935-L2960
brutasse/graphite-api
graphite_api/functions.py
holtWintersConfidenceArea
def holtWintersConfidenceArea(requestContext, seriesList, delta=3): """ Performs a Holt-Winters forecast using the series as input data and plots the area between the upper and lower bands of the predicted forecast deviations. """ bands = holtWintersConfidenceBands(requestContext, seriesList, de...
python
def holtWintersConfidenceArea(requestContext, seriesList, delta=3): """ Performs a Holt-Winters forecast using the series as input data and plots the area between the upper and lower bands of the predicted forecast deviations. """ bands = holtWintersConfidenceBands(requestContext, seriesList, de...
[ "def", "holtWintersConfidenceArea", "(", "requestContext", ",", "seriesList", ",", "delta", "=", "3", ")", ":", "bands", "=", "holtWintersConfidenceBands", "(", "requestContext", ",", "seriesList", ",", "delta", ")", "results", "=", "areaBetween", "(", "requestCon...
Performs a Holt-Winters forecast using the series as input data and plots the area between the upper and lower bands of the predicted forecast deviations.
[ "Performs", "a", "Holt", "-", "Winters", "forecast", "using", "the", "series", "as", "input", "data", "and", "plots", "the", "area", "between", "the", "upper", "and", "lower", "bands", "of", "the", "predicted", "forecast", "deviations", "." ]
train
https://github.com/brutasse/graphite-api/blob/0886b7adcf985a1e8bcb084f6dd1dc166a3f3dff/graphite_api/functions.py#L2963-L2974
brutasse/graphite-api
graphite_api/functions.py
linearRegressionAnalysis
def linearRegressionAnalysis(series): """ Returns factor and offset of linear regression function by least squares method. """ n = safeLen(series) sumI = sum([i for i, v in enumerate(series) if v is not None]) sumV = sum([v for i, v in enumerate(series) if v is not None]) sumII = sum([i...
python
def linearRegressionAnalysis(series): """ Returns factor and offset of linear regression function by least squares method. """ n = safeLen(series) sumI = sum([i for i, v in enumerate(series) if v is not None]) sumV = sum([v for i, v in enumerate(series) if v is not None]) sumII = sum([i...
[ "def", "linearRegressionAnalysis", "(", "series", ")", ":", "n", "=", "safeLen", "(", "series", ")", "sumI", "=", "sum", "(", "[", "i", "for", "i", ",", "v", "in", "enumerate", "(", "series", ")", "if", "v", "is", "not", "None", "]", ")", "sumV", ...
Returns factor and offset of linear regression function by least squares method.
[ "Returns", "factor", "and", "offset", "of", "linear", "regression", "function", "by", "least", "squares", "method", "." ]
train
https://github.com/brutasse/graphite-api/blob/0886b7adcf985a1e8bcb084f6dd1dc166a3f3dff/graphite_api/functions.py#L2977-L2995
brutasse/graphite-api
graphite_api/functions.py
linearRegression
def linearRegression(requestContext, seriesList, startSourceAt=None, endSourceAt=None): """ Graphs the liner regression function by least squares method. Takes one metric or a wildcard seriesList, followed by a quoted string with the time to start the line and another quoted string...
python
def linearRegression(requestContext, seriesList, startSourceAt=None, endSourceAt=None): """ Graphs the liner regression function by least squares method. Takes one metric or a wildcard seriesList, followed by a quoted string with the time to start the line and another quoted string...
[ "def", "linearRegression", "(", "requestContext", ",", "seriesList", ",", "startSourceAt", "=", "None", ",", "endSourceAt", "=", "None", ")", ":", "from", ".", "app", "import", "evaluateTarget", "results", "=", "[", "]", "sourceContext", "=", "requestContext", ...
Graphs the liner regression function by least squares method. Takes one metric or a wildcard seriesList, followed by a quoted string with the time to start the line and another quoted string with the time to end the line. The start and end times are inclusive (default range is from to until). See ``fro...
[ "Graphs", "the", "liner", "regression", "function", "by", "least", "squares", "method", "." ]
train
https://github.com/brutasse/graphite-api/blob/0886b7adcf985a1e8bcb084f6dd1dc166a3f3dff/graphite_api/functions.py#L2998-L3044
brutasse/graphite-api
graphite_api/functions.py
drawAsInfinite
def drawAsInfinite(requestContext, seriesList): """ Takes one metric or a wildcard seriesList. If the value is zero, draw the line at 0. If the value is above zero, draw the line at infinity. If the value is null or less than zero, do not draw the line. Useful for displaying on/off metrics, suc...
python
def drawAsInfinite(requestContext, seriesList): """ Takes one metric or a wildcard seriesList. If the value is zero, draw the line at 0. If the value is above zero, draw the line at infinity. If the value is null or less than zero, do not draw the line. Useful for displaying on/off metrics, suc...
[ "def", "drawAsInfinite", "(", "requestContext", ",", "seriesList", ")", ":", "for", "series", "in", "seriesList", ":", "series", ".", "options", "[", "'drawAsInfinite'", "]", "=", "True", "series", ".", "name", "=", "'drawAsInfinite(%s)'", "%", "series", ".", ...
Takes one metric or a wildcard seriesList. If the value is zero, draw the line at 0. If the value is above zero, draw the line at infinity. If the value is null or less than zero, do not draw the line. Useful for displaying on/off metrics, such as exit codes. (0 = success, anything else = failure.)...
[ "Takes", "one", "metric", "or", "a", "wildcard", "seriesList", ".", "If", "the", "value", "is", "zero", "draw", "the", "line", "at", "0", ".", "If", "the", "value", "is", "above", "zero", "draw", "the", "line", "at", "infinity", ".", "If", "the", "va...
train
https://github.com/brutasse/graphite-api/blob/0886b7adcf985a1e8bcb084f6dd1dc166a3f3dff/graphite_api/functions.py#L3047-L3065
brutasse/graphite-api
graphite_api/functions.py
lineWidth
def lineWidth(requestContext, seriesList, width): """ Takes one metric or a wildcard seriesList, followed by a float F. Draw the selected metrics with a line width of F, overriding the default value of 1, or the &lineWidth=X.X parameter. Useful for highlighting a single metric out of many, or havi...
python
def lineWidth(requestContext, seriesList, width): """ Takes one metric or a wildcard seriesList, followed by a float F. Draw the selected metrics with a line width of F, overriding the default value of 1, or the &lineWidth=X.X parameter. Useful for highlighting a single metric out of many, or havi...
[ "def", "lineWidth", "(", "requestContext", ",", "seriesList", ",", "width", ")", ":", "for", "series", "in", "seriesList", ":", "series", ".", "options", "[", "'lineWidth'", "]", "=", "width", "return", "seriesList" ]
Takes one metric or a wildcard seriesList, followed by a float F. Draw the selected metrics with a line width of F, overriding the default value of 1, or the &lineWidth=X.X parameter. Useful for highlighting a single metric out of many, or having multiple line widths in one graph. Example:: ...
[ "Takes", "one", "metric", "or", "a", "wildcard", "seriesList", "followed", "by", "a", "float", "F", "." ]
train
https://github.com/brutasse/graphite-api/blob/0886b7adcf985a1e8bcb084f6dd1dc166a3f3dff/graphite_api/functions.py#L3068-L3085
brutasse/graphite-api
graphite_api/functions.py
dashed
def dashed(requestContext, seriesList, dashLength=5): """ Takes one metric or a wildcard seriesList, followed by a float F. Draw the selected metrics with a dotted line with segments of length F If omitted, the default length of the segments is 5.0 Example:: &target=dashed(server01.instan...
python
def dashed(requestContext, seriesList, dashLength=5): """ Takes one metric or a wildcard seriesList, followed by a float F. Draw the selected metrics with a dotted line with segments of length F If omitted, the default length of the segments is 5.0 Example:: &target=dashed(server01.instan...
[ "def", "dashed", "(", "requestContext", ",", "seriesList", ",", "dashLength", "=", "5", ")", ":", "for", "series", "in", "seriesList", ":", "series", ".", "name", "=", "'dashed(%s, %g)'", "%", "(", "series", ".", "name", ",", "dashLength", ")", "series", ...
Takes one metric or a wildcard seriesList, followed by a float F. Draw the selected metrics with a dotted line with segments of length F If omitted, the default length of the segments is 5.0 Example:: &target=dashed(server01.instance01.memory.free,2.5)
[ "Takes", "one", "metric", "or", "a", "wildcard", "seriesList", "followed", "by", "a", "float", "F", "." ]
train
https://github.com/brutasse/graphite-api/blob/0886b7adcf985a1e8bcb084f6dd1dc166a3f3dff/graphite_api/functions.py#L3088-L3103
brutasse/graphite-api
graphite_api/functions.py
timeStack
def timeStack(requestContext, seriesList, timeShiftUnit, timeShiftStart, timeShiftEnd): """ Takes one metric or a wildcard seriesList, followed by a quoted string with the length of time (See ``from / until`` in the render\_api_ for examples of time formats). Also takes a start multiplier ...
python
def timeStack(requestContext, seriesList, timeShiftUnit, timeShiftStart, timeShiftEnd): """ Takes one metric or a wildcard seriesList, followed by a quoted string with the length of time (See ``from / until`` in the render\_api_ for examples of time formats). Also takes a start multiplier ...
[ "def", "timeStack", "(", "requestContext", ",", "seriesList", ",", "timeShiftUnit", ",", "timeShiftStart", ",", "timeShiftEnd", ")", ":", "# Default to negative. parseTimeOffset defaults to +", "if", "timeShiftUnit", "[", "0", "]", ".", "isdigit", "(", ")", ":", "ti...
Takes one metric or a wildcard seriesList, followed by a quoted string with the length of time (See ``from / until`` in the render\_api_ for examples of time formats). Also takes a start multiplier and end multiplier for the length of time- Create a seriesList which is composed the original metric seri...
[ "Takes", "one", "metric", "or", "a", "wildcard", "seriesList", "followed", "by", "a", "quoted", "string", "with", "the", "length", "of", "time", "(", "See", "from", "/", "until", "in", "the", "render", "\\", "_api_", "for", "examples", "of", "time", "for...
train
https://github.com/brutasse/graphite-api/blob/0886b7adcf985a1e8bcb084f6dd1dc166a3f3dff/graphite_api/functions.py#L3106-L3151
brutasse/graphite-api
graphite_api/functions.py
timeShift
def timeShift(requestContext, seriesList, timeShift, resetEnd=True, alignDST=False): """ Takes one metric or a wildcard seriesList, followed by a quoted string with the length of time (See ``from / until`` in the render\_api_ for examples of time formats). Draws the selected metrics s...
python
def timeShift(requestContext, seriesList, timeShift, resetEnd=True, alignDST=False): """ Takes one metric or a wildcard seriesList, followed by a quoted string with the length of time (See ``from / until`` in the render\_api_ for examples of time formats). Draws the selected metrics s...
[ "def", "timeShift", "(", "requestContext", ",", "seriesList", ",", "timeShift", ",", "resetEnd", "=", "True", ",", "alignDST", "=", "False", ")", ":", "# Default to negative. parseTimeOffset defaults to +", "if", "timeShift", "[", "0", "]", ".", "isdigit", "(", ...
Takes one metric or a wildcard seriesList, followed by a quoted string with the length of time (See ``from / until`` in the render\_api_ for examples of time formats). Draws the selected metrics shifted in time. If no sign is given, a minus sign ( - ) is implied which will shift the metric back in time...
[ "Takes", "one", "metric", "or", "a", "wildcard", "seriesList", "followed", "by", "a", "quoted", "string", "with", "the", "length", "of", "time", "(", "See", "from", "/", "until", "in", "the", "render", "\\", "_api_", "for", "examples", "of", "time", "for...
train
https://github.com/brutasse/graphite-api/blob/0886b7adcf985a1e8bcb084f6dd1dc166a3f3dff/graphite_api/functions.py#L3158-L3243
brutasse/graphite-api
graphite_api/functions.py
timeSlice
def timeSlice(requestContext, seriesList, startSliceAt, endSliceAt='now'): """ Takes one metric or a wildcard metric, followed by a quoted string with the time to start the line and another quoted string with the time to end the line. The start and end times are inclusive. See ``from / until`` in th...
python
def timeSlice(requestContext, seriesList, startSliceAt, endSliceAt='now'): """ Takes one metric or a wildcard metric, followed by a quoted string with the time to start the line and another quoted string with the time to end the line. The start and end times are inclusive. See ``from / until`` in th...
[ "def", "timeSlice", "(", "requestContext", ",", "seriesList", ",", "startSliceAt", ",", "endSliceAt", "=", "'now'", ")", ":", "results", "=", "[", "]", "start", "=", "epoch", "(", "parseATTime", "(", "startSliceAt", ")", ")", "end", "=", "epoch", "(", "p...
Takes one metric or a wildcard metric, followed by a quoted string with the time to start the line and another quoted string with the time to end the line. The start and end times are inclusive. See ``from / until`` in the render api for examples of time formats. Useful for filtering out a part of ...
[ "Takes", "one", "metric", "or", "a", "wildcard", "metric", "followed", "by", "a", "quoted", "string", "with", "the", "time", "to", "start", "the", "line", "and", "another", "quoted", "string", "with", "the", "time", "to", "end", "the", "line", ".", "The"...
train
https://github.com/brutasse/graphite-api/blob/0886b7adcf985a1e8bcb084f6dd1dc166a3f3dff/graphite_api/functions.py#L3246-L3275
brutasse/graphite-api
graphite_api/functions.py
constantLine
def constantLine(requestContext, value): """ Takes a float F. Draws a horizontal line at value F across the graph. Example:: &target=constantLine(123.456) """ name = "constantLine(%s)" % str(value) start = int(epoch(requestContext['startTime'])) end = int(epoch(requestContext...
python
def constantLine(requestContext, value): """ Takes a float F. Draws a horizontal line at value F across the graph. Example:: &target=constantLine(123.456) """ name = "constantLine(%s)" % str(value) start = int(epoch(requestContext['startTime'])) end = int(epoch(requestContext...
[ "def", "constantLine", "(", "requestContext", ",", "value", ")", ":", "name", "=", "\"constantLine(%s)\"", "%", "str", "(", "value", ")", "start", "=", "int", "(", "epoch", "(", "requestContext", "[", "'startTime'", "]", ")", ")", "end", "=", "int", "(",...
Takes a float F. Draws a horizontal line at value F across the graph. Example:: &target=constantLine(123.456)
[ "Takes", "a", "float", "F", "." ]
train
https://github.com/brutasse/graphite-api/blob/0886b7adcf985a1e8bcb084f6dd1dc166a3f3dff/graphite_api/functions.py#L3278-L3295
brutasse/graphite-api
graphite_api/functions.py
aggregateLine
def aggregateLine(requestContext, seriesList, func='avg'): """ Takes a metric or wildcard seriesList and draws a horizontal line based on the function applied to each series. Note: By default, the graphite renderer consolidates data points by averaging data points over time. If you are using the 'm...
python
def aggregateLine(requestContext, seriesList, func='avg'): """ Takes a metric or wildcard seriesList and draws a horizontal line based on the function applied to each series. Note: By default, the graphite renderer consolidates data points by averaging data points over time. If you are using the 'm...
[ "def", "aggregateLine", "(", "requestContext", ",", "seriesList", ",", "func", "=", "'avg'", ")", ":", "t_funcs", "=", "{", "'avg'", ":", "safeAvg", ",", "'min'", ":", "safeMin", ",", "'max'", ":", "safeMax", "}", "if", "func", "not", "in", "t_funcs", ...
Takes a metric or wildcard seriesList and draws a horizontal line based on the function applied to each series. Note: By default, the graphite renderer consolidates data points by averaging data points over time. If you are using the 'min' or 'max' function for aggregateLine, this can cause an unusual ...
[ "Takes", "a", "metric", "or", "wildcard", "seriesList", "and", "draws", "a", "horizontal", "line", "based", "on", "the", "function", "applied", "to", "each", "series", "." ]
train
https://github.com/brutasse/graphite-api/blob/0886b7adcf985a1e8bcb084f6dd1dc166a3f3dff/graphite_api/functions.py#L3298-L3335
brutasse/graphite-api
graphite_api/functions.py
verticalLine
def verticalLine(requestContext, ts, label=None, color=None): """ Takes a timestamp string ts. Draws a vertical line at the designated timestamp with optional 'label' and 'color'. Supported timestamp formats include both relative (e.g. -3h) and absolute (e.g. 16:00_20110501) strings, such as th...
python
def verticalLine(requestContext, ts, label=None, color=None): """ Takes a timestamp string ts. Draws a vertical line at the designated timestamp with optional 'label' and 'color'. Supported timestamp formats include both relative (e.g. -3h) and absolute (e.g. 16:00_20110501) strings, such as th...
[ "def", "verticalLine", "(", "requestContext", ",", "ts", ",", "label", "=", "None", ",", "color", "=", "None", ")", ":", "ts", "=", "int", "(", "epoch", "(", "parseATTime", "(", "ts", ",", "requestContext", "[", "'tzinfo'", "]", ")", ")", ")", "start...
Takes a timestamp string ts. Draws a vertical line at the designated timestamp with optional 'label' and 'color'. Supported timestamp formats include both relative (e.g. -3h) and absolute (e.g. 16:00_20110501) strings, such as those used with ``from`` and ``until`` parameters. When set, the 'label'...
[ "Takes", "a", "timestamp", "string", "ts", "." ]
train
https://github.com/brutasse/graphite-api/blob/0886b7adcf985a1e8bcb084f6dd1dc166a3f3dff/graphite_api/functions.py#L3338-L3373
brutasse/graphite-api
graphite_api/functions.py
threshold
def threshold(requestContext, value, label=None, color=None): """ Takes a float F, followed by a label (in double quotes) and a color. (See ``bgcolor`` in the render\_api_ for valid color names & formats.) Draws a horizontal line at value F across the graph. Example:: &target=threshold(12...
python
def threshold(requestContext, value, label=None, color=None): """ Takes a float F, followed by a label (in double quotes) and a color. (See ``bgcolor`` in the render\_api_ for valid color names & formats.) Draws a horizontal line at value F across the graph. Example:: &target=threshold(12...
[ "def", "threshold", "(", "requestContext", ",", "value", ",", "label", "=", "None", ",", "color", "=", "None", ")", ":", "[", "series", "]", "=", "constantLine", "(", "requestContext", ",", "value", ")", "if", "label", ":", "series", ".", "name", "=", ...
Takes a float F, followed by a label (in double quotes) and a color. (See ``bgcolor`` in the render\_api_ for valid color names & formats.) Draws a horizontal line at value F across the graph. Example:: &target=threshold(123.456, "omgwtfbbq", "red")
[ "Takes", "a", "float", "F", "followed", "by", "a", "label", "(", "in", "double", "quotes", ")", "and", "a", "color", ".", "(", "See", "bgcolor", "in", "the", "render", "\\", "_api_", "for", "valid", "color", "names", "&", "formats", ".", ")" ]
train
https://github.com/brutasse/graphite-api/blob/0886b7adcf985a1e8bcb084f6dd1dc166a3f3dff/graphite_api/functions.py#L3376-L3393
brutasse/graphite-api
graphite_api/functions.py
transformNull
def transformNull(requestContext, seriesList, default=0, referenceSeries=None): """ Takes a metric or wildcard seriesList and replaces null values with the value specified by `default`. The value 0 used if not specified. The optional referenceSeries, if specified, is a metric or wildcard series lis...
python
def transformNull(requestContext, seriesList, default=0, referenceSeries=None): """ Takes a metric or wildcard seriesList and replaces null values with the value specified by `default`. The value 0 used if not specified. The optional referenceSeries, if specified, is a metric or wildcard series lis...
[ "def", "transformNull", "(", "requestContext", ",", "seriesList", ",", "default", "=", "0", ",", "referenceSeries", "=", "None", ")", ":", "def", "transform", "(", "v", ",", "d", ")", ":", "if", "v", "is", "None", ":", "return", "d", "else", ":", "re...
Takes a metric or wildcard seriesList and replaces null values with the value specified by `default`. The value 0 used if not specified. The optional referenceSeries, if specified, is a metric or wildcard series list that governs which time intervals nulls should be replaced. If specified, nulls are re...
[ "Takes", "a", "metric", "or", "wildcard", "seriesList", "and", "replaces", "null", "values", "with", "the", "value", "specified", "by", "default", ".", "The", "value", "0", "used", "if", "not", "specified", ".", "The", "optional", "referenceSeries", "if", "s...
train
https://github.com/brutasse/graphite-api/blob/0886b7adcf985a1e8bcb084f6dd1dc166a3f3dff/graphite_api/functions.py#L3396-L3440
brutasse/graphite-api
graphite_api/functions.py
isNonNull
def isNonNull(requestContext, seriesList): """ Takes a metric or wild card seriesList and counts up how many non-null values are specified. This is useful for understanding which metrics have data at a given point in time (ie, to count which servers are alive). Example:: &target=isNonN...
python
def isNonNull(requestContext, seriesList): """ Takes a metric or wild card seriesList and counts up how many non-null values are specified. This is useful for understanding which metrics have data at a given point in time (ie, to count which servers are alive). Example:: &target=isNonN...
[ "def", "isNonNull", "(", "requestContext", ",", "seriesList", ")", ":", "def", "transform", "(", "v", ")", ":", "if", "v", "is", "None", ":", "return", "0", "else", ":", "return", "1", "for", "series", "in", "seriesList", ":", "series", ".", "name", ...
Takes a metric or wild card seriesList and counts up how many non-null values are specified. This is useful for understanding which metrics have data at a given point in time (ie, to count which servers are alive). Example:: &target=isNonNull(webapp.pages.*.views) Returns a seriesList whe...
[ "Takes", "a", "metric", "or", "wild", "card", "seriesList", "and", "counts", "up", "how", "many", "non", "-", "null", "values", "are", "specified", ".", "This", "is", "useful", "for", "understanding", "which", "metrics", "have", "data", "at", "a", "given",...
train
https://github.com/brutasse/graphite-api/blob/0886b7adcf985a1e8bcb084f6dd1dc166a3f3dff/graphite_api/functions.py#L3443-L3470
brutasse/graphite-api
graphite_api/functions.py
identity
def identity(requestContext, name, step=60): """ Identity function: Returns datapoints where the value equals the timestamp of the datapoint. Useful when you have another series where the value is a timestamp, and you want to compare it to the time of the datapoint, to render an age Example:: ...
python
def identity(requestContext, name, step=60): """ Identity function: Returns datapoints where the value equals the timestamp of the datapoint. Useful when you have another series where the value is a timestamp, and you want to compare it to the time of the datapoint, to render an age Example:: ...
[ "def", "identity", "(", "requestContext", ",", "name", ",", "step", "=", "60", ")", ":", "start", "=", "int", "(", "epoch", "(", "requestContext", "[", "\"startTime\"", "]", ")", ")", "end", "=", "int", "(", "epoch", "(", "requestContext", "[", "\"endT...
Identity function: Returns datapoints where the value equals the timestamp of the datapoint. Useful when you have another series where the value is a timestamp, and you want to compare it to the time of the datapoint, to render an age Example:: &target=identity("The.time.series") This wou...
[ "Identity", "function", ":", "Returns", "datapoints", "where", "the", "value", "equals", "the", "timestamp", "of", "the", "datapoint", ".", "Useful", "when", "you", "have", "another", "series", "where", "the", "value", "is", "a", "timestamp", "and", "you", "...
train
https://github.com/brutasse/graphite-api/blob/0886b7adcf985a1e8bcb084f6dd1dc166a3f3dff/graphite_api/functions.py#L3473-L3496
brutasse/graphite-api
graphite_api/functions.py
countSeries
def countSeries(requestContext, *seriesLists): """ Draws a horizontal line representing the number of nodes found in the seriesList. Example:: &target=countSeries(carbon.agents.*.*) """ if not seriesLists or not any(seriesLists): series = constantLine(requestContext, 0).pop() ...
python
def countSeries(requestContext, *seriesLists): """ Draws a horizontal line representing the number of nodes found in the seriesList. Example:: &target=countSeries(carbon.agents.*.*) """ if not seriesLists or not any(seriesLists): series = constantLine(requestContext, 0).pop() ...
[ "def", "countSeries", "(", "requestContext", ",", "*", "seriesLists", ")", ":", "if", "not", "seriesLists", "or", "not", "any", "(", "seriesLists", ")", ":", "series", "=", "constantLine", "(", "requestContext", ",", "0", ")", ".", "pop", "(", ")", "seri...
Draws a horizontal line representing the number of nodes found in the seriesList. Example:: &target=countSeries(carbon.agents.*.*)
[ "Draws", "a", "horizontal", "line", "representing", "the", "number", "of", "nodes", "found", "in", "the", "seriesList", "." ]
train
https://github.com/brutasse/graphite-api/blob/0886b7adcf985a1e8bcb084f6dd1dc166a3f3dff/graphite_api/functions.py#L3499-L3519
brutasse/graphite-api
graphite_api/functions.py
group
def group(requestContext, *seriesLists): """ Takes an arbitrary number of seriesLists and adds them to a single seriesList. This is used to pass multiple seriesLists to a function which only takes one. """ seriesGroup = [] for s in seriesLists: seriesGroup.extend(s) return serie...
python
def group(requestContext, *seriesLists): """ Takes an arbitrary number of seriesLists and adds them to a single seriesList. This is used to pass multiple seriesLists to a function which only takes one. """ seriesGroup = [] for s in seriesLists: seriesGroup.extend(s) return serie...
[ "def", "group", "(", "requestContext", ",", "*", "seriesLists", ")", ":", "seriesGroup", "=", "[", "]", "for", "s", "in", "seriesLists", ":", "seriesGroup", ".", "extend", "(", "s", ")", "return", "seriesGroup" ]
Takes an arbitrary number of seriesLists and adds them to a single seriesList. This is used to pass multiple seriesLists to a function which only takes one.
[ "Takes", "an", "arbitrary", "number", "of", "seriesLists", "and", "adds", "them", "to", "a", "single", "seriesList", ".", "This", "is", "used", "to", "pass", "multiple", "seriesLists", "to", "a", "function", "which", "only", "takes", "one", "." ]
train
https://github.com/brutasse/graphite-api/blob/0886b7adcf985a1e8bcb084f6dd1dc166a3f3dff/graphite_api/functions.py#L3522-L3532
brutasse/graphite-api
graphite_api/functions.py
mapSeries
def mapSeries(requestContext, seriesList, mapNode): """ Short form: ``map()``. Takes a seriesList and maps it to a list of sub-seriesList. Each sub-seriesList has the given mapNode in common. Example (note: This function is not very useful alone. It should be used with :py:func:`reduceSeries`)...
python
def mapSeries(requestContext, seriesList, mapNode): """ Short form: ``map()``. Takes a seriesList and maps it to a list of sub-seriesList. Each sub-seriesList has the given mapNode in common. Example (note: This function is not very useful alone. It should be used with :py:func:`reduceSeries`)...
[ "def", "mapSeries", "(", "requestContext", ",", "seriesList", ",", "mapNode", ")", ":", "metaSeries", "=", "{", "}", "keys", "=", "[", "]", "for", "series", "in", "seriesList", ":", "key", "=", "series", ".", "name", ".", "split", "(", "\".\"", ")", ...
Short form: ``map()``. Takes a seriesList and maps it to a list of sub-seriesList. Each sub-seriesList has the given mapNode in common. Example (note: This function is not very useful alone. It should be used with :py:func:`reduceSeries`):: mapSeries(servers.*.cpu.*,1) => [ ...
[ "Short", "form", ":", "map", "()", "." ]
train
https://github.com/brutasse/graphite-api/blob/0886b7adcf985a1e8bcb084f6dd1dc166a3f3dff/graphite_api/functions.py#L3535-L3562
brutasse/graphite-api
graphite_api/functions.py
reduceSeries
def reduceSeries(requestContext, seriesLists, reduceFunction, reduceNode, *reduceMatchers): """ Short form: ``reduce()``. Takes a list of seriesLists and reduces it to a list of series by means of the reduceFunction. Reduction is performed by matching the reduceNode in each series...
python
def reduceSeries(requestContext, seriesLists, reduceFunction, reduceNode, *reduceMatchers): """ Short form: ``reduce()``. Takes a list of seriesLists and reduces it to a list of series by means of the reduceFunction. Reduction is performed by matching the reduceNode in each series...
[ "def", "reduceSeries", "(", "requestContext", ",", "seriesLists", ",", "reduceFunction", ",", "reduceNode", ",", "*", "reduceMatchers", ")", ":", "metaSeries", "=", "{", "}", "keys", "=", "[", "]", "for", "seriesList", "in", "seriesLists", ":", "for", "serie...
Short form: ``reduce()``. Takes a list of seriesLists and reduces it to a list of series by means of the reduceFunction. Reduction is performed by matching the reduceNode in each series against the list of reduceMatchers. The each series is then passed to the reduceFunction as arguments in the ord...
[ "Short", "form", ":", "reduce", "()", "." ]
train
https://github.com/brutasse/graphite-api/blob/0886b7adcf985a1e8bcb084f6dd1dc166a3f3dff/graphite_api/functions.py#L3565-L3638
brutasse/graphite-api
graphite_api/functions.py
applyByNode
def applyByNode(requestContext, seriesList, nodeNum, templateFunction, newName=None): """ Takes a seriesList and applies some complicated function (described by a string), replacing templates with unique prefixes of keys from the seriesList (the key is all nodes up to the index given as ...
python
def applyByNode(requestContext, seriesList, nodeNum, templateFunction, newName=None): """ Takes a seriesList and applies some complicated function (described by a string), replacing templates with unique prefixes of keys from the seriesList (the key is all nodes up to the index given as ...
[ "def", "applyByNode", "(", "requestContext", ",", "seriesList", ",", "nodeNum", ",", "templateFunction", ",", "newName", "=", "None", ")", ":", "from", ".", "app", "import", "evaluateTarget", "prefixes", "=", "set", "(", ")", "for", "series", "in", "seriesLi...
Takes a seriesList and applies some complicated function (described by a string), replacing templates with unique prefixes of keys from the seriesList (the key is all nodes up to the index given as `nodeNum`). If the `newName` parameter is provided, the name of the resulting series will be given by tha...
[ "Takes", "a", "seriesList", "and", "applies", "some", "complicated", "function", "(", "described", "by", "a", "string", ")", "replacing", "templates", "with", "unique", "prefixes", "of", "keys", "from", "the", "seriesList", "(", "the", "key", "is", "all", "n...
train
https://github.com/brutasse/graphite-api/blob/0886b7adcf985a1e8bcb084f6dd1dc166a3f3dff/graphite_api/functions.py#L3641-L3677
brutasse/graphite-api
graphite_api/functions.py
groupByNode
def groupByNode(requestContext, seriesList, nodeNum, callback): """ Takes a serieslist and maps a callback to subgroups within as defined by a common node. Example:: &target=groupByNode(ganglia.by-function.*.*.cpu.load5,2,"sumSeries") Would return multiple series which are each the result...
python
def groupByNode(requestContext, seriesList, nodeNum, callback): """ Takes a serieslist and maps a callback to subgroups within as defined by a common node. Example:: &target=groupByNode(ganglia.by-function.*.*.cpu.load5,2,"sumSeries") Would return multiple series which are each the result...
[ "def", "groupByNode", "(", "requestContext", ",", "seriesList", ",", "nodeNum", ",", "callback", ")", ":", "return", "groupByNodes", "(", "requestContext", ",", "seriesList", ",", "callback", ",", "nodeNum", ")" ]
Takes a serieslist and maps a callback to subgroups within as defined by a common node. Example:: &target=groupByNode(ganglia.by-function.*.*.cpu.load5,2,"sumSeries") Would return multiple series which are each the result of applying the "sumSeries" function to groups joined on the second nod...
[ "Takes", "a", "serieslist", "and", "maps", "a", "callback", "to", "subgroups", "within", "as", "defined", "by", "a", "common", "node", "." ]
train
https://github.com/brutasse/graphite-api/blob/0886b7adcf985a1e8bcb084f6dd1dc166a3f3dff/graphite_api/functions.py#L3680-L3697
brutasse/graphite-api
graphite_api/functions.py
groupByNodes
def groupByNodes(requestContext, seriesList, callback, *nodes): """ Takes a serieslist and maps a callback to subgroups within as defined by multiple nodes. Example:: &target=groupByNodes(ganglia.server*.*.cpu.load*,"sumSeries",1,4) Would return multiple series which are each the result o...
python
def groupByNodes(requestContext, seriesList, callback, *nodes): """ Takes a serieslist and maps a callback to subgroups within as defined by multiple nodes. Example:: &target=groupByNodes(ganglia.server*.*.cpu.load*,"sumSeries",1,4) Would return multiple series which are each the result o...
[ "def", "groupByNodes", "(", "requestContext", ",", "seriesList", ",", "callback", ",", "*", "nodes", ")", ":", "from", ".", "app", "import", "app", "metaSeries", "=", "{", "}", "keys", "=", "[", "]", "if", "isinstance", "(", "nodes", ",", "int", ")", ...
Takes a serieslist and maps a callback to subgroups within as defined by multiple nodes. Example:: &target=groupByNodes(ganglia.server*.*.cpu.load*,"sumSeries",1,4) Would return multiple series which are each the result of applying the "sumSeries" function to groups joined on the nodes' list ...
[ "Takes", "a", "serieslist", "and", "maps", "a", "callback", "to", "subgroups", "within", "as", "defined", "by", "multiple", "nodes", "." ]
train
https://github.com/brutasse/graphite-api/blob/0886b7adcf985a1e8bcb084f6dd1dc166a3f3dff/graphite_api/functions.py#L3700-L3737
brutasse/graphite-api
graphite_api/functions.py
exclude
def exclude(requestContext, seriesList, pattern): """ Takes a metric or a wildcard seriesList, followed by a regular expression in double quotes. Excludes metrics that match the regular expression. Example:: &target=exclude(servers*.instance*.threads.busy,"server02") """ regex = re....
python
def exclude(requestContext, seriesList, pattern): """ Takes a metric or a wildcard seriesList, followed by a regular expression in double quotes. Excludes metrics that match the regular expression. Example:: &target=exclude(servers*.instance*.threads.busy,"server02") """ regex = re....
[ "def", "exclude", "(", "requestContext", ",", "seriesList", ",", "pattern", ")", ":", "regex", "=", "re", ".", "compile", "(", "pattern", ")", "return", "[", "s", "for", "s", "in", "seriesList", "if", "not", "regex", ".", "search", "(", "s", ".", "na...
Takes a metric or a wildcard seriesList, followed by a regular expression in double quotes. Excludes metrics that match the regular expression. Example:: &target=exclude(servers*.instance*.threads.busy,"server02")
[ "Takes", "a", "metric", "or", "a", "wildcard", "seriesList", "followed", "by", "a", "regular", "expression", "in", "double", "quotes", ".", "Excludes", "metrics", "that", "match", "the", "regular", "expression", "." ]
train
https://github.com/brutasse/graphite-api/blob/0886b7adcf985a1e8bcb084f6dd1dc166a3f3dff/graphite_api/functions.py#L3740-L3750
brutasse/graphite-api
graphite_api/functions.py
smartSummarize
def smartSummarize(requestContext, seriesList, intervalString, func='sum'): """ Smarter experimental version of summarize. """ results = [] delta = parseTimeOffset(intervalString) interval = to_seconds(delta) # Adjust the start time to fit an entire day for intervals >= 1 day requestCon...
python
def smartSummarize(requestContext, seriesList, intervalString, func='sum'): """ Smarter experimental version of summarize. """ results = [] delta = parseTimeOffset(intervalString) interval = to_seconds(delta) # Adjust the start time to fit an entire day for intervals >= 1 day requestCon...
[ "def", "smartSummarize", "(", "requestContext", ",", "seriesList", ",", "intervalString", ",", "func", "=", "'sum'", ")", ":", "results", "=", "[", "]", "delta", "=", "parseTimeOffset", "(", "intervalString", ")", "interval", "=", "to_seconds", "(", "delta", ...
Smarter experimental version of summarize.
[ "Smarter", "experimental", "version", "of", "summarize", "." ]
train
https://github.com/brutasse/graphite-api/blob/0886b7adcf985a1e8bcb084f6dd1dc166a3f3dff/graphite_api/functions.py#L3767-L3854
brutasse/graphite-api
graphite_api/functions.py
summarize
def summarize(requestContext, seriesList, intervalString, func='sum', alignToFrom=False): """ Summarize the data into interval buckets of a certain size. By default, the contents of each interval bucket are summed together. This is useful for counters where each increment represents a dis...
python
def summarize(requestContext, seriesList, intervalString, func='sum', alignToFrom=False): """ Summarize the data into interval buckets of a certain size. By default, the contents of each interval bucket are summed together. This is useful for counters where each increment represents a dis...
[ "def", "summarize", "(", "requestContext", ",", "seriesList", ",", "intervalString", ",", "func", "=", "'sum'", ",", "alignToFrom", "=", "False", ")", ":", "results", "=", "[", "]", "delta", "=", "parseTimeOffset", "(", "intervalString", ")", "interval", "="...
Summarize the data into interval buckets of a certain size. By default, the contents of each interval bucket are summed together. This is useful for counters where each increment represents a discrete event and retrieving a "per X" value requires summing all the events in that interval. Specifying...
[ "Summarize", "the", "data", "into", "interval", "buckets", "of", "a", "certain", "size", "." ]
train
https://github.com/brutasse/graphite-api/blob/0886b7adcf985a1e8bcb084f6dd1dc166a3f3dff/graphite_api/functions.py#L3857-L3963
brutasse/graphite-api
graphite_api/functions.py
hitcount
def hitcount(requestContext, seriesList, intervalString, alignToInterval=False): """ Estimate hit counts from a list of time series. This function assumes the values in each time series represent hits per second. It calculates hits per some larger interval such as per day or per hou...
python
def hitcount(requestContext, seriesList, intervalString, alignToInterval=False): """ Estimate hit counts from a list of time series. This function assumes the values in each time series represent hits per second. It calculates hits per some larger interval such as per day or per hou...
[ "def", "hitcount", "(", "requestContext", ",", "seriesList", ",", "intervalString", ",", "alignToInterval", "=", "False", ")", ":", "results", "=", "[", "]", "delta", "=", "parseTimeOffset", "(", "intervalString", ")", "interval", "=", "to_seconds", "(", "delt...
Estimate hit counts from a list of time series. This function assumes the values in each time series represent hits per second. It calculates hits per some larger interval such as per day or per hour. This function is like summarize(), except that it compensates automatically for different time s...
[ "Estimate", "hit", "counts", "from", "a", "list", "of", "time", "series", "." ]
train
https://github.com/brutasse/graphite-api/blob/0886b7adcf985a1e8bcb084f6dd1dc166a3f3dff/graphite_api/functions.py#L3966-L4066
brutasse/graphite-api
graphite_api/functions.py
timeFunction
def timeFunction(requestContext, name, step=60): """ Short Alias: time() Just returns the timestamp for each X value. T Example:: &target=time("The.time.series") This would create a series named "The.time.series" that contains in Y the same value (in seconds) as X. A second argu...
python
def timeFunction(requestContext, name, step=60): """ Short Alias: time() Just returns the timestamp for each X value. T Example:: &target=time("The.time.series") This would create a series named "The.time.series" that contains in Y the same value (in seconds) as X. A second argu...
[ "def", "timeFunction", "(", "requestContext", ",", "name", ",", "step", "=", "60", ")", ":", "start", "=", "int", "(", "epoch", "(", "requestContext", "[", "\"startTime\"", "]", ")", ")", "end", "=", "int", "(", "epoch", "(", "requestContext", "[", "\"...
Short Alias: time() Just returns the timestamp for each X value. T Example:: &target=time("The.time.series") This would create a series named "The.time.series" that contains in Y the same value (in seconds) as X. A second argument can be provided as a step parameter (default is 60 secs)
[ "Short", "Alias", ":", "time", "()" ]
train
https://github.com/brutasse/graphite-api/blob/0886b7adcf985a1e8bcb084f6dd1dc166a3f3dff/graphite_api/functions.py#L4069-L4098
brutasse/graphite-api
graphite_api/functions.py
sinFunction
def sinFunction(requestContext, name, amplitude=1, step=60): """ Short Alias: sin() Just returns the sine of the current time. The optional amplitude parameter changes the amplitude of the wave. Example:: &target=sin("The.time.series", 2) This would create a series named "The.time.se...
python
def sinFunction(requestContext, name, amplitude=1, step=60): """ Short Alias: sin() Just returns the sine of the current time. The optional amplitude parameter changes the amplitude of the wave. Example:: &target=sin("The.time.series", 2) This would create a series named "The.time.se...
[ "def", "sinFunction", "(", "requestContext", ",", "name", ",", "amplitude", "=", "1", ",", "step", "=", "60", ")", ":", "delta", "=", "timedelta", "(", "seconds", "=", "step", ")", "when", "=", "requestContext", "[", "\"startTime\"", "]", "values", "=", ...
Short Alias: sin() Just returns the sine of the current time. The optional amplitude parameter changes the amplitude of the wave. Example:: &target=sin("The.time.series", 2) This would create a series named "The.time.series" that contains sin(x)*2. A third argument can be provided as a ...
[ "Short", "Alias", ":", "sin", "()" ]
train
https://github.com/brutasse/graphite-api/blob/0886b7adcf985a1e8bcb084f6dd1dc166a3f3dff/graphite_api/functions.py#L4101-L4129
brutasse/graphite-api
graphite_api/functions.py
randomWalkFunction
def randomWalkFunction(requestContext, name, step=60): """ Short Alias: randomWalk() Returns a random walk starting at 0. This is great for testing when there is no real data in whisper. Example:: &target=randomWalk("The.time.series") This would create a series named "The.time.series...
python
def randomWalkFunction(requestContext, name, step=60): """ Short Alias: randomWalk() Returns a random walk starting at 0. This is great for testing when there is no real data in whisper. Example:: &target=randomWalk("The.time.series") This would create a series named "The.time.series...
[ "def", "randomWalkFunction", "(", "requestContext", ",", "name", ",", "step", "=", "60", ")", ":", "delta", "=", "timedelta", "(", "seconds", "=", "step", ")", "when", "=", "requestContext", "[", "\"startTime\"", "]", "values", "=", "[", "]", "current", ...
Short Alias: randomWalk() Returns a random walk starting at 0. This is great for testing when there is no real data in whisper. Example:: &target=randomWalk("The.time.series") This would create a series named "The.time.series" that contains points where x(t) == x(t-1)+random()-0.5, and x...
[ "Short", "Alias", ":", "randomWalk", "()" ]
train
https://github.com/brutasse/graphite-api/blob/0886b7adcf985a1e8bcb084f6dd1dc166a3f3dff/graphite_api/functions.py#L4146-L4175
opencobra/memote
memote/experimental/medium.py
Medium.validate
def validate(self, model, checks=[]): """Use a defined schema to validate the medium table format.""" custom = [ check_partial(reaction_id_check, frozenset(r.id for r in model.reactions)) ] super(Medium, self).validate(model=model, checks=checks + cu...
python
def validate(self, model, checks=[]): """Use a defined schema to validate the medium table format.""" custom = [ check_partial(reaction_id_check, frozenset(r.id for r in model.reactions)) ] super(Medium, self).validate(model=model, checks=checks + cu...
[ "def", "validate", "(", "self", ",", "model", ",", "checks", "=", "[", "]", ")", ":", "custom", "=", "[", "check_partial", "(", "reaction_id_check", ",", "frozenset", "(", "r", ".", "id", "for", "r", "in", "model", ".", "reactions", ")", ")", "]", ...
Use a defined schema to validate the medium table format.
[ "Use", "a", "defined", "schema", "to", "validate", "the", "medium", "table", "format", "." ]
train
https://github.com/opencobra/memote/blob/276630fcd4449fb7b914186edfd38c239e7052df/memote/experimental/medium.py#L48-L54
opencobra/memote
memote/experimental/medium.py
Medium.apply
def apply(self, model): """Set the defined medium on the given model.""" model.medium = {row.exchange: row.uptake for row in self.data.itertuples(index=False)}
python
def apply(self, model): """Set the defined medium on the given model.""" model.medium = {row.exchange: row.uptake for row in self.data.itertuples(index=False)}
[ "def", "apply", "(", "self", ",", "model", ")", ":", "model", ".", "medium", "=", "{", "row", ".", "exchange", ":", "row", ".", "uptake", "for", "row", "in", "self", ".", "data", ".", "itertuples", "(", "index", "=", "False", ")", "}" ]
Set the defined medium on the given model.
[ "Set", "the", "defined", "medium", "on", "the", "given", "model", "." ]
train
https://github.com/opencobra/memote/blob/276630fcd4449fb7b914186edfd38c239e7052df/memote/experimental/medium.py#L56-L59
opencobra/memote
memote/suite/results/result.py
MemoteResult.add_environment_information
def add_environment_information(meta): """Record environment information.""" meta["timestamp"] = datetime.utcnow().isoformat(" ") meta["platform"] = platform.system() meta["release"] = platform.release() meta["python"] = platform.python_version() meta["packages"] = get_pk...
python
def add_environment_information(meta): """Record environment information.""" meta["timestamp"] = datetime.utcnow().isoformat(" ") meta["platform"] = platform.system() meta["release"] = platform.release() meta["python"] = platform.python_version() meta["packages"] = get_pk...
[ "def", "add_environment_information", "(", "meta", ")", ":", "meta", "[", "\"timestamp\"", "]", "=", "datetime", ".", "utcnow", "(", ")", ".", "isoformat", "(", "\" \"", ")", "meta", "[", "\"platform\"", "]", "=", "platform", ".", "system", "(", ")", "me...
Record environment information.
[ "Record", "environment", "information", "." ]
train
https://github.com/opencobra/memote/blob/276630fcd4449fb7b914186edfd38c239e7052df/memote/suite/results/result.py#L46-L52
opencobra/memote
memote/support/helpers.py
find_transported_elements
def find_transported_elements(rxn): """ Return a dictionary showing the amount of transported elements of a rxn. Collects the elements for each metabolite participating in a reaction, multiplies the amount by the metabolite's stoichiometry in the reaction and bins the result according to the compar...
python
def find_transported_elements(rxn): """ Return a dictionary showing the amount of transported elements of a rxn. Collects the elements for each metabolite participating in a reaction, multiplies the amount by the metabolite's stoichiometry in the reaction and bins the result according to the compar...
[ "def", "find_transported_elements", "(", "rxn", ")", ":", "element_dist", "=", "defaultdict", "(", ")", "# Collecting elements for each metabolite.", "for", "met", "in", "rxn", ".", "metabolites", ":", "if", "met", ".", "compartment", "not", "in", "element_dist", ...
Return a dictionary showing the amount of transported elements of a rxn. Collects the elements for each metabolite participating in a reaction, multiplies the amount by the metabolite's stoichiometry in the reaction and bins the result according to the compartment that metabolite is in. This produces a...
[ "Return", "a", "dictionary", "showing", "the", "amount", "of", "transported", "elements", "of", "a", "rxn", "." ]
train
https://github.com/opencobra/memote/blob/276630fcd4449fb7b914186edfd38c239e7052df/memote/support/helpers.py#L81-L120
opencobra/memote
memote/support/helpers.py
find_transport_reactions
def find_transport_reactions(model): """ Return a list of all transport reactions. Parameters ---------- model : cobra.Model The metabolic model under investigation. Notes ----- A transport reaction is defined as follows: 1. It contains metabolites from at least 2 compartme...
python
def find_transport_reactions(model): """ Return a list of all transport reactions. Parameters ---------- model : cobra.Model The metabolic model under investigation. Notes ----- A transport reaction is defined as follows: 1. It contains metabolites from at least 2 compartme...
[ "def", "find_transport_reactions", "(", "model", ")", ":", "transport_reactions", "=", "[", "]", "transport_rxn_candidates", "=", "set", "(", "model", ".", "reactions", ")", "-", "set", "(", "model", ".", "boundary", ")", "-", "set", "(", "find_biomass_reactio...
Return a list of all transport reactions. Parameters ---------- model : cobra.Model The metabolic model under investigation. Notes ----- A transport reaction is defined as follows: 1. It contains metabolites from at least 2 compartments and 2. at least 1 metabolite undergoes no...
[ "Return", "a", "list", "of", "all", "transport", "reactions", "." ]
train
https://github.com/opencobra/memote/blob/276630fcd4449fb7b914186edfd38c239e7052df/memote/support/helpers.py#L124-L181
opencobra/memote
memote/support/helpers.py
is_transport_reaction_formulae
def is_transport_reaction_formulae(rxn): """ Return boolean if a reaction is a transport reaction (from formulae). Parameters ---------- rxn: cobra.Reaction The metabolic reaction under investigation. """ # Collecting criteria to classify transporters by. rxn_reactants = set([m...
python
def is_transport_reaction_formulae(rxn): """ Return boolean if a reaction is a transport reaction (from formulae). Parameters ---------- rxn: cobra.Reaction The metabolic reaction under investigation. """ # Collecting criteria to classify transporters by. rxn_reactants = set([m...
[ "def", "is_transport_reaction_formulae", "(", "rxn", ")", ":", "# Collecting criteria to classify transporters by.", "rxn_reactants", "=", "set", "(", "[", "met", ".", "formula", "for", "met", "in", "rxn", ".", "reactants", "]", ")", "rxn_products", "=", "set", "(...
Return boolean if a reaction is a transport reaction (from formulae). Parameters ---------- rxn: cobra.Reaction The metabolic reaction under investigation.
[ "Return", "boolean", "if", "a", "reaction", "is", "a", "transport", "reaction", "(", "from", "formulae", ")", "." ]
train
https://github.com/opencobra/memote/blob/276630fcd4449fb7b914186edfd38c239e7052df/memote/support/helpers.py#L184-L217
opencobra/memote
memote/support/helpers.py
is_transport_reaction_annotations
def is_transport_reaction_annotations(rxn): """ Return boolean if a reaction is a transport reaction (from annotations). Parameters ---------- rxn: cobra.Reaction The metabolic reaction under investigation. """ reactants = set([(k, tuple(v)) for met in rxn.reactants ...
python
def is_transport_reaction_annotations(rxn): """ Return boolean if a reaction is a transport reaction (from annotations). Parameters ---------- rxn: cobra.Reaction The metabolic reaction under investigation. """ reactants = set([(k, tuple(v)) for met in rxn.reactants ...
[ "def", "is_transport_reaction_annotations", "(", "rxn", ")", ":", "reactants", "=", "set", "(", "[", "(", "k", ",", "tuple", "(", "v", ")", ")", "for", "met", "in", "rxn", ".", "reactants", "for", "k", ",", "v", "in", "iteritems", "(", "met", ".", ...
Return boolean if a reaction is a transport reaction (from annotations). Parameters ---------- rxn: cobra.Reaction The metabolic reaction under investigation.
[ "Return", "boolean", "if", "a", "reaction", "is", "a", "transport", "reaction", "(", "from", "annotations", ")", "." ]
train
https://github.com/opencobra/memote/blob/276630fcd4449fb7b914186edfd38c239e7052df/memote/support/helpers.py#L220-L246
opencobra/memote
memote/support/helpers.py
find_converting_reactions
def find_converting_reactions(model, pair): """ Find all reactions which convert a given metabolite pair. Parameters ---------- model : cobra.Model The metabolic model under investigation. pair: tuple or list A pair of metabolite identifiers without compartment suffix. Retu...
python
def find_converting_reactions(model, pair): """ Find all reactions which convert a given metabolite pair. Parameters ---------- model : cobra.Model The metabolic model under investigation. pair: tuple or list A pair of metabolite identifiers without compartment suffix. Retu...
[ "def", "find_converting_reactions", "(", "model", ",", "pair", ")", ":", "first", "=", "set", "(", "find_met_in_model", "(", "model", ",", "pair", "[", "0", "]", ")", ")", "second", "=", "set", "(", "find_met_in_model", "(", "model", ",", "pair", "[", ...
Find all reactions which convert a given metabolite pair. Parameters ---------- model : cobra.Model The metabolic model under investigation. pair: tuple or list A pair of metabolite identifiers without compartment suffix. Returns ------- frozenset The set of reactio...
[ "Find", "all", "reactions", "which", "convert", "a", "given", "metabolite", "pair", "." ]
train
https://github.com/opencobra/memote/blob/276630fcd4449fb7b914186edfd38c239e7052df/memote/support/helpers.py#L249-L278
opencobra/memote
memote/support/helpers.py
find_biomass_reaction
def find_biomass_reaction(model): """ Return a list of the biomass reaction(s) of the model. This function identifies possible biomass reactions using two steps: 1. Return reactions that include the SBO annotation "SBO:0000629" for biomass. If no reactions can be identifies this way: 2. Loo...
python
def find_biomass_reaction(model): """ Return a list of the biomass reaction(s) of the model. This function identifies possible biomass reactions using two steps: 1. Return reactions that include the SBO annotation "SBO:0000629" for biomass. If no reactions can be identifies this way: 2. Loo...
[ "def", "find_biomass_reaction", "(", "model", ")", ":", "sbo_matches", "=", "set", "(", "[", "rxn", "for", "rxn", "in", "model", ".", "reactions", "if", "rxn", ".", "annotation", "is", "not", "None", "and", "'sbo'", "in", "rxn", ".", "annotation", "and",...
Return a list of the biomass reaction(s) of the model. This function identifies possible biomass reactions using two steps: 1. Return reactions that include the SBO annotation "SBO:0000629" for biomass. If no reactions can be identifies this way: 2. Look for the ``buzzwords`` "biomass", "growth" an...
[ "Return", "a", "list", "of", "the", "biomass", "reaction", "(", "s", ")", "of", "the", "model", "." ]
train
https://github.com/opencobra/memote/blob/276630fcd4449fb7b914186edfd38c239e7052df/memote/support/helpers.py#L282-L333
opencobra/memote
memote/support/helpers.py
find_demand_reactions
def find_demand_reactions(model): u""" Return a list of demand reactions. Parameters ---------- model : cobra.Model The metabolic model under investigation. Notes ----- [1] defines demand reactions as: -- 'unbalanced network reactions that allow the accumulation of a compou...
python
def find_demand_reactions(model): u""" Return a list of demand reactions. Parameters ---------- model : cobra.Model The metabolic model under investigation. Notes ----- [1] defines demand reactions as: -- 'unbalanced network reactions that allow the accumulation of a compou...
[ "def", "find_demand_reactions", "(", "model", ")", ":", "try", ":", "extracellular", "=", "find_compartment_id_in_model", "(", "model", ",", "'e'", ")", "except", "KeyError", ":", "extracellular", "=", "None", "return", "find_boundary_types", "(", "model", ",", ...
u""" Return a list of demand reactions. Parameters ---------- model : cobra.Model The metabolic model under investigation. Notes ----- [1] defines demand reactions as: -- 'unbalanced network reactions that allow the accumulation of a compound' -- reactions that are chiefly ...
[ "u", "Return", "a", "list", "of", "demand", "reactions", "." ]
train
https://github.com/opencobra/memote/blob/276630fcd4449fb7b914186edfd38c239e7052df/memote/support/helpers.py#L337-L373
opencobra/memote
memote/support/helpers.py
find_sink_reactions
def find_sink_reactions(model): u""" Return a list of sink reactions. Parameters ---------- model : cobra.Model The metabolic model under investigation. Notes ----- [1] defines sink reactions as: -- 'similar to demand reactions' but reversible, thus able to supply the m...
python
def find_sink_reactions(model): u""" Return a list of sink reactions. Parameters ---------- model : cobra.Model The metabolic model under investigation. Notes ----- [1] defines sink reactions as: -- 'similar to demand reactions' but reversible, thus able to supply the m...
[ "def", "find_sink_reactions", "(", "model", ")", ":", "try", ":", "extracellular", "=", "find_compartment_id_in_model", "(", "model", ",", "'e'", ")", "except", "KeyError", ":", "extracellular", "=", "None", "return", "find_boundary_types", "(", "model", ",", "'...
u""" Return a list of sink reactions. Parameters ---------- model : cobra.Model The metabolic model under investigation. Notes ----- [1] defines sink reactions as: -- 'similar to demand reactions' but reversible, thus able to supply the model with metabolites -- reactio...
[ "u", "Return", "a", "list", "of", "sink", "reactions", "." ]
train
https://github.com/opencobra/memote/blob/276630fcd4449fb7b914186edfd38c239e7052df/memote/support/helpers.py#L377-L412
opencobra/memote
memote/support/helpers.py
find_exchange_rxns
def find_exchange_rxns(model): u""" Return a list of exchange reactions. Parameters ---------- model : cobra.Model The metabolic model under investigation. Notes ----- [1] defines exchange reactions as: -- reactions that 'define the extracellular environment' -- 'unbala...
python
def find_exchange_rxns(model): u""" Return a list of exchange reactions. Parameters ---------- model : cobra.Model The metabolic model under investigation. Notes ----- [1] defines exchange reactions as: -- reactions that 'define the extracellular environment' -- 'unbala...
[ "def", "find_exchange_rxns", "(", "model", ")", ":", "try", ":", "extracellular", "=", "find_compartment_id_in_model", "(", "model", ",", "'e'", ")", "except", "KeyError", ":", "extracellular", "=", "None", "return", "find_boundary_types", "(", "model", ",", "'e...
u""" Return a list of exchange reactions. Parameters ---------- model : cobra.Model The metabolic model under investigation. Notes ----- [1] defines exchange reactions as: -- reactions that 'define the extracellular environment' -- 'unbalanced, extra-organism reactions that...
[ "u", "Return", "a", "list", "of", "exchange", "reactions", "." ]
train
https://github.com/opencobra/memote/blob/276630fcd4449fb7b914186edfd38c239e7052df/memote/support/helpers.py#L416-L450
opencobra/memote
memote/support/helpers.py
find_interchange_biomass_reactions
def find_interchange_biomass_reactions(model, biomass=None): """ Return the set of all transport, boundary, and biomass reactions. These reactions are either pseudo-reactions, or incorporated to allow metabolites to pass between compartments. Some tests focus on purely metabolic reactions and hence...
python
def find_interchange_biomass_reactions(model, biomass=None): """ Return the set of all transport, boundary, and biomass reactions. These reactions are either pseudo-reactions, or incorporated to allow metabolites to pass between compartments. Some tests focus on purely metabolic reactions and hence...
[ "def", "find_interchange_biomass_reactions", "(", "model", ",", "biomass", "=", "None", ")", ":", "boundary", "=", "set", "(", "model", ".", "boundary", ")", "transporters", "=", "find_transport_reactions", "(", "model", ")", "if", "biomass", "is", "None", ":"...
Return the set of all transport, boundary, and biomass reactions. These reactions are either pseudo-reactions, or incorporated to allow metabolites to pass between compartments. Some tests focus on purely metabolic reactions and hence exclude this set. Parameters ---------- model : cobra.Model...
[ "Return", "the", "set", "of", "all", "transport", "boundary", "and", "biomass", "reactions", "." ]
train
https://github.com/opencobra/memote/blob/276630fcd4449fb7b914186edfd38c239e7052df/memote/support/helpers.py#L453-L473
opencobra/memote
memote/support/helpers.py
run_fba
def run_fba(model, rxn_id, direction="max", single_value=True): """ Return the solution of an FBA to a set objective function. Parameters ---------- model : cobra.Model The metabolic model under investigation. rxn_id : string A string containing the reaction ID of the desired FB...
python
def run_fba(model, rxn_id, direction="max", single_value=True): """ Return the solution of an FBA to a set objective function. Parameters ---------- model : cobra.Model The metabolic model under investigation. rxn_id : string A string containing the reaction ID of the desired FB...
[ "def", "run_fba", "(", "model", ",", "rxn_id", ",", "direction", "=", "\"max\"", ",", "single_value", "=", "True", ")", ":", "model", ".", "objective", "=", "model", ".", "reactions", ".", "get_by_id", "(", "rxn_id", ")", "model", ".", "objective_direction...
Return the solution of an FBA to a set objective function. Parameters ---------- model : cobra.Model The metabolic model under investigation. rxn_id : string A string containing the reaction ID of the desired FBA objective. direction: string A string containing either "max" ...
[ "Return", "the", "solution", "of", "an", "FBA", "to", "a", "set", "objective", "function", "." ]
train
https://github.com/opencobra/memote/blob/276630fcd4449fb7b914186edfd38c239e7052df/memote/support/helpers.py#L476-L511
opencobra/memote
memote/support/helpers.py
close_boundaries_sensibly
def close_boundaries_sensibly(model): """ Return a cobra model with all boundaries closed and changed constraints. In the returned model previously fixed reactions are no longer constrained as such. Instead reactions are constrained according to their reversibility. This is to prevent the FBA from ...
python
def close_boundaries_sensibly(model): """ Return a cobra model with all boundaries closed and changed constraints. In the returned model previously fixed reactions are no longer constrained as such. Instead reactions are constrained according to their reversibility. This is to prevent the FBA from ...
[ "def", "close_boundaries_sensibly", "(", "model", ")", ":", "for", "rxn", "in", "model", ".", "reactions", ":", "if", "rxn", ".", "reversibility", ":", "rxn", ".", "bounds", "=", "-", "1", ",", "1", "else", ":", "rxn", ".", "bounds", "=", "0", ",", ...
Return a cobra model with all boundaries closed and changed constraints. In the returned model previously fixed reactions are no longer constrained as such. Instead reactions are constrained according to their reversibility. This is to prevent the FBA from becoming infeasible when trying to solve a mod...
[ "Return", "a", "cobra", "model", "with", "all", "boundaries", "closed", "and", "changed", "constraints", "." ]
train
https://github.com/opencobra/memote/blob/276630fcd4449fb7b914186edfd38c239e7052df/memote/support/helpers.py#L514-L541
opencobra/memote
memote/support/helpers.py
metabolites_per_compartment
def metabolites_per_compartment(model, compartment_id): """ Identify all metabolites that belong to a given compartment. Parameters ---------- model : cobra.Model The metabolic model under investigation. compartment_id : string Model specific compartment identifier. Returns...
python
def metabolites_per_compartment(model, compartment_id): """ Identify all metabolites that belong to a given compartment. Parameters ---------- model : cobra.Model The metabolic model under investigation. compartment_id : string Model specific compartment identifier. Returns...
[ "def", "metabolites_per_compartment", "(", "model", ",", "compartment_id", ")", ":", "return", "[", "met", "for", "met", "in", "model", ".", "metabolites", "if", "met", ".", "compartment", "==", "compartment_id", "]" ]
Identify all metabolites that belong to a given compartment. Parameters ---------- model : cobra.Model The metabolic model under investigation. compartment_id : string Model specific compartment identifier. Returns ------- list List of metabolites belonging to a giv...
[ "Identify", "all", "metabolites", "that", "belong", "to", "a", "given", "compartment", "." ]
train
https://github.com/opencobra/memote/blob/276630fcd4449fb7b914186edfd38c239e7052df/memote/support/helpers.py#L572-L590
opencobra/memote
memote/support/helpers.py
largest_compartment_id_met
def largest_compartment_id_met(model): """ Return the ID of the compartment with the most metabolites. Parameters ---------- model : cobra.Model The metabolic model under investigation. Returns ------- string Compartment ID of the compartment with the most metabolites. ...
python
def largest_compartment_id_met(model): """ Return the ID of the compartment with the most metabolites. Parameters ---------- model : cobra.Model The metabolic model under investigation. Returns ------- string Compartment ID of the compartment with the most metabolites. ...
[ "def", "largest_compartment_id_met", "(", "model", ")", ":", "# Sort compartments by decreasing size and extract the largest two.", "candidate", ",", "second", "=", "sorted", "(", "(", "(", "c", ",", "len", "(", "metabolites_per_compartment", "(", "model", ",", "c", "...
Return the ID of the compartment with the most metabolites. Parameters ---------- model : cobra.Model The metabolic model under investigation. Returns ------- string Compartment ID of the compartment with the most metabolites.
[ "Return", "the", "ID", "of", "the", "compartment", "with", "the", "most", "metabolites", "." ]
train
https://github.com/opencobra/memote/blob/276630fcd4449fb7b914186edfd38c239e7052df/memote/support/helpers.py#L593-L618
opencobra/memote
memote/support/helpers.py
find_compartment_id_in_model
def find_compartment_id_in_model(model, compartment_id): """ Identify a model compartment by looking up names in COMPARTMENT_SHORTLIST. Parameters ---------- model : cobra.Model The metabolic model under investigation. compartment_id : string Memote internal compartment identifi...
python
def find_compartment_id_in_model(model, compartment_id): """ Identify a model compartment by looking up names in COMPARTMENT_SHORTLIST. Parameters ---------- model : cobra.Model The metabolic model under investigation. compartment_id : string Memote internal compartment identifi...
[ "def", "find_compartment_id_in_model", "(", "model", ",", "compartment_id", ")", ":", "if", "compartment_id", "not", "in", "COMPARTMENT_SHORTLIST", ".", "keys", "(", ")", ":", "raise", "KeyError", "(", "\"{} is not in the COMPARTMENT_SHORTLIST! Make sure \"", "\"you typed...
Identify a model compartment by looking up names in COMPARTMENT_SHORTLIST. Parameters ---------- model : cobra.Model The metabolic model under investigation. compartment_id : string Memote internal compartment identifier used to access compartment name shortlist to look up poten...
[ "Identify", "a", "model", "compartment", "by", "looking", "up", "names", "in", "COMPARTMENT_SHORTLIST", "." ]
train
https://github.com/opencobra/memote/blob/276630fcd4449fb7b914186edfd38c239e7052df/memote/support/helpers.py#L621-L661
opencobra/memote
memote/support/helpers.py
find_met_in_model
def find_met_in_model(model, mnx_id, compartment_id=None): """ Return specific metabolites by looking up IDs in METANETX_SHORTLIST. Parameters ---------- model : cobra.Model The metabolic model under investigation. mnx_id : string Memote internal MetaNetX metabolite identifier u...
python
def find_met_in_model(model, mnx_id, compartment_id=None): """ Return specific metabolites by looking up IDs in METANETX_SHORTLIST. Parameters ---------- model : cobra.Model The metabolic model under investigation. mnx_id : string Memote internal MetaNetX metabolite identifier u...
[ "def", "find_met_in_model", "(", "model", ",", "mnx_id", ",", "compartment_id", "=", "None", ")", ":", "def", "compare_annotation", "(", "annotation", ")", ":", "\"\"\"\n Return annotation IDs that match to METANETX_SHORTLIST references.\n\n Compares the set of META...
Return specific metabolites by looking up IDs in METANETX_SHORTLIST. Parameters ---------- model : cobra.Model The metabolic model under investigation. mnx_id : string Memote internal MetaNetX metabolite identifier used to map between cross-references in the METANETX_SHORTLIST. ...
[ "Return", "specific", "metabolites", "by", "looking", "up", "IDs", "in", "METANETX_SHORTLIST", "." ]
train
https://github.com/opencobra/memote/blob/276630fcd4449fb7b914186edfd38c239e7052df/memote/support/helpers.py#L664-L764
opencobra/memote
memote/support/helpers.py
find_bounds
def find_bounds(model): """ Return the median upper and lower bound of the metabolic model. Bounds can vary from model to model. Cobrapy defaults to (-1000, 1000) but this may not be the case for merged or autogenerated models. In these cases, this function is used to iterate over all the bounds of...
python
def find_bounds(model): """ Return the median upper and lower bound of the metabolic model. Bounds can vary from model to model. Cobrapy defaults to (-1000, 1000) but this may not be the case for merged or autogenerated models. In these cases, this function is used to iterate over all the bounds of...
[ "def", "find_bounds", "(", "model", ")", ":", "lower_bounds", "=", "np", ".", "asarray", "(", "[", "rxn", ".", "lower_bound", "for", "rxn", "in", "model", ".", "reactions", "]", ",", "dtype", "=", "float", ")", "upper_bounds", "=", "np", ".", "asarray"...
Return the median upper and lower bound of the metabolic model. Bounds can vary from model to model. Cobrapy defaults to (-1000, 1000) but this may not be the case for merged or autogenerated models. In these cases, this function is used to iterate over all the bounds of all the reactions and find the ...
[ "Return", "the", "median", "upper", "and", "lower", "bound", "of", "the", "metabolic", "model", "." ]
train
https://github.com/opencobra/memote/blob/276630fcd4449fb7b914186edfd38c239e7052df/memote/support/helpers.py#L781-L809
opencobra/memote
memote/suite/reporting/report.py
Report.render_html
def render_html(self): """Render an HTML report.""" return self._template.safe_substitute( report_type=self._report_type, results=self.render_json() )
python
def render_html(self): """Render an HTML report.""" return self._template.safe_substitute( report_type=self._report_type, results=self.render_json() )
[ "def", "render_html", "(", "self", ")", ":", "return", "self", ".", "_template", ".", "safe_substitute", "(", "report_type", "=", "self", ".", "_report_type", ",", "results", "=", "self", ".", "render_json", "(", ")", ")" ]
Render an HTML report.
[ "Render", "an", "HTML", "report", "." ]
train
https://github.com/opencobra/memote/blob/276630fcd4449fb7b914186edfd38c239e7052df/memote/suite/reporting/report.py#L80-L85
opencobra/memote
memote/suite/reporting/report.py
Report.compute_score
def compute_score(self): """Calculate the overall test score using the configuration.""" # LOGGER.info("Begin scoring") cases = self.get_configured_tests() | set(self.result.cases) scores = DataFrame({"score": 0.0, "max": 1.0}, index=sorted(cases)) self...
python
def compute_score(self): """Calculate the overall test score using the configuration.""" # LOGGER.info("Begin scoring") cases = self.get_configured_tests() | set(self.result.cases) scores = DataFrame({"score": 0.0, "max": 1.0}, index=sorted(cases)) self...
[ "def", "compute_score", "(", "self", ")", ":", "# LOGGER.info(\"Begin scoring\")", "cases", "=", "self", ".", "get_configured_tests", "(", ")", "|", "set", "(", "self", ".", "result", ".", "cases", ")", "scores", "=", "DataFrame", "(", "{", "\"score\"", ":",...
Calculate the overall test score using the configuration.
[ "Calculate", "the", "overall", "test", "score", "using", "the", "configuration", "." ]
train
https://github.com/opencobra/memote/blob/276630fcd4449fb7b914186edfd38c239e7052df/memote/suite/reporting/report.py#L114-L164
opencobra/memote
memote/support/sbo.py
find_components_without_sbo_terms
def find_components_without_sbo_terms(model, components): """ Find model components that are not annotated with any SBO terms. Parameters ---------- model : cobra.Model The metabolic model under investigation. components : {"metabolites", "reactions", "genes"} A string denoting ...
python
def find_components_without_sbo_terms(model, components): """ Find model components that are not annotated with any SBO terms. Parameters ---------- model : cobra.Model The metabolic model under investigation. components : {"metabolites", "reactions", "genes"} A string denoting ...
[ "def", "find_components_without_sbo_terms", "(", "model", ",", "components", ")", ":", "return", "[", "elem", "for", "elem", "in", "getattr", "(", "model", ",", "components", ")", "if", "elem", ".", "annotation", "is", "None", "or", "'sbo'", "not", "in", "...
Find model components that are not annotated with any SBO terms. Parameters ---------- model : cobra.Model The metabolic model under investigation. components : {"metabolites", "reactions", "genes"} A string denoting `cobra.Model` components. Returns ------- list Th...
[ "Find", "model", "components", "that", "are", "not", "annotated", "with", "any", "SBO", "terms", "." ]
train
https://github.com/opencobra/memote/blob/276630fcd4449fb7b914186edfd38c239e7052df/memote/support/sbo.py#L27-L45
opencobra/memote
memote/support/sbo.py
check_component_for_specific_sbo_term
def check_component_for_specific_sbo_term(items, term): r""" Identify model components that lack a specific SBO term(s). Parameters ---------- items : list A list of model components i.e. reactions to be checked for a specific SBO term. term : str or list of str A string...
python
def check_component_for_specific_sbo_term(items, term): r""" Identify model components that lack a specific SBO term(s). Parameters ---------- items : list A list of model components i.e. reactions to be checked for a specific SBO term. term : str or list of str A string...
[ "def", "check_component_for_specific_sbo_term", "(", "items", ",", "term", ")", ":", "# check for multiple allowable SBO terms", "if", "isinstance", "(", "term", ",", "list", ")", ":", "return", "[", "elem", "for", "elem", "in", "items", "if", "elem", ".", "anno...
r""" Identify model components that lack a specific SBO term(s). Parameters ---------- items : list A list of model components i.e. reactions to be checked for a specific SBO term. term : str or list of str A string denoting a valid SBO term matching the regex '^SBO:\d{7}$' ...
[ "r", "Identify", "model", "components", "that", "lack", "a", "specific", "SBO", "term", "(", "s", ")", "." ]
train
https://github.com/opencobra/memote/blob/276630fcd4449fb7b914186edfd38c239e7052df/memote/support/sbo.py#L48-L77
opencobra/memote
memote/support/thermodynamics.py
get_smallest_compound_id
def get_smallest_compound_id(compounds_identifiers): """ Return the smallest KEGG compound identifier from a list. KEGG identifiers may map to compounds, drugs or glycans prefixed respectively with "C", "D", and "G" followed by at least 5 digits. We choose the lowest KEGG identifier with the assump...
python
def get_smallest_compound_id(compounds_identifiers): """ Return the smallest KEGG compound identifier from a list. KEGG identifiers may map to compounds, drugs or glycans prefixed respectively with "C", "D", and "G" followed by at least 5 digits. We choose the lowest KEGG identifier with the assump...
[ "def", "get_smallest_compound_id", "(", "compounds_identifiers", ")", ":", "return", "min", "(", "(", "c", "for", "c", "in", "compounds_identifiers", "if", "c", ".", "startswith", "(", "\"C\"", ")", ")", ",", "key", "=", "lambda", "c", ":", "int", "(", "...
Return the smallest KEGG compound identifier from a list. KEGG identifiers may map to compounds, drugs or glycans prefixed respectively with "C", "D", and "G" followed by at least 5 digits. We choose the lowest KEGG identifier with the assumption that several identifiers are due to chirality and that t...
[ "Return", "the", "smallest", "KEGG", "compound", "identifier", "from", "a", "list", "." ]
train
https://github.com/opencobra/memote/blob/276630fcd4449fb7b914186edfd38c239e7052df/memote/support/thermodynamics.py#L37-L64
opencobra/memote
memote/support/thermodynamics.py
map_metabolite2kegg
def map_metabolite2kegg(metabolite): """ Return a KEGG compound identifier for the metabolite if it exists. First see if there is an unambiguous mapping to a single KEGG compound ID provided with the model. If not, check if there is any KEGG compound ID in a list of mappings. KEGG IDs may map to co...
python
def map_metabolite2kegg(metabolite): """ Return a KEGG compound identifier for the metabolite if it exists. First see if there is an unambiguous mapping to a single KEGG compound ID provided with the model. If not, check if there is any KEGG compound ID in a list of mappings. KEGG IDs may map to co...
[ "def", "map_metabolite2kegg", "(", "metabolite", ")", ":", "logger", ".", "debug", "(", "\"Looking for KEGG compound identifier for %s.\"", ",", "metabolite", ".", "id", ")", "kegg_annotation", "=", "metabolite", ".", "annotation", ".", "get", "(", "\"kegg.compound\""...
Return a KEGG compound identifier for the metabolite if it exists. First see if there is an unambiguous mapping to a single KEGG compound ID provided with the model. If not, check if there is any KEGG compound ID in a list of mappings. KEGG IDs may map to compounds, drugs and glycans. KEGG compound IDs...
[ "Return", "a", "KEGG", "compound", "identifier", "for", "the", "metabolite", "if", "it", "exists", "." ]
train
https://github.com/opencobra/memote/blob/276630fcd4449fb7b914186edfd38c239e7052df/memote/support/thermodynamics.py#L67-L126
opencobra/memote
memote/support/thermodynamics.py
translate_reaction
def translate_reaction(reaction, metabolite_mapping): """ Return a mapping from KEGG compound identifiers to coefficients. Parameters ---------- reaction : cobra.Reaction The reaction whose metabolites are to be translated. metabolite_mapping : dict An existing mapping from cobr...
python
def translate_reaction(reaction, metabolite_mapping): """ Return a mapping from KEGG compound identifiers to coefficients. Parameters ---------- reaction : cobra.Reaction The reaction whose metabolites are to be translated. metabolite_mapping : dict An existing mapping from cobr...
[ "def", "translate_reaction", "(", "reaction", ",", "metabolite_mapping", ")", ":", "# Transport reactions where the same metabolite occurs in different", "# compartments should have been filtered out but just to be sure, we add", "# coefficients in the mapping.", "stoichiometry", "=", "def...
Return a mapping from KEGG compound identifiers to coefficients. Parameters ---------- reaction : cobra.Reaction The reaction whose metabolites are to be translated. metabolite_mapping : dict An existing mapping from cobra.Metabolite to KEGG compound identifier that may already ...
[ "Return", "a", "mapping", "from", "KEGG", "compound", "identifiers", "to", "coefficients", "." ]
train
https://github.com/opencobra/memote/blob/276630fcd4449fb7b914186edfd38c239e7052df/memote/support/thermodynamics.py#L129-L158
opencobra/memote
memote/support/thermodynamics.py
find_thermodynamic_reversibility_index
def find_thermodynamic_reversibility_index(reactions): u""" Return the reversibility index of the given reactions. To determine the reversibility index, we calculate the reversibility index ln_gamma (see [1]_ section 3.5) of each reaction using the eQuilibrator API [2]_. Parameters -------...
python
def find_thermodynamic_reversibility_index(reactions): u""" Return the reversibility index of the given reactions. To determine the reversibility index, we calculate the reversibility index ln_gamma (see [1]_ section 3.5) of each reaction using the eQuilibrator API [2]_. Parameters -------...
[ "def", "find_thermodynamic_reversibility_index", "(", "reactions", ")", ":", "incomplete_mapping", "=", "[", "]", "problematic_calculation", "=", "[", "]", "reversibility_indexes", "=", "[", "]", "unbalanced", "=", "[", "]", "metabolite_mapping", "=", "{", "}", "f...
u""" Return the reversibility index of the given reactions. To determine the reversibility index, we calculate the reversibility index ln_gamma (see [1]_ section 3.5) of each reaction using the eQuilibrator API [2]_. Parameters ---------- reactions: list of cobra.Reaction A...
[ "u", "Return", "the", "reversibility", "index", "of", "the", "given", "reactions", "." ]
train
https://github.com/opencobra/memote/blob/276630fcd4449fb7b914186edfd38c239e7052df/memote/support/thermodynamics.py#L161-L234
opencobra/memote
memote/support/consistency.py
check_stoichiometric_consistency
def check_stoichiometric_consistency(model): """ Verify the consistency of the model's stoichiometry. Parameters ---------- model : cobra.Model The metabolic model under investigation. Notes ----- See [1]_ section 3.1 for a complete description of the algorithm. .. [1] Gev...
python
def check_stoichiometric_consistency(model): """ Verify the consistency of the model's stoichiometry. Parameters ---------- model : cobra.Model The metabolic model under investigation. Notes ----- See [1]_ section 3.1 for a complete description of the algorithm. .. [1] Gev...
[ "def", "check_stoichiometric_consistency", "(", "model", ")", ":", "problem", "=", "model", ".", "problem", "# The transpose of the stoichiometric matrix N.T in the paper.", "stoich_trans", "=", "problem", ".", "Model", "(", ")", "internal_rxns", "=", "con_helpers", ".", ...
Verify the consistency of the model's stoichiometry. Parameters ---------- model : cobra.Model The metabolic model under investigation. Notes ----- See [1]_ section 3.1 for a complete description of the algorithm. .. [1] Gevorgyan, A., M. G Poolman, and D. A Fell. "Dete...
[ "Verify", "the", "consistency", "of", "the", "model", "s", "stoichiometry", "." ]
train
https://github.com/opencobra/memote/blob/276630fcd4449fb7b914186edfd38c239e7052df/memote/support/consistency.py#L63-L110
opencobra/memote
memote/support/consistency.py
find_unconserved_metabolites
def find_unconserved_metabolites(model): """ Detect unconserved metabolites. Parameters ---------- model : cobra.Model The metabolic model under investigation. Notes ----- See [1]_ section 3.2 for a complete description of the algorithm. .. [1] Gevorgyan, A., M. G Poolman...
python
def find_unconserved_metabolites(model): """ Detect unconserved metabolites. Parameters ---------- model : cobra.Model The metabolic model under investigation. Notes ----- See [1]_ section 3.2 for a complete description of the algorithm. .. [1] Gevorgyan, A., M. G Poolman...
[ "def", "find_unconserved_metabolites", "(", "model", ")", ":", "problem", "=", "model", ".", "problem", "stoich_trans", "=", "problem", ".", "Model", "(", ")", "internal_rxns", "=", "con_helpers", ".", "get_internals", "(", "model", ")", "metabolites", "=", "s...
Detect unconserved metabolites. Parameters ---------- model : cobra.Model The metabolic model under investigation. Notes ----- See [1]_ section 3.2 for a complete description of the algorithm. .. [1] Gevorgyan, A., M. G Poolman, and D. A Fell. "Detection of Stoichiomet...
[ "Detect", "unconserved", "metabolites", "." ]
train
https://github.com/opencobra/memote/blob/276630fcd4449fb7b914186edfd38c239e7052df/memote/support/consistency.py#L113-L165
opencobra/memote
memote/support/consistency.py
find_inconsistent_min_stoichiometry
def find_inconsistent_min_stoichiometry(model, atol=1e-13): """ Detect inconsistent minimal net stoichiometries. Parameters ---------- model : cobra.Model The metabolic model under investigation. atol : float, optional Values below the absolute tolerance are treated as zero. Exp...
python
def find_inconsistent_min_stoichiometry(model, atol=1e-13): """ Detect inconsistent minimal net stoichiometries. Parameters ---------- model : cobra.Model The metabolic model under investigation. atol : float, optional Values below the absolute tolerance are treated as zero. Exp...
[ "def", "find_inconsistent_min_stoichiometry", "(", "model", ",", "atol", "=", "1e-13", ")", ":", "if", "check_stoichiometric_consistency", "(", "model", ")", ":", "return", "set", "(", ")", "Model", ",", "Constraint", ",", "Variable", ",", "Objective", "=", "c...
Detect inconsistent minimal net stoichiometries. Parameters ---------- model : cobra.Model The metabolic model under investigation. atol : float, optional Values below the absolute tolerance are treated as zero. Expected to be very small but larger than zero. Notes ----...
[ "Detect", "inconsistent", "minimal", "net", "stoichiometries", "." ]
train
https://github.com/opencobra/memote/blob/276630fcd4449fb7b914186edfd38c239e7052df/memote/support/consistency.py#L170-L246
opencobra/memote
memote/support/consistency.py
detect_energy_generating_cycles
def detect_energy_generating_cycles(model, metabolite_id): u""" Detect erroneous energy-generating cycles for a a single metabolite. The function will first build a dissipation reaction corresponding to the input metabolite. This reaction is then set as the objective for optimization, after closing...
python
def detect_energy_generating_cycles(model, metabolite_id): u""" Detect erroneous energy-generating cycles for a a single metabolite. The function will first build a dissipation reaction corresponding to the input metabolite. This reaction is then set as the objective for optimization, after closing...
[ "def", "detect_energy_generating_cycles", "(", "model", ",", "metabolite_id", ")", ":", "main_comp", "=", "helpers", ".", "find_compartment_id_in_model", "(", "model", ",", "'c'", ")", "met", "=", "helpers", ".", "find_met_in_model", "(", "model", ",", "metabolite...
u""" Detect erroneous energy-generating cycles for a a single metabolite. The function will first build a dissipation reaction corresponding to the input metabolite. This reaction is then set as the objective for optimization, after closing all exchanges. If the reaction was able to carry flux, an ...
[ "u", "Detect", "erroneous", "energy", "-", "generating", "cycles", "for", "a", "a", "single", "metabolite", "." ]
train
https://github.com/opencobra/memote/blob/276630fcd4449fb7b914186edfd38c239e7052df/memote/support/consistency.py#L277-L369
opencobra/memote
memote/support/consistency.py
find_stoichiometrically_balanced_cycles
def find_stoichiometrically_balanced_cycles(model): u""" Find metabolic reactions in stoichiometrically balanced cycles (SBCs). Identify forward and reverse cycles by closing all exchanges and using FVA. Parameters ---------- model : cobra.Model The metabolic model under investigation....
python
def find_stoichiometrically_balanced_cycles(model): u""" Find metabolic reactions in stoichiometrically balanced cycles (SBCs). Identify forward and reverse cycles by closing all exchanges and using FVA. Parameters ---------- model : cobra.Model The metabolic model under investigation....
[ "def", "find_stoichiometrically_balanced_cycles", "(", "model", ")", ":", "helpers", ".", "close_boundaries_sensibly", "(", "model", ")", "fva_result", "=", "flux_variability_analysis", "(", "model", ",", "loopless", "=", "False", ")", "return", "fva_result", ".", "...
u""" Find metabolic reactions in stoichiometrically balanced cycles (SBCs). Identify forward and reverse cycles by closing all exchanges and using FVA. Parameters ---------- model : cobra.Model The metabolic model under investigation. Notes ----- "SBCs are artifacts of metabol...
[ "u", "Find", "metabolic", "reactions", "in", "stoichiometrically", "balanced", "cycles", "(", "SBCs", ")", "." ]
train
https://github.com/opencobra/memote/blob/276630fcd4449fb7b914186edfd38c239e7052df/memote/support/consistency.py#L400-L431
opencobra/memote
memote/support/consistency.py
find_orphans
def find_orphans(model): """ Return metabolites that are only consumed in reactions. Metabolites that are involved in an exchange reaction are never considered to be orphaned. Parameters ---------- model : cobra.Model The metabolic model under investigation. """ exchange =...
python
def find_orphans(model): """ Return metabolites that are only consumed in reactions. Metabolites that are involved in an exchange reaction are never considered to be orphaned. Parameters ---------- model : cobra.Model The metabolic model under investigation. """ exchange =...
[ "def", "find_orphans", "(", "model", ")", ":", "exchange", "=", "frozenset", "(", "model", ".", "exchanges", ")", "return", "[", "met", "for", "met", "in", "model", ".", "metabolites", "if", "(", "len", "(", "met", ".", "reactions", ")", ">", "0", ")...
Return metabolites that are only consumed in reactions. Metabolites that are involved in an exchange reaction are never considered to be orphaned. Parameters ---------- model : cobra.Model The metabolic model under investigation.
[ "Return", "metabolites", "that", "are", "only", "consumed", "in", "reactions", "." ]
train
https://github.com/opencobra/memote/blob/276630fcd4449fb7b914186edfd38c239e7052df/memote/support/consistency.py#L434-L454
opencobra/memote
memote/support/consistency.py
find_metabolites_not_produced_with_open_bounds
def find_metabolites_not_produced_with_open_bounds(model): """ Return metabolites that cannot be produced with open exchange reactions. A perfect model should be able to produce each and every metabolite when all medium components are available. Parameters ---------- model : cobra.Model ...
python
def find_metabolites_not_produced_with_open_bounds(model): """ Return metabolites that cannot be produced with open exchange reactions. A perfect model should be able to produce each and every metabolite when all medium components are available. Parameters ---------- model : cobra.Model ...
[ "def", "find_metabolites_not_produced_with_open_bounds", "(", "model", ")", ":", "mets_not_produced", "=", "list", "(", ")", "helpers", ".", "open_exchanges", "(", "model", ")", "for", "met", "in", "model", ".", "metabolites", ":", "with", "model", ":", "exch", ...
Return metabolites that cannot be produced with open exchange reactions. A perfect model should be able to produce each and every metabolite when all medium components are available. Parameters ---------- model : cobra.Model The metabolic model under investigation. Returns -------...
[ "Return", "metabolites", "that", "cannot", "be", "produced", "with", "open", "exchange", "reactions", "." ]
train
https://github.com/opencobra/memote/blob/276630fcd4449fb7b914186edfd38c239e7052df/memote/support/consistency.py#L493-L520
opencobra/memote
memote/support/consistency.py
find_metabolites_not_consumed_with_open_bounds
def find_metabolites_not_consumed_with_open_bounds(model): """ Return metabolites that cannot be consumed with open boundary reactions. When all metabolites can be secreted, it should be possible for each and every metabolite to be consumed in some form. Parameters ---------- model : cobra...
python
def find_metabolites_not_consumed_with_open_bounds(model): """ Return metabolites that cannot be consumed with open boundary reactions. When all metabolites can be secreted, it should be possible for each and every metabolite to be consumed in some form. Parameters ---------- model : cobra...
[ "def", "find_metabolites_not_consumed_with_open_bounds", "(", "model", ")", ":", "mets_not_consumed", "=", "list", "(", ")", "helpers", ".", "open_exchanges", "(", "model", ")", "for", "met", "in", "model", ".", "metabolites", ":", "with", "model", ":", "exch", ...
Return metabolites that cannot be consumed with open boundary reactions. When all metabolites can be secreted, it should be possible for each and every metabolite to be consumed in some form. Parameters ---------- model : cobra.Model The metabolic model under investigation. Returns ...
[ "Return", "metabolites", "that", "cannot", "be", "consumed", "with", "open", "boundary", "reactions", "." ]
train
https://github.com/opencobra/memote/blob/276630fcd4449fb7b914186edfd38c239e7052df/memote/support/consistency.py#L523-L550
opencobra/memote
memote/support/consistency.py
find_reactions_with_unbounded_flux_default_condition
def find_reactions_with_unbounded_flux_default_condition(model): """ Return list of reactions whose flux is unbounded in the default condition. Parameters ---------- model : cobra.Model The metabolic model under investigation. Returns ------- tuple list A li...
python
def find_reactions_with_unbounded_flux_default_condition(model): """ Return list of reactions whose flux is unbounded in the default condition. Parameters ---------- model : cobra.Model The metabolic model under investigation. Returns ------- tuple list A li...
[ "def", "find_reactions_with_unbounded_flux_default_condition", "(", "model", ")", ":", "try", ":", "fva_result", "=", "flux_variability_analysis", "(", "model", ",", "fraction_of_optimum", "=", "1.0", ")", "except", "Infeasible", "as", "err", ":", "LOGGER", ".", "er...
Return list of reactions whose flux is unbounded in the default condition. Parameters ---------- model : cobra.Model The metabolic model under investigation. Returns ------- tuple list A list of reactions that in default modeling conditions are able to c...
[ "Return", "list", "of", "reactions", "whose", "flux", "is", "unbounded", "in", "the", "default", "condition", "." ]
train
https://github.com/opencobra/memote/blob/276630fcd4449fb7b914186edfd38c239e7052df/memote/support/consistency.py#L553-L612
opencobra/memote
memote/experimental/tabular.py
read_tabular
def read_tabular(filename, dtype_conversion=None): """ Read a tabular data file which can be CSV, TSV, XLS or XLSX. Parameters ---------- filename : str or pathlib.Path The full file path. May be a compressed file. dtype_conversion : dict Column names as keys and corresponding t...
python
def read_tabular(filename, dtype_conversion=None): """ Read a tabular data file which can be CSV, TSV, XLS or XLSX. Parameters ---------- filename : str or pathlib.Path The full file path. May be a compressed file. dtype_conversion : dict Column names as keys and corresponding t...
[ "def", "read_tabular", "(", "filename", ",", "dtype_conversion", "=", "None", ")", ":", "if", "dtype_conversion", "is", "None", ":", "dtype_conversion", "=", "{", "}", "name", ",", "ext", "=", "filename", ".", "split", "(", "\".\"", ",", "1", ")", "ext",...
Read a tabular data file which can be CSV, TSV, XLS or XLSX. Parameters ---------- filename : str or pathlib.Path The full file path. May be a compressed file. dtype_conversion : dict Column names as keys and corresponding type for loading the data. Please take a look at the `pa...
[ "Read", "a", "tabular", "data", "file", "which", "can", "be", "CSV", "TSV", "XLS", "or", "XLSX", "." ]
train
https://github.com/opencobra/memote/blob/276630fcd4449fb7b914186edfd38c239e7052df/memote/experimental/tabular.py#L25-L60
opencobra/memote
memote/suite/cli/reports.py
snapshot
def snapshot(model, filename, pytest_args, exclusive, skip, solver, experimental, custom_tests, custom_config): """ Take a snapshot of a model's state and generate a report. MODEL: Path to model file. Can also be supplied via the environment variable MEMOTE_MODEL or configured in 'setup.cf...
python
def snapshot(model, filename, pytest_args, exclusive, skip, solver, experimental, custom_tests, custom_config): """ Take a snapshot of a model's state and generate a report. MODEL: Path to model file. Can also be supplied via the environment variable MEMOTE_MODEL or configured in 'setup.cf...
[ "def", "snapshot", "(", "model", ",", "filename", ",", "pytest_args", ",", "exclusive", ",", "skip", ",", "solver", ",", "experimental", ",", "custom_tests", ",", "custom_config", ")", ":", "model_obj", ",", "sbml_ver", ",", "notifications", "=", "api", ".",...
Take a snapshot of a model's state and generate a report. MODEL: Path to model file. Can also be supplied via the environment variable MEMOTE_MODEL or configured in 'setup.cfg' or 'memote.ini'.
[ "Take", "a", "snapshot", "of", "a", "model", "s", "state", "and", "generate", "a", "report", "." ]
train
https://github.com/opencobra/memote/blob/276630fcd4449fb7b914186edfd38c239e7052df/memote/suite/cli/reports.py#L89-L119
opencobra/memote
memote/suite/cli/reports.py
history
def history(location, model, filename, deployment, custom_config): """Generate a report over a model's git commit history.""" callbacks.git_installed() LOGGER.info("Initialising history report generation.") if location is None: raise click.BadParameter("No 'location' given or configured.") t...
python
def history(location, model, filename, deployment, custom_config): """Generate a report over a model's git commit history.""" callbacks.git_installed() LOGGER.info("Initialising history report generation.") if location is None: raise click.BadParameter("No 'location' given or configured.") t...
[ "def", "history", "(", "location", ",", "model", ",", "filename", ",", "deployment", ",", "custom_config", ")", ":", "callbacks", ".", "git_installed", "(", ")", "LOGGER", ".", "info", "(", "\"Initialising history report generation.\"", ")", "if", "location", "i...
Generate a report over a model's git commit history.
[ "Generate", "a", "report", "over", "a", "model", "s", "git", "commit", "history", "." ]
train
https://github.com/opencobra/memote/blob/276630fcd4449fb7b914186edfd38c239e7052df/memote/suite/cli/reports.py#L144-L175
opencobra/memote
memote/suite/cli/reports.py
diff
def diff(models, filename, pytest_args, exclusive, skip, solver, experimental, custom_tests, custom_config): """ Take a snapshot of all the supplied models and generate a diff report. MODELS: List of paths to two or more model files. """ if not any(a.startswith("--tb") for a in pytest_args...
python
def diff(models, filename, pytest_args, exclusive, skip, solver, experimental, custom_tests, custom_config): """ Take a snapshot of all the supplied models and generate a diff report. MODELS: List of paths to two or more model files. """ if not any(a.startswith("--tb") for a in pytest_args...
[ "def", "diff", "(", "models", ",", "filename", ",", "pytest_args", ",", "exclusive", ",", "skip", ",", "solver", ",", "experimental", ",", "custom_tests", ",", "custom_config", ")", ":", "if", "not", "any", "(", "a", ".", "startswith", "(", "\"--tb\"", "...
Take a snapshot of all the supplied models and generate a diff report. MODELS: List of paths to two or more model files.
[ "Take", "a", "snapshot", "of", "all", "the", "supplied", "models", "and", "generate", "a", "diff", "report", "." ]
train
https://github.com/opencobra/memote/blob/276630fcd4449fb7b914186edfd38c239e7052df/memote/suite/cli/reports.py#L226-L287
opencobra/memote
memote/suite/results/history_manager.py
HistoryManager.build_branch_structure
def build_branch_structure(self, model, skip): """Inspect and record the repo's branches and their history.""" self._history = dict() self._history["commits"] = commits = dict() self._history["branches"] = branches = dict() for branch in self._repo.refs: LOGGER.debug(...
python
def build_branch_structure(self, model, skip): """Inspect and record the repo's branches and their history.""" self._history = dict() self._history["commits"] = commits = dict() self._history["branches"] = branches = dict() for branch in self._repo.refs: LOGGER.debug(...
[ "def", "build_branch_structure", "(", "self", ",", "model", ",", "skip", ")", ":", "self", ".", "_history", "=", "dict", "(", ")", "self", ".", "_history", "[", "\"commits\"", "]", "=", "commits", "=", "dict", "(", ")", "self", ".", "_history", "[", ...
Inspect and record the repo's branches and their history.
[ "Inspect", "and", "record", "the", "repo", "s", "branches", "and", "their", "history", "." ]
train
https://github.com/opencobra/memote/blob/276630fcd4449fb7b914186edfd38c239e7052df/memote/suite/results/history_manager.py#L65-L90
opencobra/memote
memote/suite/results/history_manager.py
HistoryManager.load_history
def load_history(self, model, skip={"gh-pages"}): """ Load the entire results history into memory. Could be a bad idea in a far future. """ if self._history is None: self.build_branch_structure(model, skip) self._results = dict() all_commits = list(s...
python
def load_history(self, model, skip={"gh-pages"}): """ Load the entire results history into memory. Could be a bad idea in a far future. """ if self._history is None: self.build_branch_structure(model, skip) self._results = dict() all_commits = list(s...
[ "def", "load_history", "(", "self", ",", "model", ",", "skip", "=", "{", "\"gh-pages\"", "}", ")", ":", "if", "self", ".", "_history", "is", "None", ":", "self", ".", "build_branch_structure", "(", "model", ",", "skip", ")", "self", ".", "_results", "=...
Load the entire results history into memory. Could be a bad idea in a far future.
[ "Load", "the", "entire", "results", "history", "into", "memory", "." ]
train
https://github.com/opencobra/memote/blob/276630fcd4449fb7b914186edfd38c239e7052df/memote/suite/results/history_manager.py#L100-L116
opencobra/memote
memote/suite/results/history_manager.py
HistoryManager.get_result
def get_result(self, commit, default=MemoteResult()): """Return an individual result from the history if it exists.""" assert self._results is not None, \ "Please call the method `load_history` first." return self._results.get(commit, default)
python
def get_result(self, commit, default=MemoteResult()): """Return an individual result from the history if it exists.""" assert self._results is not None, \ "Please call the method `load_history` first." return self._results.get(commit, default)
[ "def", "get_result", "(", "self", ",", "commit", ",", "default", "=", "MemoteResult", "(", ")", ")", ":", "assert", "self", ".", "_results", "is", "not", "None", ",", "\"Please call the method `load_history` first.\"", "return", "self", ".", "_results", ".", "...
Return an individual result from the history if it exists.
[ "Return", "an", "individual", "result", "from", "the", "history", "if", "it", "exists", "." ]
train
https://github.com/opencobra/memote/blob/276630fcd4449fb7b914186edfd38c239e7052df/memote/suite/results/history_manager.py#L118-L122
opencobra/memote
memote/support/matrix.py
absolute_extreme_coefficient_ratio
def absolute_extreme_coefficient_ratio(model): """ Return the maximum and minimum absolute, non-zero coefficients. Parameters ---------- model : cobra.Model The metabolic model under investigation. """ s_matrix, _, _ = con_helpers.stoichiometry_matrix( model.metabolites, mo...
python
def absolute_extreme_coefficient_ratio(model): """ Return the maximum and minimum absolute, non-zero coefficients. Parameters ---------- model : cobra.Model The metabolic model under investigation. """ s_matrix, _, _ = con_helpers.stoichiometry_matrix( model.metabolites, mo...
[ "def", "absolute_extreme_coefficient_ratio", "(", "model", ")", ":", "s_matrix", ",", "_", ",", "_", "=", "con_helpers", ".", "stoichiometry_matrix", "(", "model", ".", "metabolites", ",", "model", ".", "reactions", ")", "abs_matrix", "=", "np", ".", "abs", ...
Return the maximum and minimum absolute, non-zero coefficients. Parameters ---------- model : cobra.Model The metabolic model under investigation.
[ "Return", "the", "maximum", "and", "minimum", "absolute", "non", "-", "zero", "coefficients", "." ]
train
https://github.com/opencobra/memote/blob/276630fcd4449fb7b914186edfd38c239e7052df/memote/support/matrix.py#L29-L43
opencobra/memote
memote/support/matrix.py
number_independent_conservation_relations
def number_independent_conservation_relations(model): """ Return the number of conserved metabolite pools. This number is given by the left null space of the stoichiometric matrix. Parameters ---------- model : cobra.Model The metabolic model under investigation. """ s_matrix,...
python
def number_independent_conservation_relations(model): """ Return the number of conserved metabolite pools. This number is given by the left null space of the stoichiometric matrix. Parameters ---------- model : cobra.Model The metabolic model under investigation. """ s_matrix,...
[ "def", "number_independent_conservation_relations", "(", "model", ")", ":", "s_matrix", ",", "_", ",", "_", "=", "con_helpers", ".", "stoichiometry_matrix", "(", "model", ".", "metabolites", ",", "model", ".", "reactions", ")", "ln_matrix", "=", "con_helpers", "...
Return the number of conserved metabolite pools. This number is given by the left null space of the stoichiometric matrix. Parameters ---------- model : cobra.Model The metabolic model under investigation.
[ "Return", "the", "number", "of", "conserved", "metabolite", "pools", "." ]
train
https://github.com/opencobra/memote/blob/276630fcd4449fb7b914186edfd38c239e7052df/memote/support/matrix.py#L46-L62
opencobra/memote
memote/support/matrix.py
matrix_rank
def matrix_rank(model): """ Return the rank of the model's stoichiometric matrix. Parameters ---------- model : cobra.Model The metabolic model under investigation. """ s_matrix, _, _ = con_helpers.stoichiometry_matrix( model.metabolites, model.reactions ) return co...
python
def matrix_rank(model): """ Return the rank of the model's stoichiometric matrix. Parameters ---------- model : cobra.Model The metabolic model under investigation. """ s_matrix, _, _ = con_helpers.stoichiometry_matrix( model.metabolites, model.reactions ) return co...
[ "def", "matrix_rank", "(", "model", ")", ":", "s_matrix", ",", "_", ",", "_", "=", "con_helpers", ".", "stoichiometry_matrix", "(", "model", ".", "metabolites", ",", "model", ".", "reactions", ")", "return", "con_helpers", ".", "rank", "(", "s_matrix", ")"...
Return the rank of the model's stoichiometric matrix. Parameters ---------- model : cobra.Model The metabolic model under investigation.
[ "Return", "the", "rank", "of", "the", "model", "s", "stoichiometric", "matrix", "." ]
train
https://github.com/opencobra/memote/blob/276630fcd4449fb7b914186edfd38c239e7052df/memote/support/matrix.py#L65-L78
opencobra/memote
memote/support/matrix.py
degrees_of_freedom
def degrees_of_freedom(model): """ Return the degrees of freedom, i.e., number of "free variables". Parameters ---------- model : cobra.Model The metabolic model under investigation. Notes ----- This specifically refers to the dimensionality of the (right) null space of the...
python
def degrees_of_freedom(model): """ Return the degrees of freedom, i.e., number of "free variables". Parameters ---------- model : cobra.Model The metabolic model under investigation. Notes ----- This specifically refers to the dimensionality of the (right) null space of the...
[ "def", "degrees_of_freedom", "(", "model", ")", ":", "s_matrix", ",", "_", ",", "_", "=", "con_helpers", ".", "stoichiometry_matrix", "(", "model", ".", "metabolites", ",", "model", ".", "reactions", ")", "return", "s_matrix", ".", "shape", "[", "1", "]", ...
Return the degrees of freedom, i.e., number of "free variables". Parameters ---------- model : cobra.Model The metabolic model under investigation. Notes ----- This specifically refers to the dimensionality of the (right) null space of the stoichiometric matrix, as dim(Null(S)) cor...
[ "Return", "the", "degrees", "of", "freedom", "i", ".", "e", ".", "number", "of", "free", "variables", "." ]
train
https://github.com/opencobra/memote/blob/276630fcd4449fb7b914186edfd38c239e7052df/memote/support/matrix.py#L81-L109
opencobra/memote
memote/experimental/config.py
ExperimentConfiguration.load
def load(self, model): """ Load all information from an experimental configuration file. Parameters ---------- model : cobra.Model The metabolic model under investigation. """ self.load_medium(model) self.load_essentiality(model) self...
python
def load(self, model): """ Load all information from an experimental configuration file. Parameters ---------- model : cobra.Model The metabolic model under investigation. """ self.load_medium(model) self.load_essentiality(model) self...
[ "def", "load", "(", "self", ",", "model", ")", ":", "self", ".", "load_medium", "(", "model", ")", "self", ".", "load_essentiality", "(", "model", ")", "self", ".", "load_growth", "(", "model", ")", "# self.load_experiment(config.config.get(\"growth\"), model)", ...
Load all information from an experimental configuration file. Parameters ---------- model : cobra.Model The metabolic model under investigation.
[ "Load", "all", "information", "from", "an", "experimental", "configuration", "file", "." ]
train
https://github.com/opencobra/memote/blob/276630fcd4449fb7b914186edfd38c239e7052df/memote/experimental/config.py#L67-L81
opencobra/memote
memote/experimental/config.py
ExperimentConfiguration.validate
def validate(self): """Validate the configuration file.""" validator = Draft4Validator(self.SCHEMA) if not validator.is_valid(self.config): for err in validator.iter_errors(self.config): LOGGER.error(str(err.message)) validator.validate(self.config)
python
def validate(self): """Validate the configuration file.""" validator = Draft4Validator(self.SCHEMA) if not validator.is_valid(self.config): for err in validator.iter_errors(self.config): LOGGER.error(str(err.message)) validator.validate(self.config)
[ "def", "validate", "(", "self", ")", ":", "validator", "=", "Draft4Validator", "(", "self", ".", "SCHEMA", ")", "if", "not", "validator", ".", "is_valid", "(", "self", ".", "config", ")", ":", "for", "err", "in", "validator", ".", "iter_errors", "(", "...
Validate the configuration file.
[ "Validate", "the", "configuration", "file", "." ]
train
https://github.com/opencobra/memote/blob/276630fcd4449fb7b914186edfd38c239e7052df/memote/experimental/config.py#L83-L89
opencobra/memote
memote/experimental/config.py
ExperimentConfiguration.load_medium
def load_medium(self, model): """Load and validate all media.""" media = self.config.get("medium") if media is None: return definitions = media.get("definitions") if definitions is None or len(definitions) == 0: return path = self.get_path(media, j...
python
def load_medium(self, model): """Load and validate all media.""" media = self.config.get("medium") if media is None: return definitions = media.get("definitions") if definitions is None or len(definitions) == 0: return path = self.get_path(media, j...
[ "def", "load_medium", "(", "self", ",", "model", ")", ":", "media", "=", "self", ".", "config", ".", "get", "(", "\"medium\"", ")", "if", "media", "is", "None", ":", "return", "definitions", "=", "media", ".", "get", "(", "\"definitions\"", ")", "if", ...
Load and validate all media.
[ "Load", "and", "validate", "all", "media", "." ]
train
https://github.com/opencobra/memote/blob/276630fcd4449fb7b914186edfd38c239e7052df/memote/experimental/config.py#L91-L111
opencobra/memote
memote/experimental/config.py
ExperimentConfiguration.load_essentiality
def load_essentiality(self, model): """Load and validate all data files.""" data = self.config.get("essentiality") if data is None: return experiments = data.get("experiments") if experiments is None or len(experiments) == 0: return path = self.get...
python
def load_essentiality(self, model): """Load and validate all data files.""" data = self.config.get("essentiality") if data is None: return experiments = data.get("experiments") if experiments is None or len(experiments) == 0: return path = self.get...
[ "def", "load_essentiality", "(", "self", ",", "model", ")", ":", "data", "=", "self", ".", "config", ".", "get", "(", "\"essentiality\"", ")", "if", "data", "is", "None", ":", "return", "experiments", "=", "data", ".", "get", "(", "\"experiments\"", ")",...
Load and validate all data files.
[ "Load", "and", "validate", "all", "data", "files", "." ]
train
https://github.com/opencobra/memote/blob/276630fcd4449fb7b914186edfd38c239e7052df/memote/experimental/config.py#L113-L140
opencobra/memote
memote/experimental/config.py
ExperimentConfiguration.load_growth
def load_growth(self, model): """Load and validate all data files.""" data = self.config.get("growth") if data is None: return experiments = data.get("experiments") if experiments is None or len(experiments) == 0: return path = self.get_path(data, ...
python
def load_growth(self, model): """Load and validate all data files.""" data = self.config.get("growth") if data is None: return experiments = data.get("experiments") if experiments is None or len(experiments) == 0: return path = self.get_path(data, ...
[ "def", "load_growth", "(", "self", ",", "model", ")", ":", "data", "=", "self", ".", "config", ".", "get", "(", "\"growth\"", ")", "if", "data", "is", "None", ":", "return", "experiments", "=", "data", ".", "get", "(", "\"experiments\"", ")", "if", "...
Load and validate all data files.
[ "Load", "and", "validate", "all", "data", "files", "." ]
train
https://github.com/opencobra/memote/blob/276630fcd4449fb7b914186edfd38c239e7052df/memote/experimental/config.py#L142-L169
opencobra/memote
memote/experimental/config.py
ExperimentConfiguration.get_path
def get_path(self, obj, default): """Return a relative or absolute path to experimental data.""" path = obj.get("path") if path is None: path = join(self._base, default) if not isabs(path): path = join(self._base, path) return path
python
def get_path(self, obj, default): """Return a relative or absolute path to experimental data.""" path = obj.get("path") if path is None: path = join(self._base, default) if not isabs(path): path = join(self._base, path) return path
[ "def", "get_path", "(", "self", ",", "obj", ",", "default", ")", ":", "path", "=", "obj", ".", "get", "(", "\"path\"", ")", "if", "path", "is", "None", ":", "path", "=", "join", "(", "self", ".", "_base", ",", "default", ")", "if", "not", "isabs"...
Return a relative or absolute path to experimental data.
[ "Return", "a", "relative", "or", "absolute", "path", "to", "experimental", "data", "." ]
train
https://github.com/opencobra/memote/blob/276630fcd4449fb7b914186edfd38c239e7052df/memote/experimental/config.py#L171-L178
opencobra/memote
memote/support/annotation.py
find_components_without_annotation
def find_components_without_annotation(model, components): """ Find model components with empty annotation attributes. Parameters ---------- model : cobra.Model A cobrapy metabolic model. components : {"metabolites", "reactions", "genes"} A string denoting `cobra.Model` componen...
python
def find_components_without_annotation(model, components): """ Find model components with empty annotation attributes. Parameters ---------- model : cobra.Model A cobrapy metabolic model. components : {"metabolites", "reactions", "genes"} A string denoting `cobra.Model` componen...
[ "def", "find_components_without_annotation", "(", "model", ",", "components", ")", ":", "return", "[", "elem", "for", "elem", "in", "getattr", "(", "model", ",", "components", ")", "if", "elem", ".", "annotation", "is", "None", "or", "len", "(", "elem", "....
Find model components with empty annotation attributes. Parameters ---------- model : cobra.Model A cobrapy metabolic model. components : {"metabolites", "reactions", "genes"} A string denoting `cobra.Model` components. Returns ------- list The components without an...
[ "Find", "model", "components", "with", "empty", "annotation", "attributes", "." ]
train
https://github.com/opencobra/memote/blob/276630fcd4449fb7b914186edfd38c239e7052df/memote/support/annotation.py#L125-L143