Skip to content
This repository has been archived by the owner on Nov 5, 2020. It is now read-only.

Commit

Permalink
Merge pull request #251 from ZELLMECHANIK-DRESDEN/develop
Browse files Browse the repository at this point in the history
0.9.6
  • Loading branch information
paulmueller committed Sep 9, 2019
2 parents 07d741d + f6765fb commit 8b6f6b4
Show file tree
Hide file tree
Showing 9 changed files with 57 additions and 4 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
0.9.6
- enh: improved support for tdms data (dclab 0.12.0 -> 0.14.7) (e.g. #249)
- enh: write Shape-Out version to exported .fcs and .tsv files (#250)
- fix: remove nan/inf values before performing (g)lmm analysis (#248)
- docs: request citation of Herbig2018 when performing (g)lmm analysis
0.9.5
- fix: Allow to open measurement files that do not contain the features
"area_um" or "deform" (#245)
Expand Down
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ To compile the documentation, run

Notes
=====
To view the sphinx inventory of DryMass, run
To view the sphinx inventory of Shape-Out, run

python -m sphinx.ext.intersphinx 'http://shapeout.readthedocs.io/en/develop/objects.inv'
2 changes: 2 additions & 0 deletions docs/sec_interface.rst
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,8 @@ Regression analysis:
Perform a regression analysis according to (general) linear mixed effects
models. For more information, please see :ref:`sec_qg_mixed_effects` as
well as the references :cite:`Herbig2017` and :cite:`Herbig2018`.
If you are using this feature in a scientific publication, please
consider citing :cite:`Herbig2018`.


Plotting tabs
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
],
},
install_requires=["appdirs",
"dclab[all]>=0.12.0",
"fcswrite>=0.4.1",
"dclab[all]>=0.14.6",
"fcswrite>=0.5.0",
"h5py>=2.8.0",
"imageio>=2.3.0,<2.5.0",
"nptdms",
Expand Down
16 changes: 15 additions & 1 deletion shapeout/gui/controls_analyze.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ def OnApply(self, e=None):
if self.WXCB_treatment[ii].GetSelection() == 0:
# The user selected "None"
continue
xs.append(mm[axname][mm._filter])
xs.append(mm[axname][mm.filter.all])
mmtreat = self.WXCB_treatment[ii].GetValue()
treatment.append(mmtreat)
# get repetition
Expand All @@ -231,7 +231,21 @@ def OnApply(self, e=None):
# write to temporary file and display with webbrowser
outf = tempfile.mktemp(prefix="regression_analysis_{}_".format(axname),
suffix=".txt")
# add citation request
citreq = [
"# If you are using these results in a scientific publication,",
"# please consider citing the following manuscript:",
"#",
"# Herbig M, Mietke A, Müller P, Otto O (2018)",
"# Statistics for real-time deformability cytometry: Clustering,",
"# dimensionality reduction, and significance testing.",
"# Biomicrofluidics 12:042214. doi: 10.1063/1.5027197",
"#",
"",
]

with io.open(outf, "w") as fd:
fd.writelines([ll + "\r\n" for ll in citreq])
fd.writelines(result["Full Summary"].replace("\n", "\r\n"))

webbrowser.open(fd.name)
Expand Down
4 changes: 4 additions & 0 deletions shapeout/gui/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
import wx
from wx.lib.scrolledpanel import ScrolledPanel

from .._version import version


class ExportAnalysisEvents(wx.Frame):
def __init__(self, parent, analysis, ext="ext", non_scalars=[]):
Expand Down Expand Up @@ -179,6 +181,7 @@ def export(self, out_dir, features, filtered):
m.export.fcs(os.path.join(out_dir, m.title+".fcs"),
mfeat,
filtered=filtered,
meta_data={"Shape-Out version": version},
override=True)


Expand Down Expand Up @@ -213,6 +216,7 @@ def export(self, out_dir, features, filtered):
m.export.tsv(os.path.join(out_dir, m.title+".tsv"),
mfeat,
filtered=filtered,
meta_data={"Shape-Out version": version},
override=True)


Expand Down
6 changes: 6 additions & 0 deletions shapeout/lin_mix_mod.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,12 @@ def linmixmod(xs, treatment, timeunit, model='lmm', RCMD=cran.rcmd):
timeunit = list(timeunit[~invalid])
xs = [xi for ii, xi in enumerate(xs) if ~invalid[ii]]

# convert to ndarray
xs = [np.array(xi, dtype=float) for xi in xs]

# remove nan/inf values
xs = [xi[~np.logical_or(np.isnan(xi), np.isinf(xi))] for xi in xs]

######################Differential Deformation#############################
# If the user selected 'Control-Reservoir' and/or 'Treatment-Reservoir'
Median_DiffDef = []
Expand Down
18 changes: 18 additions & 0 deletions tests/test_linmixmod.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,24 @@ def test_linmixmod():
assert np.allclose([res["Estimate"]], [136.63650509])


def test_linmixmod_nan():
treatment = ['Control', 'Treatment', 'Control', 'Treatment']
timeunit = [1, 1, 2, 2]
xs = [
[100, np.inf, 80, np.nan, 140, 150, 100, 100, 110, 111, 140, 145],
[115, 110, 90, 110, 145, 155, 110, 120, 115, 120, 120, 150,
100, 90, 100],
[150, 150, 130, 170, 190, 250, 150, 150, 160,
161, 180, 195, 130, 120, 125, 130, 125],
[155, 155, 135, 175, 195, 255, 155, 155, 165, 165,
185, 200, 135, 125, 130, 135, 140, 150, 135, 140]
]

res = linmixmod(xs=xs, treatment=treatment, timeunit=timeunit)

assert np.allclose([res["Estimate"]], [137.37179302516199186])


if __name__ == "__main__":
# Run all tests
loc = locals()
Expand Down
4 changes: 4 additions & 0 deletions tests/test_session_conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from __future__ import division, print_function

import numpy as np
import pytest

from shapeout.session import index, rw
from shapeout.analysis import Analysis
Expand Down Expand Up @@ -53,6 +54,9 @@ def test_070hierarchy2():
cleanup()


@pytest.mark.filterwarnings('ignore::dclab.rtdc_dataset.'
+ 'ancillaries.ancillary_feature.'
+ 'BadFeatureSizeWarning')
def test_074hierarchy2():
analysis = compatibility_task("session_v0.7.4_hierarchy2.zmso")

Expand Down

0 comments on commit 8b6f6b4

Please sign in to comment.