Metadata-Version: 2.1
Name: wormimtools
Version: 0.3.2
Summary: A short description of my package
Home-page: https://github.com/moore-andrew05/imtools
Author: Andrew Moore
Author-email: moore.andrew0598@gmail.com
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy
Requires-Dist: scipy
Requires-Dist: matplotlib
Requires-Dist: pandas
Requires-Dist: scikit-image

# worm-imtools

## Installation  

This package can be installed through pip using:  

```
pip install wormimtools
```

This can also be performed using pip within a conda environment if you wish to use conda to install other dependencies. 

To upgrade the package through pip, run:  

```
pip install --upgrade wormimtools  
```
## Using `worm-imtools`

It is highly recommended that this is performed using a jupyter notebook.

#### Processing

To process a directory like the one created above, import and instantiate a `Processor` object. The channel_info should be specified as a list of tuples containing your channel names and their indexes (0-based) within the images. You can use up to 4 channels: 

``` python
from wormimtools import Processor

channel_info = [("{channel 0 name}", 0), ("{channel 1 name}", 1)]

proc = Processor("{path_to_images}", channel_info) 
```

##### Additional Args: 
``` python
Default Values:
group_number = 1  
max_value    = 65535
final_len    = 3500
```

The `Processor` class contains 3 key-word arguments which have default values.  

`group_number` is used when multiple groups are contained within a single README. This variable specifies the order of the README. If the group in the directory is second in the README, set this to `2`, etc.

`max_value` is the value that the images are normalized to. It is arbitrary, but it should be set to the max value of the image format (255 for 8bit, 65535 for 16bit, etc.). When performing downstream analysis, the dataset should be normalized to the max value of the entire dataset.

`final_len` specifies the length all arrays will be interpolated to. It should be set to a value close to the average width of the images to minimize the need for interpolation.

##### Generating a DataFrame


##### DataFrame Structure
The generated DataFrame contains the following metadata columns specified in README.txt:

``` python
date                            # Date the rep was collected              
strain                          # C. elegans strain used
diet                            # Name of the bacterial diet
temp                            # Temperature worms developed at
rep                             # Rep number
name                            # Relative file name
stage                           # C. elegans developmental stage 
rating                          # Rating of quality of worm
comments                        # Comments given at imaging
ID                              # UUID
```
It also contains the following data columns for channel i (i = 0,1,2,3):

``` python 
channel{i}_name                 # Channel i name specified in `channel_info`
channel{i}_arr_vals             # Normalized and interpolated array values
channel{i}_arr_vals_ni          # Normalized array values
channel{i}_arr_vals_raw         # Raw array values
```
In most cases, the raw array values should be used for downstream analysis. 


#### Barcode Plotting

1.  To create barcode plots of the processed arrays, import and instantiate a `BarcodePlotter` object: 

``` python
from wormimtools import BarcodePlotter

plotter = BarcodePlotter()
```

##### Single Channel Plotting
``` python
data = [["Single Channel"]]    # List of arrays generated by Processor

plotter.plot_barcodes_single(data, save={"save_path"})
```
The `save` argument is optional, defaulting to None. 

##### Dual Channel Plotting
``` python
data = [[["Channel 0"], ["Channel 1"]]] # List of lists of len=2 with arrays for 2 channels of an image

plotter.plot_barcodes_dual(data)
```
The `save` argument is the same as single channel plotting. 

