.. py:currentmodule:: astropathdb.db_io.load_sample :py:func:`.load_astrosample` ====================================== .. py:function:: load_astrosample(sampleid, sdata = None, astrodb = None, database = None, *, image = True, annotations = True, cells_positions = MappingProxyType({}), cells_boundaries = MappingProxyType({}), cells_table = MappingProxyType({})) :single-line-parameter-list: Load sample data into the :class:`~spatialdata.SpatialData` framework. When loaded, the data will be labeled in the object by prepending the element with the unique sample specifier: "sampleid\_\ ``sampleid``", followed by a unique element description. The package will use the specifier and element description for referencing the elements later. Examples of some common labels are provided in the :func:`~sidus.utils.sdata_utils.lookup_element` method which can be used to lookup items in one of the elements for a sample (ex\: :attr:`~spatialdata.SpatialData.images`, :attr:`~spatialdata.SpatialData.shapes`, :attr:`~spatialdata.SpatialData.tables`). Use input arguments for elements to optionally load sample data. Only elements with the ``sampleid`` input are affected. Sample element data is only reloaded for an element if a mapping is passed to the element argument or by passing ``'reload'`` to the element argument. :param sampleid: A single or list of sampleids to load the data from. :param sdata: A :class:`~spatialdata.SpatialData` object to load the data into. If not provided a new :class:`~spatialdata.SpatialData` will be returned, :param astrodb: A :class:`~.AstroDB` database connection instance to use. If not provided an instance will be created using the ``sciserver_creds.txt`` file. :param database: The database context that contains the sample. By default we use the 'apmifwsi001_DR2' database context. If providing an ``astrodb`` this variable is not used, be sure the context of the ``astrodb`` input specifies the appropriate database. :param image: Load image data into the object (Defaults to ``True``). :param annotations: A logical value to load annotations or a mapping for what to load. Allowed arguments are columns, instance_id, geometry_id, table_name, and any of the sql filters. Defaults to True. Annotations are loaded from the :ref:`annotations_schema` by default. :param cells_table: A logical value to load cell tables or a mapping for what to load. Allowed arguments are columns, instance_id, coordinate_ids, table_name, and any of the sql filters. (Defaults to ``False``). Cells are loaded from the :ref:`celltag_schema` by default. :param cells_positions: A logical value to load cell centriods into the shapes element or a mapping for what to load. Allowed arguments are columns, instance_id, geometry_id, table_name, and any of the sql filters. (Defaults to ``False``). Cells positions are loaded from the :ref:`celltag_schema` by default. :param cells_boundaries: A logical value to load cell centriods into the shapes element or a mapping for what to load. Allowed arguments are columns, instance_id, geometry_id, table_name, and any of the sql filters. (Defaults to ``False``). Cells boundaries are loaded from the :ref:`cellgeom_schema` by default and only membranes are loaded using ``btype``. .. note:: When passing ``columns`` to load additional data for the elements, be sure that the columns exist in the table the element requests data from. If passing a ``table_name``, it is likely all of the keyword arguments need to be specified (this has not been throughly tested). .. seealso:: :meth:`.AstroDB.add_sql_filters` for a full description on the filters that can be applied. In brief, the data can be filtered by passing a column name and values to include. For example, to only include ``tdist`` between 0 and 500 pass {'tdist':[0,500]}. Allowed filters: - sampleid: Filter on the sampleid column. - ptype: Filter on the ptype column. - exprphenotype: Filter on exprphenotype column. - px: Filter on px column. - py: Filter on py column. - btype: Filter on btype column (0: Nuclei and 1:EntireCell). - lname: Filter on the annotation layer names. - tdist: Filter on tumor distance. ``func_filter`` args: - val or : A list or string indicating the values for the filter. Passing "*" will skip adding any filter. If passing named arguments, this can be passed as an argument to the filter name vs 'val' (e.g. ``{'ptype': '1'}``). If using a default include, arguments do not have to be named. - table_name: *(Optional(str))* The table name to query the column from. This can be applied when querying from multiple tables and must be a string not the ORM object. - context: *(Optional(str))* The database context to query the column from. Can be used to generate cross database queries and must be a string not the ORM object. - include: *(Optional(bool))* Should we include or exclude the values supplied in the val argument (default: ``True``). - between: *Optional(bool))* Should we use a "between" clause or "in" clause when passing a list to ``val`` (default: ``False``). Overrides ``include``. - bitwise: *Optional(Union(bool, str)))* For bitwise operations pass a boolean argument for default '&' operations (uses ``include``).