Skip to content

Commit

Permalink
Merge pull request #13 from fish-quant/release/v0.3.0
Browse files Browse the repository at this point in the history
v0.3.0
  • Loading branch information
Henley13 authored May 15, 2020
2 parents 91a54bc + e47edea commit 3448a7d
Show file tree
Hide file tree
Showing 72 changed files with 11,458 additions and 6,003 deletions.
18 changes: 18 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
comment: false

ignore:
- "setup.py"
- "python_scripts"
- "bigfish/plot"
- "bigfish/deep_learning"
- "data"
- "weights"

coverage:
status:
project:
default:
# Commits pushed to master should not make the overall project
# coverage decrease by more than 1%:
target: auto
threshold: 1%
9 changes: 3 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,9 @@ dist/
big_fish.egg-info/

# Notebooks
notebooks/old
notebooks/.ipynb_checkpoints

# Data
data/input/*
data/output/*
examples/old
examples/.ipynb_checkpoints

# Cache
__pycache__/
.pytest_cache/
107 changes: 106 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,106 @@
# big-fish
# Big-FISH

[![License](https://img.shields.io/badge/license-BSD%203--Clause-green)](https://github.com/fish-quant/big-fish/blob/master/LICENSE)
[![codecov](https://codecov.io/gh/fish-quant/big-fish/branch/master/graph/badge.svg?token=kEnikxXOxP)](https://codecov.io/gh/fish-quant/big-fish)
![License](https://img.shields.io/badge/python-3.6-blue)

**Big-FISH** is a python package for the analysis of smFISH images. It includes various methods to **manipulate microscopic images**, **detect spots** and **segment relevant area** of the cells. The package allows the user to extract specific signal from images and build a coordinate representation of the cells. The ultimate goal is to ease **large scale statistical analysis** and quantification.

| Cell image (smFISH channel) and its coordinates representation |
| ------------- |
| ![](images/plot_cell.png "Nucleus in blue, mRNAs in red, foci in orange and transcription sites in green") |

## Installation

### Dependencies

Big-FISH requires Python 3.6 or newer. Additionally, it has the following dependencies:

- numpy (>= 1.16.0)
- scipy (>= 1.2.0)
- scikit-learn (>= 0.20.2)
- scikit-image (>= 0.14.2)
- matplotlib (>= 3.0.2)
- pandas (>= 0.24.0)
- mrc (>= (0.1.5)
- pip (>= 18.1)

### User installation

To avoid dependency conflicts the use of a dedicated [virtual](https://docs.python.org/3.6/library/venv.html) or [conda](https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html) environment should be a considered option.

#### From PyPi

Use the package manager [pip](https://pip.pypa.io/en/stable/) to install Big-FISH. In a terminal run the command:

```bash
pip install bigfish
```

#### From Github

Clone the project's [Github repository](https://github.com/fish-quant/big-fish) and install it locally with the following commands:

```bash
git clone [email protected]:fish-quant/big-fish.git
cd big-fish
pip install .
```

## Usage

Big-FISH provides a toolbox for the full analysis pipeline of smFISH images:
- Use `bigfish.stack` subpackage for I/O operations, preprocessing and postprocessing.
- Use `bigfish.segmentation` subpackage for nucleus and cell segmentation.
- Use `bigfish.detection` subpackage for mRNAs detection.
- Use `bigfish.plot` subpackage for plotting routines.
- Use `bigfish.classification` subpackage for pattern recognition tasks.

Several examples are developed in the [examples](https://github.com/fish-quant/big-fish/tree/master/examples) directory.

## Support

If you have any question relative to the repository, please open an [issue](https://github.com/fish-quant/big-fish/issues). You can also contact [Arthur Imbert](mailto:[email protected]) or [Florian Mueller](mailto:[email protected]).

## Roadmap (suggestion)

Version 0.4.0:
- Refactor `bigfish.classification` subpackage.
- Add pattern recognition examples.

Version 0.5.0:
- Switch to tensorflow 2.0.0.
- Integrate a deep learning model for segmentation.

Version 1.0.0:
- Complete code coverage.
- Add sphinx documentation.

## Development

### Source code

You can access the latest sources with the commands:

```bash
git clone [email protected]:fish-quant/big-fish.git
git checkout develop
```

### Contributing

[Pull requests](https://github.com/fish-quant/big-fish/pulls) are welcome. For major changes, please open an [issue](https://github.com/fish-quant/big-fish/issues) first to discuss what you would like to change.

### Testing

Please make sure to update tests as appropriate if you open a pull request. You can install exacts dependencies and specific version of [pytest](https://docs.pytest.org/en/latest/) by running the following command:

```bash
pip install -r requirements_dev.txt
```

To perform unitary tests, run :

```bash
pytest bigfish
```
15 changes: 15 additions & 0 deletions bigfish/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# -*- coding: utf-8 -*-
# Author: Arthur Imbert <[email protected]>
# License: BSD 3 clause

"""
The bigfish package.
"""


# keep a MAJOR.MINOR.PATCH format
# MAJOR: major API changes
# MINOR: new features
# PATCH: backwards compatible bug fixes

__version__ = "0.3.0"
5 changes: 1 addition & 4 deletions bigfish/classification/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from .input_preparation import (prepare_coordinate_data,
build_boundaries_layers, build_surface_layers,
build_distance_layers, Generator)
from .squeezenet import SqueezeNet0, SqueezeNet_qbi
from .features import get_features, get_features_name

# ### Load models ###
Expand All @@ -19,6 +18,4 @@
"build_surface_layers", "build_distance_layers",
"Generator"]

_squeezenet = ["SqueezeNet0", "SqueezeNet_qbi"]

__all__ = _features + _input_preparation + _squeezenet
__all__ = _features + _input_preparation
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
import pandas as pd
from scipy import ndimage as ndi

from .utils import get_offset_value
from .augmentation import augment
from .preprocess import cast_img_float32
from .filter import mean_filter
from bigfish.stack.utils import get_margin_value
from bigfish.stack.augmentation import augment_2d
from bigfish.stack.preprocess import cast_img_float32
from bigfish.stack.filter import mean_filter

from skimage.draw import polygon_perimeter
from sklearn.preprocessing import LabelEncoder
Expand Down Expand Up @@ -272,8 +272,8 @@ def build_image(data, id_cell, image_shape=None, coord_refinement=True,

# build matrices
if image_shape is None:
max_x = cyt_coord[:, 0].max() + get_offset_value()
max_y = cyt_coord[:, 1].max() + get_offset_value()
max_x = cyt_coord[:, 0].max() + get_margin_value()
max_y = cyt_coord[:, 1].max() + get_margin_value()
image_shape = (max_x, max_y)
rna = np.zeros(image_shape, dtype=np.float32)
rna[rna_coord[:, 0], rna_coord[:, 1]] = 1.0
Expand Down Expand Up @@ -350,8 +350,8 @@ def _build_rna(data, id_cell, output_shape=None):
# get current shape
cyt_coord = data.loc[id_cell, "pos_cell"]
cyt_coord = np.array(cyt_coord, dtype=np.int64)
max_x = cyt_coord[:, 0].max() + get_offset_value()
max_y = cyt_coord[:, 1].max() + get_offset_value()
max_x = cyt_coord[:, 0].max() + get_margin_value()
max_y = cyt_coord[:, 1].max() + get_margin_value()
input_shape = (max_x, max_y)

if output_shape is not None:
Expand Down
12 changes: 12 additions & 0 deletions bigfish/deep_learning/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# -*- coding: utf-8 -*-

"""
The bigfish.deep_learning module includes deep learning models and routines.
"""

from .squeezenet import SqueezeNet0, SqueezeNet_qbi


_squeezenet = ["SqueezeNet0", "SqueezeNet_qbi"]

__all__ = _squeezenet
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import tensorflow as tf
import numpy as np

from .base import BaseModel, get_optimizer
from bigfish.deep_learning.base import BaseModel, get_optimizer

from tensorflow.python.keras.backend import function, learning_phase
from tensorflow.python.keras.models import Model
Expand Down
File renamed without changes.
Loading

0 comments on commit 3448a7d

Please sign in to comment.