sciquence.sequences

Cutting

seq(array) Cut input array into sequences consisting of the same elements
nseq(array) Returns sequences consisting of zeros
pseq(array) Returns sequences consisting of ones
specseq(array, element) Return sequences consisting of specific tag
seqi(array) Get list of sequences and corresponding list of indices
nseqi(array) Get list of negative sequences indices (consisting of zeroes)
pseqi(array) Get list of positive sequences indices (consisting of ones)
specseqi(array, elem) Get list of sequences indices, consisting of specific element
chunk(array, chunk_size) Split numpy array into chunks of equal length.

Comparing

lseq_equal(lseqa, lseqb) Compare two lists of ndarrays
shapes_equal(*arrays) Check if all the arrays have the same shape.
size_equal(*arrays, **kwargs) Check if all the arrays have the same length along the particular axis.

Sampling

random_slice(array_len, slice_length) Choose a random slice of given length

Sorting

parallel_sort(*arrays, **kwargs) Parallel sort.

Searching

mslc Given a length n real sequence, finds the consecutive subsequence of length at most U with the maximum sum in O(n) time.
longest_segment Find the longest subsequence which scores above a given threshold in O(n)
max_avg_seq Given a length n real sequence, finding the consecutive subsequence of length at least L with the maximum average can be done in O(n log L) time.