dragonn.synthetic.util module¶
-
class
dragonn.synthetic.util.
ArgsAndKwargs
(args, kwargs)¶ Bases:
tuple
-
args
¶ Alias for field number 0
-
kwargs
¶ Alias for field number 1
-
-
class
dragonn.synthetic.util.
ArgumentToAdd
(val, argumentName=None, argNameAndValSep='-')[source]¶ Bases:
object
Class to append runtime arguments to a string to facilitate auto-generation of output file names.
-
class
dragonn.synthetic.util.
ArrArgument
(val, argumentName, sep='+', toStringFunc=<type 'str'>)[source]¶
-
dragonn.synthetic.util.
CROSSC_NORMFUNC
¶ alias of
Enum
-
class
dragonn.synthetic.util.
CoreFileNameArgument
(val, argumentName=None, argNameAndValSep='-')[source]¶
-
dragonn.synthetic.util.
PERPOS_NORMFUNC
¶ alias of
Enum
-
class
dragonn.synthetic.util.
SparseArrFromDict
(theDict, defaultVal, totalLen)[source]¶ Bases:
object
-
dragonn.synthetic.util.
SplitNames
¶ alias of
Enum
-
class
dragonn.synthetic.util.
TeeOutputStreams
(*streams)[source]¶ Bases:
object
for piping to several output streams
-
closed
¶
-
-
class
dragonn.synthetic.util.
Titled2DMatrix
(colNamesPresent=False, rowNamesPresent=False, rows=None, colNames=None, rowNames=None)[source]¶ Bases:
object
has a 2D matrix, rowNames and colNames arrays
-
class
dragonn.synthetic.util.
TitledMapping
(titleArr, flagIfInconsistent=False)[source]¶ Bases:
object
- When each key maps to an array, and each index in the array is associated with
- a name.
-
class
dragonn.synthetic.util.
TitledMappingIterator
(titledMapping)[source]¶ Bases:
object
Returns an iterator over TitledArrs for the keys in titledMapping.mapping
-
class
dragonn.synthetic.util.
VariableWrapper
(var)[source]¶ For when I want reference-type access to an immutable
-
dragonn.synthetic.util.
addArguments
(string, args, joiner='_')[source]¶ args is an array of ArgumentToAdd.
-
dragonn.synthetic.util.
addDictionary
(toUpdate, toAdd, initVal=0, mergeFunc=<function <lambda>>)[source]¶ Defaults to addition, technically applicable any time you want to update a dictionary (toUpdate) with the entries of another dictionary (toAdd) using a particular operation (eg: adding corresponding keys)
-
dragonn.synthetic.util.
arrToDict
(arr)[source]¶ Turn an array into a dictionary where each value maps to ‘1’ used for membership testing.
-
dragonn.synthetic.util.
arrayEquals
(arr1, arr2)[source]¶ compares corresponding entries in arr1 and arr2
-
dragonn.synthetic.util.
computeRunningWindowOneOverMaxActivation_2d
(arr, smallerArr, windowSize)[source]¶
-
dragonn.synthetic.util.
crossCorrelateArraysLengthwise
(arr1, arr2, normaliseFunc, smallerPerPosNormFuncs=[], largerPerPosNormFuncs=[], auxLargerForPerPosNorm=None, auxLargerPerPosNormFuncs=[], pad=True)[source]¶
-
dragonn.synthetic.util.
executeForAllFilesInDirectory
(directory, function, fileFilterFunction=<function <lambda>>)[source]¶
-
dragonn.synthetic.util.
fracToRainbowColour
(frac)[source]¶ - frac is a number from 0 to 1. Map to
- a 3-tuple representing a rainbow colour.
1 -> (0, 1, 0) #green 0.75 -> (1, 0, 1) #yellow 0.5 -> (1, 0, 0) #red 0.25 -> (1, 1, 0) #violet 0 -> (0, 0, 1) #blue
-
dragonn.synthetic.util.
getBest
(arr, getterFunc, takeMax)[source]¶ - Will return a tuple of the
- index and the value of the best as extracted by getterFunc
-
dragonn.synthetic.util.
getBestLengthwiseCrossCorrelationOfArrays
(arr1, arr2, normaliseFunc, smallerPerPosNormFuncs, largerPerPosNormFuncs)[source]¶
-
dragonn.synthetic.util.
getNthInterval
(minVal, maxVal, numSteps, n, logarithmic, roundTo, cast)[source]¶ logarithmic: boolean indicating if want log numSteps vs linear roundTo: can be set to None for no rounding cast: can be set to just lambda x: x
-
dragonn.synthetic.util.
invertIndices
(selectedIndices, fullSetOfIndices)[source]¶ Returns all indices in fullSet but not in selected.
-
dragonn.synthetic.util.
multiprocessing_map_printProgress
(secondsBetweenUpdates, numThreads, func, iterable)[source]¶
-
dragonn.synthetic.util.
objectFromArgsAndKwargsFromYaml
(classOfObject, yamlWithArgsAndKwargs)[source]¶
-
dragonn.synthetic.util.
printCoordinatesForLabelSubsets
(regionIds, labels, labelSetsToFilterFor, outputFilePrefix)[source]¶ assumes regionIds of the form chr:start-end labelSetsToFilter as an iterable of iterables of the
label you want to subset. Will be incorportated into the filename- outputFile will be outputFilePrefix+”_”
- +”-”.join(str(x) for x in labelsToFilter)
-
dragonn.synthetic.util.
printRegionIds
(regionIds, labels, labelFilter, outputFile, idTransformation=<function <lambda>>)[source]¶
-
dragonn.synthetic.util.
sampleFromDiscreteDistribution
(discereteDistribution)[source]¶ Expecting an instance of DiscreteDistribution
-
dragonn.synthetic.util.
sampleFromRangeWithStepSize
(minVal, maxVal, stepSize, cast)[source]¶ cast can be just max-min
-
dragonn.synthetic.util.
sortByLabels
(arr, labels)[source]¶ - intended use case: sorting by cluster labels for
- plotting a heatmap
-
dragonn.synthetic.util.
splitIgnoringQuotes
(string, charToSplitOn=' ')[source]¶ will split on charToSplitOn, ignoring things that are in quotes