semvec/pypi-packages huggingface dataset:
chloris-app-sdk 1.2.0
A package created with a setuptools tutorial.  See article link for more details.
License: MIT

# The Chloris Platform Python SDK

The Chloris Platform Python SDK (_chloris-app-sdk_) is a Python package that provides a convenient interface to the Chloris Platform API. It is designed to be used by both humans and machines, but if you are a human you may find it easier to use the [Chloris Platform](https://app.chloris.earth/) web interface. Note that the API is only available for use with premium organizations, please contact us if you are interested in using the API.

See the [API documentation](https://app.chloris.earth/docs/index.html) for more information about the Chloris Platform API.

See the [Python API reference](./docs/index.md) for the full list of functions and classes available in the SDK.

## Installation

To install the Chloris Platform Python SDK run:

```bash
pip install chloris_app_sdk
```

## Usage

### Authentication

The Chloris Platform API uses [OAuth 2.0](https://oauth.net/2/) for authentication. You can authenticate using either a refresh token or an ID token. Refresh tokens are long-lived and can be used to generate new ID tokens. ID tokens are short-lived and can be used directly for authentication. Refresh tokens are recommended for use in scripts and ID tokens are recommended for use in web applications.

See the [Chloris Platform API documentation](https://app.chloris.earth/docs/index.html) for more information about authentication.

### Listing sites

Here is an example which lists active sites in your organization, then prints the annual stock for the first site, and then the average biomass density for 2015:

```python
from chloris_app_sdk import ChlorisAppClient
from chloris_app_sdk.utils import to_tco2e

# create the client
client = ChlorisAppClient(
    organization_id="your-organization-id",
    refresh_token="your-refresh-token", # env: CHLORIS_REFRESH_TOKEN
    # or
    # id_token="your-id-token" # env: CHLORIS_ID_TOKEN
)

# list all active sites and get the stats for the first one
reporting_units = client.list_active_sites()
stats = client.get_reporting_unit_stats(reporting_units[0])

# print the annual stock (in tons co2e) for each year
for i, year in enumerate(stats["annualYears"]):
    stock = to_tco2e(stats["annualStock"][i])
    print(f"{year}: {stock} tco₂e")

# calculate average biomass density in t/ha for 2015:
i = stats["annualYears"].index(2015)
biomass_density = stats["annualStock"][i] / (stats["annualAreaKm2"][i] * 100)
print(f"Average biomass density in 2015: {biomass_density} t/ha")

```
scenvi 0.4.6
Integration of scRNA-seq and spatial transcpriptomics data
License: MIT
Requires Python: <4.0,>=3.9

ENVI & COVET
======================


ENVI is a deep learnining based variational inference method to integrate scRNA-seq with spatial transcriptomics data. ENVI learns to reconstruct spatial onto for dissociated scRNA-seq data and impute unimagd genes onto spatial data.

This implementation is written in Python3 and relies on jax, flax, sklearn, scipy and scanpy.  


To install JAX, simply run the command:

    pip install -U "jax[cuda12]"

And to install ENVI along with the rest of the requirements: 

    pip install scenvi

To run ENVI:

    import scenvi 
    
    envi_model = scenvi.ENVI(spatial_data = st_data, sc_data = sc_data)
    
    envi_model.train()
    envi_model.impute_genes()
    envi_model.infer_niche_covet()
    envi_model.infer_niche_celltype()
    
    st_data.obsm['envi_latent'] = envi_model.spatial_data.obsm['envi_latent']
    st_data.uns['COVET_genes'] =  envi_model.CovGenes
    st_data.obsm['COVET'] = envi_model.spatial_data.obsm['COVET']
    st_data.obsm['COVET_SQRT'] = envi_model.spatial_data.obsm['COVET_SQRT']
    st_data.obsm['cell_type_niche'] = envi_model.spatial_data.obsm['cell_type_niche']
    st_data.obsm['imputation'] = envi_model.spatial_data.obsm['imputation']


    sc_data.obsm['envi_latent'] = envi_model.sc_data.obsm['envi_latent']
    sc_data.uns['COVET_genes'] =  envi_model.CovGenes
    sc_data.obsm['COVET'] = envi_model.sc_data.obsm['COVET']
    sc_data.obsm['COVET_SQRT'] = envi_model.sc_data.obsm['COVET_SQRT']
    sc_data.obsm['cell_type_niche'] = envi_model.sc_data.obsm['cell_type_niche']
    

And to just compute COVET for spatial data:

    st_data.obsm['COVET'], st_data.obsm['COVET_SQRT'], st_data.uns['CovGenes'] = scenvi.compute_covet(st_data)
        
Please read our documentation and see a full tutorial at https://scenvi.readthedocs.io/.