spateo.io.nanostring ==================== .. py:module:: spateo.io.nanostring .. autoapi-nested-parse:: IO functions for NanoString CosMx technology. Attributes ---------- .. autoapisummary:: spateo.io.nanostring.VERSIONS spateo.io.nanostring.FOV_PARSER Functions --------- .. autoapisummary:: spateo.io.nanostring.read_nanostring_as_dataframe spateo.io.nanostring.stitch_images spateo.io.nanostring.read_nanostring Module Contents --------------- .. py:data:: VERSIONS .. py:data:: FOV_PARSER .. py:function:: read_nanostring_as_dataframe(path: str, label_columns: Optional[List[str]] = None) -> pandas.DataFrame Read a NanoString CSV tx or metadata file as pandas DataFrame. :param path: Path to file. :param label_columns: Column names, the combination of which indicates unique cells. :returns: Pandas Dataframe with the following standardized column names. * `gene`: Gene name/ID (whatever was used in the original file) * `x`, `y`: X and Y coordinates .. py:function:: stitch_images(stain_dir: str, positions_path: str, labels: bool = False) -> numpy.ndarray Stitch multiple FOVs into a single image using position information. :param stain_dir: Directory containing JPEG or TIFF files with filenames ending in '_FXXX' where XXX indicates the FOV index. :param positions_path: Path to CSV file containing FOV positions. :param labels: Whether these are labels (and therefore should be made unique). :returns: A numpy array containing the stitched image. May contain multiple channels, which is the last dimension of the array. .. py:function:: read_nanostring(path: str, meta_path: Optional[str] = None, binsize: Optional[int] = None, label_columns: Optional[Union[str, List[str]]] = None, add_props: bool = True, version: typing_extensions.Literal[cosmx] = 'cosmx') -> anndata.AnnData Read NanoString CosMx data as AnnData. :param path: Path to transcript detection CSV file. :param meta_path: Path to cell metadata CSV file. :param scale: Physical length per coordinate. For visualization only. :param scale_unit: Scale unit. :param binsize: Size of pixel bins :param label_columns: Columns that contain already-segmented cell labels. Each unique combination is considered a unique cell. :param add_props: Whether or not to compute label properties, such as area, bounding box, centroid, etc. :param version: NanoString technology version. Currently only used to set the scale and scale units of each unit coordinate. This may change in the future. :returns: Bins x genes or labels x genes AnnData.