Skip to content

Commit e19daa4

Browse files
committed
Merge branch 'release/gitools-2.3.0'
2 parents 03caef5 + 1d4c0bc commit e19daa4

File tree

153 files changed

+5781
-640
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

153 files changed

+5781
-640
lines changed

changelog.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
Gitools 2.3.0
2+
-----------------------------------------------------------
3+
* Added Median aggregator
4+
* Added transformation methods to aggregation header wizard
5+
* Added OneWayAnova test to GroupComparison analysis options
6+
* Added Mode aggregator
7+
* New data layers from data transformation
8+
* Edit annotation values within the application
9+
* Enable show/hide headers from details box
10+
* Remove Layer Action
11+
* Biomart sources update
12+
113
Gitools 2.2.3
214
------------------------------------------------------------
315
* Biomart sources update

doc/source/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@
5050
# built documents.
5151
#
5252
# The short X.Y version.
53-
version = '2.2'
53+
version = '2.3'
5454
# The full version, including alpha/beta/rc tags.
55-
release = '2.2.3'
55+
release = '2.3.0'
5656

5757
# The language for content autogenerated by Sphinx. Refer to documentation
5858
# for a list of supported languages.

howto-release.txt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ git-flow hotfix start gitools-2.2.2
1212
# Update pom.xml version
1313
# The following command only prints to display
1414
# Check that you are going to update only the correct versions:
15-
find . -name pom.xml | awk '{ system("sed 0,/2.3.0-SNAPSHOT/s//2.2.2/ "$0)}' | grep -A2 -B3 2.2.2
15+
find . -name pom.xml | awk '{ system("sed 0,/2.3.0-SNAPSHOT/s//2.3.0/ "$0)}' | grep -A2 -B3 2.3.0
1616

1717
# The following command will apply the changes
1818
# Update all like this:
19-
find . -name pom.xml | awk '{ system("sed -i 0,/2.3.0-SNAPSHOT/s//2.2.2/ "$0)}'
19+
find . -name pom.xml | awk '{ system("sed -i 0,/2.3.0-SNAPSHOT/s//2.3.0/ "$0)}'
2020

2121
# Go to Documentation folder.
22-
# Check in src/conf.py if the version numbers are up to date
22+
# Check in source/conf.py if the version numbers are up to date
2323
# Generate the documentation (which hopefully is up to date).
2424
# verify the documentation has the same version as Gitools
2525
cd doc
@@ -35,16 +35,16 @@ mvn -P test-analysis clean install assembly:assembly
3535

3636
# Test new release
3737
cd target
38-
unzip gitools-2.2.2-bin.zip
39-
gitools-2.2.2/bin/gitools
38+
unzip gitools-2.3.0-bin.zip
39+
gitools-2.3.0/gitools
4040
cd ..
4141

4242
# Deploy ZIP file
43-
scp target/gitools-2.2.2-bin.zip bgadmin@ankara:/usr/local/gitools/www/downloads/
43+
scp target/gitools-2.3.0-bin.zip bgadmin@ankara:/usr/local/gitools/www/downloads/
4444

4545
# Deploy Webstart
4646
# change back to the gitools root folder
47-
./webstart-deploy.sh 2.2.2
47+
./webstart-deploy.sh 2.3.0
4848

4949
# Update this file on the server:
5050
/usr/local/gitools/www/downloads/latest.txt
@@ -56,7 +56,7 @@ make clean
5656
cd ..
5757

5858
# Commit the changes
59-
git commit -a -m "Release version 2.2.2"
59+
git commit -a -m "Release version 2.3.0"
6060

6161
# Finish the release or hotfix
6262
git flow release finish gitools-2.2.2

org.gitools.analysis/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>gitools</artifactId>
77
<groupId>org.gitools</groupId>
8-
<version>2.2.3</version>
8+
<version>2.3.0</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

org.gitools.analysis/src/main/java/org/gitools/analysis/groupcomparison/GroupComparisonProcessor.java

Lines changed: 106 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,11 @@
2525
import org.gitools.analysis.groupcomparison.dimensiongroups.DimensionGroup;
2626
import org.gitools.analysis.groupcomparison.format.math33Preview.CombinatoricsUtils;
2727
import org.gitools.analysis.stats.mtc.MTCFactory;
28+
import org.gitools.analysis.stats.test.EnrichmentTest;
2829
import org.gitools.analysis.stats.test.MannWhitneyWilcoxonTest;
30+
import org.gitools.analysis.stats.test.OneWayAnovaTest;
2931
import org.gitools.analysis.stats.test.results.GroupComparisonResult;
32+
import org.gitools.analysis.stats.test.results.OneWayAnovaResult;
3033
import org.gitools.api.analysis.IProgressMonitor;
3134
import org.gitools.api.matrix.*;
3235
import org.gitools.api.resource.ResourceReference;
@@ -73,9 +76,109 @@ public void run(IProgressMonitor monitor) {
7376
IMatrixDimension sourceRows = (analysis.isTransposeData() ? dataMatrix.getDimension(COLUMNS) : dataMatrix.getDimension(ROWS));
7477
IMatrixDimension sourceColumns = (analysis.isTransposeData() ? dataMatrix.getDimension(ROWS) : dataMatrix.getDimension(COLUMNS));
7578

79+
EnrichmentTest test = analysis.getTest();
80+
Heatmap resultHeatmap;
81+
// Prepare group predicates
82+
NullConversion nullConversionFunction = new NullConversion(analysis.getNullConversion());
83+
84+
if (test.getClass() == MannWhitneyWilcoxonTest.class) {
85+
resultHeatmap = mannWhitneyWilcoxon(monitor, dataMatrix, layer, sourceRows, sourceColumns, (MannWhitneyWilcoxonTest) test, nullConversionFunction);
86+
} else {
87+
resultHeatmap = oneWayAnova(monitor, dataMatrix, layer, sourceRows, sourceColumns, (OneWayAnovaTest) test, nullConversionFunction);
88+
}
89+
90+
91+
// Finish
92+
analysis.setStartTime(startTime);
93+
analysis.setElapsedTime(System.currentTimeMillis() - startTime.getTime());
94+
analysis.setResults(new ResourceReference<>("results", resultHeatmap));
95+
96+
}
97+
98+
99+
private Heatmap oneWayAnova(IProgressMonitor monitor, IMatrix dataMatrix, IMatrixLayer<Double> layer, IMatrixDimension sourceRows, IMatrixDimension sourceColumns, OneWayAnovaTest test, NullConversion nullConversionFunction) {
100+
101+
LayerAdapter<OneWayAnovaResult> adapter = new LayerAdapter<>(OneWayAnovaResult.class);
102+
DimensionGroup[] groups = analysis.getGroups().toArray(new DimensionGroup[analysis.getGroups().size()]);
103+
104+
ArrayList<String> resultColnames = new ArrayList<>();
105+
resultColnames.add("oneWayAnova");
106+
107+
HashMatrixDimension resultColumns = new HashMatrixDimension(COLUMNS, resultColnames);
108+
HashMatrixDimension resultsRows = new HashMatrixDimension(ROWS, sourceRows);
109+
110+
Heatmap resultHeatmap = new Heatmap(
111+
new HashMatrix(
112+
adapter.getMatrixLayers(),
113+
resultsRows,
114+
resultColumns
115+
)
116+
);
117+
118+
// Run comparison
119+
dataMatrix.newPosition()
120+
.iterate(sourceRows)
121+
.monitor(monitor, "Running group comparison analysis")
122+
.transform(
123+
new OneWayAnovaFunction(
124+
test,
125+
sourceColumns,
126+
layer,
127+
nullConversionFunction,
128+
groups)
129+
)
130+
.store(resultHeatmap, new MapLayerAdapter<>(resultColumns, adapter));
131+
132+
// Run multiple test correction
133+
IMatrixPosition position = resultHeatmap.newPosition();
134+
IMatrixFunction<Double, Double> mtcFunction = MTCFactory.createFunction(analysis.getMtc());
135+
136+
for (String condition : position.iterate(resultColumns)) {
137+
// Two-tail p-Value
138+
position.iterate(adapter.getLayer(Double.class, "two-tail-p-value"), resultsRows)
139+
.transform(mtcFunction)
140+
.store(resultHeatmap, adapter.getLayer(Double.class, "corrected-two-tail-p-value"));
141+
}
142+
143+
144+
// Results formatting
145+
146+
for (HeatmapLayer resultLayer : resultHeatmap.getLayers()) {
147+
if (resultLayer.getId().contains("p-value")) {
148+
resultLayer.setDecorator(new PValueDecorator());
149+
}
150+
}
151+
152+
resultHeatmap.setTitle(analysis.getTitle() + " (results)");
153+
154+
if (analysis.isCopyAnnotation() && dataMatrix instanceof Heatmap &&
155+
((Heatmap) dataMatrix).getRows().getAnnotations() != null) {
156+
157+
resultHeatmap.getRows().addAnnotations(
158+
((Heatmap) dataMatrix).getRows().getAnnotations()
159+
);
160+
161+
for (HeatmapHeader header : ((Heatmap) dataMatrix).getRows().getHeaders()) {
162+
163+
HeatmapHeader headerClone = null;
164+
try {
165+
headerClone = CloneUtils.clone(header);
166+
} catch (Exception e) {
167+
e.printStackTrace();
168+
}
169+
170+
resultHeatmap.getRows().addHeader(headerClone);
171+
headerClone.init(resultHeatmap.getRows());
172+
}
173+
}
174+
175+
176+
return resultHeatmap;
177+
}
178+
179+
private Heatmap mannWhitneyWilcoxon(IProgressMonitor monitor, IMatrix dataMatrix, IMatrixLayer<Double> layer, IMatrixDimension sourceRows, IMatrixDimension sourceColumns, MannWhitneyWilcoxonTest test, NullConversion nullConversionFunction) {
76180
// Prepare results data matrix
77181
LayerAdapter<GroupComparisonResult> adapter = new LayerAdapter<>(GroupComparisonResult.class);
78-
MannWhitneyWilcoxonTest test = (MannWhitneyWilcoxonTest) analysis.getTest();
79182

80183
DimensionGroup[] groups = analysis.getGroups().toArray(new DimensionGroup[analysis.getGroups().size()]);
81184
ArrayList<String> resultColnames = new ArrayList<>();
@@ -105,8 +208,7 @@ public void run(IProgressMonitor monitor) {
105208
)
106209
);
107210
resultHeatmap.getColumns().addAnnotations(resultColumnAnnotations);
108-
// Prepare group predicates
109-
NullConversion nullConversionFunction = new NullConversion(analysis.getNullConversion());
211+
110212

111213
// Run comparison
112214
dataMatrix.newPosition()
@@ -205,12 +307,7 @@ public void run(IProgressMonitor monitor) {
205307
group2Header.setTitle("Group 2");
206308
resultHeatmap.getColumns().addHeader(group1Header);
207309
resultHeatmap.getColumns().addHeader(group2Header);
208-
209-
// Finish
210-
analysis.setStartTime(startTime);
211-
analysis.setElapsedTime(System.currentTimeMillis() - startTime.getTime());
212-
analysis.setResults(new ResourceReference<>("results", resultHeatmap));
213-
310+
return resultHeatmap;
214311
}
215312

216313

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
/*
2+
* #%L
3+
* gitools-core
4+
* %%
5+
* Copyright (C) 2013 Universitat Pompeu Fabra - Biomedical Genomics group
6+
* %%
7+
* This program is free software: you can redistribute it and/or modify
8+
* it under the terms of the GNU General Public License as
9+
* published by the Free Software Foundation, either version 3 of the
10+
* License, or (at your option) any later version.
11+
*
12+
* This program is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU General Public
18+
* License along with this program. If not, see
19+
* <http://www.gnu.org/licenses/gpl-3.0.html>.
20+
* #L%
21+
*/
22+
package org.gitools.analysis.groupcomparison;
23+
24+
import com.google.common.collect.Iterables;
25+
import org.gitools.analysis.groupcomparison.dimensiongroups.DimensionGroup;
26+
import org.gitools.analysis.groupcomparison.format.math33Preview.CombinatoricsUtils;
27+
import org.gitools.analysis.stats.test.MannWhitneyWilcoxonTest;
28+
import org.gitools.analysis.stats.test.OneWayAnovaTest;
29+
import org.gitools.analysis.stats.test.results.GroupComparisonResult;
30+
import org.gitools.analysis.stats.test.results.OneWayAnovaResult;
31+
import org.gitools.api.matrix.AbstractMatrixFunction;
32+
import org.gitools.api.matrix.IMatrixDimension;
33+
import org.gitools.api.matrix.IMatrixLayer;
34+
import org.gitools.api.matrix.IMatrixPosition;
35+
36+
import java.util.*;
37+
38+
import static com.google.common.base.Predicates.notNull;
39+
import static com.google.common.collect.Iterables.filter;
40+
import static com.google.common.collect.Iterables.transform;
41+
42+
public class OneWayAnovaFunction extends AbstractMatrixFunction<Map<String, OneWayAnovaResult>, String> {
43+
44+
private OneWayAnovaTest test;
45+
private IMatrixLayer<Double> valueLayer;
46+
private IMatrixDimension sourceDimension;
47+
private DimensionGroup[] groups;
48+
private NullConversion nullConversion;
49+
50+
public OneWayAnovaFunction(OneWayAnovaTest test,
51+
IMatrixDimension sourceDimension,
52+
IMatrixLayer<Double> valueLayer,
53+
NullConversion nullConversion,
54+
DimensionGroup... groups) {
55+
this.test = test;
56+
this.sourceDimension = sourceDimension;
57+
this.valueLayer = valueLayer;
58+
this.groups = groups;
59+
this.nullConversion = nullConversion;
60+
}
61+
62+
public OneWayAnovaFunction() {
63+
64+
}
65+
66+
@Override
67+
public Map<String, OneWayAnovaResult> apply(String identifier, IMatrixPosition position) {
68+
69+
List<Iterable<Double>> doubleGroups = new ArrayList<>();
70+
71+
Map<String, OneWayAnovaResult> resultHashMap = new LinkedHashMap<>();
72+
73+
for (DimensionGroup dimensionGroup : groups) {
74+
75+
doubleGroups.add(filter(transform(
76+
position.iterate(valueLayer, sourceDimension).filter(dimensionGroup.getPredicate()), nullConversion),
77+
notNull()));
78+
79+
}
80+
OneWayAnovaResult result = test.processTest(doubleGroups);
81+
resultHashMap.put(
82+
"oneWayAnova",
83+
result);
84+
return resultHashMap;
85+
86+
}
87+
88+
89+
}
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
/*
2+
* #%L
3+
* gitools-core
4+
* %%
5+
* Copyright (C) 2013 Universitat Pompeu Fabra - Biomedical Genomics group
6+
* %%
7+
* This program is free software: you can redistribute it and/or modify
8+
* it under the terms of the GNU General Public License as
9+
* published by the Free Software Foundation, either version 3 of the
10+
* License, or (at your option) any later version.
11+
*
12+
* This program is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU General Public
18+
* License along with this program. If not, see
19+
* <http://www.gnu.org/licenses/gpl-3.0.html>.
20+
* #L%
21+
*/
22+
package org.gitools.analysis.stats.test;
23+
24+
import com.google.common.collect.Lists;
25+
import com.google.common.primitives.Doubles;
26+
import org.apache.commons.math3.stat.inference.OneWayAnova;
27+
import org.apache.commons.math3.stat.ranking.NaNStrategy;
28+
import org.apache.commons.math3.stat.ranking.NaturalRanking;
29+
import org.apache.commons.math3.stat.ranking.TiesStrategy;
30+
import org.gitools.analysis.stats.test.results.OneWayAnovaResult;
31+
32+
import java.util.ArrayList;
33+
import java.util.Collection;
34+
import java.util.List;
35+
36+
37+
public class OneWayAnovaTest extends AbstractEnrichmentTest {
38+
39+
private NaturalRanking naturalRanking;
40+
41+
public OneWayAnovaTest() {
42+
super("oneWayAnova", OneWayAnovaResult.class);
43+
naturalRanking = new NaturalRanking(NaNStrategy.FIXED, TiesStrategy.AVERAGE);
44+
}
45+
46+
public OneWayAnovaResult processTest(List<Iterable<Double>> groups) {
47+
48+
49+
Collection<double[]> groupsCollection = new ArrayList<>();
50+
//int[] groupNs = new int[groups.size()];
51+
ArrayList<Integer> groupNs = new ArrayList<>();
52+
53+
int counter = 0;
54+
int totalN = 0;
55+
int minN = 0;
56+
for (Iterable<Double> g : groups) {
57+
double[] doubles = Doubles.toArray(Lists.newArrayList(g));
58+
if (doubles.length > 1) {
59+
groupsCollection.add(doubles);
60+
totalN += doubles.length;
61+
minN = minN == 0 ? doubles.length : Math.min(doubles.length, minN);
62+
groupNs.add(doubles.length);
63+
}
64+
}
65+
66+
OneWayAnova anova = new OneWayAnova();
67+
if (groupNs.size() > 1) {
68+
double pvalue = anova.anovaPValue(groupsCollection);
69+
double fvalue = anova.anovaFValue(groupsCollection);
70+
return new OneWayAnovaResult(totalN, minN, groupNs.size(), pvalue, fvalue);
71+
} else {
72+
return new OneWayAnovaResult(totalN, minN, groupNs.size(), Double.NaN, Double.NaN);
73+
}
74+
}
75+
76+
}

0 commit comments

Comments
 (0)