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_documentation_string
stringlengths
1
47.2k
func_code_url
stringlengths
85
339
CellProfiler/centrosome
centrosome/haralick.py
normalized_per_object
def normalized_per_object(image, labels): """Normalize the intensities of each object to the [0, 1] range.""" nobjects = labels.max() objects = np.arange(nobjects + 1) lmin, lmax = scind.extrema(image, labels, objects)[:2] # Divisor is the object's max - min, or 1 if they are the same. divisor =...
python
def normalized_per_object(image, labels): """Normalize the intensities of each object to the [0, 1] range.""" nobjects = labels.max() objects = np.arange(nobjects + 1) lmin, lmax = scind.extrema(image, labels, objects)[:2] # Divisor is the object's max - min, or 1 if they are the same. divisor =...
Normalize the intensities of each object to the [0, 1] range.
https://github.com/CellProfiler/centrosome/blob/7bd9350a2d4ae1b215b81eabcecfe560bbb1f32a/centrosome/haralick.py#L16-L24
CellProfiler/centrosome
centrosome/haralick.py
quantize
def quantize(image, nlevels): """Quantize an image into integers 0, 1, ..., nlevels - 1. image -- a numpy array of type float, range [0, 1] nlevels -- an integer """ tmp = np.array(image // (1.0 / nlevels), dtype='i1') return tmp.clip(0, nlevels - 1)
python
def quantize(image, nlevels): """Quantize an image into integers 0, 1, ..., nlevels - 1. image -- a numpy array of type float, range [0, 1] nlevels -- an integer """ tmp = np.array(image // (1.0 / nlevels), dtype='i1') return tmp.clip(0, nlevels - 1)
Quantize an image into integers 0, 1, ..., nlevels - 1. image -- a numpy array of type float, range [0, 1] nlevels -- an integer
https://github.com/CellProfiler/centrosome/blob/7bd9350a2d4ae1b215b81eabcecfe560bbb1f32a/centrosome/haralick.py#L26-L33
CellProfiler/centrosome
centrosome/haralick.py
cooccurrence
def cooccurrence(quantized_image, labels, scale_i=3, scale_j=0): """Calculates co-occurrence matrices for all the objects in the image. Return an array P of shape (nobjects, nlevels, nlevels) such that P[o, :, :] is the cooccurence matrix for object o. quantized_image -- a numpy array of integer type ...
python
def cooccurrence(quantized_image, labels, scale_i=3, scale_j=0): """Calculates co-occurrence matrices for all the objects in the image. Return an array P of shape (nobjects, nlevels, nlevels) such that P[o, :, :] is the cooccurence matrix for object o. quantized_image -- a numpy array of integer type ...
Calculates co-occurrence matrices for all the objects in the image. Return an array P of shape (nobjects, nlevels, nlevels) such that P[o, :, :] is the cooccurence matrix for object o. quantized_image -- a numpy array of integer type labels -- a numpy array of integer type scale ...
https://github.com/CellProfiler/centrosome/blob/7bd9350a2d4ae1b215b81eabcecfe560bbb1f32a/centrosome/haralick.py#L35-L95
CellProfiler/centrosome
centrosome/haralick.py
Haralick.H3
def H3(self): "Correlation." multiplied = np.dot(self.levels[:, np.newaxis] + 1, self.levels[np.newaxis] + 1) repeated = np.tile(multiplied[np.newaxis], (self.nobjects, 1, 1)) summed = (repeated * self.P).sum(2).sum(1) h3 = (summed - self.mux * self.mu...
python
def H3(self): "Correlation." multiplied = np.dot(self.levels[:, np.newaxis] + 1, self.levels[np.newaxis] + 1) repeated = np.tile(multiplied[np.newaxis], (self.nobjects, 1, 1)) summed = (repeated * self.P).sum(2).sum(1) h3 = (summed - self.mux * self.mu...
Correlation.
https://github.com/CellProfiler/centrosome/blob/7bd9350a2d4ae1b215b81eabcecfe560bbb1f32a/centrosome/haralick.py#L170-L178
CellProfiler/centrosome
centrosome/haralick.py
Haralick.H5
def H5(self): "Inverse difference moment." t = 1 + toeplitz(self.levels) ** 2 repeated = np.tile(t[np.newaxis], (self.nobjects, 1, 1)) return (1.0 / repeated * self.P).sum(2).sum(1)
python
def H5(self): "Inverse difference moment." t = 1 + toeplitz(self.levels) ** 2 repeated = np.tile(t[np.newaxis], (self.nobjects, 1, 1)) return (1.0 / repeated * self.P).sum(2).sum(1)
Inverse difference moment.
https://github.com/CellProfiler/centrosome/blob/7bd9350a2d4ae1b215b81eabcecfe560bbb1f32a/centrosome/haralick.py#L184-L188
CellProfiler/centrosome
centrosome/haralick.py
Haralick.H6
def H6(self): "Sum average." if not hasattr(self, '_H6'): self._H6 = ((self.rlevels2 + 2) * self.p_xplusy).sum(1) return self._H6
python
def H6(self): "Sum average." if not hasattr(self, '_H6'): self._H6 = ((self.rlevels2 + 2) * self.p_xplusy).sum(1) return self._H6
Sum average.
https://github.com/CellProfiler/centrosome/blob/7bd9350a2d4ae1b215b81eabcecfe560bbb1f32a/centrosome/haralick.py#L190-L194
CellProfiler/centrosome
centrosome/haralick.py
Haralick.H7
def H7(self): "Sum variance (error in Haralick's original paper here)." h6 = np.tile(self.H6(), (self.rlevels2.shape[1], 1)).transpose() return (((self.rlevels2 + 2) - h6) ** 2 * self.p_xplusy).sum(1)
python
def H7(self): "Sum variance (error in Haralick's original paper here)." h6 = np.tile(self.H6(), (self.rlevels2.shape[1], 1)).transpose() return (((self.rlevels2 + 2) - h6) ** 2 * self.p_xplusy).sum(1)
Sum variance (error in Haralick's original paper here).
https://github.com/CellProfiler/centrosome/blob/7bd9350a2d4ae1b215b81eabcecfe560bbb1f32a/centrosome/haralick.py#L196-L199
CellProfiler/centrosome
centrosome/haralick.py
Haralick.H8
def H8(self): "Sum entropy." return -(self.p_xplusy * np.log(self.p_xplusy + self.eps)).sum(1)
python
def H8(self): "Sum entropy." return -(self.p_xplusy * np.log(self.p_xplusy + self.eps)).sum(1)
Sum entropy.
https://github.com/CellProfiler/centrosome/blob/7bd9350a2d4ae1b215b81eabcecfe560bbb1f32a/centrosome/haralick.py#L201-L203
CellProfiler/centrosome
centrosome/haralick.py
Haralick.H9
def H9(self): "Entropy." if not hasattr(self, '_H9'): self._H9 = -(self.P * np.log(self.P + self.eps)).sum(2).sum(1) return self._H9
python
def H9(self): "Entropy." if not hasattr(self, '_H9'): self._H9 = -(self.P * np.log(self.P + self.eps)).sum(2).sum(1) return self._H9
Entropy.
https://github.com/CellProfiler/centrosome/blob/7bd9350a2d4ae1b215b81eabcecfe560bbb1f32a/centrosome/haralick.py#L205-L209
CellProfiler/centrosome
centrosome/haralick.py
Haralick.H10
def H10(self): "Difference variance." c = (self.rlevels * self.p_xminusy).sum(1) c1 = np.tile(c, (self.nlevels,1)).transpose() e = self.rlevels - c1 return (self.p_xminusy * e ** 2).sum(1)
python
def H10(self): "Difference variance." c = (self.rlevels * self.p_xminusy).sum(1) c1 = np.tile(c, (self.nlevels,1)).transpose() e = self.rlevels - c1 return (self.p_xminusy * e ** 2).sum(1)
Difference variance.
https://github.com/CellProfiler/centrosome/blob/7bd9350a2d4ae1b215b81eabcecfe560bbb1f32a/centrosome/haralick.py#L211-L216
CellProfiler/centrosome
centrosome/haralick.py
Haralick.H11
def H11(self): "Difference entropy." return -(self.p_xminusy * np.log(self.p_xminusy + self.eps)).sum(1)
python
def H11(self): "Difference entropy." return -(self.p_xminusy * np.log(self.p_xminusy + self.eps)).sum(1)
Difference entropy.
https://github.com/CellProfiler/centrosome/blob/7bd9350a2d4ae1b215b81eabcecfe560bbb1f32a/centrosome/haralick.py#L218-L220
CellProfiler/centrosome
centrosome/haralick.py
Haralick.H12
def H12(self): "Information measure of correlation 1." maxima = np.vstack((self.hx, self.hy)).max(0) return (self.H9() - self.hxy1) / maxima
python
def H12(self): "Information measure of correlation 1." maxima = np.vstack((self.hx, self.hy)).max(0) return (self.H9() - self.hxy1) / maxima
Information measure of correlation 1.
https://github.com/CellProfiler/centrosome/blob/7bd9350a2d4ae1b215b81eabcecfe560bbb1f32a/centrosome/haralick.py#L222-L225
CellProfiler/centrosome
centrosome/haralick.py
Haralick.H13
def H13(self): "Information measure of correlation 2." # An imaginary result has been encountered once in the Matlab # version. The reason is unclear. return np.sqrt(1 - np.exp(-2 * (self.hxy2 - self.H9())))
python
def H13(self): "Information measure of correlation 2." # An imaginary result has been encountered once in the Matlab # version. The reason is unclear. return np.sqrt(1 - np.exp(-2 * (self.hxy2 - self.H9())))
Information measure of correlation 2.
https://github.com/CellProfiler/centrosome/blob/7bd9350a2d4ae1b215b81eabcecfe560bbb1f32a/centrosome/haralick.py#L227-L231
CellProfiler/centrosome
centrosome/zernike.py
construct_zernike_lookuptable
def construct_zernike_lookuptable(zernike_indexes): """Return a lookup table of the sum-of-factorial part of the radial polynomial of the zernike indexes passed zernike_indexes - an Nx2 array of the Zernike polynomials to be computed. """ n_max = np.max(zernike_indexes[:,0...
python
def construct_zernike_lookuptable(zernike_indexes): """Return a lookup table of the sum-of-factorial part of the radial polynomial of the zernike indexes passed zernike_indexes - an Nx2 array of the Zernike polynomials to be computed. """ n_max = np.max(zernike_indexes[:,0...
Return a lookup table of the sum-of-factorial part of the radial polynomial of the zernike indexes passed zernike_indexes - an Nx2 array of the Zernike polynomials to be computed.
https://github.com/CellProfiler/centrosome/blob/7bd9350a2d4ae1b215b81eabcecfe560bbb1f32a/centrosome/zernike.py#L13-L34
CellProfiler/centrosome
centrosome/zernike.py
construct_zernike_polynomials
def construct_zernike_polynomials(x, y, zernike_indexes, mask=None, weight=None): """Return the zerike polynomials for all objects in an image x - the X distance of a point from the center of its object y - the Y distance of a point from the center of its object zernike_indexes - an Nx2 array of th...
python
def construct_zernike_polynomials(x, y, zernike_indexes, mask=None, weight=None): """Return the zerike polynomials for all objects in an image x - the X distance of a point from the center of its object y - the Y distance of a point from the center of its object zernike_indexes - an Nx2 array of th...
Return the zerike polynomials for all objects in an image x - the X distance of a point from the center of its object y - the Y distance of a point from the center of its object zernike_indexes - an Nx2 array of the Zernike polynomials to be computed. mask - a mask with same shape as X and Y of the...
https://github.com/CellProfiler/centrosome/blob/7bd9350a2d4ae1b215b81eabcecfe560bbb1f32a/centrosome/zernike.py#L37-L101
CellProfiler/centrosome
centrosome/zernike.py
score_zernike
def score_zernike(zf, radii, labels, indexes=None): """Score the output of construct_zernike_polynomials zf - the output of construct_zernike_polynomials which is I x J x K where K is the number of zernike polynomials computed radii - a vector of the radius of each of N labeled objects lab...
python
def score_zernike(zf, radii, labels, indexes=None): """Score the output of construct_zernike_polynomials zf - the output of construct_zernike_polynomials which is I x J x K where K is the number of zernike polynomials computed radii - a vector of the radius of each of N labeled objects lab...
Score the output of construct_zernike_polynomials zf - the output of construct_zernike_polynomials which is I x J x K where K is the number of zernike polynomials computed radii - a vector of the radius of each of N labeled objects labels - a label matrix outputs a N x K matrix of the...
https://github.com/CellProfiler/centrosome/blob/7bd9350a2d4ae1b215b81eabcecfe560bbb1f32a/centrosome/zernike.py#L104-L141
CellProfiler/centrosome
centrosome/zernike.py
zernike
def zernike(zernike_indexes,labels,indexes): """Compute the Zernike features for the labels with the label #s in indexes returns the score per labels and an array of one image per zernike feature """ # # "Reverse_indexes" is -1 if a label # is not to be processed. Otherwise # reverse_index[...
python
def zernike(zernike_indexes,labels,indexes): """Compute the Zernike features for the labels with the label #s in indexes returns the score per labels and an array of one image per zernike feature """ # # "Reverse_indexes" is -1 if a label # is not to be processed. Otherwise # reverse_index[...
Compute the Zernike features for the labels with the label #s in indexes returns the score per labels and an array of one image per zernike feature
https://github.com/CellProfiler/centrosome/blob/7bd9350a2d4ae1b215b81eabcecfe560bbb1f32a/centrosome/zernike.py#L143-L192
CellProfiler/centrosome
centrosome/zernike.py
get_zernike_indexes
def get_zernike_indexes(limit=10): """Return a list of all Zernike indexes up to the given limit limit - return all Zernike indexes with N less than this limit returns an array of 2-tuples. Each tuple is organized as (N,M). The Zernikes are stored as complex numbers with the real part bein...
python
def get_zernike_indexes(limit=10): """Return a list of all Zernike indexes up to the given limit limit - return all Zernike indexes with N less than this limit returns an array of 2-tuples. Each tuple is organized as (N,M). The Zernikes are stored as complex numbers with the real part bein...
Return a list of all Zernike indexes up to the given limit limit - return all Zernike indexes with N less than this limit returns an array of 2-tuples. Each tuple is organized as (N,M). The Zernikes are stored as complex numbers with the real part being (N,M) and the imaginary being (N,-M)
https://github.com/CellProfiler/centrosome/blob/7bd9350a2d4ae1b215b81eabcecfe560bbb1f32a/centrosome/zernike.py#L194-L211
CellProfiler/centrosome
centrosome/propagate.py
propagate
def propagate(image, labels, mask, weight): """Propagate the labels to the nearest pixels image - gives the Z height when computing distance labels - the labeled image pixels mask - only label pixels within the mask weight - the weighting of x/y distance vs z distance high number...
python
def propagate(image, labels, mask, weight): """Propagate the labels to the nearest pixels image - gives the Z height when computing distance labels - the labeled image pixels mask - only label pixels within the mask weight - the weighting of x/y distance vs z distance high number...
Propagate the labels to the nearest pixels image - gives the Z height when computing distance labels - the labeled image pixels mask - only label pixels within the mask weight - the weighting of x/y distance vs z distance high numbers favor x/y, low favor z returns a label m...
https://github.com/CellProfiler/centrosome/blob/7bd9350a2d4ae1b215b81eabcecfe560bbb1f32a/centrosome/propagate.py#L6-L31
CellProfiler/centrosome
centrosome/lapjv.py
lapjv
def lapjv(i, j, costs, wants_dual_variables = False, augmenting_row_reductions = 2): '''Sparse linear assignment solution using Jonker-Volgenant algorithm i,j - similarly-sized vectors that pair the object at index i[n] with the object at index j[j] costs - a vector of similar size...
python
def lapjv(i, j, costs, wants_dual_variables = False, augmenting_row_reductions = 2): '''Sparse linear assignment solution using Jonker-Volgenant algorithm i,j - similarly-sized vectors that pair the object at index i[n] with the object at index j[j] costs - a vector of similar size...
Sparse linear assignment solution using Jonker-Volgenant algorithm i,j - similarly-sized vectors that pair the object at index i[n] with the object at index j[j] costs - a vector of similar size to i and j that is the cost of pairing i[n] with j[n]. wants_d...
https://github.com/CellProfiler/centrosome/blob/7bd9350a2d4ae1b215b81eabcecfe560bbb1f32a/centrosome/lapjv.py#L10-L134
CellProfiler/centrosome
centrosome/lapjv.py
slow_reduction_transfer
def slow_reduction_transfer(ii, j, idx, count, x, u, v, c): '''Perform the reduction transfer step from the Jonker-Volgenant algorithm The data is input in a ragged array in terms of "i" structured as a vector of values for each i,j combination where: ii - the i to be reduced j - the j-ind...
python
def slow_reduction_transfer(ii, j, idx, count, x, u, v, c): '''Perform the reduction transfer step from the Jonker-Volgenant algorithm The data is input in a ragged array in terms of "i" structured as a vector of values for each i,j combination where: ii - the i to be reduced j - the j-ind...
Perform the reduction transfer step from the Jonker-Volgenant algorithm The data is input in a ragged array in terms of "i" structured as a vector of values for each i,j combination where: ii - the i to be reduced j - the j-index of every entry idx - the index of the first entry for each i...
https://github.com/CellProfiler/centrosome/blob/7bd9350a2d4ae1b215b81eabcecfe560bbb1f32a/centrosome/lapjv.py#L136-L170
CellProfiler/centrosome
centrosome/lapjv.py
slow_augmenting_row_reduction
def slow_augmenting_row_reduction(n, ii, jj, idx, count, x, y, u, v, c): '''Perform the augmenting row reduction step from the Jonker-Volgenaut algorithm n - the number of i and j in the linear assignment problem ii - the unassigned i jj - the j-index of every entry in c idx - the index of the ...
python
def slow_augmenting_row_reduction(n, ii, jj, idx, count, x, y, u, v, c): '''Perform the augmenting row reduction step from the Jonker-Volgenaut algorithm n - the number of i and j in the linear assignment problem ii - the unassigned i jj - the j-index of every entry in c idx - the index of the ...
Perform the augmenting row reduction step from the Jonker-Volgenaut algorithm n - the number of i and j in the linear assignment problem ii - the unassigned i jj - the j-index of every entry in c idx - the index of the first entry for each i count - the number of entries for each i x - the ...
https://github.com/CellProfiler/centrosome/blob/7bd9350a2d4ae1b215b81eabcecfe560bbb1f32a/centrosome/lapjv.py#L172-L235
CellProfiler/centrosome
centrosome/lapjv.py
slow_augment
def slow_augment(n, ii, jj, idx, count, x, y, u, v, c): '''Perform the augmentation step to assign unassigned i and j n - the # of i and j, also the marker of unassigned x and y ii - the unassigned i jj - the ragged arrays of j for each i idx - the index of the first j for each i count - th...
python
def slow_augment(n, ii, jj, idx, count, x, y, u, v, c): '''Perform the augmentation step to assign unassigned i and j n - the # of i and j, also the marker of unassigned x and y ii - the unassigned i jj - the ragged arrays of j for each i idx - the index of the first j for each i count - th...
Perform the augmentation step to assign unassigned i and j n - the # of i and j, also the marker of unassigned x and y ii - the unassigned i jj - the ragged arrays of j for each i idx - the index of the first j for each i count - the number of j for each i x - the assignments of j for each ...
https://github.com/CellProfiler/centrosome/blob/7bd9350a2d4ae1b215b81eabcecfe560bbb1f32a/centrosome/lapjv.py#L237-L360
koszullab/instaGRAAL
instagraal/cuda_lib_gl_single.py
sampler.estimate_parameters_rippe
def estimate_parameters_rippe( self, max_dist_kb, size_bin_kb, display_graph ): """ estimation by least square optimization of Rippe parameters on the experimental data :param max_dist_kb: :param size_bin_kb: """ logger.info("estimation of the paramete...
python
def estimate_parameters_rippe( self, max_dist_kb, size_bin_kb, display_graph ): """ estimation by least square optimization of Rippe parameters on the experimental data :param max_dist_kb: :param size_bin_kb: """ logger.info("estimation of the paramete...
estimation by least square optimization of Rippe parameters on the experimental data :param max_dist_kb: :param size_bin_kb:
https://github.com/koszullab/instaGRAAL/blob/1c02ca838e57d8178eec79f223644b2acd0153dd/instagraal/cuda_lib_gl_single.py#L2729-L2901
koszullab/instaGRAAL
instagraal/cuda_lib_gl_single.py
sampler.estimate_parameters
def estimate_parameters(self, max_dist_kb, size_bin_kb, display_graph): """ estimation by least square optimization of Rippe parameters on the experimental data :param max_dist_kb: :param size_bin_kb: """ logger.info("estimation of the parameters of the model") ...
python
def estimate_parameters(self, max_dist_kb, size_bin_kb, display_graph): """ estimation by least square optimization of Rippe parameters on the experimental data :param max_dist_kb: :param size_bin_kb: """ logger.info("estimation of the parameters of the model") ...
estimation by least square optimization of Rippe parameters on the experimental data :param max_dist_kb: :param size_bin_kb:
https://github.com/koszullab/instaGRAAL/blob/1c02ca838e57d8178eec79f223644b2acd0153dd/instagraal/cuda_lib_gl_single.py#L2903-L3021
koszullab/instaGRAAL
instagraal/linkage.py
collapse_degenerate_markers
def collapse_degenerate_markers(linkage_records): """Group all markers with no genetic distance as distinct features to generate a BED file with. Simple example with sixteen degenerate markers: >>> marker_features = [ ... ['36915_sctg_207_31842', 1, 0, 207, 31842], ... ['36941_sct...
python
def collapse_degenerate_markers(linkage_records): """Group all markers with no genetic distance as distinct features to generate a BED file with. Simple example with sixteen degenerate markers: >>> marker_features = [ ... ['36915_sctg_207_31842', 1, 0, 207, 31842], ... ['36941_sct...
Group all markers with no genetic distance as distinct features to generate a BED file with. Simple example with sixteen degenerate markers: >>> marker_features = [ ... ['36915_sctg_207_31842', 1, 0, 207, 31842], ... ['36941_sctg_207_61615', 1, 0, 207, 61615], ... ['36956_sctg_...
https://github.com/koszullab/instaGRAAL/blob/1c02ca838e57d8178eec79f223644b2acd0153dd/instagraal/linkage.py#L36-L123
koszullab/instaGRAAL
instagraal/linkage.py
linkage_group_ordering
def linkage_group_ordering(linkage_records): """Convert degenerate linkage records into ordered info_frags-like records for comparison purposes. Simple example: >>> linkage_records = [ ... ['linkage_group_1', 31842, 94039, 'sctg_207'], ... ['linkage_group_1', 95303, 95303, 'sctg_20...
python
def linkage_group_ordering(linkage_records): """Convert degenerate linkage records into ordered info_frags-like records for comparison purposes. Simple example: >>> linkage_records = [ ... ['linkage_group_1', 31842, 94039, 'sctg_207'], ... ['linkage_group_1', 95303, 95303, 'sctg_20...
Convert degenerate linkage records into ordered info_frags-like records for comparison purposes. Simple example: >>> linkage_records = [ ... ['linkage_group_1', 31842, 94039, 'sctg_207'], ... ['linkage_group_1', 95303, 95303, 'sctg_207'], ... ['linkage_group_2', 15892, 25865, '...
https://github.com/koszullab/instaGRAAL/blob/1c02ca838e57d8178eec79f223644b2acd0153dd/instagraal/linkage.py#L133-L187
koszullab/instaGRAAL
instagraal/linkage.py
compare_orderings
def compare_orderings(info_frags_records, linkage_orderings): """Given linkage groups and info_frags records, link pseudo-chromosomes to scaffolds based on the initial contig composition of each group. Because info_frags records are usually richer and may contain contigs not found in linkage groups, th...
python
def compare_orderings(info_frags_records, linkage_orderings): """Given linkage groups and info_frags records, link pseudo-chromosomes to scaffolds based on the initial contig composition of each group. Because info_frags records are usually richer and may contain contigs not found in linkage groups, th...
Given linkage groups and info_frags records, link pseudo-chromosomes to scaffolds based on the initial contig composition of each group. Because info_frags records are usually richer and may contain contigs not found in linkage groups, those extra sequences are discarded. Example with two linkage group...
https://github.com/koszullab/instaGRAAL/blob/1c02ca838e57d8178eec79f223644b2acd0153dd/instagraal/linkage.py#L190-L287
koszullab/instaGRAAL
instagraal/linkage.py
get_missing_blocks
def get_missing_blocks(info_frags_records, matching_pairs, linkage_orderings): """Get missing blocks in a scaffold based on the genetic map order. Given matching scaffold blocks/genetic map blocks (based on restriction sites and SNP markers, respectively), move around the scaffold blocks such that the...
python
def get_missing_blocks(info_frags_records, matching_pairs, linkage_orderings): """Get missing blocks in a scaffold based on the genetic map order. Given matching scaffold blocks/genetic map blocks (based on restriction sites and SNP markers, respectively), move around the scaffold blocks such that the...
Get missing blocks in a scaffold based on the genetic map order. Given matching scaffold blocks/genetic map blocks (based on restriction sites and SNP markers, respectively), move around the scaffold blocks such that they map the genetic map order. Parameters ---------- info_frags_records : d...
https://github.com/koszullab/instaGRAAL/blob/1c02ca838e57d8178eec79f223644b2acd0153dd/instagraal/linkage.py#L290-L435
koszullab/instaGRAAL
instagraal/parse_info_frags.py
parse_info_frags
def parse_info_frags(info_frags): """Import an info_frags.txt file and return a dictionary where each key is a newly formed scaffold and each value is the list of bins and their origin on the initial scaffolding. """ new_scaffolds = {} with open(info_frags, "r") as info_frags_handle: cu...
python
def parse_info_frags(info_frags): """Import an info_frags.txt file and return a dictionary where each key is a newly formed scaffold and each value is the list of bins and their origin on the initial scaffolding. """ new_scaffolds = {} with open(info_frags, "r") as info_frags_handle: cu...
Import an info_frags.txt file and return a dictionary where each key is a newly formed scaffold and each value is the list of bins and their origin on the initial scaffolding.
https://github.com/koszullab/instaGRAAL/blob/1c02ca838e57d8178eec79f223644b2acd0153dd/instagraal/parse_info_frags.py#L39-L68
koszullab/instaGRAAL
instagraal/parse_info_frags.py
parse_bed
def parse_bed(bed_file): """Import a BED file (where the data entries are analogous to what may be expected in an info_frags.txt file) and return a scaffold dictionary, similarly to parse_info_frags. """ new_scaffolds = {} with open(bed_file) as bed_handle: for line in bed_handle: ...
python
def parse_bed(bed_file): """Import a BED file (where the data entries are analogous to what may be expected in an info_frags.txt file) and return a scaffold dictionary, similarly to parse_info_frags. """ new_scaffolds = {} with open(bed_file) as bed_handle: for line in bed_handle: ...
Import a BED file (where the data entries are analogous to what may be expected in an info_frags.txt file) and return a scaffold dictionary, similarly to parse_info_frags.
https://github.com/koszullab/instaGRAAL/blob/1c02ca838e57d8178eec79f223644b2acd0153dd/instagraal/parse_info_frags.py#L73-L100
koszullab/instaGRAAL
instagraal/parse_info_frags.py
correct_scaffolds
def correct_scaffolds(scaffolds, corrector): """Unfinished """ new_scaffolds = {} def are_overlapping(bin1, bin2): """Check for overlapping regions between two regions - necessary requirement before potentially merging """ if bin2 is None: return False ...
python
def correct_scaffolds(scaffolds, corrector): """Unfinished """ new_scaffolds = {} def are_overlapping(bin1, bin2): """Check for overlapping regions between two regions - necessary requirement before potentially merging """ if bin2 is None: return False ...
Unfinished
https://github.com/koszullab/instaGRAAL/blob/1c02ca838e57d8178eec79f223644b2acd0153dd/instagraal/parse_info_frags.py#L103-L179
koszullab/instaGRAAL
instagraal/parse_info_frags.py
format_info_frags
def format_info_frags(info_frags): """A function to seamlessly run on either scaffold dictionaries or info_frags.txt files without having to check the input first. """ if isinstance(info_frags, dict): return info_frags else: try: scaffolds = parse_info_frags(info_frags) ...
python
def format_info_frags(info_frags): """A function to seamlessly run on either scaffold dictionaries or info_frags.txt files without having to check the input first. """ if isinstance(info_frags, dict): return info_frags else: try: scaffolds = parse_info_frags(info_frags) ...
A function to seamlessly run on either scaffold dictionaries or info_frags.txt files without having to check the input first.
https://github.com/koszullab/instaGRAAL/blob/1c02ca838e57d8178eec79f223644b2acd0153dd/instagraal/parse_info_frags.py#L182-L194
koszullab/instaGRAAL
instagraal/parse_info_frags.py
plot_info_frags
def plot_info_frags(scaffolds): """A crude way to visualize new scaffolds according to their origin on the initial scaffolding. Each scaffold spawns a new plot. Orientations are represented by different colors. """ scaffolds = format_info_frags(scaffolds) for name, scaffold in scaffolds.items(...
python
def plot_info_frags(scaffolds): """A crude way to visualize new scaffolds according to their origin on the initial scaffolding. Each scaffold spawns a new plot. Orientations are represented by different colors. """ scaffolds = format_info_frags(scaffolds) for name, scaffold in scaffolds.items(...
A crude way to visualize new scaffolds according to their origin on the initial scaffolding. Each scaffold spawns a new plot. Orientations are represented by different colors.
https://github.com/koszullab/instaGRAAL/blob/1c02ca838e57d8178eec79f223644b2acd0153dd/instagraal/parse_info_frags.py#L197-L221
koszullab/instaGRAAL
instagraal/parse_info_frags.py
remove_spurious_insertions
def remove_spurious_insertions(scaffolds): """Remove all bins whose left and right neighbors belong to the same, different scaffold. Example with three such insertions in two different scaffolds: >>> scaffolds = { ... "scaffold1": [ ... ["contig1", 0, 0, 100, 1], ...
python
def remove_spurious_insertions(scaffolds): """Remove all bins whose left and right neighbors belong to the same, different scaffold. Example with three such insertions in two different scaffolds: >>> scaffolds = { ... "scaffold1": [ ... ["contig1", 0, 0, 100, 1], ...
Remove all bins whose left and right neighbors belong to the same, different scaffold. Example with three such insertions in two different scaffolds: >>> scaffolds = { ... "scaffold1": [ ... ["contig1", 0, 0, 100, 1], ... ["contig1", 1, 100, 200, 1], ...
https://github.com/koszullab/instaGRAAL/blob/1c02ca838e57d8178eec79f223644b2acd0153dd/instagraal/parse_info_frags.py#L224-L301
koszullab/instaGRAAL
instagraal/parse_info_frags.py
correct_spurious_inversions
def correct_spurious_inversions(scaffolds, criterion="colinear"): """Invert bins based on orientation neighborhoods. Neighborhoods can be defined by three criteria: -a 'cis' neighborhood is a group of bins belonging to the same initial contig -a 'colinear' neighborhood is a 'cis' neighborhood where...
python
def correct_spurious_inversions(scaffolds, criterion="colinear"): """Invert bins based on orientation neighborhoods. Neighborhoods can be defined by three criteria: -a 'cis' neighborhood is a group of bins belonging to the same initial contig -a 'colinear' neighborhood is a 'cis' neighborhood where...
Invert bins based on orientation neighborhoods. Neighborhoods can be defined by three criteria: -a 'cis' neighborhood is a group of bins belonging to the same initial contig -a 'colinear' neighborhood is a 'cis' neighborhood where bins are ordered the same way they were on the initial contig -a...
https://github.com/koszullab/instaGRAAL/blob/1c02ca838e57d8178eec79f223644b2acd0153dd/instagraal/parse_info_frags.py#L304-L462
koszullab/instaGRAAL
instagraal/parse_info_frags.py
rearrange_intra_scaffolds
def rearrange_intra_scaffolds(scaffolds): """Rearranges all bins within each scaffold such that all bins belonging to the same initial contig are grouped together in the same order. When two such groups are found, the smaller one is moved to the larger one. """ scaffolds = format_info_frags(scaffo...
python
def rearrange_intra_scaffolds(scaffolds): """Rearranges all bins within each scaffold such that all bins belonging to the same initial contig are grouped together in the same order. When two such groups are found, the smaller one is moved to the larger one. """ scaffolds = format_info_frags(scaffo...
Rearranges all bins within each scaffold such that all bins belonging to the same initial contig are grouped together in the same order. When two such groups are found, the smaller one is moved to the larger one.
https://github.com/koszullab/instaGRAAL/blob/1c02ca838e57d8178eec79f223644b2acd0153dd/instagraal/parse_info_frags.py#L465-L508
koszullab/instaGRAAL
instagraal/parse_info_frags.py
write_fasta
def write_fasta( init_fasta, info_frags, output=DEFAULT_NEW_GENOME_NAME, junction=False ): """Convert an info_frags.txt file into a fasta file given a reference. Optionally adds junction sequences to reflect the possibly missing base pairs between two newly joined scaffolds. """ init_genome = ...
python
def write_fasta( init_fasta, info_frags, output=DEFAULT_NEW_GENOME_NAME, junction=False ): """Convert an info_frags.txt file into a fasta file given a reference. Optionally adds junction sequences to reflect the possibly missing base pairs between two newly joined scaffolds. """ init_genome = ...
Convert an info_frags.txt file into a fasta file given a reference. Optionally adds junction sequences to reflect the possibly missing base pairs between two newly joined scaffolds.
https://github.com/koszullab/instaGRAAL/blob/1c02ca838e57d8178eec79f223644b2acd0153dd/instagraal/parse_info_frags.py#L604-L664
koszullab/instaGRAAL
instagraal/parse_info_frags.py
is_block
def is_block(bin_list): """Check if a bin list has exclusively consecutive bin ids. """ id_set = set((my_bin[1] for my_bin in bin_list)) start_id, end_id = min(id_set), max(id_set) return id_set == set(range(start_id, end_id + 1))
python
def is_block(bin_list): """Check if a bin list has exclusively consecutive bin ids. """ id_set = set((my_bin[1] for my_bin in bin_list)) start_id, end_id = min(id_set), max(id_set) return id_set == set(range(start_id, end_id + 1))
Check if a bin list has exclusively consecutive bin ids.
https://github.com/koszullab/instaGRAAL/blob/1c02ca838e57d8178eec79f223644b2acd0153dd/instagraal/parse_info_frags.py#L804-L810
koszullab/instaGRAAL
instagraal/leastsqbound.py
internal2external_grad
def internal2external_grad(xi, bounds): """ Calculate the internal to external gradiant Calculates the partial of external over internal """ ge = np.empty_like(xi) for i, (v, bound) in enumerate(zip(xi, bounds)): a = bound[0] # minimum b = bound[1] # maximum ...
python
def internal2external_grad(xi, bounds): """ Calculate the internal to external gradiant Calculates the partial of external over internal """ ge = np.empty_like(xi) for i, (v, bound) in enumerate(zip(xi, bounds)): a = bound[0] # minimum b = bound[1] # maximum ...
Calculate the internal to external gradiant Calculates the partial of external over internal
https://github.com/koszullab/instaGRAAL/blob/1c02ca838e57d8178eec79f223644b2acd0153dd/instagraal/leastsqbound.py#L19-L46
koszullab/instaGRAAL
instagraal/leastsqbound.py
internal2external
def internal2external(xi, bounds): """ Convert a series of internal variables to external variables""" xe = np.empty_like(xi) for i, (v, bound) in enumerate(zip(xi, bounds)): a = bound[0] # minimum b = bound[1] # maximum if a == None and b == None: # No constraints ...
python
def internal2external(xi, bounds): """ Convert a series of internal variables to external variables""" xe = np.empty_like(xi) for i, (v, bound) in enumerate(zip(xi, bounds)): a = bound[0] # minimum b = bound[1] # maximum if a == None and b == None: # No constraints ...
Convert a series of internal variables to external variables
https://github.com/koszullab/instaGRAAL/blob/1c02ca838e57d8178eec79f223644b2acd0153dd/instagraal/leastsqbound.py#L56-L78
koszullab/instaGRAAL
instagraal/leastsqbound.py
external2internal
def external2internal(xe, bounds): """ Convert a series of external variables to internal variables""" xi = np.empty_like(xe) for i, (v, bound) in enumerate(zip(xe, bounds)): a = bound[0] # minimum b = bound[1] # maximum if a == None and b == None: # No constraints ...
python
def external2internal(xe, bounds): """ Convert a series of external variables to internal variables""" xi = np.empty_like(xe) for i, (v, bound) in enumerate(zip(xe, bounds)): a = bound[0] # minimum b = bound[1] # maximum if a == None and b == None: # No constraints ...
Convert a series of external variables to internal variables
https://github.com/koszullab/instaGRAAL/blob/1c02ca838e57d8178eec79f223644b2acd0153dd/instagraal/leastsqbound.py#L81-L103
koszullab/instaGRAAL
instagraal/leastsqbound.py
calc_cov_x
def calc_cov_x(infodic, p): """ Calculate cov_x from fjac, ipvt and p as is done in leastsq """ fjac = infodic["fjac"] ipvt = infodic["ipvt"] n = len(p) # adapted from leastsq function in scipy/optimize/minpack.py perm = np.take(np.eye(n), ipvt - 1, 0) r = np.triu(np.transpose(fjac...
python
def calc_cov_x(infodic, p): """ Calculate cov_x from fjac, ipvt and p as is done in leastsq """ fjac = infodic["fjac"] ipvt = infodic["ipvt"] n = len(p) # adapted from leastsq function in scipy/optimize/minpack.py perm = np.take(np.eye(n), ipvt - 1, 0) r = np.triu(np.transpose(fjac...
Calculate cov_x from fjac, ipvt and p as is done in leastsq
https://github.com/koszullab/instaGRAAL/blob/1c02ca838e57d8178eec79f223644b2acd0153dd/instagraal/leastsqbound.py#L112-L129
koszullab/instaGRAAL
instagraal/leastsqbound.py
leastsqbound
def leastsqbound(func, x0, bounds, args=(), **kw): """ Constrained multivariant Levenberg-Marquard optimization Minimize the sum of squares of a given function using the Levenberg-Marquard algorithm. Contraints on parameters are inforced using variable transformations as described in the MINUIT U...
python
def leastsqbound(func, x0, bounds, args=(), **kw): """ Constrained multivariant Levenberg-Marquard optimization Minimize the sum of squares of a given function using the Levenberg-Marquard algorithm. Contraints on parameters are inforced using variable transformations as described in the MINUIT U...
Constrained multivariant Levenberg-Marquard optimization Minimize the sum of squares of a given function using the Levenberg-Marquard algorithm. Contraints on parameters are inforced using variable transformations as described in the MINUIT User's Guide by Fred James and Matthias Winkler. Parame...
https://github.com/koszullab/instaGRAAL/blob/1c02ca838e57d8178eec79f223644b2acd0153dd/instagraal/leastsqbound.py#L132-L183
guykisel/inline-plz
inlineplz/interfaces/github.py
GitHubInterface.start_review
def start_review(self): """Mark our review as started.""" if self.set_status: self.github_repo.create_status( state="pending", description="Static analysis in progress.", context="inline-plz", sha=self.last_sha, )
python
def start_review(self): """Mark our review as started.""" if self.set_status: self.github_repo.create_status( state="pending", description="Static analysis in progress.", context="inline-plz", sha=self.last_sha, )
Mark our review as started.
https://github.com/guykisel/inline-plz/blob/b5b1744e9156e31f68b519c0d8022feff79888ae/inlineplz/interfaces/github.py#L199-L207
guykisel/inline-plz
inlineplz/interfaces/github.py
GitHubInterface.finish_review
def finish_review(self, success=True, error=False): """Mark our review as finished.""" if self.set_status: if error: self.github_repo.create_status( state="error", description="Static analysis error! inline-plz failed to run.", ...
python
def finish_review(self, success=True, error=False): """Mark our review as finished.""" if self.set_status: if error: self.github_repo.create_status( state="error", description="Static analysis error! inline-plz failed to run.", ...
Mark our review as finished.
https://github.com/guykisel/inline-plz/blob/b5b1744e9156e31f68b519c0d8022feff79888ae/inlineplz/interfaces/github.py#L209-L232
guykisel/inline-plz
inlineplz/interfaces/github.py
GitHubInterface.out_of_date
def out_of_date(self): """Check if our local latest sha matches the remote latest sha""" try: latest_remote_sha = self.pr_commits(self.pull_request.refresh(True))[-1].sha print("Latest remote sha: {}".format(latest_remote_sha)) try: print("Ratelimit re...
python
def out_of_date(self): """Check if our local latest sha matches the remote latest sha""" try: latest_remote_sha = self.pr_commits(self.pull_request.refresh(True))[-1].sha print("Latest remote sha: {}".format(latest_remote_sha)) try: print("Ratelimit re...
Check if our local latest sha matches the remote latest sha
https://github.com/guykisel/inline-plz/blob/b5b1744e9156e31f68b519c0d8022feff79888ae/inlineplz/interfaces/github.py#L234-L245
guykisel/inline-plz
inlineplz/interfaces/github.py
GitHubInterface.position
def position(self, message): """Calculate position within the PR, which is not the line number""" if not message.line_number: message.line_number = 1 for patched_file in self.patch: target = patched_file.target_file.lstrip("b/") if target == message.path: ...
python
def position(self, message): """Calculate position within the PR, which is not the line number""" if not message.line_number: message.line_number = 1 for patched_file in self.patch: target = patched_file.target_file.lstrip("b/") if target == message.path: ...
Calculate position within the PR, which is not the line number
https://github.com/guykisel/inline-plz/blob/b5b1744e9156e31f68b519c0d8022feff79888ae/inlineplz/interfaces/github.py#L444-L461
koszullab/instaGRAAL
instagraal/simu_single.py
simulation.modify_vect_frags
def modify_vect_frags(self): "include repeated frags" modified_vect_frags = dict() init_vect_frags = self.level.S_o_A_frags # init_max_id_d = init_vect_frags["id"].max() max_id_F = len(init_vect_frags["id"]) max_id_C = init_vect_frags["id_c"].max() + 1 # HSV_tu...
python
def modify_vect_frags(self): "include repeated frags" modified_vect_frags = dict() init_vect_frags = self.level.S_o_A_frags # init_max_id_d = init_vect_frags["id"].max() max_id_F = len(init_vect_frags["id"]) max_id_C = init_vect_frags["id_c"].max() + 1 # HSV_tu...
include repeated frags
https://github.com/koszullab/instaGRAAL/blob/1c02ca838e57d8178eec79f223644b2acd0153dd/instagraal/simu_single.py#L261-L450
koszullab/instaGRAAL
instagraal/simu_single.py
simulation.modify_sub_vect_frags
def modify_sub_vect_frags(self): "include repeated frags" modified_vect_frags = dict() init_vect_frags = self.sub_level.S_o_A_frags # init_max_id_d = init_vect_frags["id"].max() max_id_F = len(init_vect_frags["id"]) max_id_C = init_vect_frags["id_c"].max() + 1 #...
python
def modify_sub_vect_frags(self): "include repeated frags" modified_vect_frags = dict() init_vect_frags = self.sub_level.S_o_A_frags # init_max_id_d = init_vect_frags["id"].max() max_id_F = len(init_vect_frags["id"]) max_id_C = init_vect_frags["id_c"].max() + 1 #...
include repeated frags
https://github.com/koszullab/instaGRAAL/blob/1c02ca838e57d8178eec79f223644b2acd0153dd/instagraal/simu_single.py#L452-L637
koszullab/instaGRAAL
instagraal/instagraal.py
window.draw
def draw(self): """Render the particles""" # update or particle positions by calling the OpenCL kernel # self.cle.execute(10) OpenGL.GL.glFlush() OpenGL.GL.glClear( OpenGL.GL.GL_COLOR_BUFFER_BIT | OpenGL.GL.GL_DEPTH_BUFFER_BIT ) if self.white == -1: ...
python
def draw(self): """Render the particles""" # update or particle positions by calling the OpenCL kernel # self.cle.execute(10) OpenGL.GL.glFlush() OpenGL.GL.glClear( OpenGL.GL.GL_COLOR_BUFFER_BIT | OpenGL.GL.GL_DEPTH_BUFFER_BIT ) if self.white == -1: ...
Render the particles
https://github.com/koszullab/instaGRAAL/blob/1c02ca838e57d8178eec79f223644b2acd0153dd/instagraal/instagraal.py#L1564-L1772
koszullab/instaGRAAL
instagraal/pyramid_sparse.py
build_and_filter
def build_and_filter(base_folder, size_pyramid, factor, thresh_factor=1): """Build a filtered pyramid of contact maps Build a fragment pyramid for multi-scale analysis and remove high sparsity (i.e. low-coverage) and short fragments. Parameters ---------- base_folder : str or pathlib.Path ...
python
def build_and_filter(base_folder, size_pyramid, factor, thresh_factor=1): """Build a filtered pyramid of contact maps Build a fragment pyramid for multi-scale analysis and remove high sparsity (i.e. low-coverage) and short fragments. Parameters ---------- base_folder : str or pathlib.Path ...
Build a filtered pyramid of contact maps Build a fragment pyramid for multi-scale analysis and remove high sparsity (i.e. low-coverage) and short fragments. Parameters ---------- base_folder : str or pathlib.Path Where to create the hdf5 files containing the matrices. size_pyramid : i...
https://github.com/koszullab/instaGRAAL/blob/1c02ca838e57d8178eec79f223644b2acd0153dd/instagraal/pyramid_sparse.py#L29-L203
koszullab/instaGRAAL
instagraal/pyramid_sparse.py
build
def build(base_folder, size_pyramid, factor, min_bin_per_contig): """Build a pyramid of contact maps Build a fragment pyramid for multi-scale analysis Parameters ---------- base_folder : str or pathlib.Path Where to create the hdf5 files containing the matrices. size_pyramid : int ...
python
def build(base_folder, size_pyramid, factor, min_bin_per_contig): """Build a pyramid of contact maps Build a fragment pyramid for multi-scale analysis Parameters ---------- base_folder : str or pathlib.Path Where to create the hdf5 files containing the matrices. size_pyramid : int ...
Build a pyramid of contact maps Build a fragment pyramid for multi-scale analysis Parameters ---------- base_folder : str or pathlib.Path Where to create the hdf5 files containing the matrices. size_pyramid : int How many levels (contact maps of decreasing resolution) to genera...
https://github.com/koszullab/instaGRAAL/blob/1c02ca838e57d8178eec79f223644b2acd0153dd/instagraal/pyramid_sparse.py#L206-L329
koszullab/instaGRAAL
instagraal/pyramid_sparse.py
abs_contact_2_coo_file
def abs_contact_2_coo_file(abs_contact_file, coo_file): """Convert contact maps between old-style and new-style formats. A legacy function that converts contact maps from the older GRAAL format to the simpler instaGRAAL format. This is useful with datasets generated by Hi-C box. Parameters ---...
python
def abs_contact_2_coo_file(abs_contact_file, coo_file): """Convert contact maps between old-style and new-style formats. A legacy function that converts contact maps from the older GRAAL format to the simpler instaGRAAL format. This is useful with datasets generated by Hi-C box. Parameters ---...
Convert contact maps between old-style and new-style formats. A legacy function that converts contact maps from the older GRAAL format to the simpler instaGRAAL format. This is useful with datasets generated by Hi-C box. Parameters ---------- abs_contact_file : str, file or pathlib.Path ...
https://github.com/koszullab/instaGRAAL/blob/1c02ca838e57d8178eec79f223644b2acd0153dd/instagraal/pyramid_sparse.py#L332-L381
koszullab/instaGRAAL
instagraal/pyramid_sparse.py
fill_sparse_pyramid_level
def fill_sparse_pyramid_level(pyramid_handle, level, contact_file, nfrags): """Fill a level with sparse contact map data Fill values from the simple text matrix file to the hdf5-based pyramid level with contact data. Parameters ---------- pyramid_handle : h5py.File The hdf5 file ha...
python
def fill_sparse_pyramid_level(pyramid_handle, level, contact_file, nfrags): """Fill a level with sparse contact map data Fill values from the simple text matrix file to the hdf5-based pyramid level with contact data. Parameters ---------- pyramid_handle : h5py.File The hdf5 file ha...
Fill a level with sparse contact map data Fill values from the simple text matrix file to the hdf5-based pyramid level with contact data. Parameters ---------- pyramid_handle : h5py.File The hdf5 file handle containing the whole dataset. level : int The level (resolution) t...
https://github.com/koszullab/instaGRAAL/blob/1c02ca838e57d8178eec79f223644b2acd0153dd/instagraal/pyramid_sparse.py#L384-L450
koszullab/instaGRAAL
instagraal/pyramid_sparse.py
init_frag_list
def init_frag_list(fragment_list, new_frag_list): """Adapt the original fragment list to fit the build function requirements Parameters ---------- fragment_list : str, file or pathlib.Path The input fragment list. new_frag_list : str, file or pathlib.Path The output fragment list to...
python
def init_frag_list(fragment_list, new_frag_list): """Adapt the original fragment list to fit the build function requirements Parameters ---------- fragment_list : str, file or pathlib.Path The input fragment list. new_frag_list : str, file or pathlib.Path The output fragment list to...
Adapt the original fragment list to fit the build function requirements Parameters ---------- fragment_list : str, file or pathlib.Path The input fragment list. new_frag_list : str, file or pathlib.Path The output fragment list to be written. Returns ------- i : int ...
https://github.com/koszullab/instaGRAAL/blob/1c02ca838e57d8178eec79f223644b2acd0153dd/instagraal/pyramid_sparse.py#L453-L519
koszullab/instaGRAAL
instagraal/pyramid_sparse.py
pyramid.zoom_in_frag
def zoom_in_frag(self, curr_frag): """ :param curr_frag: """ level = curr_frag[1] frag = curr_frag[0] output = [] if level > 0: str_level = str(level) sub_low = self.spec_level[str_level]["fragments_dict"][frag][ "sub_low_in...
python
def zoom_in_frag(self, curr_frag): """ :param curr_frag: """ level = curr_frag[1] frag = curr_frag[0] output = [] if level > 0: str_level = str(level) sub_low = self.spec_level[str_level]["fragments_dict"][frag][ "sub_low_in...
:param curr_frag:
https://github.com/koszullab/instaGRAAL/blob/1c02ca838e57d8178eec79f223644b2acd0153dd/instagraal/pyramid_sparse.py#L1697-L1717
koszullab/instaGRAAL
instagraal/pyramid_sparse.py
pyramid.zoom_out_frag
def zoom_out_frag(self, curr_frag): """ :param curr_frag: """ level = curr_frag[1] frag = curr_frag[0] output = [] if level > 0: str_level = str(level) high_frag = self.spec_level[str_level]["fragments_dict"][frag][ "super_i...
python
def zoom_out_frag(self, curr_frag): """ :param curr_frag: """ level = curr_frag[1] frag = curr_frag[0] output = [] if level > 0: str_level = str(level) high_frag = self.spec_level[str_level]["fragments_dict"][frag][ "super_i...
:param curr_frag:
https://github.com/koszullab/instaGRAAL/blob/1c02ca838e57d8178eec79f223644b2acd0153dd/instagraal/pyramid_sparse.py#L1719-L1735
koszullab/instaGRAAL
instagraal/pyramid_sparse.py
pyramid.zoom_in_pixel
def zoom_in_pixel(self, curr_pixel): """ return the curr_frag at a higher resolution""" low_frag = curr_pixel[0] high_frag = curr_pixel[1] level = curr_pixel[2] if level > 0: str_level = str(level) low_sub_low = self.spec_level[str_level]["fragments_dict"]...
python
def zoom_in_pixel(self, curr_pixel): """ return the curr_frag at a higher resolution""" low_frag = curr_pixel[0] high_frag = curr_pixel[1] level = curr_pixel[2] if level > 0: str_level = str(level) low_sub_low = self.spec_level[str_level]["fragments_dict"]...
return the curr_frag at a higher resolution
https://github.com/koszullab/instaGRAAL/blob/1c02ca838e57d8178eec79f223644b2acd0153dd/instagraal/pyramid_sparse.py#L1759-L1785
koszullab/instaGRAAL
instagraal/pyramid_sparse.py
pyramid.zoom_out_pixel
def zoom_out_pixel(self, curr_pixel): """ return the curr_frag at a lower resolution""" low_frag = curr_pixel[0] high_frag = curr_pixel[1] level = curr_pixel[2] str_level = str(level) if level < self.n_level - 1: low_super = self.spec_level[str_level]["fragmen...
python
def zoom_out_pixel(self, curr_pixel): """ return the curr_frag at a lower resolution""" low_frag = curr_pixel[0] high_frag = curr_pixel[1] level = curr_pixel[2] str_level = str(level) if level < self.n_level - 1: low_super = self.spec_level[str_level]["fragmen...
return the curr_frag at a lower resolution
https://github.com/koszullab/instaGRAAL/blob/1c02ca838e57d8178eec79f223644b2acd0153dd/instagraal/pyramid_sparse.py#L1787-L1807
koszullab/instaGRAAL
instagraal/pyramid_sparse.py
pyramid.zoom_in_area
def zoom_in_area(self, area): """ zoom in area""" x = area[0] y = area[1] level = x[2] logger.debug("x = {}".format(x)) logger.debug("y = {}".format(y)) logger.debug("level = {}".format(level)) if level == y[2] and level > 0: new_level = level ...
python
def zoom_in_area(self, area): """ zoom in area""" x = area[0] y = area[1] level = x[2] logger.debug("x = {}".format(x)) logger.debug("y = {}".format(y)) logger.debug("level = {}".format(level)) if level == y[2] and level > 0: new_level = level ...
zoom in area
https://github.com/koszullab/instaGRAAL/blob/1c02ca838e57d8178eec79f223644b2acd0153dd/instagraal/pyramid_sparse.py#L1809-L1835
koszullab/instaGRAAL
instagraal/pyramid_sparse.py
level.load_data
def load_data(self, pyramid): """ :param pyramid: hic pyramid """ import colorsys logger.info("loading data from level = {}".format(self.level)) # self.im_init = np.array(pyramid.data[str(self.level)], # dtype=np.int32) # self.n_frags = self.im_init.shape...
python
def load_data(self, pyramid): """ :param pyramid: hic pyramid """ import colorsys logger.info("loading data from level = {}".format(self.level)) # self.im_init = np.array(pyramid.data[str(self.level)], # dtype=np.int32) # self.n_frags = self.im_init.shape...
:param pyramid: hic pyramid
https://github.com/koszullab/instaGRAAL/blob/1c02ca838e57d8178eec79f223644b2acd0153dd/instagraal/pyramid_sparse.py#L1927-L2155
guykisel/inline-plz
inlineplz/main.py
load_config
def load_config(args, config_path=".inlineplz.yml"): """Load inline-plz config from yaml config file with reasonable defaults.""" config = {} try: with open(config_path) as configfile: config = yaml.safe_load(configfile) or {} if config: print("Loaded config f...
python
def load_config(args, config_path=".inlineplz.yml"): """Load inline-plz config from yaml config file with reasonable defaults.""" config = {} try: with open(config_path) as configfile: config = yaml.safe_load(configfile) or {} if config: print("Loaded config f...
Load inline-plz config from yaml config file with reasonable defaults.
https://github.com/guykisel/inline-plz/blob/b5b1744e9156e31f68b519c0d8022feff79888ae/inlineplz/main.py#L102-L143
guykisel/inline-plz
inlineplz/main.py
inline
def inline(args): """ Parse input file with the specified parser and post messages based on lint output :param args: Contains the following interface: How are we going to post comments? owner: Username of repo owner repo: Repository name pr: Pull request ID token: Au...
python
def inline(args): """ Parse input file with the specified parser and post messages based on lint output :param args: Contains the following interface: How are we going to post comments? owner: Username of repo owner repo: Repository name pr: Pull request ID token: Au...
Parse input file with the specified parser and post messages based on lint output :param args: Contains the following interface: How are we going to post comments? owner: Username of repo owner repo: Repository name pr: Pull request ID token: Authentication for repository ...
https://github.com/guykisel/inline-plz/blob/b5b1744e9156e31f68b519c0d8022feff79888ae/inlineplz/main.py#L146-L270
guykisel/inline-plz
inlineplz/linter_runner.py
LinterRunner.cleanup
def cleanup(): """Delete standard installation directories.""" for install_dir in linters.INSTALL_DIRS: try: shutil.rmtree(install_dir, ignore_errors=True) except Exception: print( "{0}\nFailed to delete {1}".format( ...
python
def cleanup(): """Delete standard installation directories.""" for install_dir in linters.INSTALL_DIRS: try: shutil.rmtree(install_dir, ignore_errors=True) except Exception: print( "{0}\nFailed to delete {1}".format( ...
Delete standard installation directories.
https://github.com/guykisel/inline-plz/blob/b5b1744e9156e31f68b519c0d8022feff79888ae/inlineplz/linter_runner.py#L167-L178
quantmind/aio-kong
kong/services.py
Services.apply_json
async def apply_json(self, data): """Apply a JSON data object for a service """ if not isinstance(data, list): data = [data] result = [] for entry in data: if not isinstance(entry, dict): raise KongError('dictionary required') e...
python
async def apply_json(self, data): """Apply a JSON data object for a service """ if not isinstance(data, list): data = [data] result = [] for entry in data: if not isinstance(entry, dict): raise KongError('dictionary required') e...
Apply a JSON data object for a service
https://github.com/quantmind/aio-kong/blob/65607c6a6fea4c50b94e5f06dfbcd2841dfa8abf/kong/services.py#L34-L67
quantmind/aio-kong
kong/snis.py
Snis.apply_json
async def apply_json(self, data): """Apply a JSON data object for a service """ if not isinstance(data, list): data = [data] result = [] for entry in data: name = entry.pop('name') if await self.has(name): sni = await self.updat...
python
async def apply_json(self, data): """Apply a JSON data object for a service """ if not isinstance(data, list): data = [data] result = [] for entry in data: name = entry.pop('name') if await self.has(name): sni = await self.updat...
Apply a JSON data object for a service
https://github.com/quantmind/aio-kong/blob/65607c6a6fea4c50b94e5f06dfbcd2841dfa8abf/kong/snis.py#L7-L20
pycontribs/pyrax
pyrax/clouddatabases.py
CloudDatabaseVolume.resize
def resize(self, size): """ Resize the volume to the specified size (in GB). """ self.instance.resize_volume(size) self.size = size
python
def resize(self, size): """ Resize the volume to the specified size (in GB). """ self.instance.resize_volume(size) self.size = size
Resize the volume to the specified size (in GB).
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/clouddatabases.py#L53-L58
pycontribs/pyrax
pyrax/clouddatabases.py
CloudDatabaseManager.get
def get(self, item): """ This additional code is necessary to properly return the 'volume' attribute of the instance as a CloudDatabaseVolume object instead of a raw dict. """ resource = super(CloudDatabaseManager, self).get(item) resource.volume = CloudDatabaseVo...
python
def get(self, item): """ This additional code is necessary to properly return the 'volume' attribute of the instance as a CloudDatabaseVolume object instead of a raw dict. """ resource = super(CloudDatabaseManager, self).get(item) resource.volume = CloudDatabaseVo...
This additional code is necessary to properly return the 'volume' attribute of the instance as a CloudDatabaseVolume object instead of a raw dict.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/clouddatabases.py#L73-L81
pycontribs/pyrax
pyrax/clouddatabases.py
CloudDatabaseManager._create_body
def _create_body(self, name, flavor=None, volume=None, databases=None, users=None, version=None, type=None): """ Used to create the dict required to create a Cloud Database instance. """ if flavor is None: flavor = 1 flavor_ref = self.api._get_flavor_ref(f...
python
def _create_body(self, name, flavor=None, volume=None, databases=None, users=None, version=None, type=None): """ Used to create the dict required to create a Cloud Database instance. """ if flavor is None: flavor = 1 flavor_ref = self.api._get_flavor_ref(f...
Used to create the dict required to create a Cloud Database instance.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/clouddatabases.py#L84-L114
pycontribs/pyrax
pyrax/clouddatabases.py
CloudDatabaseManager.create_backup
def create_backup(self, instance, name, description=None): """ Creates a backup of the specified instance, giving it the specified name along with an optional description. """ body = {"backup": { "instance": utils.get_id(instance), "name": name, ...
python
def create_backup(self, instance, name, description=None): """ Creates a backup of the specified instance, giving it the specified name along with an optional description. """ body = {"backup": { "instance": utils.get_id(instance), "name": name, ...
Creates a backup of the specified instance, giving it the specified name along with an optional description.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/clouddatabases.py#L117-L131
pycontribs/pyrax
pyrax/clouddatabases.py
CloudDatabaseManager.restore_backup
def restore_backup(self, backup, name, flavor, volume): """ Restores a backup to a new database instance. You must supply a backup (either the ID or a CloudDatabaseBackup object), a name for the new instance, as well as a flavor and volume size (in GB) for the instance. """ ...
python
def restore_backup(self, backup, name, flavor, volume): """ Restores a backup to a new database instance. You must supply a backup (either the ID or a CloudDatabaseBackup object), a name for the new instance, as well as a flavor and volume size (in GB) for the instance. """ ...
Restores a backup to a new database instance. You must supply a backup (either the ID or a CloudDatabaseBackup object), a name for the new instance, as well as a flavor and volume size (in GB) for the instance.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/clouddatabases.py#L134-L149
pycontribs/pyrax
pyrax/clouddatabases.py
CloudDatabaseManager.list_backups
def list_backups(self, instance=None, marker=0, limit=20): """ Returns a paginated list of backups, or just for a particular instance. """ return self.api._backup_manager.list(instance=instance, limit=limit, marker=marker)
python
def list_backups(self, instance=None, marker=0, limit=20): """ Returns a paginated list of backups, or just for a particular instance. """ return self.api._backup_manager.list(instance=instance, limit=limit, marker=marker)
Returns a paginated list of backups, or just for a particular instance.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/clouddatabases.py#L152-L158
pycontribs/pyrax
pyrax/clouddatabases.py
CloudDatabaseManager._list_backups_for_instance
def _list_backups_for_instance(self, instance, marker=0, limit=20): """ Instance-specific backups are handled through the instance manager, not the backup manager. """ uri = "/%s/%s/backups?limit=%d&marker=%d" % (self.uri_base, ...
python
def _list_backups_for_instance(self, instance, marker=0, limit=20): """ Instance-specific backups are handled through the instance manager, not the backup manager. """ uri = "/%s/%s/backups?limit=%d&marker=%d" % (self.uri_base, ...
Instance-specific backups are handled through the instance manager, not the backup manager.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/clouddatabases.py#L161-L173
pycontribs/pyrax
pyrax/clouddatabases.py
CloudDatabaseUserManager._get_db_names
def _get_db_names(self, dbs, strict=True): """ Accepts a single db (name or object) or a list of dbs, and returns a list of database names. If any of the supplied dbs do not exist, a NoSuchDatabase exception will be raised, unless you pass strict=False. """ dbs = utils.co...
python
def _get_db_names(self, dbs, strict=True): """ Accepts a single db (name or object) or a list of dbs, and returns a list of database names. If any of the supplied dbs do not exist, a NoSuchDatabase exception will be raised, unless you pass strict=False. """ dbs = utils.co...
Accepts a single db (name or object) or a list of dbs, and returns a list of database names. If any of the supplied dbs do not exist, a NoSuchDatabase exception will be raised, unless you pass strict=False.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/clouddatabases.py#L209-L226
pycontribs/pyrax
pyrax/clouddatabases.py
CloudDatabaseUserManager.update
def update(self, user, name=None, password=None, host=None): """ Allows you to change one or more of the user's username, password, or host. """ if not any((name, password, host)): raise exc.MissingDBUserParameters("You must supply at least one of " ...
python
def update(self, user, name=None, password=None, host=None): """ Allows you to change one or more of the user's username, password, or host. """ if not any((name, password, host)): raise exc.MissingDBUserParameters("You must supply at least one of " ...
Allows you to change one or more of the user's username, password, or host.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/clouddatabases.py#L239-L264
pycontribs/pyrax
pyrax/clouddatabases.py
CloudDatabaseUserManager.list_user_access
def list_user_access(self, user): """ Returns a list of all database names for which the specified user has access rights. """ user = utils.get_name(user) uri = "/%s/%s/databases" % (self.uri_base, user) try: resp, resp_body = self.api.method_get(uri) ...
python
def list_user_access(self, user): """ Returns a list of all database names for which the specified user has access rights. """ user = utils.get_name(user) uri = "/%s/%s/databases" % (self.uri_base, user) try: resp, resp_body = self.api.method_get(uri) ...
Returns a list of all database names for which the specified user has access rights.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/clouddatabases.py#L267-L279
pycontribs/pyrax
pyrax/clouddatabases.py
CloudDatabaseUserManager.grant_user_access
def grant_user_access(self, user, db_names, strict=True): """ Gives access to the databases listed in `db_names` to the user. You may pass in either a single db or a list of dbs. If any of the databases do not exist, a NoSuchDatabase exception will be raised, unless you specify ...
python
def grant_user_access(self, user, db_names, strict=True): """ Gives access to the databases listed in `db_names` to the user. You may pass in either a single db or a list of dbs. If any of the databases do not exist, a NoSuchDatabase exception will be raised, unless you specify ...
Gives access to the databases listed in `db_names` to the user. You may pass in either a single db or a list of dbs. If any of the databases do not exist, a NoSuchDatabase exception will be raised, unless you specify `strict=False` in the call.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/clouddatabases.py#L282-L298
pycontribs/pyrax
pyrax/clouddatabases.py
CloudDatabaseUserManager.revoke_user_access
def revoke_user_access(self, user, db_names, strict=True): """ Revokes access to the databases listed in `db_names` for the user. If any of the databases do not exist, a NoSuchDatabase exception will be raised, unless you specify `strict=False` in the call. """ user = ut...
python
def revoke_user_access(self, user, db_names, strict=True): """ Revokes access to the databases listed in `db_names` for the user. If any of the databases do not exist, a NoSuchDatabase exception will be raised, unless you specify `strict=False` in the call. """ user = ut...
Revokes access to the databases listed in `db_names` for the user. If any of the databases do not exist, a NoSuchDatabase exception will be raised, unless you specify `strict=False` in the call.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/clouddatabases.py#L301-L313
pycontribs/pyrax
pyrax/clouddatabases.py
CloudDatabaseBackupManager.list
def list(self, instance=None, limit=20, marker=0): """ Return a paginated list of backups, or just for a particular instance. """ if instance is None: return super(CloudDatabaseBackupManager, self).list() return self.api._manager._list_backups_for_instance(ins...
python
def list(self, instance=None, limit=20, marker=0): """ Return a paginated list of backups, or just for a particular instance. """ if instance is None: return super(CloudDatabaseBackupManager, self).list() return self.api._manager._list_backups_for_instance(ins...
Return a paginated list of backups, or just for a particular instance.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/clouddatabases.py#L331-L339
pycontribs/pyrax
pyrax/clouddatabases.py
CloudDatabaseInstance.get
def get(self): """ Need to override the default get() behavior by making the 'volume' attribute into a CloudDatabaseVolume object instead of the raw dict. """ super(CloudDatabaseInstance, self).get() # Make the volume into an accessible object instead of a dict se...
python
def get(self): """ Need to override the default get() behavior by making the 'volume' attribute into a CloudDatabaseVolume object instead of the raw dict. """ super(CloudDatabaseInstance, self).get() # Make the volume into an accessible object instead of a dict se...
Need to override the default get() behavior by making the 'volume' attribute into a CloudDatabaseVolume object instead of the raw dict.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/clouddatabases.py#L362-L369
pycontribs/pyrax
pyrax/clouddatabases.py
CloudDatabaseInstance.list_databases
def list_databases(self, limit=None, marker=None): """Returns a list of the names of all databases for this instance.""" return self._database_manager.list(limit=limit, marker=marker)
python
def list_databases(self, limit=None, marker=None): """Returns a list of the names of all databases for this instance.""" return self._database_manager.list(limit=limit, marker=marker)
Returns a list of the names of all databases for this instance.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/clouddatabases.py#L372-L374
pycontribs/pyrax
pyrax/clouddatabases.py
CloudDatabaseInstance.list_users
def list_users(self, limit=None, marker=None): """Returns a list of the names of all users for this instance.""" return self._user_manager.list(limit=limit, marker=marker)
python
def list_users(self, limit=None, marker=None): """Returns a list of the names of all users for this instance.""" return self._user_manager.list(limit=limit, marker=marker)
Returns a list of the names of all users for this instance.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/clouddatabases.py#L377-L379
pycontribs/pyrax
pyrax/clouddatabases.py
CloudDatabaseInstance.get_user
def get_user(self, name): """ Finds the user in this instance with the specified name, and returns a CloudDatabaseUser object. If no match is found, a NoSuchDatabaseUser exception is raised. """ try: return self._user_manager.get(name) except exc.NotFo...
python
def get_user(self, name): """ Finds the user in this instance with the specified name, and returns a CloudDatabaseUser object. If no match is found, a NoSuchDatabaseUser exception is raised. """ try: return self._user_manager.get(name) except exc.NotFo...
Finds the user in this instance with the specified name, and returns a CloudDatabaseUser object. If no match is found, a NoSuchDatabaseUser exception is raised.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/clouddatabases.py#L382-L392
pycontribs/pyrax
pyrax/clouddatabases.py
CloudDatabaseInstance.get_database
def get_database(self, name): """ Finds the database in this instance with the specified name, and returns a CloudDatabaseDatabase object. If no match is found, a NoSuchDatabase exception is raised. """ try: return [db for db in self.list_databases() ...
python
def get_database(self, name): """ Finds the database in this instance with the specified name, and returns a CloudDatabaseDatabase object. If no match is found, a NoSuchDatabase exception is raised. """ try: return [db for db in self.list_databases() ...
Finds the database in this instance with the specified name, and returns a CloudDatabaseDatabase object. If no match is found, a NoSuchDatabase exception is raised.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/clouddatabases.py#L395-L406
pycontribs/pyrax
pyrax/clouddatabases.py
CloudDatabaseInstance.create_database
def create_database(self, name, character_set=None, collate=None): """ Creates a database with the specified name. If a database with that name already exists, a BadRequest (400) exception will be raised. """ if character_set is None: character_set = "utf8" ...
python
def create_database(self, name, character_set=None, collate=None): """ Creates a database with the specified name. If a database with that name already exists, a BadRequest (400) exception will be raised. """ if character_set is None: character_set = "utf8" ...
Creates a database with the specified name. If a database with that name already exists, a BadRequest (400) exception will be raised.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/clouddatabases.py#L409-L423
pycontribs/pyrax
pyrax/clouddatabases.py
CloudDatabaseInstance.create_user
def create_user(self, name, password, database_names, host=None): """ Creates a user with the specified name and password, and gives that user access to the specified database(s). If a user with that name already exists, a BadRequest (400) exception will be raised. """ ...
python
def create_user(self, name, password, database_names, host=None): """ Creates a user with the specified name and password, and gives that user access to the specified database(s). If a user with that name already exists, a BadRequest (400) exception will be raised. """ ...
Creates a user with the specified name and password, and gives that user access to the specified database(s). If a user with that name already exists, a BadRequest (400) exception will be raised.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/clouddatabases.py#L426-L443
pycontribs/pyrax
pyrax/clouddatabases.py
CloudDatabaseInstance.delete_database
def delete_database(self, name_or_obj): """ Deletes the specified database. If no database by that name exists, no exception will be raised; instead, nothing at all is done. """ name = utils.get_name(name_or_obj) self._database_manager.delete(name)
python
def delete_database(self, name_or_obj): """ Deletes the specified database. If no database by that name exists, no exception will be raised; instead, nothing at all is done. """ name = utils.get_name(name_or_obj) self._database_manager.delete(name)
Deletes the specified database. If no database by that name exists, no exception will be raised; instead, nothing at all is done.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/clouddatabases.py#L446-L453
pycontribs/pyrax
pyrax/clouddatabases.py
CloudDatabaseInstance.update_user
def update_user(self, user, name=None, password=None, host=None): """ Allows you to change one or more of the user's username, password, or host. """ return self._user_manager.update(user, name=name, password=password, host=host)
python
def update_user(self, user, name=None, password=None, host=None): """ Allows you to change one or more of the user's username, password, or host. """ return self._user_manager.update(user, name=name, password=password, host=host)
Allows you to change one or more of the user's username, password, or host.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/clouddatabases.py#L466-L472
pycontribs/pyrax
pyrax/clouddatabases.py
CloudDatabaseInstance.grant_user_access
def grant_user_access(self, user, db_names, strict=True): """ Gives access to the databases listed in `db_names` to the user. """ return self._user_manager.grant_user_access(user, db_names, strict=strict)
python
def grant_user_access(self, user, db_names, strict=True): """ Gives access to the databases listed in `db_names` to the user. """ return self._user_manager.grant_user_access(user, db_names, strict=strict)
Gives access to the databases listed in `db_names` to the user.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/clouddatabases.py#L483-L488
pycontribs/pyrax
pyrax/clouddatabases.py
CloudDatabaseInstance.revoke_user_access
def revoke_user_access(self, user, db_names, strict=True): """ Revokes access to the databases listed in `db_names` for the user. """ return self._user_manager.revoke_user_access(user, db_names, strict=strict)
python
def revoke_user_access(self, user, db_names, strict=True): """ Revokes access to the databases listed in `db_names` for the user. """ return self._user_manager.revoke_user_access(user, db_names, strict=strict)
Revokes access to the databases listed in `db_names` for the user.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/clouddatabases.py#L491-L496
pycontribs/pyrax
pyrax/clouddatabases.py
CloudDatabaseInstance.delete_user
def delete_user(self, user): """ Deletes the specified user. If no user by that name exists, no exception will be raised; instead, nothing at all is done. """ name = utils.get_name(user) self._user_manager.delete(name)
python
def delete_user(self, user): """ Deletes the specified user. If no user by that name exists, no exception will be raised; instead, nothing at all is done. """ name = utils.get_name(user) self._user_manager.delete(name)
Deletes the specified user. If no user by that name exists, no exception will be raised; instead, nothing at all is done.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/clouddatabases.py#L499-L506
pycontribs/pyrax
pyrax/clouddatabases.py
CloudDatabaseInstance.enable_root_user
def enable_root_user(self): """ Enables login from any host for the root user and provides the user with a generated root password. """ uri = "/instances/%s/root" % self.id resp, body = self.manager.api.method_post(uri) return body["user"]["password"]
python
def enable_root_user(self): """ Enables login from any host for the root user and provides the user with a generated root password. """ uri = "/instances/%s/root" % self.id resp, body = self.manager.api.method_post(uri) return body["user"]["password"]
Enables login from any host for the root user and provides the user with a generated root password.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/clouddatabases.py#L509-L516
pycontribs/pyrax
pyrax/clouddatabases.py
CloudDatabaseInstance.root_user_status
def root_user_status(self): """ Returns True or False, depending on whether the root user for this instance has been enabled. """ uri = "/instances/%s/root" % self.id resp, body = self.manager.api.method_get(uri) return body["rootEnabled"]
python
def root_user_status(self): """ Returns True or False, depending on whether the root user for this instance has been enabled. """ uri = "/instances/%s/root" % self.id resp, body = self.manager.api.method_get(uri) return body["rootEnabled"]
Returns True or False, depending on whether the root user for this instance has been enabled.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/clouddatabases.py#L519-L526
pycontribs/pyrax
pyrax/clouddatabases.py
CloudDatabaseInstance.resize
def resize(self, flavor): """Set the size of this instance to a different flavor.""" # We need the flavorRef, not the flavor or size. flavorRef = self.manager.api._get_flavor_ref(flavor) body = {"flavorRef": flavorRef} self.manager.action(self, "resize", body=body)
python
def resize(self, flavor): """Set the size of this instance to a different flavor.""" # We need the flavorRef, not the flavor or size. flavorRef = self.manager.api._get_flavor_ref(flavor) body = {"flavorRef": flavorRef} self.manager.action(self, "resize", body=body)
Set the size of this instance to a different flavor.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/clouddatabases.py#L534-L539
pycontribs/pyrax
pyrax/clouddatabases.py
CloudDatabaseInstance.resize_volume
def resize_volume(self, size): """Changes the size of the volume for this instance.""" curr_size = self.volume.size if size <= curr_size: raise exc.InvalidVolumeResize("The new volume size must be larger " "than the current volume size of '%s'." % curr_size) ...
python
def resize_volume(self, size): """Changes the size of the volume for this instance.""" curr_size = self.volume.size if size <= curr_size: raise exc.InvalidVolumeResize("The new volume size must be larger " "than the current volume size of '%s'." % curr_size) ...
Changes the size of the volume for this instance.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/clouddatabases.py#L542-L549
pycontribs/pyrax
pyrax/clouddatabases.py
CloudDatabaseInstance.list_backups
def list_backups(self, limit=20, marker=0): """ Returns a paginated list of backups for this instance. """ return self.manager._list_backups_for_instance(self, limit=limit, marker=marker)
python
def list_backups(self, limit=20, marker=0): """ Returns a paginated list of backups for this instance. """ return self.manager._list_backups_for_instance(self, limit=limit, marker=marker)
Returns a paginated list of backups for this instance.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/clouddatabases.py#L552-L557
pycontribs/pyrax
pyrax/clouddatabases.py
CloudDatabaseInstance.create_backup
def create_backup(self, name, description=None): """ Creates a backup of this instance, giving it the specified name along with an optional description. """ return self.manager.create_backup(self, name, description=description)
python
def create_backup(self, name, description=None): """ Creates a backup of this instance, giving it the specified name along with an optional description. """ return self.manager.create_backup(self, name, description=description)
Creates a backup of this instance, giving it the specified name along with an optional description.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/clouddatabases.py#L560-L565
pycontribs/pyrax
pyrax/clouddatabases.py
CloudDatabaseUser.update
def update(self, name=None, password=None, host=None): """ Allows you to change one or more of the user's username, password, or host. """ return self.manager.update(self, name=name, password=password, host=host)
python
def update(self, name=None, password=None, host=None): """ Allows you to change one or more of the user's username, password, or host. """ return self.manager.update(self, name=name, password=password, host=host)
Allows you to change one or more of the user's username, password, or host.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/clouddatabases.py#L625-L631
pycontribs/pyrax
pyrax/clouddatabases.py
CloudDatabaseUser.grant_user_access
def grant_user_access(self, db_names, strict=True): """ Gives access to the databases listed in `db_names` to the user. """ return self.manager.grant_user_access(self, db_names, strict=strict)
python
def grant_user_access(self, db_names, strict=True): """ Gives access to the databases listed in `db_names` to the user. """ return self.manager.grant_user_access(self, db_names, strict=strict)
Gives access to the databases listed in `db_names` to the user.
https://github.com/pycontribs/pyrax/blob/9ddfd5064b3a292d7337906f3b2d5dce95b50b99/pyrax/clouddatabases.py#L642-L646