text stringlengths 18 773k |
|---|
def add_profile_variants(self, profile_variants):
"""Add several variants to the profile_variant collection in the
database
Args:
profile_variants(list(models.ProfileVariant))
"""
results = self.db.profile_variant.insert_many(profile_variants)
return res... |
def zip_fit_params(data):
"""
Returns the ZIP parameters that best fit a given data set.
Args:
data (array): 2d array of genes x cells belonging to a given cluster
Returns:
L (array): 1d array of means
M (array): 1d array of zero-inflation parameter
"""
genes, cells = d... |
def zip_cluster(data, k, init=None, max_iters=100):
"""
Performs hard EM clustering using the zero-inflated Poisson distribution.
Args:
data (array): A 2d array- genes x cells
k (int): Number of clusters
init (array, optional): Initial centers - genes x k array. Default: None, use k... |
def diffusion_mds(means, weights, d, diffusion_rounds=10):
"""
Dimensionality reduction using MDS, while running diffusion on W.
Args:
means (array): genes x clusters
weights (array): clusters x cells
d (int): desired dimensionality
Returns:
W_reduced (array): array of ... |
def mds(means, weights, d):
"""
Dimensionality reduction using MDS.
Args:
means (array): genes x clusters
weights (array): clusters x cells
d (int): desired dimensionality
Returns:
W_reduced (array): array of shape (d, cells)
"""
X = dim_reduce(means, weights, d... |
def dim_reduce_data(data, d):
"""
Does a MDS on the data directly, not on the means.
Args:
data (array): genes x cells
d (int): desired dimensionality
Returns:
X, a cells x d matrix
"""
genes, cells = data.shape
distances = np.zeros((cells, cells))
for i in rang... |
def case(self, case):
"""Get a case from the database
Search the cases with the case id
Args:
case (dict): A case dictionary
Returns:
mongo_case (dict): A mongo case dictionary
"""
LOG.debug("Getting case {0} from database".f... |
def nr_cases(self, snv_cases=None, sv_cases=None):
"""Return the number of cases in the database
Args:
snv_cases(bool): If only snv cases should be searched
sv_cases(bool): If only snv cases should be searched
Returns:
cases (Iterable(Case)): A iterable with... |
def add_case(self, case, update=False):
"""Add a case to the case collection
If the case exists and update is False raise error.
Args:
db (MongoClient): A connection to the mongodb
case (dict): A case dictionary
update(bool): If existing case should be updat... |
def delete_case(self, case):
"""Delete case from the database
Delete a case from the database
Args:
case (dict): A case dictionary
"""
mongo_case = self.case(case)
if not mongo_case:
raise CaseError("Tried to delete case {0} but cou... |
def make_sink_proxies(drivers):
''' Build a list of sink proxies. sink proxies are a two-level ordered
dictionary. The first level contains the lst of drivers, and the second
level contains the list of sink proxies for each driver:
drv1-->sink1
| |->sink2
|
drv2-->sink1
|->sink2... |
def build_profile_variant(variant):
"""Returns a ProfileVariant object
Args:
variant (cyvcf2.Variant)
Returns:
variant (models.ProfileVariant)
"""
chrom = variant.CHROM
if chrom.startswith(('chr', 'CHR', 'Chr')):
chrom = chrom[3:]
pos = int(variant.POS)
varia... |
def add_headers(vcf_obj, nr_cases=None, sv=False):
"""Add loqus specific information to a VCF header
Args:
vcf_obj(cyvcf2.VCF)
"""
vcf_obj.add_info_to_header(
{
'ID':"Obs",
'Number': '1',
'Type': 'Integer',
'Description': "The number of o... |
def get_file_handle(file_path):
"""Return cyvcf2 VCF object
Args:
file_path(str)
Returns:
vcf_obj(cyvcf2.VCF)
"""
LOG.debug("Check if file end is correct")
if not os.path.exists(file_path):
raise IOError("No such file:{0}".format(file_path))
if not os.path.splitex... |
def check_vcf(vcf_path, expected_type='snv'):
"""Check if there are any problems with the vcf file
Args:
vcf_path(str)
expected_type(str): 'sv' or 'snv'
Returns:
vcf_info(dict): dict like
{
'nr_variants':<INT>,
'variant_type': <STR> in ['snv', 'sv'],... |
def is_dn(s):
"""Return True if s is a LDAP DN."""
if s == '':
return True
rm = DN_REGEX.match(s)
return rm is not None and rm.group(0) == s |
def _fold_line(self, line):
"""Write string line as one or more folded lines."""
if len(line) <= self._cols:
self._output_file.write(line)
self._output_file.write(self._line_sep)
else:
pos = self._cols
self._output_file.write(line[0:self._cols])
... |
def _needs_base64_encoding(self, attr_type, attr_value):
"""Return True if attr_value has to be base-64 encoded.
This is the case because of special chars or because attr_type is in
self._base64_attrs
"""
return attr_type.lower() in self._base64_attrs or \
isinstance... |
def _unparse_attr(self, attr_type, attr_value):
"""Write a single attribute type/value pair."""
if self._needs_base64_encoding(attr_type, attr_value):
if not isinstance(attr_value, bytes):
attr_value = attr_value.encode(self._encoding)
encoded = base64.encodestrin... |
def _unparse_entry_record(self, entry):
"""
:type entry: Dict[string, List[string]]
:param entry: Dictionary holding an entry
"""
for attr_type in sorted(entry.keys()):
for attr_value in entry[attr_type]:
self._unparse_attr(attr_type, attr_value) |
def _unparse_changetype(self, mod_len):
"""Detect and write the changetype."""
if mod_len == 2:
changetype = 'add'
elif mod_len == 3:
changetype = 'modify'
else:
raise ValueError("modlist item of wrong length")
self._unparse_attr('changetype',... |
def _unparse_change_record(self, modlist):
"""
:type modlist: List[Tuple]
:param modlist: List of additions (2-tuple) or modifications (3-tuple)
"""
mod_len = len(modlist[0])
self._unparse_changetype(mod_len)
for mod in modlist:
if len(mod) != mod_len... |
def unparse(self, dn, record):
"""Write an entry or change record to the output file.
:type dn: string
:param dn: distinguished name
:type record: Union[Dict[string, List[string]], List[Tuple]]
:param record: Either a dictionary holding an entry or a list of
additi... |
def _strip_line_sep(self, s):
"""Strip trailing line separators from s, but no other whitespaces."""
if s[-2:] == b'\r\n':
return s[:-2]
elif s[-1:] == b'\n':
return s[:-1]
else:
return s |
def _iter_unfolded_lines(self):
"""Iter input unfoled lines. Skip comments."""
line = self._input_file.readline()
while line:
self.line_counter += 1
self.byte_counter += len(line)
line = self._strip_line_sep(line)
nextline = self._input_file.read... |
def _iter_blocks(self):
"""Iter input lines in blocks separated by blank lines."""
lines = []
for line in self._iter_unfolded_lines():
if line:
lines.append(line)
elif lines:
self.records_read += 1
yield lines
... |
def _parse_attr(self, line):
"""Parse a single attribute type/value pair."""
colon_pos = line.index(b':')
attr_type = line[0:colon_pos].decode('ascii')
if line[colon_pos:].startswith(b'::'):
attr_value = base64.decodestring(line[colon_pos + 2:])
elif line[colon_pos:]... |
def _check_dn(self, dn, attr_value):
"""Check dn attribute for issues."""
if dn is not None:
self._error('Two lines starting with dn: in one record.')
if not is_dn(attr_value):
self._error('No valid string-representation of '
'distinguished name %s.' % att... |
def _check_changetype(self, dn, changetype, attr_value):
"""Check changetype attribute for issues."""
if dn is None:
self._error('Read changetype: before getting valid dn: line.')
if changetype is not None:
self._error('Two lines starting with changetype: in one record.')... |
def _parse_entry_record(self, lines):
"""Parse a single entry record from a list of lines."""
dn = None
entry = OrderedDict()
for line in lines:
attr_type, attr_value = self._parse_attr(line)
if attr_type == 'dn':
self._check_dn(dn, attr_value)
... |
def _create_w_objective(m, X, Z=None):
"""
Creates an objective function and its derivative for W, given M and X (data)
Args:
m (array): genes x clusters
X (array): genes x cells
Z (array): zero-inflation parameters - genes x 1
"""
genes, clusters = m.shape
cells = X.sha... |
def zip_estimate_state(data, clusters, init_means=None, init_weights=None, max_iters=10, tol=1e-4, disp=True, inner_max_iters=400, normalize=True):
"""
Uses a Zero-inflated Poisson Mixture model to estimate cell states and
cell state mixing weights.
Args:
data (array): genes x cells
clu... |
def kmeans_pp(data, k, centers=None):
"""
Generates kmeans++ initial centers.
Args:
data (array): A 2d array- genes x cells
k (int): Number of clusters
centers (array, optional): if provided, these are one or more known cluster centers. 2d array of genes x number of centers (<=k).
... |
def poisson_cluster(data, k, init=None, max_iters=100):
"""
Performs Poisson hard EM on the given data.
Args:
data (array): A 2d array- genes x cells. Can be dense or sparse; for best performance, sparse matrices should be in CSC format.
k (int): Number of clusters
init (array, opti... |
def cases(ctx, case_id, to_json):
"""Display cases in the database."""
adapter = ctx.obj['adapter']
cases = []
if case_id:
case_obj = adapter.case({'case_id':case_id})
if not case_obj:
LOG.info("Case {0} does not exist in database".format(case_id))
return
... |
def variants(ctx, variant_id, chromosome, end_chromosome, start, end, variant_type,
sv_type):
"""Display variants in the database."""
if sv_type:
variant_type = 'sv'
adapter = ctx.obj['adapter']
if (start or end):
if not (chromosome and start and end):
LOG.warn... |
def index(ctx, view):
"""Index the database."""
adapter = ctx.obj['adapter']
if view:
click.echo(adapter.indexes())
return
adapter.ensure_indexes() |
def dotd(A, B, out=None):
r"""Diagonal of :math:`\mathrm A\mathrm B^\intercal`.
If ``A`` is :math:`n\times p` and ``B`` is :math:`p\times n`, it is done in
:math:`O(pn)`.
Args:
A (array_like): Left matrix.
B (array_like): Right matrix.
out (:class:`numpy.ndarray`, optional): co... |
def ddot(L, R, left=None, out=None):
r"""Dot product of a matrix and a diagonal one.
Args:
L (array_like): Left matrix.
R (array_like): Right matrix.
out (:class:`numpy.ndarray`, optional): copy result to.
Returns:
:class:`numpy.ndarray`: Resulting matrix.
"""
L = a... |
def cdot(L, out=None):
r"""Product of a Cholesky matrix with itself transposed.
Args:
L (array_like): Cholesky matrix.
out (:class:`numpy.ndarray`, optional): copy result to.
Returns:
:class:`numpy.ndarray`: :math:`\mathrm L\mathrm L^\intercal`.
"""
L = asarray(L, float)
... |
def nanrankdata(a, axis=-1, inplace=False):
""" Rank data for arrays contaning NaN values.
Parameters
----------
X : array_like
Array of values.
axis : int, optional
Axis value. Defaults to `1`.
inplace : bool, optional
Defaults to `False`.
Returns
-------
... |
def plogdet(K):
r"""Log of the pseudo-determinant.
It assumes that ``K`` is a positive semi-definite matrix.
Args:
K (array_like): matrix.
Returns:
float: log of the pseudo-determinant.
"""
egvals = eigvalsh(K)
return npsum(log(egvals[egvals > epsilon])) |
def economic_qs(K, epsilon=sqrt(finfo(float).eps)):
r"""Economic eigen decomposition for symmetric matrices.
A symmetric matrix ``K`` can be decomposed in
:math:`\mathrm Q_0 \mathrm S_0 \mathrm Q_0^\intercal + \mathrm Q_1\
\mathrm S_1 \mathrm Q_1^ \intercal`, where :math:`\mathrm S_1` is a zero
mat... |
def economic_qs_linear(G):
r"""Economic eigen decomposition for symmetric matrices ``dot(G, G.T)``.
It is theoretically equivalent to ``economic_qs(dot(G, G.T))``.
Refer to :func:`numpy_sugar.economic_qs` for further information.
Args:
G (array_like): Matrix.
Returns:
tuple: ``((Q... |
def cartesian(shape):
r"""Cartesian indexing.
Returns a sequence of n-tuples indexing each element of a hypothetical
matrix of the given shape.
Args:
shape (tuple): tuple of dimensions.
Returns:
array_like: indices.
Example
-------
.. doctest::
>>> from nump... |
def unique(ar):
r"""Find the unique elements of an array.
It uses ``dask.array.unique`` if necessary.
Args:
ar (array_like): Input array.
Returns:
array_like: the sorted unique elements.
"""
import dask.array as da
if isinstance(ar, da.core.Array):
return da.uniq... |
def lu_slogdet(LU):
r"""Natural logarithm of a LU decomposition.
Args:
LU (tuple): LU decomposition.
Returns:
tuple: sign and log-determinant.
"""
LU = (asarray(LU[0], float), asarray(LU[1], float))
adet = _sum(log(_abs(LU[0].diagonal())))
s = prod(sign(LU[0].diagonal()))
... |
def lu_solve(LU, b):
r"""Solve for LU decomposition.
Solve the linear equations :math:`\mathrm A \mathbf x = \mathbf b`,
given the LU factorization of :math:`\mathrm A`.
Args:
LU (array_like): LU decomposition.
b (array_like): Right-hand side.
Returns:
:class:`numpy.ndarra... |
def lstsq(A, b):
r"""Return the least-squares solution to a linear matrix equation.
Args:
A (array_like): Coefficient matrix.
b (array_like): Ordinate values.
Returns:
:class:`numpy.ndarray`: Least-squares solution.
"""
A = asarray(A, float)
b = asarray(b, float)
i... |
def dotd(A, B):
r"""Diagonal of :math:`\mathrm A\mathrm B^\intercal`.
If ``A`` is :math:`n\times p` and ``B`` is :math:`p\times n`, it is done in
:math:`O(pn)`.
Args:
A (array_like): Left matrix.
B (array_like): Right matrix.
Returns:
:class:`numpy.ndarray`: Resulting diag... |
def economic_svd(G, epsilon=sqrt(finfo(float).eps)):
r"""Economic Singular Value Decomposition.
Args:
G (array_like): Matrix to be factorized.
epsilon (float): Threshold on the square root of the eigen values.
Default is ``sqrt(finfo(float).eps)``.
Returns:
... |
def hsolve(A, y):
r"""Solver for the linear equations of two variables and equations only.
It uses Householder reductions to solve ``Ax = y`` in a robust manner.
Parameters
----------
A : array_like
Coefficient matrix.
y : array_like
Ordinate values.
Returns
-------
... |
def solve(A, b):
r"""Solve for the linear equations :math:`\mathrm A \mathbf x = \mathbf b`.
Args:
A (array_like): Coefficient matrix.
b (array_like): Ordinate values.
Returns:
:class:`numpy.ndarray`: Solution ``x``.
"""
A = asarray(A, float)
b = asarray(b, float)
i... |
def rsolve(A, b, epsilon=_epsilon):
r"""Robust solve for the linear equations.
Args:
A (array_like): Coefficient matrix.
b (array_like): Ordinate values.
Returns:
:class:`numpy.ndarray`: Solution ``x``.
"""
A = asarray(A, float)
b = asarray(b, float)
if A.shape[0] =... |
def kron_dot(A, B, C, out=None):
r""" Kronecker product followed by dot product.
Let :math:`\mathrm A`, :math:`\mathrm B`, and :math:`\mathrm C` be matrices of
dimensions :math:`p\times p`, :math:`n\times d`, and :math:`d\times p`.
It computes
.. math::
\text{unvec}((\mathrm A\otimes\mat... |
def check_semidefinite_positiveness(A):
"""Check if ``A`` is a semi-definite positive matrix.
Args:
A (array_like): Matrix.
Returns:
bool: ``True`` if ``A`` is definite positive; ``False`` otherwise.
"""
B = empty_like(A)
B[:] = A
B[diag_indices_from(B)] += sqrt(finfo(float... |
def check_symmetry(A):
"""Check if ``A`` is a symmetric matrix.
Args:
A (array_like): Matrix.
Returns:
bool: ``True`` if ``A`` is symmetric; ``False`` otherwise.
"""
A = asanyarray(A)
if A.ndim != 2:
raise ValueError("Checks symmetry only for bi-dimensional arrays.")
... |
def cho_solve(L, b):
r"""Solve for Cholesky decomposition.
Solve the linear equations :math:`\mathrm A \mathbf x = \mathbf b`,
given the Cholesky factorization of :math:`\mathrm A`.
Args:
L (array_like): Lower triangular matrix.
b (array_like): Right-hand side.
Returns:
:c... |
def file_or_resource(fname=None):
'''get filename and check if in getcwd then get from
the package resources folder
'''
if fname is not None:
filename = os.path.expanduser(fname)
resource_package = opentargets_validator.__name__
resource_path = os.path.sep.join(('resources',... |
def stl(A, b):
r"""Shortcut to ``solve_triangular(A, b, lower=True, check_finite=False)``.
Solve linear systems :math:`\mathrm A \mathbf x = \mathbf b` when
:math:`\mathrm A` is a lower-triangular matrix.
Args:
A (array_like): A lower-triangular matrix.
b (array_like): Ordinate values.... |
def _windows_resolve(command):
"""
Try and find the full path and file extension of the executable to run.
This is so that e.g. calls to 'somescript' will point at 'somescript.cmd'
without the need to set shell=True in the subprocess.
If the executable contains periods it is a special case. Here the... |
def run(
command,
timeout=None,
debug=False,
stdin=None,
print_stdout=True,
print_stderr=True,
callback_stdout=None,
callback_stderr=None,
environment=None,
environment_override=None,
win32resolve=True,
working_directory=None,
):
"""
Run an external process.
... |
def run_process_dummy(command, **kwargs):
"""
A stand-in function that returns a valid result dictionary indicating a
successful execution. The external process is not run.
"""
warnings.warn(
"procrunner.run_process_dummy() is deprecated", DeprecationWarning, stacklevel=2
)
time_sta... |
def run_process(*args, **kwargs):
"""API used up to version 0.2.0."""
warnings.warn(
"procrunner.run_process() is deprecated and has been renamed to run()",
DeprecationWarning,
stacklevel=2,
)
return run(*args, **kwargs) |
def add(self, data):
"""
Add a single character to buffer. If one or more full lines are found,
print them (if desired) and pass to callback function.
"""
data = self._decoder.decode(data)
if not data:
return
self._buffer += data
if "\n" in dat... |
def flush(self):
"""Print/send any remaining data to callback function."""
self._buffer += self._decoder.decode(b"", final=True)
if self._buffer:
if self._print:
print(self._buffer)
if self._callback:
self._callback(self._buffer)
se... |
def get_output(self):
"""
Retrieve the stored data in full.
This call may block if the reading thread has not yet terminated.
"""
self._closing = True
if not self.has_finished():
if self._debug:
# Main thread overtook stream reading thread.
... |
def trace2(A, B):
r"""Trace of :math:`\mathrm A \mathrm B^\intercal`.
Args:
A (array_like): Left-hand side.
B (array_like): Right-hand side.
Returns:
float: Trace of :math:`\mathrm A \mathrm B^\intercal`.
"""
A = asarray(A, float)
B = asarray(B, float)
layout_error... |
def sum2diag(A, D, out=None):
r"""Add values ``D`` to the diagonal of matrix ``A``.
Args:
A (array_like): Left-hand side.
D (array_like or float): Values to add.
out (:class:`numpy.ndarray`, optional): copy result to.
Returns:
:class:`numpy.ndarray`: Resulting matrix.
"... |
def hira2kata(text, ignore=''):
"""Convert Hiragana to Full-width (Zenkaku) Katakana.
Parameters
----------
text : str
Hiragana string.
ignore : str
Characters to be ignored in converting.
Return
------
str
Katakana string.
Examples
--------
>>> pri... |
def hira2hkata(text, ignore=''):
"""Convert Hiragana to Half-width (Hankaku) Katakana
Parameters
----------
text : str
Hiragana string.
ignore : str
Characters to be ignored in converting.
Return
------
str
Half-width Katakana string.
Examples
--------
... |
def kata2hira(text, ignore=''):
"""Convert Full-width Katakana to Hiragana
Parameters
----------
text : str
Full-width Katakana string.
ignore : str
Characters to be ignored in converting.
Return
------
str
Hiragana string.
Examples
--------
>>> pri... |
def h2z(text, ignore='', kana=True, ascii=False, digit=False):
"""Convert Half-width (Hankaku) Katakana to Full-width (Zenkaku) Katakana
Parameters
----------
text : str
Half-width Katakana string.
ignore : str
Characters to be ignored in converting.
kana : bool
Either c... |
def z2h(text, ignore='', kana=True, ascii=False, digit=False):
"""Convert Full-width (Zenkaku) Katakana to Half-width (Hankaku) Katakana
Parameters
----------
text : str
Full-width Katakana string.
ignore : str
Characters to be ignored in converting.
kana : bool
Either c... |
def normalize(text, mode='NFKC', ignore=''):
"""Convert Half-width (Hankaku) Katakana to Full-width (Zenkaku) Katakana,
Full-width (Zenkaku) ASCII and DIGIT to Half-width (Hankaku) ASCII
and DIGIT.
Additionally, Full-width wave dash (〜) etc. are normalized
Parameters
----------
text : str
... |
def kana2alphabet(text):
"""Convert Hiragana to hepburn-style alphabets
Parameters
----------
text : str
Hiragana string.
Return
------
str
Hepburn-style alphabets string.
Examples
--------
>>> print(jaconv.kana2alphabet('まみさん'))
mamisan
"""
text = ... |
def alphabet2kana(text):
"""Convert alphabets to Hiragana
Parameters
----------
text : str
Alphabets string.
Return
------
str
Hiragana string.
Examples
--------
>>> print(jaconv.alphabet2kana('mamisan'))
まみさん
"""
text = text.replace('kya', 'きゃ').re... |
def histpoints(x, bins=None, xerr=None, yerr='gamma', normed=False, **kwargs):
"""
Plot a histogram as a series of data points.
Compute and draw the histogram of *x* using individual (x,y) points
for the bin contents.
By default, vertical poisson error bars are calculated using the
gamma distr... |
def pool(self):
"""Get an eventlet pool used to dispatch requests."""
self._pool = self._pool or eventlet.GreenPool(size=self.pool_size)
return self._pool |
def start(self):
"""Start the process with daemonization.
If the process is already started this call should exit with code
ALREADY_RUNNING. Otherwise it must call the 'daemonize' method and then
call 'run'.
"""
if self.pid is not None:
LOG.error(
... |
def stop(self):
"""Stop the daemonized process.
If the process is already stopped this call should exit successfully.
If the process cannot be stopped this call should exit with code
STOP_FAILED.
"""
if self.pid is None:
return None
try:
... |
def handle(self, signum, handler):
"""Set a function to run when the given signal is recieved.
Multiple handlers may be assigned to a single signal. The order of
handlers does not need to be preserved.
'signum' must be an integer representing a signal.
'handler' must be a call... |
def send(self, signum):
"""Send the given signal to the running process.
If the process is not running a RuntimeError with a message of "No such
process" should be emitted.
"""
if not isinstance(signum, int):
raise TypeError(
"Signals must be given a... |
def _handle_signals(self, signum, frame):
"""Handler for all signals.
This method must be used to handle all signals for the process. It is
responsible for runnin the appropriate signal handlers registered with
the 'handle' method unless they are shutdown signals. Shutdown signals
... |
def shutdown(self, signum):
"""Handle all signals which trigger a process stop.
This method should run all appropriate signal handlers registered
through the 'handle' method. At the end it should cause the process
to exit with a status code. If any of the handlers raise an exception
... |
def preprocess_path(path):
""" Given a dataset path, the following structure is to be expected:
- path/
- files/
- S_00000.gdm
- S_00000.gdm.meta
- S_00001.gdm
- S_00001.gdm.meta
- ...
- schema.xml
... |
def check_for_dataset(files):
""" A GDM dataset has the form:
- S_00000.gdm
- S_00000.gdm.meta
- S_00001.gdm
- S_00001.gdm.meta
- ...
- schema.xml
- [profile.xml]
- [web_profile.xml]
:param files: path of the dataset
:return: True if the path c... |
def load_from_path(local_path=None, parser=None, all_load=False):
""" Loads the data from a local path into a GMQLDataset.
The loading of the files is "lazy", which means that the files are loaded only when the
user does a materialization (see :func:`~gmql.dataset.GMQLDataset.GMQLDataset.materialize` ).
... |
def load_from_remote(remote_name, owner=None):
""" Loads the data from a remote repository.
:param remote_name: The name of the dataset in the remote repository
:param owner: (optional) The owner of the dataset. If nothing is provided, the current user
is used. For public datasets use 'pu... |
def scan(interface):
"""Perform a scan for access points in the area.
Arguments:
interface - device to use for scanning (e.g. eth1, wlan0).
"""
interface = _get_bytes(interface)
head = ffi.new('wireless_scan_head *')
with iwlib_socket() as sock:
range = _get_range_info(interfa... |
def login(self, username=None, password=None):
""" Before doing any remote operation, the user has to login to the GMQL serivice.
This can be done in the two following ways:
* Guest mode: the user has no credentials and uses the system only as a temporary guest
* Authenticated m... |
def logout(self):
""" Logout from the remote account
:return: None
"""
url = self.address + "/logout"
header = self.__check_authentication()
response = requests.get(url, headers=header)
if response.status_code != 200:
raise ValueError("Code {}. {}".fo... |
def get_dataset_list(self):
""" Returns the list of available datasets for the current user.
:return: a pandas Dataframe
"""
url = self.address + "/datasets"
header = self.__check_authentication()
response = requests.get(url, headers=header)
response = response.j... |
def get_dataset_samples(self, dataset_name, owner=None):
""" Get the list of samples of a specific remote dataset.
:param dataset_name: the dataset name
:param owner: (optional) who owns the dataset. If it is not specified, the current user
is used. For public dataset use 'public... |
def get_dataset_schema(self, dataset_name, owner=None):
""" Given a dataset name, it returns a BedParser coherent with the schema of it
:param dataset_name: a dataset name on the repository
:param owner: (optional) who owns the dataset. If it is not specified, the current user
is... |
def upload_dataset(self, dataset, dataset_name, schema_path=None):
""" Upload to the repository an entire dataset from a local path
:param dataset: the local path of the dataset
:param dataset_name: the name you want to assign to the dataset remotely
:return: None
"""
u... |
def delete_dataset(self, dataset_name):
""" Deletes the dataset having the specified name
:param dataset_name: the name that the dataset has on the repository
:return: None
"""
url = self.address + "/datasets/" + dataset_name
header = self.__check_authentication()
... |
def download_dataset(self, dataset_name, local_path, how="stream"):
""" It downloads from the repository the specified dataset and puts it
in the specified local folder
:param dataset_name: the name the dataset has in the repository
:param local_path: where you want to save the dataset
... |
def query(self, query, output_path=None, file_name="query", output="tab"):
""" Execute a GMQL textual query on the remote server.
:param query: the string containing the query
:param output_path (optional): where to store the results locally. If specified
the results are download... |
def trace_job(self, jobId):
""" Get information about the specified remote job
:param jobId: the job identifier
:return: a dictionary with the information
"""
header = self.__check_authentication()
status_url = self.address + "/jobs/" + jobId + "/trace"
status_re... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.