Skip to content

Commit

Permalink
Merge pull request #7 from SomaLogic/CAN-18
Browse files Browse the repository at this point in the history
We are deploying `Canopy` to PyPI as `SomaData` This will make the package easier to install and it will enable users to employ SomaData (f.k.a Canopy) as a dependency in their own packages.
  • Loading branch information
tjohnson-somalogic authored May 15, 2024
2 parents 7e2151a + ef75c91 commit d91253f
Show file tree
Hide file tree
Showing 49 changed files with 188 additions and 155 deletions.
10 changes: 5 additions & 5 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# Released under MIT License

Canopy
SomaData

Copyright © 2023 SomaLogic Operating Company, Inc.
Copyright © 2024 Standard BioTools.

Permission is hereby granted, free of charge, to any person obtaining a copy of the Canopy software
Permission is hereby granted, free of charge, to any person obtaining a copy of the SomaData software
and associated documentation files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions outlined below. Further, Canopy and SomaLogic are trademarks
owned by SomaLogic Operating Company, Inc. No license is hereby granted to these trademarks other than for purposes of
subject to the following conditions outlined below. Further, SomaData and SomaLogic are trademarks
owned by Standard BioTools. No license is hereby granted to these trademarks other than for purposes of
identifying the origin or source of the Software.

The above copyright notice and this permission notice shall be included in all copies or substantial
Expand Down
57 changes: 33 additions & 24 deletions README.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"# The Python `Canopy` Package from Somalogic, Inc.\n",
"# The Python `SomaData` Package from Somalogic, Inc.\n",
"\n",
"![cover](https://img.shields.io/badge/coverage-97-success.svg?style=flat&logo=codecov)\n",
"[![License:\n",
Expand All @@ -14,7 +14,7 @@
"\n",
"## Overview\n",
"\n",
"This document accompanies the Python package `canopy`, which loads the SomaLogic, Inc. structured text data file called an `*.adat`. The `canopy.Adat` object is an extension of the `pandas.DataFrame` class. The package provides auxiliary functions for extracting relevant information from the ADAT object once in the Python environment. Basic familiarity with the Python environment is assumed, as is the ability to install contributed packages from the Python Package Installer (pip)\n",
"This document accompanies the Python package `somadata`, which loads the SomaLogic, Inc. structured text data file called an `*.adat`. The `somadata.Adat` object is an extension of the `pandas.DataFrame` class. The package provides auxiliary functions for extracting relevant information from the ADAT object once in the Python environment. Basic familiarity with the Python environment is assumed, as is the ability to install contributed packages from the Python Package Installer (pip)\n",
"\n",
"-----"
]
Expand Down Expand Up @@ -44,23 +44,32 @@
"<a name=\"installation\"></a>\n",
"\n",
"## Installation\n",
"The easiest way to install `Canopy` is to install directly from\n",
"\n",
"The easiest way to install `SomaData` is to install directly from PyPI\n",
"\n",
"PIP:\n",
"\n",
"```bash\n",
"pip install SomaData\n",
"```\n",
"\n",
"\n",
"GitHub:\n",
"\n",
"``` bash\n",
"pip install git+https://github.com/SomaLogic/canopy.git#egg=canopy\n",
"pip install git+https://github.com/SomaLogic/Canopy.git#egg=somadata\n",
"```\n",
"\n",
"Alternatively, if you wish to develop or change the source code, you may clone the repository and install manually via:\n",
"\n",
"``` bash\n",
"git clone https://github.com/SomaLogic/canopy.git\n",
"pip install -e ./canopy\n",
"git clone https://github.com/SomaLogic/Canopy.git\n",
"pip install -e ./somadata\n",
"```\n",
"\n",
"### Dependencies\n",
"\n",
"`Python >=3.8` is required to install `canopy`. The following package dependencies are installed on a `pip install`:\n",
"`Python >=3.8` is required to install `somadata`. The following package dependencies are installed on a `pip install`:\n",
" - `pandas >= 1.1.0`\n",
" - `numpy >= 1.19.1`\n",
"\n",
Expand All @@ -75,7 +84,7 @@
"\n",
"## Basics\n",
"\n",
"Upon installation, load `canopy` as normal:\n",
"Upon installation, load `somadata` as normal:\n",
"\n",
"[return to top](#toptoc)"
]
Expand All @@ -86,7 +95,7 @@
"metadata": {},
"outputs": [],
"source": [
"import canopy"
"import somadata"
]
},
{
Expand All @@ -107,10 +116,10 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Help on package canopy:\n",
"Help on package somadata:\n",
"\n",
"NAME\n",
" canopy\n",
" somadata\n",
"\n",
"PACKAGE CONTENTS\n",
" adat\n",
Expand All @@ -122,15 +131,15 @@
" tools (package)\n",
"\n",
"FILE\n",
" /Users/tjohnson/code/repos/Canopy/canopy/__init__.py\n",
" /Users/tjohnson/code/repos/SomaData/somadata/__init__.py\n",
"\n",
"\n"
]
}
],
"source": [
"help(canopy)\n",
"# help(canopy.adat) ... etc"
"help(somadata)\n",
"# help(somadata.adat) ... etc"
]
},
{
Expand All @@ -139,9 +148,9 @@
"source": [
"### Internal Objects\n",
"\n",
"The `canopy` package comes with one internal object available to users to run canned examples (or analyses). It can be accessed by perform the import:\n",
"The `somadata` package comes with one internal object available to users to run canned examples (or analyses). It can be accessed by perform the import:\n",
"\n",
" - `from canopy.data.example_data import example_data`"
" - `from somadata.data.example_data import example_data`"
]
},
{
Expand Down Expand Up @@ -175,7 +184,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Loading the sample file from within the canopy library via its path"
"Loading the sample file from within the somadata library via its path"
]
},
{
Expand All @@ -186,7 +195,7 @@
{
"data": {
"text/plain": [
"canopy.adat.Adat"
"somadata.adat.Adat"
]
},
"execution_count": 3,
Expand All @@ -195,7 +204,7 @@
}
],
"source": [
"adat = canopy.read_adat('./canopy/data/example_data.adat')\n",
"adat = somadata.read_adat('./somadata/data/example_data.adat')\n",
"type(adat)"
]
},
Expand Down Expand Up @@ -1445,7 +1454,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Canopy's Adat object inherits the pandas printing methods which displays nicely in Jupyter Notebooks when using `IPython.display.display()`."
"SomaData's Adat object inherits the pandas printing methods which displays nicely in Jupyter Notebooks when using `IPython.display.display()`."
]
},
{
Expand Down Expand Up @@ -2698,7 +2707,7 @@
"\n",
"### Subsetting/Slicing the Dataframe\n",
"\n",
"You may extract certain subgroups of samples and/or features. Canopy augments the pandas dataframe with a number of helper functions to aid the user.\n",
"You may extract certain subgroups of samples and/or features. SomaData augments the pandas dataframe with a number of helper functions to aid the user.\n",
"\n",
"[return to top](#toptoc)"
]
Expand Down Expand Up @@ -7698,7 +7707,7 @@
],
"source": [
"# Observing the Lin's CCC of the lifting scale factors.\n",
"from canopy.data import getSomaScanLiftCCC\n",
"from somadata.data import getSomaScanLiftCCC\n",
"\n",
"# the method returns a pandas dataframe containing the available lift Lins's CCC values:\n",
"ccc = getSomaScanLiftCCC()\n",
Expand Down Expand Up @@ -7778,7 +7787,7 @@
"<a name=\"example\"></a>\n",
"\n",
"# Typical Analyses\n",
"Although it is beyond the scope of the `Canopy` package, below are 3\n",
"Although it is beyond the scope of the `SomaData` package, below are 3\n",
"sample analyses that typical users/clients would perform on SomaLogic data.\n",
"They are not intended to be a definitive guide in statistical\n",
"analysis and existing packages do exist in the `Python` universe that perform parts\n",
Expand All @@ -7805,7 +7814,7 @@
"metadata": {},
"outputs": [],
"source": [
"from canopy.data.example_data import example_data # Example ADAT included with Canopy\n",
"from somadata.data.example_data import example_data # Example ADAT included with SomaData\n",
"from scipy.stats import ttest_ind\n",
"from collections import Counter\n",
"import matplotlib.pyplot as plt\n",
Expand Down
57 changes: 33 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# The Python `Canopy` Package from Somalogic, Inc.
# The Python `SomaData` Package from Somalogic, Inc.

![cover](https://img.shields.io/badge/coverage-97-success.svg?style=flat&logo=codecov)
[![License:
Expand All @@ -8,7 +8,7 @@ MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://choosealicense.

## Overview

This document accompanies the Python package `canopy`, which loads the SomaLogic, Inc. structured text data file called an `*.adat`. The `canopy.Adat` object is an extension of the `pandas.DataFrame` class. The package provides auxiliary functions for extracting relevant information from the ADAT object once in the Python environment. Basic familiarity with the Python environment is assumed, as is the ability to install contributed packages from the Python Package Installer (pip)
This document accompanies the Python package `somadata`, which loads the SomaLogic, Inc. structured text data file called an `*.adat`. The `somadata.Adat` object is an extension of the `pandas.DataFrame` class. The package provides auxiliary functions for extracting relevant information from the ADAT object once in the Python environment. Basic familiarity with the Python environment is assumed, as is the ability to install contributed packages from the Python Package Installer (pip)

-----

Expand All @@ -28,23 +28,32 @@ This document accompanies the Python package `canopy`, which loads the SomaLogic
<a name="installation"></a>

## Installation
The easiest way to install `Canopy` is to install directly from
The easiest way to install `SomaData` is to install directly from PyPI

PIP:

```bash
pip install SomaData
```

Alternatively one can install from the GitHub repository.

GitHub:

``` bash
pip install git+https://github.com/SomaLogic/canopy.git#egg=canopy
pip install git+https://github.com/SomaLogic/Canopy.git#egg=somadata
```

Alternatively, if you wish to develop or change the source code, you may clone the repository and install manually via:

``` bash
git clone https://github.com/SomaLogic/canopy.git
pip install -e ./canopy
git clone https://github.com/SomaLogic/Canopy.git
pip install -e ./somadata
```

### Dependencies

`Python >=3.8` is required to install `canopy`. The following package dependencies are installed on a `pip install`:
`Python >=3.8` is required to install `somadata`. The following package dependencies are installed on a `pip install`:
- `pandas >= 1.1.0`
- `numpy >= 1.19.1`

Expand All @@ -54,27 +63,27 @@ pip install -e ./canopy

## Basics

Upon installation, load `canopy` as normal:
Upon installation, load `somadata` as normal:

[return to top](#toptoc)


```python
import canopy
import somadata
```

### For a traversable index of the library:


```python
help(canopy)
# help(canopy.adat) ... etc
help(somadata)
# help(somadata.adat) ... etc
```

Help on package canopy:
Help on package somadata:

NAME
canopy
somadata

PACKAGE CONTENTS
adat
Expand All @@ -86,16 +95,16 @@ help(canopy)
tools (package)

FILE
/Users/tjohnson/code/repos/Canopy/canopy/__init__.py
/Users/tjohnson/code/repos/SomaData/somadata/__init__.py




### Internal Objects

The `canopy` package comes with one internal object available to users to run canned examples (or analyses). It can be accessed by perform the import:
The `somadata` package comes with one internal object available to users to run canned examples (or analyses). It can be accessed by perform the import:

- `from canopy.data.example_data import example_data`
- `from somadata.data.example_data import example_data`

## Main Features (I/O)

Expand All @@ -114,18 +123,18 @@ The `canopy` package comes with one internal object available to users to run ca

[return to top](#toptoc)

Loading the sample file from within the canopy library via its path
Loading the sample file from within the somadata library via its path


```python
adat = canopy.read_adat('./canopy/data/example_data.adat')
adat = somadata.read_adat('./somadata/data/example_data.adat')
type(adat)
```




canopy.adat.Adat
somadata.adat.Adat



Expand Down Expand Up @@ -1331,7 +1340,7 @@ adat.header_metadata



Canopy's Adat object inherits the pandas printing methods which displays nicely in Jupyter Notebooks when using `IPython.display.display()`.
SomaData's Adat object inherits the pandas printing methods which displays nicely in Jupyter Notebooks when using `IPython.display.display()`.

<a name="wrangling"></a>

Expand Down Expand Up @@ -2368,7 +2377,7 @@ sqrt_adat = adat.apply(np.sqrt) # equivlane to `np.sqrt(adat)`

### Subsetting/Slicing the Dataframe

You may extract certain subgroups of samples and/or features. Canopy augments the pandas dataframe with a number of helper functions to aid the user.
You may extract certain subgroups of samples and/or features. SomaData augments the pandas dataframe with a number of helper functions to aid the user.

[return to top](#toptoc)

Expand Down Expand Up @@ -5920,7 +5929,7 @@ lifted_adat = adat.lift('11K')

```python
# Observing the Lin's CCC of the lifting scale factors.
from canopy.data import getSomaScanLiftCCC
from somadata.data import getSomaScanLiftCCC

# the method returns a pandas dataframe containing the available lift Lins's CCC values:
ccc = getSomaScanLiftCCC()
Expand Down Expand Up @@ -6111,7 +6120,7 @@ adat.to_adat('/tmp/out_file.adat')
<a name="example"></a>

# Typical Analyses
Although it is beyond the scope of the `Canopy` package, below are 3
Although it is beyond the scope of the `SomaData` package, below are 3
sample analyses that typical users/clients would perform on SomaLogic data.
They are not intended to be a definitive guide in statistical
analysis and existing packages do exist in the `Python` universe that perform parts
Expand All @@ -6128,7 +6137,7 @@ preliminary analyses on SomaLogic data for:


```python
from canopy.data.example_data import example_data # Example ADAT included with Canopy
from somadata.data.example_data import example_data # Example ADAT included with SomaData
from scipy.stats import ttest_ind
from collections import Counter
import matplotlib.pyplot as plt
Expand Down
4 changes: 2 additions & 2 deletions bin/canopy_check_adat → bin/somadata_check_adat
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
import argparse
from canopy import Adat
from somadata import Adat


if __name__ == '__main__':
Expand All @@ -27,4 +27,4 @@ if __name__ == '__main__':
print('SUCCESS')
except Exception as e:
print('FAILURE')
print('Adat read error, please send the adat to Joey or Ted for debugging with the following error message: ' + str(e))
print('Adat read error, please contact support@somalogic.com for debugging with the ADAT file and following error message: ' + str(e))
Loading

0 comments on commit d91253f

Please sign in to comment.