Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFC: public/private separation #1244

Merged
merged 1 commit into from
Apr 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .flake8
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[flake8]
max-line-length=100
application-import-names = starfish, examples
application-import-names = starfish
import-order-style = smarkets
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
import os
from typing import List, Mapping, Tuple, Union

import click
import numpy as np
from skimage.io import imread
from slicedimage import ImageFormat

from starfish.experiment.builder import FetchedTile, TileFetcher, write_experiment_json
from starfish.types import Axes, Coordinates, Features, Number
from starfish.util import click


class ImagingMassCytometryTile(FetchedTile):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
import re
from typing import Mapping, Tuple, Union

import click
import numpy as np
from slicedimage import ImageFormat

import starfish.util.try_import
from starfish.experiment.builder import FetchedTile, TileFetcher, write_experiment_json
from starfish.types import Axes, Coordinates, Features, Number
from starfish.util import click


# We use this to cache images across tiles. In the case of the osmFISH data set, volumes are saved
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
import os
from typing import Mapping, Tuple, Union

import click
import numpy as np
from skimage.io import imread
from slicedimage import ImageFormat

from starfish import Codebook
from starfish.experiment.builder import FetchedTile, TileFetcher, write_experiment_json
from starfish.types import Axes, Coordinates, Features
from starfish.util import click


# We use this to cache images. This allows us to write a separate function to extract the data's
Expand Down
2 changes: 1 addition & 1 deletion docs/source/api/data_structures/codebook.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
Codebook
========

.. automodule:: starfish.codebook.codebook
.. autoclass:: starfish.core.codebook.codebook.Codebook
:members:
2 changes: 1 addition & 1 deletion docs/source/api/data_structures/experiment.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
Experiment
==========

.. autoclass:: starfish.experiment.experiment.Experiment
.. autoclass:: starfish.core.experiment.experiment.Experiment
:members:
2 changes: 1 addition & 1 deletion docs/source/api/data_structures/expression_matrix.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ Expression Matrix is a wrapper for xarray.DataArray that provides serialization
loom, and AnnData to enable it to be used with single-cell analysis software packages such as
scanpy (python) and seurat (R).

.. automodule:: starfish.expression_matrix.expression_matrix
.. autoclass:: starfish.core.expression_matrix.expression_matrix.ExpressionMatrix
:members:
2 changes: 1 addition & 1 deletion docs/source/api/data_structures/field_of_view.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
Field of View
=============

.. autoclass:: starfish.experiment.experiment.FieldOfView
.. autoclass:: starfish.core.experiment.experiment.FieldOfView
:members:
2 changes: 1 addition & 1 deletion docs/source/api/data_structures/image_stack.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
ImageStack
==========

.. automodule:: starfish.imagestack.imagestack
.. autoclass:: starfish.core.imagestack.imagestack.ImageStack
:members:
4 changes: 2 additions & 2 deletions docs/source/api/data_structures/intensity_table.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
IntensityTable
==============

.. automodule:: starfish.intensity_table.intensity_table
.. autoclass:: starfish.core.intensity_table.intensity_table.IntensityTable
:members:

.. automodule:: starfish.intensity_table.intensity_table_coordinates
.. automodule:: starfish.core.intensity_table.intensity_table_coordinates
:members:
2 changes: 1 addition & 1 deletion docs/source/api/data_structures/pipeline_component.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
Pipeline Component
==================

.. automodule:: starfish.pipeline.pipelinecomponent
.. automodule:: starfish.core.pipeline.pipelinecomponent
:members:
2 changes: 1 addition & 1 deletion docs/source/api/recipe/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
Recipe
======

.. autoclass:: starfish.recipe.Recipe
.. autoclass:: starfish.core.recipe.Recipe
:members:
12 changes: 6 additions & 6 deletions docs/source/api/types/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ Coordinates holds constants that store with the physical coordinates of a field
a field of view's relative location to some global scale parameter, and identify how to stitch or
combine multiple fields of view.

.. autoclass:: starfish.types.Coordinates
.. autoclass:: starfish.core.types.Coordinates
:members:
:undoc-members:

Physical Coordinates
---------------------
.. autoclass:: starfish.types.PhysicalCoordinateTypes
.. autoclass:: starfish.core.types.PhysicalCoordinateTypes
:members:
:undoc-members:

Expand All @@ -36,7 +36,7 @@ Axes holds constants that represent indexers into the dimensions of the :py:clas
2. :py:class:`Codebook`, which stores expected image intensities across imaging rounds and
channels

.. autoclass:: starfish.types.Axes
.. autoclass:: starfish.core.types.Axes
:members:
:undoc-members:

Expand All @@ -46,7 +46,7 @@ Features
Features holds constants that represent characteristics of detected image features (most often
spots, but sometimes also individual pixels).

.. autoclass:: starfish.types.Features
.. autoclass:: starfish.core.types.Features
:members:
:undoc-members:

Expand All @@ -58,13 +58,13 @@ SpotAttributes defines the minimum amount of information required by starfish to
a spot. It also contains methods to save these attributes to files that can be used to visualize
detected spots.

.. autoclass:: starfish.types.SpotAttributes
.. autoclass:: starfish.core.types.SpotAttributes
:members:

Clip
_____

.. autoclass:: starfish.types.Clip
.. autoclass:: starfish.core.types.Clip
:members:
:undoc-members:

6 changes: 3 additions & 3 deletions docs/source/api/validation/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Validators are provided for validating a SpaceTx fileset against the :ref:`schem
Validators
----------

.. autoclass:: starfish.spacetx_format.util.SpaceTxValidator
.. autoclass:: starfish.core.spacetx_format.util.SpaceTxValidator
:members:
:exclude-members: fuzz_object

Expand All @@ -19,7 +19,7 @@ In addition, the starfish.spacetx_format.validate_sptx module contains helpers t
iterating over the tree of json files and their respective schemas.


.. automodule:: starfish.spacetx_format.validate_sptx
.. automodule:: starfish.core.spacetx_format.validate_sptx
:members:


Expand All @@ -31,7 +31,7 @@ For example:

::

starfish/starfish/spacetx_format/util.py:82: UserWarning:
starfish/starfish/core/spacetx_format/util.py:82: UserWarning:
'contents' is a required property
Schema: https://github.com/spacetx/starfish/starfish/file-format/schema/fov-manifest.json
Subschema level: 0
Expand Down
4 changes: 2 additions & 2 deletions docs/source/getting_started/formatting_data/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,10 @@ SpaceTx-Format :py:class:`Experiment`.

These are the abstract classes that must be subclassed for each set of naming conventions:

.. literalinclude:: /../../starfish/experiment/builder/providers.py
.. literalinclude:: /../../starfish/core/experiment/builder/providers.py
:pyobject: FetchedTile

.. literalinclude:: /../../starfish/experiment/builder/providers.py
.. literalinclude:: /../../starfish/core/experiment/builder/providers.py
:pyobject: TileFetcher

To create a formatter object for in-situ sequencing, we subclass the ``TileFetcher`` and
Expand Down
2 changes: 1 addition & 1 deletion notebooks/ISS.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@
"outputs": [],
"source": [
"from starfish.spots import AssignTargets\n",
"from starfish.expression_matrix.expression_matrix import ExpressionMatrix\n",
"from starfish import ExpressionMatrix\n",
"\n",
"al = AssignTargets.Label()\n",
"labeled = al.run(masks, decoded)\n",
Expand Down
18 changes: 6 additions & 12 deletions notebooks/STARmap.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@
"rounds. Ideally, these should form fairly coherent spots, indicating that the\n",
"data are well registered. By contrast, if there are patterns whereby pairs of\n",
"spots are consistently present at small shifts, that can indicate systematic\n",
"registration offsets which should be corrected prior to analysis.\n",
""
"registration offsets which should be corrected prior to analysis."
]
},
{
Expand Down Expand Up @@ -92,8 +91,7 @@
"----------------------\n",
"The STARmap codebook maps pixel intensities across the rounds and channels to\n",
"the corresponding barcodes and genes that those pixels code for. For this\n",
"dataset, the codebook specifies 160 gene targets.\n",
""
"dataset, the codebook specifies 160 gene targets."
]
},
{
Expand Down Expand Up @@ -185,8 +183,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Show the effect of registration.\n",
""
"Show the effect of registration."
]
},
{
Expand Down Expand Up @@ -234,8 +231,7 @@
"Note that this type of histogram matching has an implied assumption that each\n",
"channel has relatively similar numbers of spots. In the case of this data\n",
"this assumption is reasonably accurate, but for other datasets it can be\n",
"problematic to apply filters that match this stringently.\n",
""
"problematic to apply filters that match this stringently."
]
},
{
Expand Down Expand Up @@ -294,8 +290,7 @@
"zero. Note that many of the spots do _not_ identify spots in other rounds and\n",
"channels and will therefore fail decoding. Because of the stringency built\n",
"into the STARmap codebook, it is OK to be relatively permissive with the spot\n",
"finding parameters for this assay.\n",
""
"finding parameters for this assay."
]
},
{
Expand Down Expand Up @@ -324,8 +319,7 @@
"------------\n",
"Next, spots are decoded. There is really no good way to display 3-d spot\n",
"detection in 2-d planes, so we encourage you to grab this notebook and\n",
"uncomment the below lines.\n",
""
"uncomment the below lines."
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion notebooks/py/ISS.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@

# EPY: START code
from starfish.spots import AssignTargets
from starfish.expression_matrix.expression_matrix import ExpressionMatrix
from starfish import ExpressionMatrix

al = AssignTargets.Label()
labeled = al.run(masks, decoded)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
},
entry_points={
'console_scripts': [
"starfish=starfish.starfish:starfish",
"starfish=starfish:starfish",
]
},
include_package_data=True,
Expand Down
51 changes: 20 additions & 31 deletions starfish/__init__.py
Original file line number Diff line number Diff line change
@@ -1,37 +1,26 @@
# deal with numpy import warnings due to cython
# See: https://stackoverflow.com/questions/40845304/
# runtimewarning-numpy-dtype-size-changed-may-indicate-binary-incompatibility)
import warnings
warnings.filterwarnings("ignore", message="numpy.dtype size changed") # noqa
warnings.filterwarnings("ignore", message="numpy.ufunc size changed") # noqa

import pkg_resources

# image processing methods and objects
from . import image
# spot detection and manipulation
from . import spots
from . import (
# configuration management.
config,
# image processing methods and objects.
image,
# spot detection and manipulation.
spots,
)
from .core import (
is_release_tag as __is_release_tag__,
version as __version__
)
# display images and spots
from ._display import display
# generated version number and commit hash
from ._version import get_versions
from .core._display import display
# top-level objects
from .codebook.codebook import Codebook
from .experiment.experiment import Experiment, FieldOfView
from .imagestack.imagestack import ImageStack
from .intensity_table.intensity_table import IntensityTable
from .recipe import cli
from .starfish import starfish
from .core.codebook.codebook import Codebook
from .core.experiment.experiment import Experiment, FieldOfView
from .core.expression_matrix.expression_matrix import ExpressionMatrix
from .core.imagestack.imagestack import ImageStack
from .core.intensity_table.intensity_table import IntensityTable
from .core.recipe import cli
from .core.starfish import starfish


# NOTE: if we move to python 3.7, we can produce this value at call time via __getattr__
__version__ = get_versions()['version']
__is_release_tag__ = None
if "+" not in str(__version__):
__is_release_tag__ = f"Release: {__version__}"
del get_versions

if __name__ == "__main__":
starfish()

del warnings, pkg_resources
3 changes: 0 additions & 3 deletions starfish/__main__.py

This file was deleted.

1 change: 1 addition & 0 deletions starfish/config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .core.config import environ, StarfishConfig # noqa: F401
16 changes: 16 additions & 0 deletions starfish/core/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# deal with numpy import warnings due to cython
# See: https://stackoverflow.com/questions/40845304/
# runtimewarning-numpy-dtype-size-changed-may-indicate-binary-incompatibility)
import warnings
warnings.filterwarnings("ignore", message="numpy.dtype size changed") # noqa
warnings.filterwarnings("ignore", message="numpy.ufunc size changed") # noqa

# generated version number and commit hash
from ._version import get_versions


# NOTE: if we move to python 3.7, we can produce this value at call time via __getattr__
version = get_versions()['version']
is_release_tag = None
if "+" not in str(version):
is_release_tag = f"Release: {version}"
6 changes: 3 additions & 3 deletions starfish/_display.py → starfish/core/_display.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@

import numpy as np

from starfish.imagestack.imagestack import ImageStack
from starfish.intensity_table.intensity_table import IntensityTable
from starfish.types import Axes, Features
from starfish.core.imagestack.imagestack import ImageStack
from starfish.core.intensity_table.intensity_table import IntensityTable
from starfish.core.types import Axes, Features

try:
with warnings.catch_warnings():
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading