text stringlengths 81 112k |
|---|
Add a bulk of variants
This could be used for faster inserts
Args:
variants(iterable(dict))
def add_variants(self, variants):
"""Add a bulk of variants
This could be used for faster inserts
Args:
variants(iterable(dict)... |
Make a batch search for variants in the database
Args:
variant_ids(list(str)): List of variant ids
Returns:
res(pymngo.Cursor(variant_obj)): The result
def search_variants(self, variant_ids):
"""Make a batch search for variants in the database
... |
Return all variants in the database
If no region is specified all variants will be returned.
Args:
chromosome(str)
start(int)
end(int)
Returns:
variants(Iterable(Variant))
def get_variants(self, chromosome=None, start=None, end=None... |
Delete observation in database
This means that we take down the observations variable with one.
If 'observations' == 1 we remove the variant. If variant was homozygote
we decrease 'homozygote' with one.
Also remove the family from array 'families'.
Args:
variant (di... |
Return a list of all chromosomes found in database
Args:
sv(bool): if sv variants should be choosen
Returns:
res(iterable(str)): An iterable with all chromosomes in the database
def get_chromosomes(self, sv=False):
"""Return a list of all chromosomes fo... |
Get the last position observed on a chromosome in the database
Args:
chrom(str)
Returns:
end(int): The largest end position found
def get_max_position(self, chrom):
"""Get the last position observed on a chromosome in the database
Args:... |
Restore the database from a zipped file.
Default is to restore from db dump in loqusdb/resources/
def restore(ctx, filename):
"""Restore the database from a zipped file.
Default is to restore from db dump in loqusdb/resources/
"""
filename = filename or background_path
if not os.path.... |
downsample the data by removing a given percentage of the reads.
Args:
data: genes x cells array or sparse matrix
percent: float between 0 and 1
def downsample(data, percent):
"""
downsample the data by removing a given percentage of the reads.
Args:
data: genes x cells array ... |
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
R (array): 1 x genes
def _create_w_objective(m, X, R):
"""
Creates an objective function and its derivative for W, given M and X (data)
Args:... |
Uses a Negative Binomial Mixture model to estimate cell states and
cell state mixing weights.
If some of the genes do not fit a negative binomial distribution
(mean > var), then the genes are discarded from the analysis.
Args:
data (array): genes x cells
clusters (int): number of mixtu... |
Creates an objective function and its derivative for M, given W and X
Args:
w (array): clusters x cells
X (array): genes x cells
selected_genes (array): array of ints - genes to be selected
def poisson_objective(X, m, w):
"""
Creates an objective function and its derivative for M, g... |
Runs LDA on the given dataset (can be an 2-D array of any form - sparse
or dense, as long as it can be indexed). If the data has not already been
prepared into LDA format, set "prepare_data" to TRUE. If "prepare_data" is
FALSE, the method assumes that the data has already been preprocessed into
LightLDA... |
Load all files in a directory.
def cli(ctx, directory, uri, verbose, count):
"""Load all files in a directory."""
# configure root logger to print to STDERR
loglevel = "INFO"
if verbose:
loglevel = "DEBUG"
coloredlogs.install(level=loglevel)
p = Path(directory)
if not p.is... |
Generates initial M and W given a data set and an array of cluster labels.
There are 3 options for init:
enhanced - uses EIn-NMF from Gong 2013
basic - uses means for M, assigns W such that the chosen cluster for a given cell has value 0.75 and all others have 0.25/(k-1).
nmf - uses means f... |
Args:
data (array): dense or sparse array with shape (genes, cells)
k (int): number of cell types
normalize_w (bool, optional): True if W should be normalized (so that each column sums to 1). Default: True
return_cost (bool, optional): True if the NMF objective value (squared error) shou... |
Check if a coordinate is in the PAR region
Args:
chrom(str)
pos(int)
Returns:
par(bool)
def check_par(chrom, pos):
"""Check if a coordinate is in the PAR region
Args:
chrom(str)
pos(int)
Returns:
... |
Get a variant id on the format chrom_pos_ref_alt
def get_variant_id(variant):
"""Get a variant id on the format chrom_pos_ref_alt"""
variant_id = '_'.join([
str(variant.CHROM),
str(variant.POS),
str(variant.REF),
str(variant.ALT[0])
]
)
return var... |
Check if position a is greater than position b
This will look at chromosome and position.
For example a position where chrom = 2 and pos = 300 is greater than a position where
chrom = 1 and pos = 1000
If any of the chromosomes is outside [1-22,X,Y,MT] we can not say which is biggest.
... |
Returns a dictionary with position information
Args:
variant(cyvcf2.Variant)
Returns:
coordinates(dict)
def get_coords(variant):
"""Returns a dictionary with position information
Args:
variant(cyvcf2.Variant)
Returns:
coordinates(dict)
"""
... |
Return a Variant object
Take a cyvcf2 formated variant line and return a models.Variant.
If criterias are not fullfilled, eg. variant have no gt call or quality
is below gq treshold then return None.
Args:
variant(cyvcf2.Variant)
case_obj(Case): We need the case object to check indivi... |
Migrate an old loqusdb instance to 1.0
def migrate(ctx,):
"""Migrate an old loqusdb instance to 1.0
"""
adapter = ctx.obj['adapter']
start_time = datetime.now()
nr_updated = migrate_database(adapter)
LOG.info("All variants updated, time to complete migration: {}".format(
... |
Load the variants of a case
A variant is loaded if it is observed in any individual of a case
If no family file is provided all individuals in vcf file will be considered.
def update(ctx, variant_file, sv_variants, family_file, family_type, skip_case_id, gq_treshold,
case_id, ensure_index, max_win... |
Export the variants of a loqus db
The variants are exported to a vcf file
def export(ctx, outfile, variant_type):
"""Export the variants of a loqus db
The variants are exported to a vcf file
"""
adapter = ctx.obj['adapter']
version = ctx.obj['version']
LOG.inf... |
Load the database with a case and its variants
Args:
adapter: Connection to database
variant_file(str): Path to variant file
sv_file(str): Path to sv variant file
family_file(str): Path to family file
family_type(str): Format of family file
skip_case_id(b... |
Load a case to the database
Args:
adapter: Connection to database
case_obj: dict
update(bool): If existing case should be updated
Returns:
case_obj(models.Case)
def load_case(adapter, case_obj, update=False):
"""Load a case to the database
Args:
adapter: Conne... |
Load variants for a family into the database.
Args:
adapter (loqusdb.plugins.Adapter): initialized plugin
case_obj(Case): dict with case information
nr_variants(int)
skip_case_id (bool): whether to include the case id on variant level
or not
gq_t... |
Calculates the variance for each row of a sparse matrix,
using the relationship Var = E[x^2] - E[x]^2.
Returns:
pair of matrices mean, variance.
def sparse_mean_var(data):
"""
Calculates the variance for each row of a sparse matrix,
using the relationship Var = E[x^2] - E[x]^2.
Return... |
This function identifies the genes that have the max variance
across a number of bins sorted by mean.
Args:
data (array): genes x cells
nbins (int): number of bins to sort genes by mean expression level. Default: 10.
frac (float): fraction of genes to return per bin - between 0 and 1. D... |
Returns the data where the expression is normalized so that the total
count per cell is equal.
def cell_normalize(data):
"""
Returns the data where the expression is normalized so that the total
count per cell is equal.
"""
if sparse.issparse(data):
data = sparse.csc_matrix(data.astype(... |
Returns ln(data+1), whether the original data is dense or sparse.
def log1p(data):
"""
Returns ln(data+1), whether the original data is dense or sparse.
"""
if sparse.issparse(data):
return data.log1p()
else:
return np.log1p(data) |
Return a dictionary with individual positions
Args:
individuals(list): A list with vcf individuals in correct order
Returns:
ind_pos(dict): Map from ind_id -> index position
def get_individual_positions(individuals):
"""Return a dictionary with individual positions
Args:
indi... |
Build a Case from the given information
Args:
case(ped_parser.Family): A family object
vcf_individuals(list): Show the order of inds in vcf file
case_id(str): If another name than the one in family file should be used
vcf_path(str)
sv_individuals(list): Show the order of ind... |
Generates poisson-distributed data, given a set of means for each cluster.
Args:
centers (array): genes x clusters matrix
n_cells (int): number of output cells
cluster_probs (array): prior probability for each cluster.
Default: uniform.
Returns:
output - array with ... |
Generates zero-inflated poisson-distributed data, given a set of means and zero probs for each cluster.
Args:
M (array): genes x clusters matrix
L (array): genes x clusters matrix - zero-inflation parameters
n_cells (int): number of output cells
cluster_probs (array): prior probabil... |
Generates data according to the Poisson Convex Mixture Model.
Args:
means (array): Cell types- genes x clusters
weights (array): Cell cluster assignments- clusters x cells
Returns:
data matrix - genes x cells
def generate_state_data(means, weights):
"""
Generates data accordin... |
Generates data according to the Zero-inflated Poisson Convex Mixture Model.
Args:
means (array): Cell types- genes x clusters
weights (array): Cell cluster assignments- clusters x cells
z (float): zero-inflation parameter
Returns:
data matrix - genes x cells
def generate_zip_s... |
Generates data according to the Negative Binomial Convex Mixture Model.
Args:
means (array): Cell types- genes x clusters
weights (array): Cell cluster assignments- clusters x cells
R (array): dispersion parameter - 1 x genes
Returns:
data matrix - genes x cells
def generate_n... |
Generates means and weights for the Negative Binomial Mixture Model.
Weights are distributed Dirichlet(1,1,...), means are rand(0, 1).
Returned values can be passed to generate_state_data(M, W).
Args:
n_states (int): number of states or clusters
n_cells (int): number of cells
n_gene... |
Generates means and weights for the Poisson Convex Mixture Model.
Weights are distributed Dirichlet(1,1,...), means are rand(0, 100).
Returned values can be passed to generate_state_data(M, W).
Args:
n_states (int): number of states or clusters
n_cells (int): number of cells
n_genes... |
Generates a lineage for each state- assumes that each state has a common
ancestor.
Returns:
M - genes x clusters
W - clusters x cells
def generate_poisson_lineage(n_states, n_cells_per_cluster, n_genes, means=300):
"""
Generates a lineage for each state- assumes that each state has a c... |
Generates negative binomial data
Args:
P (array): genes x clusters
R (array): genes x clusters
n_cells (int): number of cells
assignments (list): cluster assignment of each cell. Default:
random uniform
Returns:
data array with shape genes x cells
la... |
Saves a scatter plot of a visualization of W, the result from Poisson SE.
def visualize_poisson_w(w, labels, filename, method='pca', figsize=(18,10), title='', **scatter_options):
"""
Saves a scatter plot of a visualization of W, the result from Poisson SE.
"""
if method == 'pca':
pca = PCA(2)
... |
Saves a scatter plot of a (2,n) matrix r, where each column is a cell.
Args:
r (array): (2,n) matrix
labels (array): (n,) array of ints/strings or floats. Can be None.
filename (string): string to save the output graph. If None, then this just displays the plot.
figsize (tuple): Def... |
runs a pre-processing + clustering experiment...
exactly one of use_purity, use_nmi, or use_ari can be true
Args:
methods: list of 2-tuples. The first element is either a single Preprocess object or a list of Preprocess objects, to be applied in sequence to the data. The second element is either a sin... |
Generates visualization scatters for all the methods.
Args:
methods: follows same format as run_experiments. List of tuples.
data: genes x cells
true_labels: array of integers
base_dir: base directory to save all the plots
figsize: tuple of ints representing size of figure
... |
Returns:
list of W, M*W
ll
def run(self, data):
"""
Returns:
list of W, M*W
ll
"""
if self.normalize_data:
data = cell_normalize(data)
M, W, ll = poisson_estimate_state(data, **self.params)
outputs = []
... |
Credit for conversion to itsnotlupus/vesync_wsproxy
def calculate_hex(hex_string):
"""Credit for conversion to itsnotlupus/vesync_wsproxy"""
hex_conv = hex_string.split(':')
converted_hex = (int(hex_conv[0], 16) + int(hex_conv[1], 16))/8192
return converted_hex |
Merges changes from one list of devices against another
def resolve_updates(orig_list, updated_list):
"""Merges changes from one list of devices against another"""
if updated_list is not None and updated_list:
if orig_list is None:
orig_list = updated_list
else:... |
Usage: create_sedml output-filename
def main (args):
"""Usage: create_sedml output-filename
"""
if (len(args) != 2):
print(main.__doc__)
sys.exit(1);
# create the document
doc = libsedml.SedDocument();
doc.setLevel(1);
doc.setVersion(1);
# create a first model referencing an sbml file
model... |
Given a vcf, get a profile string for each sample in the vcf
based on the profile variants in the database
Args:
adapter(MongoAdapter): Adapter to mongodb
vcf_file(str): Path to vcf file
Returns:
profiles (dict(str)): The profiles (given as strings) for each sample
... |
given a dict of profiles, searches through all the samples in the DB
for a match. If a matching sample is found an exception is raised,
and the variants will not be loaded into the database.
Args:
adapter (MongoAdapter): Adapter to mongodb
profiles (dict(str)): The profi... |
Given two profiles, determine the ratio of similarity, i.e.
the hamming distance between the strings.
Args:
profile1/2 (str): profile string
Returns:
similarity_ratio (float): the ratio of similiarity (0-1)
def compare_profiles(profile1, profile2):
"""
Give... |
For all cases having vcf_path, update the profile string for the samples
Args:
adapter (MongoAdapter): Adapter to mongodb
def update_profiles(adapter):
"""
For all cases having vcf_path, update the profile string for the samples
Args:
adapter (MongoAdapter): Adapter to mongodb
"... |
Compares the pairwise hamming distances for all the sample profiles in
the database. Returns a table of the number of distances within given
ranges.
Args:
adapter (MongoAdapter): Adapter to mongodb
threshold (float): If any distance is found above this threshold
... |
Calculates the purity score for the given labels.
Args:
labels (array): 1D array of integers
true_labels (array): 1D array of integers - true labels
Returns:
purity score - a float bewteen 0 and 1. Closer to 1 is better.
def purity(labels, true_labels):
"""
Calculates the puri... |
Calculates the nearest neighbor accuracy (basically leave-one-out cross
validation with a 1NN classifier).
Args:
dim_red (array): dimensions (k, cells)
true_labels (array): 1d array of integers
Returns:
Nearest neighbor accuracy - fraction of points for which the 1NN
1NN cl... |
Returns the minimum description length score of the model given its
log-likelihood and k, the number of cell types.
a lower cost is better...
def mdl(ll, k, data):
"""
Returns the minimum description length score of the model given its
log-likelihood and k, the number of cell types.
a lower c... |
Finds the indices of all genes in the dataset that have
a mean < 0.9 variance. Returns an array of booleans.
def find_nb_genes(data):
"""
Finds the indices of all genes in the dataset that have
a mean < 0.9 variance. Returns an array of booleans.
"""
data_means = data.mean(1)
data_vars = da... |
Returns log(nCr(a,b)), given that b<a. Does not assume that a and b
are integers (uses log-gamma).
def log_ncr(a, b):
"""
Returns log(nCr(a,b)), given that b<a. Does not assume that a and b
are integers (uses log-gamma).
"""
val = gammaln(a+1) - gammaln(a-b+1) - gammaln(b+1)
return val |
Returns the negative binomial log-likelihood of the data.
Args:
data (array): genes x cells
P (array): NB success probability param - genes x clusters
R (array): NB stopping param - genes x clusters
Returns:
cells x clusters array of log-likelihoods
def nb_ll(data, P, R):
... |
Returns the zero-inflated negative binomial log-likelihood of the data.
def zinb_ll(data, P, R, Z):
"""
Returns the zero-inflated negative binomial log-likelihood of the data.
"""
lls = nb_ll(data, P, R)
clusters = P.shape[1]
for c in range(clusters):
pass
return lls |
returns the negative LL of a single row.
Args:
params (array) - [p, r]
data_row (array) - 1d array of data
Returns:
LL of row
def nb_ll_row(params, data_row):
"""
returns the negative LL of a single row.
Args:
params (array) - [p, r]
data_row (array) - 1d ... |
Derivative of log-likelihood wrt r (formula from wikipedia)
Args:
r (float): the R paramemter in the NB distribution
data_row (array): 1d array of length cells
def nb_r_deriv(r, data_row):
"""
Derivative of log-likelihood wrt r (formula from wikipedia)
Args:
r (float): the R p... |
Fits the NB distribution to data using method of moments.
Args:
data (array): genes x cells
P_init (array, optional): NB success prob param - genes x 1
R_init (array, optional): NB stopping param - genes x 1
Returns:
P, R - fit to data
def nb_fit(data, P_init=None, R_init=None... |
Performs negative binomial clustering on the given data. If some genes have mean > variance, then these genes are fitted to a Poisson distribution.
Args:
data (array): genes x cells
k (int): number of clusters
P_init (array): NB success prob param - genes x k. Default: random
R_init... |
Fits NB/poisson params to a cluster.
def fit_cluster(data, assignments, k, P_init, R_init, means):
"""
Fits NB/poisson params to a cluster.
"""
for c in range(k):
if data[:,assignments==c].shape[1] == 0:
_, assignments = kmeans_pp(data, k)
genes, cells = data.shape
nb_gene_i... |
Calculates the zero-inflated Poisson log-likelihood.
Args:
data (array): genes x cells
means (array): genes x k
M (array): genes x k - this is the zero-inflation parameter.
Returns:
cells x k array of log-likelihood for each cell/cluster pair.
def zip_ll(data, means, M):
"... |
Returns the negative log-likelihood of a row given ZIP data.
Args:
params (list): [lambda zero-inf]
data_row (array): 1d array
Returns:
negative log-likelihood
def zip_ll_row(params, data_row):
"""
Returns the negative log-likelihood of a row given ZIP data.
Args:
... |
Migrate an old loqusdb instance to 1.0
Args:
adapter
Returns:
nr_updated(int): Number of variants that where updated
def migrate_database(adapter):
"""Migrate an old loqusdb instance to 1.0
Args:
adapter
Returns:
nr_updated(int): Number of variant... |
Usage: create_sedml2 output-filename
def main (args):
"""Usage: create_sedml2 output-filename
"""
if (len(args) != 2):
print(main.__doc__)
sys.exit(1);
# create the document
doc = libsedml.SedDocument();
doc.setLevel(1);
doc.setVersion(3);
# create a data description
ddesc = doc.createDa... |
basic data preprocessing before running gap score
Assumes that data is a matrix of shape (genes, cells).
Returns a matrix of shape (cells, 8), using the first 8 SVD
components. Why 8? It's an arbitrary selection...
def preproc_data(data, gene_subset=False, **kwargs):
"""
basic data preprocessing ... |
Returns a 2 x m array indicating the min and max along each
dimension.
def calculate_bounding_box(data):
"""
Returns a 2 x m array indicating the min and max along each
dimension.
"""
mins = data.min(0)
maxes = data.max(0)
return mins, maxes |
See: https://datasciencelab.wordpress.com/2013/12/27/finding-the-k-in-k-means-clustering/
https://web.stanford.edu/~hastie/Papers/gap.pdf
Returns two results: the gap score, and s_k.
def calculate_gap(data, clustering, km, B=50, **kwargs):
"""
See: https://datasciencelab.wordpress.com/2013/12/27/find... |
Runs gap score for all k from k_min to k_max.
def run_gap_k_selection(data, k_min=1, k_max=50, B=5,
skip=5, **kwargs):
"""
Runs gap score for all k from k_min to k_max.
"""
if k_min == k_max:
return k_min
gap_vals = []
sk_vals = []
k_range = list(range(k_min, k_max, skip))
... |
Make a request against the RainMachine device.
async def _request(
self,
method: str,
url: str,
*,
headers: dict = None,
params: dict = None,
json: dict = None) -> dict:
"""Make a request against the RainMachine device."""
... |
Return list of VeSync devices
def get_devices(self) -> list:
"""Return list of VeSync devices"""
if not self.enabled:
return None
self.in_process = True
response, _ = helpers.call_api(
'/cloud/v1/deviceManaged/devices',
'post',
headers=... |
Return True if log in request succeeds
def login(self) -> bool:
"""Return True if log in request succeeds"""
user_check = isinstance(self.username, str) and len(self.username) > 0
pass_check = isinstance(self.password, str) and len(self.password) > 0
if user_check and pass_check:
... |
Fetch updated information about devices
def update(self):
"""Fetch updated information about devices"""
if self.device_time_check():
if not self.in_process:
outlets, switches, fans = self.get_devices()
self.outlets = helpers.resolve_updates(self.outlets, o... |
Fetch updated energy information about devices
def update_energy(self, bypass_check=False):
"""Fetch updated energy information about devices"""
for outlet in self.outlets:
outlet.update_energy(bypass_check) |
Given a data matrix, this returns the per-gene fit error for the
Poisson, Normal, and Log-Normal distributions.
Args:
Dat (array): numpy array with shape (genes, cells)
Returns:
d (dict): 'poiss', 'norm', 'lognorm' give the fit error for each distribution.
def DistFitDataset(Dat):
"""... |
Delete a case and all of it's variants from the database.
Args:
adapter: Connection to database
case_obj(models.Case)
update(bool): If we are in the middle of an update
existing_case(models.Case): If something failed during an update we need to revert
... |
Delete variants for a case in the database
Args:
adapter(loqusdb.plugins.Adapter)
vcf_obj(iterable(dict))
ind_positions(dict)
case_id(str)
Returns:
nr_deleted (int): Number of deleted variants
def delete_variants(adapter, vcf_obj, case_obj, case_id=None):
"... |
Annotate the variants in a VCF
def annotate(ctx, variant_file, sv):
"""Annotate the variants in a VCF
"""
adapter = ctx.obj['adapter']
variant_path = os.path.abspath(variant_file)
expected_type = 'snv'
if sv:
expected_type = 'sv'
if 'sv':
nr_cases = adapter.nr_cases(sv_c... |
Get tracking info for one or more tracking numbers.
async def find(self, *tracking_numbers: str) -> list:
"""Get tracking info for one or more tracking numbers."""
data = {'data': [{'num': num} for num in tracking_numbers]}
tracking_resp = await self._request('post', API_URL_TRACK, json=data)
... |
loqusdb: manage a local variant count database.
def cli(ctx, database, username, password, authdb, port, host, uri, verbose, config, test):
"""loqusdb: manage a local variant count database."""
loglevel = "INFO"
if verbose:
loglevel = "DEBUG"
coloredlogs.install(level=loglevel)
LOG.info("Ru... |
binarizes an expression dataset.
def binarize(qualitative):
"""
binarizes an expression dataset.
"""
thresholds = qualitative.min(1) + (qualitative.max(1) - qualitative.min(1))/2.0
binarized = qualitative > thresholds.reshape((len(thresholds), 1)).repeat(8,1)
return binarized.astype(int) |
Does qualNorm but returns a filtered gene set, based on a p-value threshold.
def qualNorm_filter_genes(data, qualitative, pval_threshold=0.05, smoothing=1e-5, eps=1e-5):
"""
Does qualNorm but returns a filtered gene set, based on a p-value threshold.
"""
genes, cells = data.shape
clusters = qualita... |
Generates starting points using binarized data. If qualitative data is missing for a given gene, all of its entries should be -1 in the qualitative matrix.
Args:
data (array): 2d array of genes x cells
qualitative (array): 2d array of numerical data - genes x clusters
Returns:
Array of... |
Generates starting points using binarized data. If qualitative data is missing for a given gene, all of its entries should be -1 in the qualitative matrix.
Args:
data (array): 2d array of genes x cells
qualitative (array): 2d array of numerical data - genes x clusters
Returns:
Array of... |
Get current script's directory
Args:
pyobject (Any): Any Python object in the script
follow_symlinks (Optional[bool]): Follow symlinks or not. Defaults to True.
Returns:
str: Current script's directory
def script_dir(pyobject, follow_symlinks=True):
"""Get current script's directo... |
Get current script's directory and then append a filename
Args:
filename (str): Filename to append to directory path
pyobject (Any): Any Python object in the script
follow_symlinks (Optional[bool]): Follow symlinks or not. Defaults to True.
Returns:
str: Current script's direct... |
Check how well SVs are working in the database
def identity(ctx, variant_id):
"""Check how well SVs are working in the database
"""
if not variant_id:
LOG.warning("Please provide a variant id")
ctx.abort()
adapter = ctx.obj['adapter']
version = ctx.obj['version']
... |
Some entities return the register entity id,
but other do not. Unsure if this is a bug or
inconsistently registered data.
def registration_authority_entity_id(self):
"""
Some entities return the register entity id,
but other do not. Unsure if this is a bug or
inconsisten... |
In some cases, the legal form is stored in the JSON-data.
In other cases, an ELF-code, consisting of mix of exactly
four letters and numbers are stored. This ELF-code
can be looked up in a registry where a code maps to
a organizational type. ELF-codes are not unique,
it can reocc... |
Loop through data to find a valid record. Return list of LEI.
def valid_child_records(self):
child_lei = list()
"""Loop through data to find a valid record. Return list of LEI."""
for d in self.raw['data']:
# We're not very greedy here, but it seems some records have
#... |
Annotate a cyvcf variant with observations
Args:
variant(cyvcf2.variant)
var_obj(dict)
Returns:
variant(cyvcf2.variant): Annotated variant
def annotate_variant(variant, var_obj=None):
"""Annotate a cyvcf variant with observations
Args:
variant(cyvcf2.varia... |
Annotate an SNV/INDEL variant
Args:
adapter(loqusdb.plugin.adapter)
variant(cyvcf2.Variant)
def annotate_snv(adpter, variant):
"""Annotate an SNV/INDEL variant
Args:
adapter(loqusdb.plugin.adapter)
variant(cyvcf2.Variant)
"""
variant_id = get_variant_id(var... |
Annotate all SV variants in a VCF
Args:
adapter(loqusdb.plugin.adapter)
vcf_obj(cyvcf2.VCF)
Yields:
variant(cyvcf2.Variant)
def annotate_svs(adapter, vcf_obj):
"""Annotate all SV variants in a VCF
Args:
adapter(loqusdb.plugin.adapter)
vcf_obj(cyvcf... |
Annotate all variants in a VCF
Args:
adapter(loqusdb.plugin.adapter)
vcf_obj(cyvcf2.VCF)
Yields:
variant(cyvcf2.Variant): Annotated variant
def annotate_snvs(adapter, vcf_obj):
"""Annotate all variants in a VCF
Args:
adapter(loqusdb.plugin.adapter)
... |
Create a Geometry from a GeoJSON. The SRID can be overridden from the
expected 4326.
def from_geojson(geojson, srid=4326):
"""
Create a Geometry from a GeoJSON. The SRID can be overridden from the
expected 4326.
"""
type_ = geojson["type"].lower()
if type_ == "ge... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.