Metadata-Version: 2.4
Name: napari-molecular-cartography-viewer
Version: 0.1.0
Summary: A simple plugin to use Molecular Cartography Viewer within napari
Author: Yaohua Li
Author-email: liyaohua12345@foxmail.com
License: BSD 3-Clause License
        
        Copyright (c) 2026, yaohualee1215-bit
        
        Redistribution and use in source and binary forms, with or without
        modification, are permitted provided that the following conditions are met:
        
        1. Redistributions of source code must retain the above copyright notice, this
           list of conditions and the following disclaimer.
        
        2. Redistributions in binary form must reproduce the above copyright notice,
           this list of conditions and the following disclaimer in the documentation
           and/or other materials provided with the distribution.
        
        3. Neither the name of the copyright holder nor the names of its
           contributors may be used to endorse or promote products derived from
           this software without specific prior written permission.
        
        THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
        AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
        IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
        DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
        FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
        DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
        SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
        CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
        OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
        OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
        
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Framework :: napari
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Image Processing
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy
Requires-Dist: magicgui
Requires-Dist: qtpy
Requires-Dist: scikit-image
Provides-Extra: all
Requires-Dist: napari[all]; extra == "all"
Dynamic: license-file

# napari-molecular-cartography-viewer

A napari dock widget to **visualize exported molecular coordinate tables (CSV)** as transcript points.  
It supports **multi-gene overlay**, value thresholding, and an optional gray background layer showing all transcripts.

> This plugin is intended for **exported/parsed coordinate tables** (CSV).  
> It does **not** require or reverse-engineer any proprietary file formats.

## Compatibility

- **Python:** 3.10–3.13 (tested on 3.11)
- **napari:** 0.6.x (tested on 0.6.6)

## CSV format requirements

The plugin auto-detects **4 required fields**. Column names may vary, but must match one of the accepted names below.

### Required columns

| Field | Meaning | Accepted column names |
|------|---------|------------------------|
| `x`  | X coordinate (pixel) | `x`, `X` |
| `y`  | Y coordinate (pixel) | `y`, `Y` |
| `gene` | Gene / target name | `gene`, `Gene`, `target`, `ID` |
| `val` | Numeric value (intensity/score/confidence) | `val`, `value`, `intensity`, `score`, `confidence`, `qc`, `V`, `v` |

Notes:
- napari points are rendered in **(y, x)** order internally.
- `val` must be numeric; non-numeric/NaN rows are automatically dropped.
- The CSV must contain a header row.

### Minimal example

```csv
x,y,gene,val
120.5,88.2,GLYMA_01G000100,12.3
121.0,88.9,GLYMA_01G000100,8.1
500.2,410.7,NOD26,30.0
```

## Usage

1. Start napari.
2. Open the viewer: **Plugins → Molecular Cartography Viewer**
3. Click **Choose CSV…** and select your exported/parsed `.csv`.
4. Search genes by substring, multi-select candidates, click **Add →**
5. Click **Update display** to render selected genes.

## Options

- **Show gray background layer**: toggles `All_transcripts`
- **Value threshold**: keep points with `val >= threshold` (unless “Ignore threshold” is checked)
- **Ignore threshold**: show all points for selected genes
- **Scale size by value**: point size mapped to `val`
- **Opacity / Base size**: affects per-gene layers
- All point layers are forced to render with **no borders** for clean visualization.

## Installation

### From PyPI

```bash
pip install napari-molecular-cartography-viewer
```

If you need a full napari install in a fresh environment:

```bash
pip install "napari[all]" napari-molecular-cartography-viewer
```

## Notes

### Reading LZW-compressed TIFF images (optional)
If your background image is a TIFF with **LZW compression**, install `imagecodecs`:

```bash
conda install -c conda-forge imagecodecs
```

## License

BSD-3-Clause. See `LICENSE`.
