gnocis¶
Gnocis is divided into a number of modules, with discrete functions.
gnocis.biomarkers module¶
-
class
gnocis.biomarkers.
biomarkers
¶ Bases:
object
The biomarkers class represents a set of biomarker regions. Up to multiple regions marking a phenomenon of interest can be registered in a biomarker object.
Parameters: - name (str) – Name of the biomarker set.
- regionSets (list, optional) – Name of the biomarker set. Defaults to [].
- positiveThreshold (int, optional) – Threshold for Highly BioMarker-Enriched (HBME) loci. Defaults to -1.
- negativeThreshold (int, optional) – Threshold for Lowly BioMarker-Enriched (LBME) loci. Defaults to -1.
After constructing a biomarkers object, for a set of biomarkers BM, len(BM) gives the number of markers, BM[‘FACTOR_NAME’] gives the merged set of regions for factor FACTOR_NAME, and [ x for x in BM ] gives the list of merged regions per biomarker contained in BM.
-
HBMEs
()¶ Gets highly biomarker-enriched regions of a set. This is determined either by an optional threshold argument, or, if unspecified, by the positiveThreshold member. The resulting set is the merged biomarker spectrum for enrichment levels >= to the threshold.
Parameters: rs (regions) – Region set to extract enriched subset of. Returns: Highly BioMarker-Enriched regions (HBMEs). Return type: regions
-
LBMEs
()¶ Gets lowly biomarker-enriched regions of a set. This is determined either by an optional threshold argument, or, if unspecified, by the negativeThreshold member. The resulting set is the merged biomarker spectrum for enrichment levels <= to the threshold.
Parameters: rs (regions) – Region set to extract enriched subset of. Returns: Highly BioMarker-Enriched regions (HBMEs) Return type: regions
-
add
()¶ Adds a biomarker to the set, by name and region set. The name of the region set is taken as the name of the biomarker.
Parameters: rs (regions) – Region set to add as biomarker.
-
biomarkers
¶
-
enrichmentSpectrum
()¶ Returns the biomarker spectrum. This is a dictionary with numerical keys, containing subsets enriched in N biomarkers, for every valid N as key.
Parameters: rs (regions) – Region set to add as biomarker. Returns: Biomarker spectrum Return type: dict
-
name
¶
-
negativeThreshold
¶
-
positiveThreshold
¶
gnocis.common module¶
-
gnocis.common.
CI
()¶ Calculates a confidence interval of the mean for a set of values. By default, Gnocis calculates a 95% confidence interval with a normal distribution. It is recommended to replace this with an appropriate distribution depending on the analysis performed.
Parameters: X (list) – Values. Returns: Confidence interval difference from the mean. Return type: float
-
gnocis.common.
KLdiv
()¶
-
gnocis.common.
SE
()¶
-
gnocis.common.
getFloat
()¶ Helper function to get floating point values of the same precision as used for float by Cython.
Parameters: v (float) – Value.
-
gnocis.common.
getReverseComplementaryDNASequence
()¶ Returns the reverse complement of a DNA sequence.
Parameters: seq (str) – Sequence to get reverse complement of.
-
gnocis.common.
mean
()¶
-
gnocis.common.
setConfidenceIntervalFunction
()¶ Sets the function for calculating confidence intervals.
Parameters: CIfunc (function) – Function that takes a set of values and outputs the confidence interval difference from the mean. A symmetric confidence interval is assumed.
-
gnocis.common.
setSeed
()¶ Sets the random seed.
Parameters: seed (int) – Sequence to get reverse complement of.
-
gnocis.common.
std
()¶
-
gnocis.common.
useSciPyConfidenceIntervals
()¶ Sets the function for calculating confidence intervals.
Parameters: CIfunc (function) – Function that takes a set of values and outputs the confidence interval difference from the mean. A symmetric confidence interval is assumed.
gnocis.features module¶
-
class
gnocis.features.
feature
¶ Bases:
object
The feature class is a base class for sequence features.
-
cachedSequence
¶
-
cachedValue
¶
-
-
class
gnocis.features.
featureMotifOccurrenceFrequency
¶ Bases:
gnocis.features.feature
Occurrence frequency feature for a motif.
Parameters: _motif (motif) – The motif that the feature is for. -
get
()¶ Extracts the feature value from a sequence.
Parameters: seq (sequence) – The sequence to extract the feature value from. Returns: Feature value Return type: float
-
m
¶
-
-
class
gnocis.features.
featurePREdictorMotifPairOccurrenceFrequency
¶ Bases:
gnocis.features.feature
PREdictor pair occurrence frequency feature for two motifs and a distance cutoff.
Parameters: - motifA (motif) – The first motif.
- motifB (motif) – The second motif.
- distanceCutoff (int) – Pairing cutoff distance. The cutoff is for nucleotides inbetween occurrences of motifA and motifB.
-
distCut
¶
-
get
()¶ Extracts the feature value from a sequence.
Parameters: seq (sequence) – The sequence to extract the feature value from. Returns: Feature value Return type: float
-
mA
¶
-
mB
¶
-
class
gnocis.features.
featureScaler
¶ Bases:
gnocis.features.features
The featureScaler class scales an input feature set, based on a binary training set.
Parameters:
-
class
gnocis.features.
features
¶ Bases:
object
The features class represents a set of features.
Parameters: - name (str) – Name of the feature set
- f (list, optional) – Features to include. Defaults to [].
After constructing a features object, for a set of features FS, len(FS) gives the number of features, FS[i] gives feature with index i, and [ x for x in FS ] gives the list of feature objects. Two features objects A and B can be added together with A+B, yielding a concatenated set of features.
-
diffsummary
()¶
-
features
¶
-
getAll
()¶ Extracts the feature values from a sequence.
Parameters: seq (sequence) – The sequence to extract the feature value from. Returns: Feature vector Return type: list
-
static
kSpectrum
()¶ Constructs the k-mer spectrum kernel, the occurrence frequencies of all motifs of length k, with no ambiguous positions.
Parameters: k (int) – k-mer length. Returns: Feature set Return type: features
-
static
kSpectrumGPS
()¶ Constructs the k-mer spectrum graded position stranded kernel, the occurrence frequencies of all motifs of length k, with one allowed mismatch in an arbitrary position.
Parameters: k (int) – k-mer length. Returns: Feature set Return type: features
-
static
kSpectrumMM
()¶ Constructs the k-mer spectrum mismatch kernel, the occurrence frequencies of all motifs of length k, with one allowed mismatch in an arbitrary position.
Parameters: k (int) – k-mer length. Returns: Feature set Return type: features
-
static
kSpectrumMMD
()¶ Constructs the k-mer spectrum mismatch kernel, the occurrence frequencies of all motifs of length k, with one allowed mismatch in an arbitrary position. This formulation counts the base k-mer k times, and mutated k-mers one time.
Parameters: k (int) – k-mer length. Returns: Feature set Return type: features
-
static
motifPairSpectrum
()¶ Constructs a feature set for the PREdictor motif pair occurrence spectrum, given a set of motifs.
Parameters: motifs (motifs) – The motifs to use for the feature space. Returns: Feature set Return type: features
-
static
motifSpectrum
()¶ Constructs a feature set for the motif occurrence spectrum, given a set of motifs.
Parameters: motifs (motifs) – The motifs to use for the feature space. Returns: Feature set Return type: features
-
name
¶
-
nvalues
¶
-
scale
()¶
-
summary
()¶
-
table
()¶
-
values
¶
-
class
gnocis.features.
kSpectrum
¶ Bases:
object
Feature set that extracts the occurrence frequencies of all unambiguous motifs of length k. Extraction of the entire spectrum is optimized by taking overlaps of motifs into account.
Parameters: nspectrum (int) – Length of motifs, k, to use. -
bitmask
¶
-
cachedSequence
¶
-
cachedSpectrum
¶
-
features
¶
-
kmerByIndex
¶
-
nFeatures
¶
-
nspectrum
¶
-
-
class
gnocis.features.
kSpectrumFeatureGPS
¶ Bases:
gnocis.features.feature
-
get
()¶ Extracts the feature value from a sequence.
Parameters: seq (sequence) – The sequence to extract the feature value from. Returns: Feature value Return type: float
-
index
¶
-
kmer
¶
-
parent
¶
-
section
¶
-
-
class
gnocis.features.
kSpectrumGPS
¶ Bases:
object
Feature set that extracts the occurrence frequencies of all motifs of length k, position and strand represented. To represent position and strandedness, four features are generated per k-mer: one for each combination of strandedness and sequence end for proximity. Graded distance to each end of the sequence is used in order to represent position. Extraction of the entire spectrum is optimized by taking overlaps of motifs into account.
Parameters: nspectrum (int) – Length of motifs, k, to use. -
bitmask
¶
-
cachedSequence
¶
-
cachedSpectrum
¶
-
features
¶
-
kmerByIndex
¶
-
nFeatures
¶
-
nkmers
¶
-
nspectrum
¶
-
-
class
gnocis.features.
kSpectrumMM
¶ Bases:
object
Feature set that extracts the occurrence frequencies of all motifs of length k, with one mismatch allowed in an arbitrary position. Extraction of the entire spectrum is optimized by taking overlaps of motifs into account.
Parameters: nspectrum (int) – Length of motifs, k, to use. -
bitmask
¶
-
cachedSequence
¶
-
cachedSpectrum
¶
-
features
¶
-
kmerByIndex
¶
-
nFeatures
¶
-
nspectrum
¶
-
-
class
gnocis.features.
kSpectrumMMD
¶ Bases:
object
Feature set that extracts the occurrence frequencies of all motifs of length k, with one mismatch allowed in an arbitrary position. Extraction of the entire spectrum is optimized by taking overlaps of motifs into account.
Parameters: nspectrum (int) – Length of motifs, k, to use. -
bitmask
¶
-
cachedSequence
¶
-
cachedSpectrum
¶
-
features
¶
-
kmerByIndex
¶
-
nFeatures
¶
-
nspectrum
¶
-
-
class
gnocis.features.
kSpectrumMMDFeature
¶ Bases:
gnocis.features.feature
-
get
()¶ Extracts the feature value from a sequence.
Parameters: seq (sequence) – The sequence to extract the feature value from. Returns: Feature value Return type: float
-
index
¶
-
kmer
¶
-
parent
¶
-
-
class
gnocis.features.
scaledFeature
¶ Bases:
gnocis.features.feature
The scaledFeature class scales and shifts an input feature.
Parameters: - _feature (feature) – The feature to scale.
- vScale (float) – Value to scale by.
- vSub (float) – Shifting.
After constructing a biomarkers object, for a set of biomarkers BM, len(BM) gives the number of markers, BM[‘FACTOR_NAME’] gives the merged set of regions for factor FACTOR_NAME, and [ x for x in BM ] gives the list of merged regions per biomarker contained in BM.
-
feature
¶
-
get
()¶ Extracts the feature value from a sequence.
Parameters: seq (sequence) – The sequence to extract the feature value from. Returns: Feature value Return type: float
-
vScale
¶
-
vSub
¶
gnocis.models module¶
-
class
gnocis.models.
CVModelPredictions
¶ Bases:
object
Helper class that represents cross-validated model predictions..
Parameters: - model (sequenceModel) – Model.
- labelPredictionCurves (dict) – Labelled prediction curves.
-
getStatTable
¶
-
predictCore
¶
-
regions
¶
-
setCorePredictions
¶
-
gnocis.models.
createDummyPREdictorModel
()¶
-
gnocis.models.
crossvalidate
()¶
-
class
gnocis.models.
crossvalidation
¶ Bases:
object
Helper class for cross-validations. Accepts binary training and validation sets and constructs cross-validation sets for a desired number of repeats. If a separate validation set is not given, the training set is used. The cross-validation set for each repeat contains numbers of training and test sequences determined by a training-to-testing sequence ratio, as well as a negative-per-positive test sequence ratio. When constructing the validation set, identities are checked for against the training set, to avoid contamination (will not work if sequences are cloned). Holds models and validation statistics. Integrates with terminal and IPython for visualization of results. Stores training and testing data, so new models can be added.
Parameters: - models (list) – List of models to cross-validate.
- tpos (sequences) – Positive training set.
- tneg (sequences) – Negative training set.
- vpos (sequences, optional) – Positive validation set.
- vneg (sequences, optional) – Negative validation set.
- repeats (int, optional) – Number of experimental repeats. Default = 20.
- ratioTrainTest (float, optional) – Ratio of training to testing sequences. Default = 80%.
- ratioNegPos (float, optional) – Ratio of validation negatives to positives. Default = 100.
-
addModel
¶
-
calibrate
¶
-
getAUCTable
¶
-
getConfigurationTable
¶
-
plotPRC
¶
-
plotROC
¶
-
predict
¶
-
class
gnocis.models.
sequenceModel
¶ Bases:
object
The sequenceModel class is an abstract class for sequence models. A number of methods are implemented for machine learning and prediction with DNA sequences.
Parameters: - name (string) – Name of model.
- enableMultiprocessing (bool) – If True (default), multiprocessing is enabled.
-
calibrateGenomewidePrecision
¶ Calibrates the model threshold for an expected precision genome-wide. Returns self to facilitate chaining of operations. However, this operation does mutate the model object. A scaling factor can be applied to the genome with the ‘factor’ argument. If, for instance, the positive set has been divided in half for independent training and calibration, a factor of 0.5 can be used.
Parameters: - positives (sequences/sequenceStream) – Positive sequences.
- genome (sequences/sequenceStream/str) – The genome.
- factor (float, optional) – Scaling factor for positive set versus genome.
- precision (float, optional) – The precision to approximate.
Returns: List of the maximum window score per sequence
Return type: list
-
getConfusionMatrix
¶ Calculates and returns a confusion matrix for sets of positive and negative sequences.
Parameters: - seqs (sequences) – Sequences.
- labelPositive (sequenceLabel) – Label of positives.
- labelNegative (sequenceLabel) – Label of negatives.
Returns: Confusion matrix
Return type: dict
-
getOptimalAccuracyThreshold
¶ Gets a threshold value optimized for accuracy to a set of positive and a set of negative sequences.
Parameters: - seqs (sequences) – Sequences.
- labelPositive (sequenceLabel) – Label of positives.
- labelNegative (sequenceLabel) – Label of negatives.
Returns: List of the maximum window score per sequence
Return type: list
-
getPRC
¶ Calculates and returns a Precision/Recall curve (PRC) for sets of positive and negative sequences.
Parameters: - seqs (sequences) – Sequences.
- labelPositive (sequenceLabel) – Label of positives.
- labelNegative (sequenceLabel) – Label of negatives.
Returns: Precision/Recall curve (PRC)
Return type: list
-
getPRCAUC
¶ Calculates and returns the area under a Precision/Recall curve (PRCAUC) for sets of positive and negative sequences.
Parameters: - seqs (sequences) – Sequences.
- labelPositive (sequenceLabel) – Label of positives.
- labelNegative (sequenceLabel) – Label of negatives.
Returns: Area under the Precision/Recall curve (PRCAUC)
Return type: list
-
getPrecisionThreshold
¶ Gets a threshold value for a desired precision to a set of positive and a set of negative sequences. Linear interpolation is used in order to achieve a close approximation.
Parameters: - seqs (sequences) – Sequences.
- labelPositive (sequenceLabel) – Label of positives.
- labelNegative (sequenceLabel) – Label of negatives.
- wantedPrecision (float) – The precision to approximate.
Returns: List of the maximum window score per sequence
Return type: list
-
getROC
¶ Calculates and returns a Receiver Operating Characteristic (ROC) curve for sets of positive and negative sequences.
Parameters: - seqs (sequences) – Sequences.
- labelPositive (sequenceLabel) – Label of positives.
- labelNegative (sequenceLabel) – Label of negatives.
Returns: Receiver Operating Characteristic (ROC) curve
Return type: list
-
getROCAUC
¶ Calculates and returns the area under a Receiver Operating Characteristic (ROCAUC) curve for sets of positive and negative sequences.
Parameters: - seqs (sequences) – Sequences.
- labelPositive (sequenceLabel) – Label of positives.
- labelNegative (sequenceLabel) – Label of negatives.
Returns: Area under the Receiver Operating Characteristic (ROCAUC) curve
Return type: list
-
getSequenceScores
¶ Scores a set of sequences, returning the maximum window score for each. Multiprocessing is enabled by default, but can be disabled in the constructor.
Parameters: seqs (sequences/sequenceStream) – Sequences to score. Returns: List of the maximum window score per sequence Return type: list
-
getValidationStatistics
¶ Returns common model validation statistics (confusion matrix values; ROCAUC; PRCAUC).
Parameters: - seqs (sequences) – Sequences.
- labelPositive (sequenceLabel) – Label of positives.
- labelNegative (sequenceLabel) – Label of negatives.
Returns: Validation statistics
Return type: list
-
plotPRC
¶ Plots a Precision/Recall curve and either displays it in an IPython session or saves it to a file.
Parameters: - seqs (sequences) – Sequences.
- labelPositive (sequenceLabel) – Label of positives.
- labelNegative (sequenceLabel) – Label of negatives.
- figsize (tuple, optional) – Tuple of figure dimensions.
- outpath (str, optional) – Path to save generated plot to. If not set, the plot will be output to IPython.
- style (str, optional) – Matplotlib style to use.
-
predict
¶ Applies the model using a sliding window across an input sequence stream or sequence set. Windows with a score >= self.threshold are predicted, and predicted windows are merged into non-overlapping predictions.
Parameters: stream (sequences/sequenceStream/str) – Sequence material that the model is applied to for prediction. Returns: Set of non-overlapping (merged) predicted regions Return type: regions
-
predictCore
¶ Predicts cores. Not implemented by default. Models that use core prediction should implement this.
Parameters: genome (genome) – Genome. Returns: Predicted core regions if implemented, or None otherwise Return type: regions
-
predictSequenceStreamCurves
¶ Applies the model using a sliding window across an input sequence stream or sequence set. Windows with a score >= self.threshold are predicted, and predicted windows are merged into non-overlapping predictions.
Parameters: stream (sequences/sequenceStream/str) – Sequence material that the model is applied to for prediction. Returns: Set of non-overlapping (merged) predicted regions Return type: regions
-
predictSequenceStreamRegions
¶ Applies the model using a sliding window across an input sequence stream or sequence set. Windows with a score >= self.threshold are predicted, and predicted windows are merged into non-overlapping predictions.
Parameters: stream (sequences/sequenceStream/str) – Sequence material that the model is applied to for prediction. Returns: Set of non-overlapping (merged) predicted regions Return type: regions
-
printTestStatistics
¶
-
score
¶ Scores a sequence of set of sequences.
Parameters: - target (sequence/sequences/sequenceStream) – Sequence(s) to score.
- asTable (bool) – If True, a table will be output. Otherwise, a list.
Returns: Score or list of scores
Return type: float/list
-
scoreSequence
¶ Scores a single sequence. The score is determined by applying the model with a sliding window, and taking the maximum score.
Parameters: seq (sequences/sequenceStream) – The sequence. Returns: Maximal window score Return type: float
-
train
¶ Scores a sequence of set of sequences.
Parameters: ts (sequences) – Training set. Returns: Trained model Return type: sequenceModel
-
class
gnocis.models.
sequenceModelDummy
¶ Bases:
gnocis.models.sequenceModel
This model takes a feature set, and scores input sequences by summing feature values, without weighting.
Parameters: - name (str) – Model name.
- features (features) – The feature set.
- windowSize (int) – Window size to use.
- windowStep (int) – Window step size to use.
-
getTrainer
¶
-
scoreWindow
¶
-
class
gnocis.models.
sequenceModelLogOdds
¶ Bases:
gnocis.models.sequenceModel
Constructs a log-odds model based on an input feature set and binary training set, and scores input sequences by summing log-odds-weighted feature values.
Parameters: - name (str) – Model name.
- features (features) – The feature set.
- trainingSet (sequences) – Training sequences.
- windowSize (int) – Window size to use.
- windowStep (int) – Window step size to use.
- labelPositive (sequenceLabel) – Positive training class label.
- labelNegative (sequenceLabel) – Negative training class label.
-
getTrainer
¶
-
scoreWindow
¶
-
gnocis.models.
setNCores
()¶ Sets the number of cores to use for multiprocessing.
Parameters: n (int) – The number of cores to use.
-
gnocis.models.
setNThreadFetch
()¶
-
gnocis.models.
trainPREdictorModel
()¶
-
gnocis.models.
trainSinglePREdictorModel
()¶
gnocis.motifs module¶
-
class
gnocis.motifs.
IUPACMotif
¶ Bases:
object
Represents an IUPAC motif.
Parameters: - name (str) – Name of the motif.
- motif (str) – Motif sequence, in IUPAC nucleotide codes (https://www.bioinformatics.org/sms/iupac.html).
-
c
¶
-
cRC
¶
-
cachedOcc
¶
-
cachedSequence
¶
-
find
()¶ Finds the occurrences of the motif in a sequence.
Parameters: - seq (sequence) – The sequence.
- cache (bool) – Whether or not to cache.
Returns: List of motif occurrences
Return type: list
-
motif
¶
-
name
¶
-
nmismatches
¶
-
regexMotif
¶
-
regexMotifRC
¶
-
class
gnocis.motifs.
PWMMotif
¶ Bases:
object
Represents an Position Weight Matrix (PWM) motif.
Parameters: - name (str) – Name of the motif.
- pwm (str) – Position Weight Matrix.
- path (str) – Path to file that the PWM was loaded from.
-
PWMF
¶
-
PWMRC
¶
-
cachedOcc
¶
-
cachedSequence
¶
-
find
()¶ Finds the occurrences of the motif in a sequence.
Parameters: - seq (sequence) – The sequence.
- cache (bool) – Whether or not to cache.
Returns: List of motif occurrences
Return type: list
-
getEValueThreshold
()¶ Calibrates the threshold for a desired E-value.
Parameters: - bgModel (object) – Background model to use for calibration.
- Evalue (float) – The desired E-value.
- EvalueUnit (float) – E-value unit.
- seedThreshold (float) – Seed threshold.
- iterations (int) – Number of iterations.
Returns: Threshold
Return type: float
-
name
¶
-
path
¶
-
setPWM
()¶ Sets the Position Weight Matrix.
Parameters: pwm (list) – Position Weight Matrix.
-
threshold
¶
-
gnocis.motifs.
loadMEMEPWMDatabase
()¶
-
class
gnocis.motifs.
motifOccurrence
¶ Bases:
object
Represents motif occurrences.
Parameters: - motif (object) – The motif.
- seq – Name of the sequence the motif occurred on.
- start – Occurrence start nucleotide.
- end – Occurrence end nucleotide.
- strand – Occurrence strand. True is the +/forward strand, and False is the -/backward strand.
- seq – str
- start – int
- end – int
- strand – bool
After constructing a biomarkers object, for a set of biomarkers BM, len(BM) gives the number of markers, BM[‘FACTOR_NAME’] gives the merged set of regions for factor FACTOR_NAME, and [ x for x in BM ] gives the list of merged regions per biomarker contained in BM.
-
end
¶
-
motif
¶
-
seq
¶
-
start
¶
-
strand
¶
-
class
gnocis.motifs.
motifs
¶ Bases:
object
The motifs class represents a set of motifs.
Parameters: - name (str) – Name of the motif set.
- motifs – List of motifs.
- motifs – list
-
Ringrose2003
¶ Preset for generating the Ringrose et al. (2003) motif set.
-
Ringrose2003GTGT
¶ Preset for generating the Ringrose et al. (2003) motif set, with GTGT added (as in Bredesen et al. 2019).
-
motifs
¶
-
name
¶
-
occFreq
¶ Generates an occurrence frequency feature set
-
pairFreq
¶ Generates a pair occurrence frequency feature set
-
table
¶
gnocis.regions module¶
-
gnocis.regions.
loadBED
()¶ Loads regions from a BED (https://www.ensembl.org/info/website/upload/bed.html) file.
Parameters: path (str) – Path to the input file. Returns: Loaded regions. Return type: regions
-
gnocis.regions.
loadBEDGZ
()¶ Loads regions from a gzipped BED (https://www.ensembl.org/info/website/upload/bed.html) file.
Parameters: path (str) – Path to the input file. Returns: Loaded regions. Return type: regions
-
gnocis.regions.
loadCoordinateList
()¶ Loads regions from a coordinate list file (one region per line, with the format seq:start..end).
Parameters: path (str) – Path to the input file. Returns: Loaded regions. Return type: regions
-
gnocis.regions.
loadGFF
()¶ Loads regions from a General Feature Format (https://www.ensembl.org/info/website/upload/gff.html) file.
Parameters: path (str) – Path to the input file. Returns: Loaded regions. Return type: regions
-
gnocis.regions.
loadGFFGZ
()¶ Loads regions from a gzipped General Feature Format (https://www.ensembl.org/info/website/upload/gff.html) file.
Parameters: path (str) – Path to the input file. Returns: Loaded regions. Return type: regions
-
gnocis.regions.
nucleotidePrecisionBarplot
()¶ Generates a prediction nucleotide precision barplot.
Parameters: - predictionSets (list) – List of prediction region sets.
- regionSets (list) – List of validation region sets.
- figsize (tuple, optional) – Figure size.
- outpath (str, optional) – Output path.
- returnHTML (bool, optional) – If True, an HTML node will be returned.
- fontsizeLabels (float, optional) – Size of label font.
- fontsizeLegend (float, optional) – Size of legend font.
- fontsizeAxis (float, optional) – Size of axis font.
- style (str, optional) – Plot style to use.
- showLegend (bool, optional) – Flag for whether or not to render legend.
- bboxAnchorTo (tuple, optional) – Legend anchor point.
- legendLoc (str, optional) – Legend location.
- showValues (bool, optional) – If True, values will be plotted.
-
gnocis.regions.
nucleotideRegionF1Barplot
()¶ Generates a barplot of F1-measures, where the recall is based on region overlap sensitivity and precision is based on nucleotide precision.
Parameters: - predictionSets (list) – List of prediction region sets.
- regionSets (list) – List of validation region sets.
- figsize (tuple, optional) – Figure size.
- outpath (str, optional) – Output path.
- returnHTML (bool, optional) – If True, an HTML node will be returned.
- fontsizeLabels (float, optional) – Size of label font.
- fontsizeLegend (float, optional) – Size of legend font.
- fontsizeAxis (float, optional) – Size of axis font.
- style (str, optional) – Plot style to use.
- showLegend (bool, optional) – Flag for whether or not to render legend.
- bboxAnchorTo (tuple, optional) – Legend anchor point.
- legendLoc (str, optional) – Legend location.
- showValues (bool, optional) – If True, values will be plotted.
-
gnocis.regions.
overlapPrecisionBarplot
()¶ Generates a prediction overlap precision barplot.
Parameters: - predictionSets (list) – List of prediction region sets.
- regionSets (list) – List of validation region sets.
- figsize (tuple, optional) – Figure size.
- outpath (str, optional) – Output path.
- returnHTML (bool, optional) – If True, an HTML node will be returned.
- fontsizeLabels (float, optional) – Size of label font.
- fontsizeLegend (float, optional) – Size of legend font.
- fontsizeAxis (float, optional) – Size of axis font.
- style (str, optional) – Plot style to use.
- showLegend (bool, optional) – Flag for whether or not to render legend.
- bboxAnchorTo (tuple, optional) – Legend anchor point.
- legendLoc (str, optional) – Legend location.
- showValues (bool, optional) – If True, values will be plotted.
-
gnocis.regions.
overlapSensitivityBarplot
()¶ Generates a prediction overlap sensitivity barplot.
Parameters: - predictionSets (list) – List of prediction region sets.
- regionSets (list) – List of validation region sets.
- figsize (tuple, optional) – Figure size.
- outpath (str, optional) – Output path.
- returnHTML (bool, optional) – If True, an HTML node will be returned.
- fontsizeLabels (float, optional) – Size of label font.
- fontsizeLegend (float, optional) – Size of legend font.
- fontsizeAxis (float, optional) – Size of axis font.
- style (str, optional) – Plot style to use.
- showLegend (bool, optional) – Flag for whether or not to render legend.
- bboxAnchorTo (tuple, optional) – Legend anchor point.
- legendLoc (str, optional) – Legend location.
- showValues (bool, optional) – If True, values will be plotted.
-
gnocis.regions.
predictionBarplot
()¶ Generates a prediction overlap precision barplot.
Parameters: - predictionSets (list) – List of prediction region sets.
- figsize (tuple, optional) – Figure size.
- outpath (str, optional) – Output path.
- returnHTML (bool, optional) – If True, an HTML node will be returned.
- fontsizeLabels (float, optional) – Size of label font.
- fontsizeLegend (float, optional) – Size of legend font.
- fontsizeAxis (float, optional) – Size of axis font.
- style (str, optional) – Plot style to use.
- showLegend (bool, optional) – Flag for whether or not to render legend.
- bboxAnchorTo (tuple, optional) – Legend anchor point.
- legendLoc (str, optional) – Legend location.
- showValues (bool, optional) – If True, values will be plotted.
-
class
gnocis.regions.
region
¶ Bases:
object
The region class represents a region within a sequence. A region has a sequence name, a start and end, and a strandedness, with optional additional annotation.
Parameters: - seq (str) – Sequence name.
- start (int) – Start coordinate.
- end (int) – End coordinate (inclusive).
- strand (bool, optional) – Strandedness. True for the + (forward) strand (default), and False for the - (reverse) strand.
- score (float, optional) – Score.
- source (str, optional) – Soure.
- feature (str, optional) – Feature.
- group (str, optional) – Group.
- dropChr (bool, optional) – True if a leading chr in seq is to be dropped (default).
The length of a region r can be calculated with len(r).
-
bstr
()¶ Returns: Returns the region formatted as a string: seq:start..end (strand). Return type: str
-
center
()¶
-
end
¶
-
ext
¶
-
feature
¶
-
group
¶
-
markers
¶
-
score
¶
-
seq
¶
-
singleton
()¶
-
source
¶
-
start
¶
-
strand
¶
-
gnocis.regions.
regionBarplot
()¶ Generates a barplot of a measure (lambda) for predicted regions.
Parameters: - mainRegions (list) – List of main region sets.
- measure (function) – Function to compute measure.
- measureName (str) – Name of measure.
- testRegions (list, optional) – List of test region sets, to check against (or None if not relevant).
- figsize (tuple, optional) – Figure size.
- outpath (str, optional) – Output path.
- returnHTML (bool, optional) – If True, an HTML node will be returned.
- fontsizeLabels (float, optional) – Size of label font.
- fontsizeLegend (float, optional) – Size of legend font.
- fontsizeAxis (float, optional) – Size of axis font.
- style (str, optional) – Plot style to use.
- showLegend (bool, optional) – Flag for whether or not to render legend.
- bboxAnchorTo (tuple, optional) – Legend anchor point.
- legendLoc (str, optional) – Legend location.
- showValues (bool, optional) – If True, values will be plotted.
- isPercent (bool, optional) – If True, values will be plotted as percentages.
-
class
gnocis.regions.
regions
¶ Bases:
object
The regions class represents a set of regions.
Parameters: - name (str) – Name for the sequence set.
- rgns (list) – List of regions to include.
- initialSort (bool) – Whether or not to sort the regions (default is True).
For a region set RS, len(RS) gives the number of regions, RS[i] gives the i`th region in the set, and `[ r for r in RS ] lists regions in the set. For sets A and B, A+B gives a sorted region set of regions from both sets, A|B gives the merged set, A&B the conjunction, and A^B the regions of A with B excluded.
-
bstr
()¶ Returns: Returns a concatenated list of regions formatted as seq:start..end (strand). Return type: str
-
deltaResize
()¶ Gets a set of resized regions. The delta size is subtracted from the start and added to the end.
Parameters: sizeDelta – Desired region size change. Returns: Set of resized regions. Return type: regions
-
dummy
()¶ Generates a dummy region set, with the same region lengths but random positions.
Parameters: - genome (genome) – Genome.
- useSeq (list) – Chromosomes to focus on.
Returns: Dummy region set.
Return type:
-
exclusion
()¶ Gets the regions of this set with regions of another set excluded.
Parameters: other (regions) – Other region set. Returns: Excluded region set. Return type: regions
-
expected
()¶ Calculates an expected statistic by random dummy set creation and averaging.
Parameters: - genome (genome) – Genome.
- statfun (Function) – Function to apply to region sets that returns desired statistic.
- useSeq (list) – Chromosomes to focus on.
- repeats (int) – Number of repeats for calculating statistic.
Returns: Average statistic.
Return type: float
-
extract
()¶ Extracts region sequences from a sequence set, sequence stream, or a file by path.
Parameters: src (sequences/sequenceStream/str) – Sequence set, sequence stream, or sequence file path. Returns: Extracted region sequences. Return type: sequences
-
extractSequences
()¶ Extracts region sequences from a sequence set or stream.
Parameters: seqs (sequences/sequenceStream) – Sequences/sequence stream to extract region sequences from. Returns: Extracted region sequences. Return type: sequences
-
extractSequencesFrom2bit
()¶ Extracts region sequences from a 2bit file.
Parameters: path (str) – Path to 2bit file. Returns: Extracted region sequences. Return type: sequences
-
extractSequencesFromFASTA
()¶ Extracts region sequences from a FASTA file.
Parameters: path (str) – Path to FASTA file. Returns: Extracted region sequences. Return type: sequences
-
filter
()¶ Returns a region set filtered with the input lambda function.
Parameters: - fltName (str) – Name of the filter. Appended to the region set name.
- flt (lambda) – Lambda function to be applied to every region, returning True if the region is to be included, or otherwise False.
Returns: Region set filtered with the lambda function.
Return type:
-
flatten
()¶ Returns a flattened set of regions, with internally overlapping regions merged.
Returns: Flattened region set. Return type: regions
-
intersection
()¶ Gets the intersection of regions in this set and another.
Parameters: other (regions) – Other region set. Returns: Intersection region set. Return type: regions
-
merge
()¶ Gets the merged set of regions in this set and another.
Parameters: other (regions) – Other region set. Returns: Merged region set. Return type: regions
-
name
¶
-
nonOverlap
()¶ Gets the regions in this set that do not overlap with another.
Parameters: other (regions) – Other region set. Returns: Set of non-overlapping regions. Return type: regions
-
nucleotidePrecision
()¶ Calculates the nucleotide precision to another set.
Parameters: other (regions) – Other region set. Returns: Nucleotide precision. Return type: float
-
overlap
()¶ Gets the regions in this set that overlap with another.
Parameters: other (regions) – Other region set. Returns: Set of overlapping regions. Return type: regions
-
overlapPrecision
()¶ Calculates the overlap precision to another set.
Parameters: other (regions) – Other region set. Returns: Overlap precision. Return type: float
-
overlapSensitivity
()¶ Calculates the overlap sensitivity to another set.
Parameters: other (regions) – Other region set. Returns: Overlap sensitivity. Return type: float
-
printStatistics
()¶ Outputs basic statistics.
-
randomSplit
()¶ Parameters: ratio (float) – Ratio for the split, between 0 and 1. For the return touple, (A, B), a ratio of 0 means all the regions are in B, and opposite for a ratio of 1. Returns: Returns a random split of the regions into two independent sets, with the given ratio. Return type: regions
-
recenter
()¶ Gets a set of randomly recentered regions. If the target size is smaller than a given region, a region of the desired size is randomly placed within the region. If the desired size is larger, a region of the desired size is placed with equal center to the center of the region.
Parameters: size (int) – Desired region size. Returns: Set of randomly recentered regions. Return type: regions
-
regions
¶
-
sample
()¶ Parameters: n (int) – Number of regions to pick. If 0, the same number will be selected as are in the full set. Returns: Returns a random sample of the regions of size n. Regions are selected with replacement, and the same region can occur multiple times. Return type: regions
-
saveBED
()¶ Saves the regions to a BED (https://www.ensembl.org/info/website/upload/bed.html) file.
Parameters: path (str) – Output file path.
-
saveCoordinateList
()¶ Saves the regions to a coordinate list file (a coordinate per line, with the format seq:start..end).
Parameters: path (str) – Output file path.
-
saveGFF
()¶ Saves the regions to a General Feature Format (https://www.ensembl.org/info/website/upload/gff.html) file.
Parameters: path (str) – Output file path.
-
sort
()¶ Sorts the set, first by start coordinate, then by sequence.
-
table
()¶
gnocis.sequences module¶
-
class
gnocis.sequences.
IID
¶ Bases:
gnocis.sequences.sequenceGenerator
The IID class trains an i.i.d. model for generating sequences.
Parameters: - trainingSequences (sequences/sequenceStream/str) – Training sequences.
- pseudoCounts (bool, optional) – Whether or not to use pseudocounts. Default is True.
- addComplements (bool, optional) – Whether or not to add complements. Default is True.
-
addComplements
¶
-
generate
()¶ Generates a sequence.
Parameters: length (int) – Length of the sequence to generate. Returns: Random sequence. Return type: sequence
-
nGenerated
¶
-
ntDistribution
¶
-
prepared
¶
-
pseudoCounts
¶
-
spectrum
¶
-
trainingSequences
¶
-
class
gnocis.sequences.
MarkovChain
¶ Bases:
gnocis.sequences.sequenceGenerator
The MarkovChain class trains a Markov chain for generating sequences.
Parameters: - trainingSequences (sequences/sequenceStream/str) – Training sequences.
- degree (int, optional) – Markov chain degree. Default is 4.
- pseudoCounts (bool, optional) – Whether or not to use pseudocounts. Default is True.
- addReverseComplements (bool, optional) – Whether or not to add reverse complements. Default is True.
-
addReverseComplements
¶
-
comparableSpectrum
¶
-
degree
¶
-
generate
()¶ Generates a sequence.
Parameters: length (int) – Length of the sequence to generate. Returns: Random sequence. Return type: sequence
-
initialDistribution
¶
-
nGenerated
¶
-
prepared
¶
-
probspectrum
¶
-
pseudoCounts
¶
-
spectrum
¶
-
trainingSequences
¶
-
gnocis.sequences.
getSequenceStreamFromPath
()¶ Creates a sequence stream from a path, deducing the file type.
Parameters: - path (str) – Path to the input file.
- wantBlockSize (int, optional) – Desired block size.
- spacePrune (bool, optional) – Whether or not to prune sequence name spaces.
- dropChr (bool, optional) – Whether or not to prune sequence name “chr”-prefixes.
- restrictToSequences (list, optional) – List of sequence names to restrict to/focus on.
Returns: Generated sequence stream.
Return type:
-
gnocis.sequences.
getSequenceWindowRegions
()¶ Generates sequence window regions for a sequence set or stream.
Parameters: - stream – Input sequences.
- windowSize (int) – Window size.
- windowStep (int) – Window step size.
Returns: Sequence window regions.
Return type:
-
gnocis.sequences.
loadFASTA
()¶ Loads sequences from a FASTA file.
Parameters: path (str) – Path to the input file. Returns: Loaded sequences. Return type: sequences
-
gnocis.sequences.
loadFASTAGZ
()¶ Loads sequences from a gzipped FASTA file.
Parameters: path (str) – Path to the input file. Returns: Loaded sequences. Return type: sequences
-
class
gnocis.sequences.
sequence
¶ Bases:
object
The sequence class represents a DNA sequence.
Parameters: - name (str) – Name of the sequence.
- seq (str) – Sequence.
- path (str, optional) – Source file path.
- sourceRegion (region, optional) – Source region.
- annotation (str, optional) – Annotation.
For a sequence instance S, len(S) gives the sequence length. [ nt for nt in S ] lists the nucleotides. For two sequences A and B, A+B gives the concatenated sequence.
-
annotation
¶
-
label
()¶ Parameters: label (sequenceLabel) – Label to add. Returns: Returns a labelled sequence. Return type: sequence
-
labels
¶
-
name
¶
-
path
¶
-
seq
¶
-
sourceRegion
¶
-
class
gnocis.sequences.
sequenceGenerator
¶ Bases:
object
The sequenceGenerator class is an abstract class for sequence generators.
-
generateFASTA
()¶ Generates sequences and saves them to a FASTA file.
Parameters: - path (str) – Output path.
- n (int) – Number of sequences to generate.
- length (int) – Length of each sequence to generate.
-
generateSet
()¶ Parameters: - n (int) – Number of sequences to generate.
- length (int) – Length of each sequence to generate.
Returns: Sequence set of n randomly generated sequences, each of length length.
Return type:
-
generateStream
()¶ Parameters: - n (int) – Number of sequences to generate.
- length (int) – Length of each sequence to generate.
- wantBlockSize (int, optional) – Desired block size.
Returns: Sequence stream of n randomly generated sequences, each of length length.
Return type: sequencesStream
-
-
class
gnocis.sequences.
sequenceLabel
¶ Bases:
object
The sequenceLabel class represents a label that can be assigned to sequences to be used for model training or testing, such as “positive” or “negative”.
Parameters: - name (str) – Name of the sequence label.
- value (float) – Value to represent the label.
-
name
¶
-
value
¶
-
class
gnocis.sequences.
sequenceStream
¶ Bases:
object
The sequenceStream class represents sequence streams.
-
fetch
()¶ Fetches n sequences (or less, if fewer or none are left).
Parameters: - n (int) – Number of sequences to fetch.
- maxnt (int) – Maximum number of nucleotides to fetch.
:return Yields sequences. :rtype: sequences (yield)
-
sequenceLengths
()¶ Returns: Returns a dictionary of the lengths of all sequences in the stream. Return type: dict
-
streamFullSequences
()¶ Streams and yields whole sequences.
:return Yields whole sequence. :rtype: sequence (yield)
-
windowRegions
()¶ Generates and returns a set of sliding window regions.
Parameters: - size (int) – Window size.
- step (int) – Window step size.
Returns: Region set of all sliding window regions across all sequences in the stream.
Return type:
-
-
class
gnocis.sequences.
sequenceStream2bit
¶ Bases:
gnocis.sequences.sequenceStream
Streams a 2bit file.
Parameters: - path (str) – Path to the input file.
- wantBlockSize (int) – Desired block size.
- spacePrune (bool) – Whether or not to prune sequence name spaces.
- dropChr (bool) – Whether or not to prune sequence name “chr”-prefixes.
- restrictToSequences (list) – List of sequence names to restrict to/focus on.
-
class
gnocis.sequences.
sequenceStreamFASTA
¶ Bases:
gnocis.sequences.sequenceStream
Streams a FASTA file.
Parameters: - path (str) – Path to the input file.
- wantBlockSize (int) – Desired block size.
- spacePrune (bool) – Whether or not to prune sequence name spaces.
- dropChr (bool) – Whether or not to prune sequence name “chr”-prefixes.
- restrictToSequences (list) – List of sequence names to restrict to/focus on.
- isGZ (bool) – Whether or not the input file is GZipped.
-
class
gnocis.sequences.
sequences
¶ Bases:
object
The sequences class represents a set of DNA sequences.
Parameters: - name (str) – Name of the sequence set.
- seq (list) – List of sequences to include.
For a sequence instance S, len(S) gives the sequence length, and [ s for s in S ] lists the sequences. For two sequence sets A and B, A+B gives the set containing all sequences from both sets.
-
label
()¶ Adds a label to sequences.
Parameters: label (sequenceLabel) – Label to add to sequences. Returns: Sequences with label added. Return type: sequences
-
labels
()¶ Gets labels for sequences.
Returns: Set of labels. Return type: set
-
name
¶
-
printStatistics
()¶ Outputs basic statistics.
-
randomSplit
()¶ Parameters: ratio (float) – Ratio for the split, between 0 and 1. For the return touple, (A, B), a ratio of 0 means all the sequences are in B, and opposite for a ratio of 1. Returns: Returns a random split of the sequences into two independent sets, with the given ratio. Return type: sequences
-
sample
()¶ Parameters: n (int) – Number of sequences to pick. If 0, the same number will be selected as are in the full set. Returns: Returns a random sample of the sequences of size n. Sequences are selected with replacement, and the same sequence can occur multiple times. Return type: sequences
-
saveFASTA
()¶ Saves the regions to a FASTA file.
Parameters: path (str) – Output file path.
-
sequenceLengths
()¶ Returns: Returns a dictionary of the lengths of all sequences in the set. Return type: dict
-
sequences
¶
-
sourceRegions
()¶ Returns: Region set of source regions for all sequences in the set. Return type: regions
-
split
()¶ Parameters: n (int) – Number of sets to split into. Returns: Returns a list of n independent splits of the sequence set, without shuffling. Return type: list
-
table
()¶
-
windowRegions
()¶ Generates and returns a set of sliding window regions.
Parameters: - size (int) – Window size.
- step (int) – Window step size.
Returns: Region set of all sliding window regions across all sequences in the set.
Return type:
-
windows
()¶ Generates and returns a set of sliding window sequences.
Parameters: - size (int) – Window size.
- step (int) – Window step size.
Returns: Sequence set of all sliding window sequences across all sequences in the set.
Return type:
-
withLabel
()¶ Extracts sequences with the given label or labels.
Parameters: - labels (list, sequenceLabel) – List of labels, or single labels, to extract sequences with.
- ensureAllLabels (bool) – If true, an exception is raised if no sequences with a label were found. Default true.
Returns: Single label or list of labels.
Return type: sequences, list
If multiple labels are given, a list of sequences instances are returned in the same order as the labels.
-
gnocis.sequences.
stream2bit
()¶ Streams a 2bit file.
Parameters: - path (str) – Path to the input file.
- wantBlockSize (int, optional) – Desired block size.
- spacePrune (bool, optional) – Whether or not to prune sequence name spaces.
- dropChr (bool, optional) – Whether or not to prune sequence name “chr”-prefixes.
- restrictToSequences (list, optional) – List of sequence names to restrict to/focus on.
Returns: Generated sequence stream.
Return type:
-
gnocis.sequences.
streamFASTA
()¶ Streams a FASTA file.
Parameters: - path (str) – Path to the input file.
- wantBlockSize (int, optional) – Desired block size.
- spacePrune (bool, optional) – Whether or not to prune sequence name spaces.
- dropChr (bool, optional) – Whether or not to prune sequence name “chr”-prefixes.
- restrictToSequences (list, optional) – List of sequence names to restrict to/focus on.
Returns: Generated sequence stream.
Return type:
-
gnocis.sequences.
streamFASTAGZ
()¶ Streams a gzipped FASTA file.
Parameters: - path (str) – Path to the input file.
- wantBlockSize (int, optional) – Desired block size.
- spacePrune (bool, optional) – Whether or not to prune sequence name spaces.
- dropChr (bool, optional) – Whether or not to prune sequence name “chr”-prefixes.
- restrictToSequences (list, optional) – List of sequence names to restrict to/focus on.
Returns: Generated sequence stream.
Return type:
-
gnocis.sequences.
streamSequenceWindows
()¶ Yields sequence windows for a sequence set, sequence stream or a path to a sequence file.
Parameters: - src (sequences/sequenceStream/str) – Input sequences.
- windowSize (int) – Window size.
- windowStep (int) – Window step size.
Returns: Sequence windows.
Return type: sequence (yield)
gnocis.sklearnModels module¶
-
class
gnocis.sklearnModels.
RF
(model=None, labelPositive=Sequence label<Positive; value = 1.0>, labelNegative=Sequence label<Negative; value = -1.0>, nTrees=100, maxDepth=None)[source]¶ Bases:
gnocis.featurenetwork.baseModel
-
class
gnocis.sklearnModels.
SVM
(model=None, labelPositive=Sequence label<Positive; value = 1.0>, labelNegative=Sequence label<Negative; value = -1.0>, kDegree=1, C=4)[source]¶ Bases:
gnocis.featurenetwork.baseModel
-
class
gnocis.sklearnModels.
sequenceModelLasso
(name, features, trainingSet, windowSize, windowStep, alpha=1.0, labelPositive=Sequence label<Positive; value = 1.0>, labelNegative=Sequence label<Negative; value = -1.0>)[source]¶ Bases:
gnocis.models.sequenceModel
The sequenceModelLasso class trains a Lasso model using scikit-learn.
Parameters:
-
class
gnocis.sklearnModels.
sequenceModelRF
(name, features, trainingSet, windowSize, windowStep, nTrees=100, maxDepth=None, scale=True, labelPositive=Sequence label<Positive; value = 1.0>, labelNegative=Sequence label<Negative; value = -1.0>)[source]¶ Bases:
gnocis.models.sequenceModel
The sequenceModelRF class trains a Random Forest (RF) model using scikit-learn.
Parameters: - name (str) – Model name.
- features (features) – Feature set.
- positives (sequences) – Positive training sequences.
- negatives (sequences) – Negative training sequences.
- windowSize (int) – Window size.
- windowStep (int) – Window step size.
- nTrees (int) – Number of trees.
- maxDepth (int) – Maximum tree depth.
-
class
gnocis.sklearnModels.
sequenceModelSVM
(name, features, trainingSet, windowSize, windowStep, kDegree, scale=True, labelPositive=Sequence label<Positive; value = 1.0>, labelNegative=Sequence label<Negative; value = -1.0>)[source]¶ Bases:
gnocis.models.sequenceModel
The sequenceModelSVM class trains a Support Vector Machine (SVM) using scikit-learn.
Parameters:
gnocis.sklearnModelsOpt module¶
-
class
gnocis.sklearnModelsOpt.
sequenceModelSVMOptimizedQuadratic
(name, features, trainingSet, windowSize, windowStep, kDegree, scale=True, labelPositive=Sequence label<Positive; value = 1.0>, labelNegative=Sequence label<Negative; value = -1.0>)[source]¶ Bases:
gnocis.models.sequenceModel
The sequenceModelSVMOptimizedQuadratic class trains a quadratic kernel Support Vector Machine (SVM) using scikit-learn. The kernel is applied using matrix multiplication.
Parameters:
-
class
gnocis.sklearnModelsOpt.
sequenceModelSVMOptimizedQuadraticAutoScale
(name, features, trainingSet, windowSize, windowStep, kDegree, scale=True, labelPositive=Sequence label<Positive; value = 1.0>, labelNegative=Sequence label<Negative; value = -1.0>)[source]¶ Bases:
gnocis.models.sequenceModel
The sequenceModelSVMOptimizedQuadratic class trains a quadratic kernel Support Vector Machine (SVM) using scikit-learn. The kernel is applied using matrix multiplication.
Parameters:
-
class
gnocis.sklearnModelsOpt.
sequenceModelSVMOptimizedQuadraticCUDA
(name, features, trainingSet, windowSize, windowStep, kDegree, scale=True, labelPositive=Sequence label<Positive; value = 1.0>, labelNegative=Sequence label<Negative; value = -1.0>)[source]¶ Bases:
gnocis.models.sequenceModel
The sequenceModelSVMOptimizedQuadraticCUDA class trains a quadratic kernel Support Vector Machine (SVM) using scikit-learn. The kernel is applied using matrix multiplication with CUDA.
Parameters:
gnocis.validation module¶
-
gnocis.validation.
getAUC
()¶ Calculates the Area Under the Curve (AUC) for an input curve.
Parameters: curve (list) – Curve to calculate area under. Returns: Area Under the Curve (AUC). Return type: float
-
gnocis.validation.
getConfusionMatrix
()¶ Calculates confusion matrix based on input validation pairs, and an optional threshold.
Parameters: - vPos (list) – Positive validation pairs.
- vNeg (list) – Negative validation pairs.
- threshold (float) – Classification threshold.
Returns: Dictionary with confusion matrix entries.
Return type: dict
-
gnocis.validation.
getConfusionMatrixStatistics
()¶ Calculates confusion matrix statistics in an input confusion matrix dictionary.
Parameters: CM (dict) – Confusion matrix dictionary. Returns: Dictionary with confusion matrix statistics. Return type: dict
-
gnocis.validation.
getPRC
()¶ Generates a Precision/Recall Curve (PRC).
Parameters: - vPos (list) – Positive validation pairs.
- vNeg (list) – Negative validation pairs.
Returns: List of 2D-points for curve
Return type: list
-
gnocis.validation.
getROC
()¶ Generates a Receiver Operating Characteristic (ROC) curve.
Parameters: - vPos (list) – Positive validation pairs.
- vNeg (list) – Negative validation pairs.
Returns: List of 2D-points for curve
Return type: list
-
class
gnocis.validation.
point2D
¶ Bases:
object
Two-dimensional point.
Parameters: - x (float) – X-coordinate.
- y (float) – Y-coordinate.
- rank (float, optional) – Rank.
-
rank
¶
-
x
¶
-
y
¶
-
gnocis.validation.
printValidationStatistics
()¶ Prints model confusion matrix statistics from a dictionary.
Parameters: stats (dict) – Confusion matrix statistics dictionary.


I am content in the Header
I am content in the SideOne
I am content in theContent
I am content in theSideTwo
I am content in theFooter


git - definitions
what is git
- a distributed version control system
- a directory content management system
- a tree history storage system
- a stupid content tracker
concepts
Comprendre Git - ancien blog de Xavier Pigeon - 2012
Article intéressant avec une approche travaillée sur l’implémentation interne :
Git est un :
- gestionnaire de contenu,
- stocké sous la forme d’un graphe acyclique d’objets,
- accessible par des références.
Git est structuré en 2 partie :
- le frontend, qui regroupe les commandes dites porcelain (add, commit, checkout, etc).
- le backend, développé par Linus Torvalds, qui réunit les commandes dites plumbing (hash-object, cat-file).
On retrouve cette distinction dans la littérature informatique et dans les formations : souvent, les formations pour débutants présentent le frontend, et le backend ne sera traité que par les formations avancées. Les dissocier de cette manière est une erreur, car en maîtrisant le backend, on maîtrisera bien mieux le frondend.
Concept #1 : Git est un gestionnaire de contenu.
Concept #2 : La relation entre commits est un graphe acyclique (ou DAG).
Concept #3 : Le contenu est accessible sous forme de références.
repository
Named also a tree by some git users.
It is the whole history of a project (a directory).
Composed by commits. Each node is a commit.
Created by git init
command (or by git clone
if you want to copy an existing repository).
Create a self-sufficient .git
directory. It means that a simple zip on the repository root directory is enough to backup it.
bare repository
A repository created with git init
command is for working.
A repository created with git init --bare
command is for sharing.
A bare repository doesn’t contain a working directory nor a .git
directory.

What is a bare git repository : www.saintsjd.com
Notice that you can add to your remote list a non-bare
repository but you will not be able to push in it if the branch where
you want to push is checked out in it, git will deny the push (cause possible inconsistency).
It can be bypassed by setting the receive.denyCurrentBranch
config variable in the receiver repo to 'ignore'
or 'warn'
but it is not recommended.
working directory
difference between working copy and working directory - groups.google.com - git-users
Litterally it is the directory where the user is working ;)
A git status
on a working directory without any changes tracked by git output this :
$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean
remote
A remote is a distant repository (a repo on another computer).
commit
Also named revision.
It is a state of a directory.
Each commit has one ore more parents commit.
Git stores only the difference between current commit state and parents. So a commit = current project state - parents.
Comment faire un commit sans faire du Git (Alexandre Garnier) : Devoxx2016
branch
A “branch” is an active line of development.
The most recent commit on a branch is referred to as the tip of that branch. The tip of the branch is referenced by a branch head, which moves forward as additional development is done on the branch.
tag
A ref pointing to a tag or commit object. In contrast to a head, a tag is not changed by a commit.
merge
git merge
is the action of merging a source branch in a destination branch.
If the destination branch have not diverged from the root of the source branch, the merge is a fast-forward.
-- M1
\
B1 - B2 - B3
At the end, the two branches will points on the same commit.
-- M1 - B1 - B2 - B3
If the destination branch have diverged from the root of the source branch,
-- M1 - M2
\
B1 - B2 - B3
git will create a merge commit containing all the modifications.
-- M1 - M2 - - - M3
\ /
B1 - B2 - B3
rebase
git rebase
allows user to rewrite the history.
-- M1 - M2
\
B1 - B2 - B3
At this point, instead of merging, we can rewrite our branch history, the goal is to set the B1 parents to M2 instead of M1 :
-- M1 - M2
\
B1 - B2 - B3
Now we can run a fast-forward merge to keep a clean linear history :
-- M1 - M2 - B1 - B2 - B3
fetch
git fetch
is the action to update a given remote repository data locally. (you have a local occurrence of all the remote you have added to your remote list).
pull
git pull <remote-name> <branch-name>
runs a git fetch
on the given remote then a git merge
on the local branch from the remote branch.
push
Obviously, write access is mandatory on the remotegit push <remote-name> <branch-name>
write the local branch commits on the remote branch.
The history must be clean enough to allow a fast forward or git will reject the push.
range operators
Used mostly with git log
and git diff
commands. Provide a tool to compare branches and tags.
Difference depends on the command context. Log work with commits where diff work with commit content.
..
(dot dot)
$ git log A..B
# output all of the commits that B has that A doesn't have
$ git diff A..B
# exactly the same as
$ git diff A B
# output all the difference between A and B, if A got diff that B doesn't have and B has diff that A doesn't have, it will output BOTH.
...
(dot dot dot)
$ git log A...B
# filter out all of the commits that both A and B share, thus only showing the commits that they don't both share
$ git diff A...B
# output only the commits in B that A doesn't have (compare from the root of the 2 branches)
ancestry references
Used in a lot of commands stuck with HEAD
ref to points to ancestors commits.
What’s the difference between HEAD^ and HEAD~ in Git? : stackoverflow.com
~
specifies ancestors^
specifies parents
Ancestors are related to the current branch.
A commit can have more then one parent, caret is used to select the parent.
Let’s say we have this tree :
-- A1 - A2 - - - A3
\ /
B1 - B2 - B3
where HEAD
is A3
.
^
(caret)
HEAD^ is a shortand for HEAD^1
HEAD^=A2
HEAD^^ = HEAD^1^1 = A1
HEAD^2 = B3
HEAD^2^1 = B2
HEAD^2^2 = nothing as B3 has only one parent (B2)
~
(tilde)
HEAD~ is a shortand for HEAD~1
HEAD~2 = A1
HEAD^2~2 = B1


|
Keyframe Title:
|
|
Add a caption to this keyframe.
|
Load |
Paste the tour or waypoint collection share link below and then click Load.
|
| Title: |
Save and Share |
|
Copy the link below and share it on the web. Keep this URL handy though, since this is what will be required to load and make future changes to your work.
|
Embed |
|
You can also copy the iframe code below and embed this on your own website or blog.
|
| Embed Size: |


Licensees
Contact form https://www.gov.uk/gov...
Contact a local school or organisation licensed to offer our national qualifications and modules.
Guidance
Find out about study modules you can take on their own or as part of a national school leadership qualification.
These study modules will help you to develop the skills, confidence and knowledge to improve team performance and classroom practice.
You’ll find them useful if you have responsibility for leading a team in a school. You may be a head of department, or lead a key stage, subject, curriculum areas or pastoral services.
You can study any of the modules according to your school priorities and your own development needs.
Any modules you study can count towards the National Professional Qualification for Middle Leadership (NPQML) . You must complete the qualification within 3 years. This is because policy and content may change and this could affect the outcome of your final assessment.
Each module requires up to 50 hours of learning. This includes:
Apply with one of the schools or organisations licensed to offer these study modules . Contact a licensee for details of the modules they are currently offering and how to apply. The costs to study a module vary with each licensee.
Learn how to improve practice and raise expectations so that all pupils can fulfil their potential, particularly those with special educational needs and disabilities.
In this module, you’ll learn about:
Learn how to spot talent and develop individual team members to improve teaching and performance.
In this module, you’ll learn about:
Learn how to lead effective teams with a culture of high performance and trust.
In this module, you’ll learn about:
Learn the essential knowledge needed to lead change to achieve school improvement.
In this module, you’ll learn about:
Learn more about your own leadership and how to develop your leadership capacity and capability.
In this module, you’ll learn about:
Contact form https://www.gov.uk/gov...
Contact a local school or organisation licensed to offer our national qualifications and modules.
Published: 18 March 2014
Updated: 15 July 2015


Player Class¶
The variations on Player
class implementations are the heart of this application.
Each subclass can reflect different betting strategies.
In Roulette Game Class,
we roughed out a stub class for the Player
class. In this chapter,
we will complete that design. We will also expand on it to implement the
Martingale betting strategy.
We have now built enough infrastructure that we can begin to add a variety of players and see how poorly each betting strategy works. Each player is a betting algorithm that we will evaluate by looking at the player’s stake to see how much they win, and how long they play before they run out of time or go broke.
We’ll look at the player problem in Roulette Player Analysis.
In Player Design we’ll expand on our previous skeleton Player
to create a more complete implementation. We’ll expand on that again
in Martingale Player Design.
In Player Deliverables we’ll enumerate the deliverables for this chapter.
Roulette Player Analysis¶
The Player
class has the responsibility to create Bet
instances and manage
the amount of their stake. To create Bet
instances, the player must create legal
bets from known Outcome
instances and stay within table limits. To
manage their stake, the player must deduct money when creating a bet,
accept winnings or pushes, report on the current value of the stake, and
leave the table when they are out of money.
We’ll look at a number of topics:
Our overall goal, in Design Objectives.
How we manage the budget, in Tracking the Stake.
How a player interacts with table limits, in Table Limits.
In Leaving the Table we’ll look at a player retiring when they’re ahead. Or broke.
In Creating Bets from Outcomes we’ll look at a technical question of transforming an
Outcome
instance into aBet
instance.
We roughed out an interface for the player as part of the design of the :class: Game class
and the Table
class. In designing the :class: Game class,
we defined a Player.placeBets()
method to place all bets.
We expected the Player
instance
to create Bet
instances and use the Table.placeBet()
method
to save all of the individual Bet
instances.
In the Passenger57 Design section we defined a kind of player.
When we finish creating the final superclass, Player
, we
can then revise our Passenger57
class to be a subclass of the Player
class.
We should be able to rerun our unit tests to be sure that this new, more complete design
still handles the original test cases correctly.
Design Objectives¶
Our objective is to have a new abstract class, Player
,
with two new concrete subclasses: a revision to the Passenger57
class
and a new player subclass that follows the Martingale betting system.
We’ll defer some of the design required to collect detailed measurements for statistical analysis. In this first release, we’ll simply place bets.
There are four design issues tied up in the Player
class: tracking
stake, keeping within table limits, leaving the table, and creating
bets. We’ll tackle them in separate subsections.
Tracking the Stake¶
One of the more important features we need to add to the
Player
class are the methods to track the player’s stake. The
initial value of the stake is the player’s budget. Here is a list of several
significant changes to the stake:
Each bet placed will deduct the bet amount from the
Player
object’s stake. We are stopped from placing bets when our stake is less than the table minimum.Each win will credit the stake. The
Outcome
class will compute this amount for thePlayer
object.Additionally, a “push” outcome will put the original bet amount back into the player’s stake. This is a kind of win with no odds applied.
We’ll have to design an interface that will create Bet
objects,
reducing the stake. and will be used by :class: Game class to notify the Player
instance of the amount won.
Additionally, we will need a method to reset the stake to the starting amount. This will be used as part of data collection for the overall simulation.
Table Limits¶
Once we have our superclass, we can then define the Martingale
player as a subclass. This player doubles their bet on every loss, and
resets their bet to a base amount on every win. In the event of a long
sequence of losses, this player will have their bets rejected as over
the table limit. This raises the question of how the table limit is
represented and how conformance with the table limit is assured.
We put a preliminary design in place in Roulette Table Class. There are several places where we could isolate this responsibility.
The
Player
class can stop placing bets when they are over the table limit. In this case, we will be delegating responsibility to thePlayer
class hierarchy. In a casino, a sign is posted on the table, and both players and casino staff enforce this rule. This can be modeled by providing a method inTable
class to return the table limit for use by thePlayer
instance to keep bets within the limit.The
Table
class provides a “valid bet” method. This can include computing a total of all bets placed, and raise exceptions.The
Table
class raises an “illegal bet” exception when an illegal bet is placed.
The first alternative is unpleasant because the responsibility to spread
around: both the Player
and the Table
classes must be aware of a feature
of the Table
class. This means that a change to the Table
class design will
also require a change to the Player
class implementation. This is poor object-oriented
design.
The second and third choices reflect two common approaches that are summarized as:
Ask Permission. The application has code wrapped in
if permitted:
conditional processing.Ask Forgiveness. The application assumes that things will work. An exception indicates something unexpected happened.
The general advice is this:
It’s easier to ask forgiveness than to ask permission.
Most of the time, validation should be handled by raising an exception. This suggests
the Table
class should raise exceptions for bets which are invalid.
This includes rejecting bets which exceed the table limit.
Handling Game State. The idea of bet validation raises a question about how we handle games where some bets are not allowed during some game states.
There are two sources of validation for a bet.
The
Table
class may reject a bet because it’s over (or under) a limit.The :class: Game class may reject a bet because it’s illegal in the current state of the game.
Since these considerations are part of Craps and Blackjack, we’ll set them aside for now. They’re side-bar considerations during the design of Roulette.
Leaving the Table¶
We need to address the issue of the player
leaving the game. We can identify a number of possible reasons for
leaving: out of money, out of time, won enough, and unwilling to place a
legal bet. Since this decision is private to the Player
class,
we need a way of alerting the :class: Game instance that the Player
object
is finished placing bets.
There are three mechanisms for alerting a :class: Game instance that a Player
instance is finished placing bets.
Expand the responsibilities of the
Game.placeBets()
to also indicate if the player intends to play or is withdrawing from the game. While most table games require bets on each round, it is possible to step up to a table and watch play before placing a bet. This is one classic strategy for winning at blackjack: one player sits at the table, placing small bets and counting cards, while a confederate places large bets only when the deck is favorable. We really have three player conditions: watching, betting, and finished playing. It becomes complex trying to bundle all this extra responsibility into theGame.placeBets()
method.Add another method to the
Player
class, used by the :class: Game class to determine if thePlayer
instance will continue or stop playing. This can be used for a player who is placing no bets while waiting; for example, a player who is waiting for the Roulette wheel to spin red seven times in a row before betting on black.The
Player
class can raise an exception when they are done playing. This is an odd use case for an exception. The situation occurs exactly once in each simulation, and it is a well-defined condition: it doesn’t deserve to be called “exceptional” . It is merely a terminating condition for the game.
We recommend adding a method to the Player
class to indicate when the player
is finished. This gives the most flexibility, and it permits the Game
class
to cycle until the player withdraws from the game.
A consequence of this decision is to rework the :class: Game class
to allow the player to exit. This is relatively small change to
interrogate the Player
instance to see if they’re active
before asking them to place bets.
Note
Design Evolution
This section reveals situations we didn’t discover during
the initial design. It helped to have some experience with the
classes in order to determine the proper allocation of
responsibilities. While design walk-throughs are helpful, an
alternative is to create a “technical spike”: a piece of software that is
incomplete and can be disposed of. The earlier exercise created a
version of the Game
class that was incomplete,
and a version of Passenger57
that will have to be disposed of.
Creating Bets from Outcomes¶
Generally, a Player
instance will
have a few Outcome
instances on which they are betting. Many
systems are similar to the Martingale system, and place bets on only one
of the many Outcome
instances. These Outcome
objects are
usually created during player initialization. From these Outcome
instances,
the Player
object can create the individual Bet
instances based on their betting strategy.
Since we’re currently using the Wheel
class as a repository for all legal
Outcome
instances, we’ll need to provide the Wheel
class to the
Player
.
This doesn’t generalize well for Craps or Blackjack. We’ll need to revisit
this design decision. In the long run, we’ll need to find another kind of factory for
creating proper Outcome
instances.
We’ll design the base class of Player
and a specific subclass,
Martingale
. This will give us a working player that we can
test with.
Player Design¶
-
class
Player
¶ Player
places bets in Roulette. This an abstract class, with no actual body for thePlayer.placeBets()
method. However, this class does implement the basicPlayer.win()
method used by all subclasses.
Fields¶
-
Player.
stake
The player’s current stake. Initialized to the player’s starting budget.
-
Player.
roundsToGo
The number of rounds left to play. Initialized by the overall simulation control to the maximum number of rounds to play. In Roulette, this is spins. In Craps, this is the number of throws of the dice, which may be a large number of quick games or a small number of long-running games. In Craps, this is the number of cards played, which may be large number of hands or small number of multi-card hands.
Constructors¶
Methods¶
-
Player.
playing
(self) → bool Returns
True
while the player is still active.
-
Player.
placeBets
(self) → None Updates the
Table
object with the variousBet
objects.When designing the
Table
class, we decided that we needed to deduct the amount of a bet from the stake when the bet is created. See the Table Roulette Table Analysis for more information.
-
Player.
win
(self, bet: Bet) → None - Parameters
bet (
Bet
) – The bet which won
Notification from the :class: Game object that the
Bet
instance was a winner. The amount of money won is available via theBet.winAmount()
method.
Martingale Player Design¶
-
class
Martingale
¶ Martingale
is aPlayer
who places bets in Roulette. This player doubles their bet on every loss and resets their bet to a base amount on each win.
Fields¶
-
Martingale.
lossCount
¶ The number of losses. This is the number of times to double the bet.
-
Martingale.
betMultiple
¶ The the bet multiplier, based on the number of losses. This starts at 1, and is reset to 1 on each win. It is doubled in each loss. This is always equal to .
Methods¶
-
Martingale.
placeBets
(self) → None¶ Updates the
Table
object with a bet on “black”. The amount bet is , which is the value ofbetMultiple
.
-
Martingale.
win
(self, bet: Bet) → None¶ - Parameters
bet (
Bet
) – The bet which won
Uses the superclass
Player.win()
method to update the stake with an amount won. This method then resetslossCount
to zero, and resetsbetMultiple
to1
.
-
Martingale.
lose
(self, bet: Bet) → None¶ - Parameters
bet (
Bet
) – The bet which won
Uses the superclass
Player.loss()
to do whatever bookkeeping the superclass already does. IncrementslossCount
by1
and doublesbetMultiple
.
Player Deliverables¶
There are six deliverables for this exercise. The new classes must have Python docstrings.
The
Player
abstract superclass. Since this class doesn’t have a body for theplaceBets()
, it can’t be unit tested directly.A revised
Passenger57
class. This version will be a proper subclass ofPlayer
, but still place bets on black until the stake is exhausted. The existing unit test forPassenger57
class should continue to work correctly after these changes.The
Martingale
subclass of thePlayer
class.A unit test class for the
Martingale
class. This test should synthesize a fixed list ofOutcome
instances,Bin
instances, and calls aMartingale
instance with various sequences of reds and blacks to assure that the bet doubles appropriately on each loss, and is reset on each win.A revised :class: Game class. This will check the player’s
playing()
method before callingplaceBets()
method, and do nothing if the player withdraws. It will also call the player’swin()
andloss()
methods for winning and losing bets.A unit test class for the revised :class: Game class. Using a non-random generator for
Wheel
instance, this should be able to confirm correct operation of the :class: Game class for a number of bets.
Looking Forward¶
Now that we have working Table
, Game
, and Player
classes, we have
two fundamental choices. One option is to build more subclass of the Player
class.
The other choice is to put an overall simulation wrapper around the work done so far.
Building the overall simulation control allows us to deliver a small, working example before investing time in building more sophisticated features. This is a very helpful next step, so the next chapter will look at overall simulation control.


{{vm.markers.length}} crimes reported within these bounds.
More than 1000 crimes within these bounds. Only showing top 1000.


If you can see this page you need to set up a volume. Refer to the README.
This manifest.json file is here to test the configuration of the server. It should transfer as a file and not load into a browser window as text.


_Dancer_in_the_Dark_ (R) **** (out of ****)
Without question, the love-it-or-hate-it reaction that greeted Lars von Trier's _Dancer_in_the_Dark_ at this year's Cannes Film Festival will be duplicated as the film slowly rolls out in theatres across the country. The controversial winner of this year's Palme d'Or is a film that not only challenges conventional explanation, it also defies easy analysis. But given the dramatic effect--both positive and negative--that it has on audiences, it can be agreed that Dancer in the Dark is a film like no other, and even if only to simply bear witness to such a bold, experimental work, it commands a viewing.
However, I believe there is a lot more to _Dancer_ than simple curiosity value, and I think my--and the rest of the film's fans'--embrace of the film stems from an idea suggested in a comment that von Trier made (which has also been echoed by co-star Catherine Deneuve) about the film's star, Icelandic music sensation Björk (who won the Best Actress prize at Cannes): "She can't really act; she can only feel." Similarly, I think the key to appreciating _Dancer_ is not to watch it, but to "feel" it--to experience the raw gamut of emotions it thrusts upon the audience throughout its 140 minutes.
This idea of "feeling"--and the big debate over the film--is established long before a single image appears on screen. _Dancer_ begins with a somber five-minute overture accompanied by a black screen, and it would be easy to dismiss it as a pompously pretentious move. But it also clearly announces two of von Trier's objectives in this film: first, to evoke the spirit of the grand melodramas of yesteryear; and second, to immerse the audience the point of view of his main character, Selma Jezkova (Björk).
Selma, a Czech immigrant trying to carve out a living as a punch press operator in the 1960s Pacific Northwest, is going blind. Keeping Selma going as her condition rapidly deteriorates is the love of and for her 12-year-old son Gene (Vladica Kostic) and her love for the lavish Hollywood screen musicals. The latter initially manifests itself in Selma's life in her ability to imagine music out of everyday sounds. While the strains of the overture don't derive from such a recognizable source noise, this opening gets the general idea across: the audience sees darkness yet can hear music, much like how Selma experiences her reality.
A number of writers as well as distributor Fine Line Features have been remarkably indiscreet about divulging details about _Dancer_'s story; in fact, the film's trailer gives away one critical plot point. I won't do that myself though I will say this much more about the story: Selma's condition is hereditary, and she puts away every single penny of her negligible factory wages toward an operation that would save Gene from her literally dark fate. To say more than that is to say too much, making the temptation to include spoilers quite understandable--there really isn't much to von Trier's story. That has also been leveled as a criticism of the film, but I think it's a deliberate move; the straightforward plot again reflects old-fashioned screen melodrama dating back to the silent era.
There is another cinematic spirit von Trier conjures up, and that is of the classic, cheery Hollywood musical. References are everywhere--Selma regularly attends showings of Busby Berkeley tunefests with her best friend and co-worker Kathy (Deneuve), who often has to verbally describe the onscreen action to her; Selma and Kathy spend a number of their off hours rehearsing for a community theater production of _The_Sound_of_Music_; and, most notably, Selma has elaborate fantasies of her life as a musical. These numbers, which are shown in a glorious mock-Technicolor splendor, starkly contrast with Selma's reality not only in a visual sense (the shaky hand-held camera work and washed out, _Breaking_the_Waves_-style hues evaporate in favor of a vibrant faux Technicolor and quick cuts between what reportedly are up to 100 fixed digital video cameras) but in an emotional sense--these scenes are all unbridled joy while the rest of the film bears an unshakable air of misfortune and misery. Much has been said about von Trier "reimagining" musical conventions by marrying high-kicking production numbers with a grim story, but, again, he's not so much attempting something fresh than reviving what had been an out-of-fashion aesthetic: that of classical opera, which invariably is tragedy set to music.
Granted, however, these are non-traditional musical numbers, beginning with the music itself. Björk composed all of the songs, and like her other work they are characterized by a dissonant marriage between orchestral arrangements and more manufactured sounds--an admittedly acquired taste for general listening, but a perfect match for this context; nearly all of Selma's numbers are triggered by a real world noise, which lingers as a song's backbeat. That makes just about none of the songs instantly hummable nor memorable (though the pivotal "I've Seen It All" leaves a haunting impression); consequently, each appearance of a musical number--which are all heavily choreographed--is made all the more jarring and, in certain cases, annoying. Nonetheless, a strange effect is achieved; a couple of the interludes don't quite work as you watch them, but when looked back upon as part of the bigger, completed picture, a method is revealed to the madness. Selma's imaginings grow more outrageous as her situation grows more dire, and it becomes clear that her dreams are not so much an escape route from her real life than her only way of actively and effectively living that life.
If, as the comment goes, Björk can't act but only feel, von Trier could not have made a better choice for his lead. Selma's story is all about emotion, and in order for _Dancer_ to succeed, her portrayer must make an instant connection with the audience. And that Björk instantly achieves; Selma may be rather naïve (another point of criticism for the hate-its), but she is endearingly, honestly so, and one is easily willing to accompany her on her flights of fancy and stand by her during her many trials and tribulations. While von Trier's radical storytelling and directorial hand are a large factor, the astonishing, unadorned force of the film's finale would not have been achieved with an "actress" playing Selma. Björk simply is Selma--and the film itself.
Given von Trier's reputation as an insincere provocateur, the impassioned hate-it contingent for _Dancer_in_the_Dark_ is not only understandable, perhaps it's even correct in pegging the film as a fraudulent come-on. _Dancer_ could very well be read as some sick joke, a cynical jab at an America that invites foreigners to its land with sunny propaganda (here, movie musicals) only to plop them down in the diametrically opposing genre--tragic melodrama; or even an experiment in shameless audience manipulation. But if von Trier's machinations are able to wring such a genuine and profound emotional response from the audience by the final frame (and I speak not only of the overwhelming sense of loss and devastation it brings the film's admirers but also the equally fervent anger it incites in its detractors) how can the work be--as the now-infamous _Daily_Variety_ review of the film put it--"artistically bankrupt on every level"? (opens September 23 in New York)
Michael Dequina<EMAIL_ADDRESS>|<EMAIL_ADDRESS>|<EMAIL_ADDRESS>Mr. Brown's Movie Site: http://www.moviereportsite.com CinemaReview Magazine: http://www.CinemaReview.com on ICQ: #25289934 | on AOL Instant Messenger: MrBrown23
The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.
Please direct comments/criticisms of the review to relevant newsgroups.
Broken URLs inthe reviews are the responsibility of the author.
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
Related links: index of all rec.arts.movies.reviews reviews


Numbers 1:49
Only thou shalt not number the tribe of Levi, neither take the sum of them among the children of Israel:


| DOSE: |
repeated |
insufflated |
Cocaine |
(powder / crystals) |
I am writing from inside an increasing addiction to my favorite drug. I did coke the first time when I was 17, with a very hot boy who was an excellent lover. He would have me drive him to the city to buy and sell drugs. I loved it from the first time, the smell, the feeling, the horniness. I wasn't exactly a coke whore for him, I'd have hung out without the drugs, but it was certainly a bonus. I didn't do it anymore until I was 24, mostly because I was in a very domestic relationship and had a little boy.
After I left that relationship, which was unhealthy, I started hitting the bar scene in my town and lo and behold, my town is in the middle of a cocaine 'epidemic, which to me was just a stroke of good good luck. It's everywhere. I do it because I'm bored, because I want to feel happy. I know all about dopamine levels and all the other reasons cocaine works and why it brings me down farther than when I started when I come off it.
Recently I've been messing with a very good looking coke dealer, which I recognize to be unhealthy, but the sex and the drugs, and yes the combination are just too tempting. I'm very smart and generally have a non-addictive personality, but lately I've had three separate experiences of staying up all night, splitting a teener (1.75g) with this man. Usually I can sleep on moderate levels of coke, but not that amount. I've missed some work. I've started to realize that I've done lines in the bathrooms of just about every bar I've gone to this year. I carry around between a gram and an eight-ball in my car or purse at all times.
I roll it around in my vial and think 'I love you.' I have a professional reputation by day, and even by night only a very few people know I do coke at all. I feel fairly confident that I'll get bored of the coke and let it go at some point - I hope. But I thought it might help to contribute the perspective of someone who is still on the upside of developing a habit. Every time I'm scared I might have a heart attack, especially when I smoke it off of foil, I know unprocessed coke can kill me. Especially when I do huge rails for the fifth time at 3:00 am. But it is beautiful and white and it is happiness in a jar.
Experience Reports are the writings and opinions of the individual authors who submit them.
Some of the activities described are dangerous and/or illegal and none are recommended by Erowid.


|
lwIP
2.1.3
Lightweight IP stack
|
#include "lwip/opt.h"
#include "lwip/def.h"
#include "lwip/pbuf.h"
#include "lwip/ip4_addr.h"
#include "lwip/err.h"
#include "lwip/netif.h"
#include "lwip/prot/ip4.h"
Macros | |
| #define | IP_OPTIONS_SEND (LWIP_IPV4 && LWIP_IGMP) |
Functions | |
| struct netif * | ip4_route (const ip4_addr_t *dest) |
| struct netif * | ip4_route_src (const ip4_addr_t *src, const ip4_addr_t *dest) |
| err_t | ip4_input (struct pbuf *p, struct netif *inp) |
| err_t | ip4_output (struct pbuf *p, const ip4_addr_t *src, const ip4_addr_t *dest, u8_t ttl, u8_t tos, u8_t proto) |
| err_t | ip4_output_if (struct pbuf *p, const ip4_addr_t *src, const ip4_addr_t *dest, u8_t ttl, u8_t tos, u8_t proto, struct netif *netif) |
| err_t | ip4_output_if_src (struct pbuf *p, const ip4_addr_t *src, const ip4_addr_t *dest, u8_t ttl, u8_t tos, u8_t proto, struct netif *netif) |
| err_t | ip4_output_if_opt (struct pbuf *p, const ip4_addr_t *src, const ip4_addr_t *dest, u8_t ttl, u8_t tos, u8_t proto, struct netif *netif, void *ip_options, u16_t optlen) |
| err_t | ip4_output_if_opt_src (struct pbuf *p, const ip4_addr_t *src, const ip4_addr_t *dest, u8_t ttl, u8_t tos, u8_t proto, struct netif *netif, void *ip_options, u16_t optlen) |
| void | ip4_set_default_multicast_netif (struct netif *default_multicast_netif) |
IPv4 API
Currently, the function ip_output_if_opt() is only used with IGMP
This function is called by the network interface device driver when an IP packet is received. The function does the basic checks of the IP header such as packet size being at least larger than the header size etc. If the packet was not destined for us, the packet is forwarded (using ip_forward). The IP checksum is always checked.
Finally, the packet is sent to the upper layer protocol input function.
| p | the received IP packet (p->payload points to IP header) |
| inp | the netif on which this packet was received |
| err_t ip4_output | ( | struct pbuf * | p, |
| const ip4_addr_t * | src, | ||
| const ip4_addr_t * | dest, | ||
| u8_t | ttl, | ||
| u8_t | tos, | ||
| u8_t | proto | ||
| ) |
Simple interface to ip_output_if. It finds the outgoing network interface and calls upon ip_output_if to do the actual work.
| p | the packet to send (p->payload points to the data, e.g. next protocol header; if dest == LWIP_IP_HDRINCL, p already includes an IP header and p->payload points to that IP header) |
| src | the source IP address to send from (if src == IP4_ADDR_ANY, the IP address of the netif used to send is used as source address) |
| dest | the destination IP address to send the packet to |
| ttl | the TTL value to be set in the IP header |
| tos | the TOS value to be set in the IP header |
| proto | the PROTOCOL to be set in the IP header |
| err_t ip4_output_if | ( | struct pbuf * | p, |
| const ip4_addr_t * | src, | ||
| const ip4_addr_t * | dest, | ||
| u8_t | ttl, | ||
| u8_t | tos, | ||
| u8_t | proto, | ||
| struct netif * | netif | ||
| ) |
Sends an IP packet on a network interface. This function constructs the IP header and calculates the IP header checksum. If the source IP address is NULL, the IP address of the outgoing network interface is filled in as source address. If the destination IP address is LWIP_IP_HDRINCL, p is assumed to already include an IP header and p->payload points to it instead of the data.
| p | the packet to send (p->payload points to the data, e.g. next protocol header; if dest == LWIP_IP_HDRINCL, p already includes an IP header and p->payload points to that IP header) |
| src | the source IP address to send from (if src == IP4_ADDR_ANY, the IP address of the netif used to send is used as source address) |
| dest | the destination IP address to send the packet to |
| ttl | the TTL value to be set in the IP header |
| tos | the TOS value to be set in the IP header |
| proto | the PROTOCOL to be set in the IP header |
| netif | the netif on which to send this packet |
| err_t ip4_output_if_opt | ( | struct pbuf * | p, |
| const ip4_addr_t * | src, | ||
| const ip4_addr_t * | dest, | ||
| u8_t | ttl, | ||
| u8_t | tos, | ||
| u8_t | proto, | ||
| struct netif * | netif, | ||
| void * | ip_options, | ||
| u16_t | optlen | ||
| ) |
Same as ip_output_if() but with the possibility to include IP options:
@ param ip_options pointer to the IP options, copied into the IP header @ param optlen length of ip_options
| err_t ip4_output_if_opt_src | ( | struct pbuf * | p, |
| const ip4_addr_t * | src, | ||
| const ip4_addr_t * | dest, | ||
| u8_t | ttl, | ||
| u8_t | tos, | ||
| u8_t | proto, | ||
| struct netif * | netif, | ||
| void * | ip_options, | ||
| u16_t | optlen | ||
| ) |
Same as ip_output_if_opt() but 'src' address is not replaced by netif address when it is 'any'.
| err_t ip4_output_if_src | ( | struct pbuf * | p, |
| const ip4_addr_t * | src, | ||
| const ip4_addr_t * | dest, | ||
| u8_t | ttl, | ||
| u8_t | tos, | ||
| u8_t | proto, | ||
| struct netif * | netif | ||
| ) |
Same as ip_output_if() but 'src' address is not replaced by netif address when it is 'any'.
| struct netif* ip4_route | ( | const ip4_addr_t * | dest | ) |
Finds the appropriate network interface for a given IP address. It searches the list of network interfaces linearly. A match is found if the masked IP address of the network interface equals the masked IP address given to the function.
| dest | the destination IP address for which to find the route |
| struct netif* ip4_route_src | ( | const ip4_addr_t * | src, |
| const ip4_addr_t * | dest | ||
| ) |
Source based IPv4 routing must be fully implemented in LWIP_HOOK_IP4_ROUTE_SRC(). This function only provides the parameters.


DEEP RISING (1998)
A film review by Steve Kong Copyright 1998 Steve Kong
Deep Rising is a B-movie stuck in an A-movie body. Director Stephen Sommers (Jungle Book) is able to keep the campiness high and not take the film too seriously, which keeps the film from falling flat on its face.
Imagine a film about a large luxury boat sinking with thousands dead or dying. No, this is not Titanic. Nor does this film have any of the great characteristics that made Titanic so wonderful. Missing are the characters that we can latch onto or the plot to completely pull you into the film.
A group of heavily armed mercenaries is about to over take this huge luxury boat, The Argonaut. When they arrive and board the ship, they find that the ship is empty and very bloody. Not one soul can be found, not even a corpse.
The mercenaries, led by Hanover (Wes Studi), are taken out to the luxury ship by Finnegan (Treat Williams). Aboard the ship, untouched by whatever got to everyone else, is a beautiful jewel thief, Trillian (Famke Janssen). As the mercenaries, along with Finnegan and crew, search out the ship, they soon run into Trillian. Together they find that there is something horrible aboard the ship.
About halfway through the film we are introduced to the horror that is on the ship. It comes in the form of an octopus-like creature that ravaged the ship and its passengers. Now, do not imagine a common octopus that you might see at the local aquarium. This creature is huge and it is hungry. How does the creature terrorize these people? Think tentacles. Think jaws on tentacles. Think speed and deadly aim. That's how this creature terrorizes the main characters.
Deep Rising is not a horrible movie but at points it's a painful movie. What is most painful about the movie? Kevin J. O'Connor. His character, Joey (Finnegan's ship mechanic), is written as the comic relief of the film but serves as the opposite. Every time he was on screen I kept mentally cheering, "Die, Joey! Die!"  His screen time is as enjoyable as chewing aluminum foil.
I'm happy to say that everyone else fares a bit better in the film, especially Treat Williams and Framke Janssen. Both suffer from bad dialogue, but as a whole, their reputation comes out somewhat unscathed. It's nice to see Famke Janssen again; she was introduced to us in GoldenEye as a bad Bond girl. One face that might stand out is Djimon Hounsou's, one of the mercenaries. It's disappointing to see Hounsou in such a mediocre and short role after seeing his wonderful performance in Amistad.
The music by Jerry Goldsmith is forgettable. At times, the score seems overly campy, which fits the movie just right. Then there are times when the score is too serious and falls out of place.
The special effects are admirable. The creature is scary enough, but director Sommers does not use it to its full potential. One special effect that disappointed was "the fireball." When is Hollywood going to learn that it is impossible to outrun an exploding fireball?
Deep Rising's saving grace is that it doesn't take itself too seriously. >From its campy script to its over-the-top action and its cool looking creature, Deep Rising is a blast if you don't walk into the theatre expecting too much. If you want to have some mindless fun, catch Deep Rising in the theatres.
--- steve kong<EMAIL_ADDRESS>find the latest movie reviews at the hard boiled movie page http://boiled.sbay.org/boiled/
The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.
Please direct comments/criticisms of the review to relevant newsgroups.
Broken URLs inthe reviews are the responsibility of the author.
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
Related links: index of all rec.arts.movies.reviews reviews


WITNESS LIST Judicial Affairs Committee March 5, 2001-2:00P HB 546 For: Kauffman, Al (MALDEF) Reyes, Frumencio (Mexican American Bar Association) Salazar, Joel (Mexican American Bar Association) Against: Hernandez, James (Young Conservatives of Texas) Rodriguez, Rene (Young Conservatives of Texas) On: Bickett, Mari Kay (Self and Texas Center for the Judiciary) McCorkle, Judge Lamar (Self) Registering, but not testifying: On: Reaves, Margaret (State Commission on Judicial Conduct) HB 808 For: Guillot, Patrick (Uniform Laws Commissioner) HB 1083 For: Rothermel, John F. (Stewart Title Guaranty Co.) Registering, but not testifying: For: Herman, Judge Guy (Self and Judges of the Statutory Probate Courts of Texas) Lee, Randy (Stewart Title Guaranty Co.) Sneed, Robert (Texas Land Title Association) HB 1107 For: Loessberg, Rick (Dallas County Commissioners Court) HB 1112 For: Edwards, Mark (Self) HB 1131 Registering, but not testifying: For: Herman, Judge Guy (Self and Judges of the Statutory Probate Courts of Texas) Jones, Jerry (Real Estate, Probate & Trust Law Section of the State Bar of Texas) HB 1132 For: Jamieson, Lisa (Real Estate, Probate & Trust Law Section of the State Bar) Jones, Jerry (Real Estate, Probate & Trust Law Section of the State Bar) Registering, but not testifying: For: Herman, Judge Guy (Self and Judges of the Statutory Probate Courts of Texas) HB 1287 For: Blustein, David (Montgomery County District Attorney's Office) Creuzot, Judge John (Self) Dawson-Brown, Claire (Self and Travis County District Attorney) Frazier, Jeff (Texas ACLU) Greenspan, Patricia (Self and Travis County Drug Court) Heikkala, Karen (Self) Holt, Charles (Self and Common Cause Texas) Keenan, Barry (New Directions in Corrections/C-Cubed Institute) Smith, Dan (Travis County Judge Samuel T. Biscoe) Yarborough, Sylvia (Montgomery County District Attorney's Office) Against: Noll, Chuck (Harris County District Attorney's Office) On: Munoz, Manuel (Texas Comptroller) Registering, but not testifying: For: Ellinger, Wally (Self) Flint, Janice (Self) Jackson, Larry (Self) Jackson, Sandra (Self) Joblin, Elizabeth (Self) Johnson, Drew (Self) Kamm, Bob (Travis County Commissioners Court) Leath, Jean (Self) Mendez, Mark (Tarrant County Commissioners Court) Moseley, Ola Ann (Self) Rittenberry, Suzanne (Texas CURE) Scott, Rider (Greater Dallas Crime Commission) Velasquez, Sally (Webb County) HB 1287 Amendment (Deshotel/Amend. #4) For: Creuzot, Judge John (Self) Yarborough, Sylvia (Montgomery County District Attorney's Office) HB 1287 Amendment (Solis/Amendment # 1) Against: Noll, Chuck (Harris County District Attorney's Office) HB 1459 For: Carroll, B.F. Hank (Texas Cemeteries Association) HB 1560 For: Nations, Hugh (Men & Fathers Resource Center/Texas Fatherhood Initiative) On: Buhmann, Elizabeth (Office of the Attorney General)