Skip to main content

Biocarta

Creating Cartographic Representations of Biological Data DOI

Installation

pip install biocarta

Example code

if __name__ == '__main__' :
    from biocarta.quantification import full_mapping
    #
    adf = pd.read_csv('analytes.tsv',sep='\t',index_col=0)
    #
    # WE DO NOT WANT TO KEEP POTENTIALLY BAD ENTRIES 
    adf = adf.iloc[ np.inf != np.abs( 1.0/np.std(adf.values,1) ) ,
                    np.inf != np.abs( 1.0/np.std(adf.values,0) ) ].copy()
    #
    # READING IN SAMPLE INFORMATION
    # THIS IS NEEDED FOR THE ALIGNED PCA TO WORK
    jdf = pd.read_csv('journal.tsv',sep='\t',index_col=0)
    jdf = jdf.loc[:,adf.columns.values]
    #
    alignment_label , sample_label = 'Disease' , None
    add_labels = ['Cell-line']
    #
    cmd                = 'max'
    # WRITE FILES AND MAKE NOISE
    bVerbose           = True
    # CREATE AN OPTIMIZED REPRESENTATION
    bExtreme           = True
    # WE MIGHT WANT SOME SPECIFIC INTERSECTIONS OF THE HIERARCHY
    n_clusters         = [20,40,60,80,100]
    # USE ALL INFORMATION
    n_components       = None
    umap_dimension     = 2
    n_neighbors        = 20
    local_connectivity = 20.
    transform_seed     = 42
    #
    print ( adf , jdf )
    #
    # distance_type = 'correlation,spearman,absolute' # DONT USE THIS
    distance_type = 'covariation' # BECOMES CO-EXPRESSION BASED
    #
    results = full_mapping ( adf , jdf                  ,
        bVerbose = bVerbose             ,
        bExtreme = bExtreme             ,
        n_clusters = n_clusters         ,
        n_components = n_components     ,
        distance_type = distance_type   ,
        umap_dimension = umap_dimension ,
        umap_n_neighbors = n_neighbors  ,
        umap_local_connectivity = local_connectivity ,
        umap_seed = transform_seed      ,
        hierarchy_cmd = cmd             ,
        add_labels = add_labels         ,
        alignment_label = alignment_label ,
        sample_label = None     )
    #
    map_analytes        = results[0]
    map_samples         = results[1]
    hierarchy_analytes  = results[2]
    hierarchy_samples   = results[3]

or just call it using the default values:

import pandas as pd
import numpy  as np

if __name__ == '__main__' :
    from biocarta.quantification import full_mapping
    #
    adf = pd.read_csv('analytes.tsv',sep='\t',index_col=0)
    #
    adf = adf.iloc[ np.inf != np.abs( 1.0/np.std(adf.values,1) ) ,
                    np.inf != np.abs( 1.0/np.std(adf.values,0) ) ].copy()
    jdf = pd.read_csv('journal.tsv',sep='\t',index_col=0)
    jdf = jdf.loc[:,adf.columns.values]
    #
    alignment_label , sample_label = 'Disease' , None
    add_labels = ['Cell-line']
    #
    results = full_mapping ( adf , jdf  ,
        bVerbose = True			,
        n_clusters = [40,80,120]        ,
        add_labels = add_labels         ,
        alignment_label = alignment_label )
    #
    map_analytes        = results[0]
    map_samples         = results[1]
    hierarchy_analytes  = results[2]
    hierarchy_samples   = results[3]

and plotting the information of the map analytes yields : Cancer Disease Example

You can also run an alternative algorithm where the UMAP coordinates are employed directly for clustering by setting

    results = full_mapping ( adf , jdf  ,
        bVerbose = True			        ,
        bUseUmap = True                 ,
        n_clusters = [40,80,120]        ,
        add_labels = add_labels         ,
        alignment_label = alignment_label )

with the following results.

Download the zip and open the html index:

chromium index.html

Other generated solutions

The clustering visualisations were created using the Biocarta and hvplot :

What groupings corresponds to biomarker variance that describe them? Here are two visualisations of that:

Diseases : cancers biocarta gfa enrichment biocarta treemap cluster 61

Tissues : tissues

Single Cells: single cells biocarta gfa enrichment biocarta treemap cluster 47

Blood Cells: blood cells biocarta gfa enrichment biocarta treemap cluster 2

Release files for biocarta 0.2.26

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for biocarta 0.2.26
File Size Uploaded
biocarta-0.2.26.tar.gz 18.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for biocarta 0.2.26
File Interpreter ABI Platform
biocarta-0.2.26-py3-none-any.whl Python 3 none any Details

Total release size: 39.4 kB

Release files / biocarta-0.2.26.tar.gz

Download URL biocarta-0.2.26.tar.gz
Size 18.7 kB
Tags Source
SHA-256 checksum
How to use checksums
a6e380fddc49c3401927118caaa637e7e0f089f5a7bea9437f9cf63e178750e4
BLAKE2b-256 checksum
How to use checksums
269f601388ba28e3202fa4f1cad6e6843d0dd17978af91ccc0182a990d5fe7ec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.13

Release files / biocarta-0.2.26-py3-none-any.whl

Download URL biocarta-0.2.26-py3-none-any.whl
Size 20.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6541a3840a81f45bd4d918ca7b4a24aae5e72040f74b92c7bb30aeb53166aae7
BLAKE2b-256 checksum
How to use checksums
1fca566855cf2995af6499afd91eae98da85ce05a3bb758de68141f5fe012ca9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.13

Release history Release notifications | RSS feed

This release

0.2.26 This release

2 release files

0.2.25

2 release files

0.2.24

2 release files

0.2.23

2 release files

0.2.22

2 release files

0.2.18

2 release files

0.2.17

2 release files

0.2.15

2 release files

0.2.13

2 release files

0.2.10

2 release files

0.2.9

2 release files

0.2.8

2 release files

0.2.6

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page