malva.serve.serve module

exception malva.serve.serve.SequenceValidationError(message, help_text=None)[source]

Bases: ValueError

Custom error for sequence validation issues

__init__(message, help_text=None)[source]
malva.serve.serve.interactive_query_standard(sequence, sliding_size=128, pct_threshold=0.65, low_complexity_filter=True, countmaxkmer=100000, countminkmer=10)[source]

Process standard sequence query

Return type:

Tuple[ndarray, ndarray, List]

class malva.serve.serve.MalvaProxyFix(app, uuid)[source]

Bases: object

Custom middleware for handling proxy prefixes

__init__(app, uuid)[source]
class malva.serve.serve.SpatialData(coordinates, values, bounds)[source]

Bases: object

Class to hold spatial data and related methods

coordinates: ndarray
values: ndarray
bounds: Tuple[float, float, float, float]
property xmin: float
property xmax: float
property ymin: float
property ymax: float
__init__(coordinates, values, bounds)
class malva.serve.serve.GlobalState[source]

Bases: object

Singleton class to manage global state and data

__init__()[source]
initialize_from_index(index_path, max_mem=32)[source]

Initialize global state from a malva index file

initialize(coordinates, values, bounds)[source]

Initialize with data

get_bounds()[source]

Get the coordinate bounds

get_coordinates()[source]

Get the spatial coordinates

class malva.serve.serve.UserSession(session_id)[source]

Bases: object

Class to manage per-user session data

__init__(session_id)[source]
initialize_background()[source]

Initialize session with background data from global state

add_query_result(locations, intensities)[source]

Add query results to user session

add_background_data(coordinates, values)[source]

Store background data

get_tile_data(x, y, zoom)[source]

Get tile data for this user’s view

Return type:

ndarray

cleanup()[source]

Clean up session data

malva.serve.serve.create_app(init_state=True, _uuid=None)[source]

Application factory function