Skip to content

Commit

Permalink
Merge pull request #85 from vksriharsha/master
Browse files Browse the repository at this point in the history
Logging and playback fixes and optimization
  • Loading branch information
urmi-21 committed Oct 22, 2020
2 parents 12aae42 + b5c1371 commit 755c6ab
Show file tree
Hide file tree
Showing 14 changed files with 1,449 additions and 760 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
</descriptorRefs>
</configuration>
</plugin>
<!-- <plugin> <artifactId>maven-assembly-plugin</artifactId> <executions>
<!-- <plugin> <artifactId>maven-assembly-plugin</artifactId> <executions>
<execution> <phase>package</phase> <goals> <goal>single</goal> </goals> </execution>
</executions> <configuration> <archive> <manifest> <mainClass>edu.iastate.metnet.metaomgraph.MetaOmGraph</mainClass>
</manifest> </archive> <descriptorRefs> <descriptorRef>jar-with-dependencies</descriptorRef>
Expand Down
108 changes: 98 additions & 10 deletions src/edu/iastate/metnet/metaomgraph/MetaOmAnalyzer.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package edu.iastate.metnet.metaomgraph;

import edu.iastate.metnet.metaomgraph.logging.ActionProperties;
import edu.iastate.metnet.metaomgraph.ui.BlockingProgressDialog;
import edu.iastate.metnet.metaomgraph.ui.ClearableTextField;
import edu.iastate.metnet.metaomgraph.ui.DualTablePanel;
Expand All @@ -16,8 +17,11 @@
import java.io.FileWriter;
import java.io.IOException;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
Expand Down Expand Up @@ -51,15 +55,57 @@ public MetaOmAnalyzer() {
}

/**
* @author urmi Update the exclude list to remove excluded data cols from charts
* @author urmi Update the exclude list to remove excluded data cols from charts and log
* it in the mog log.
* @param excluded
* list of excluded data cols
*
*/
public static void updateExcluded(Set<String> excluded) {
public static void updateExcluded(Set<String> excluded, boolean loggingRequired) {
if (excluded.size() == 0) {
MetaOmAnalyzer.exclude = null;
MetaOmAnalyzer.excludeCount = 0;
MetaOmGraph.fixTitle();

HashMap<String, Object> actionMap = new HashMap<String, Object>();
HashMap<String, Object> dataMap = new HashMap<String, Object>();
HashMap<String, Object> result = new HashMap<String, Object>();

actionMap.put("parent", MetaOmGraph.getCurrentProjectActionId());

MetadataHybrid mdhObj = MetaOmGraph.getActiveProject().getMetadataHybrid();
MetadataCollection mcol = null;
if(mdhObj != null) {
mcol = mdhObj.getMetadataCollection();
}
if(exclude != null) {
boolean [] excludedSamplesBoolean = MetaOmAnalyzer.getExclude();
List<Integer> excludedSamplesInteger = new ArrayList<Integer>();

for(int index=0; index < exclude.length; index++) {
if(exclude[index]) {
excludedSamplesInteger.add(index);
}
}
result.put("Excluded Samples", excludedSamplesInteger);

dataMap.put("Data Column", mcol.getDatacol());
}
else {
result.put("Excluded Samples", new Integer[0]);
}

result.put("result", "OK");

ActionProperties filterMetadataAction = new ActionProperties("filter-metadata", actionMap, dataMap, result,
new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS zzz").format(new Date()));

if(loggingRequired) {
result.put("Sample Action", filterMetadataAction.getCounter()+1);
filterMetadataAction.logActionProperties();
MetaOmGraph.setCurrentSamplesActionId(filterMetadataAction.getActionNumber());
}

return;
} else {

Expand All @@ -74,6 +120,7 @@ public static void updateExcluded(Set<String> excluded) {
int excount = 0;
String[] dataCols = MetaOmGraph.getActiveProject().getDataColumnHeaders();
for (int j = 0; j < dataCols.length; j++) {
String dc = dataCols[j];
if (excluded.contains(dataCols[j])) {
exclude[j] = true;
excount++;
Expand All @@ -86,6 +133,47 @@ public static void updateExcluded(Set<String> excluded) {
MetaOmAnalyzer.excludeCount = excount;
MetaOmGraph.fixTitle();


// Harsha - logging the sample filter action

HashMap<String, Object> actionMap = new HashMap<String, Object>();
HashMap<String, Object> dataMap = new HashMap<String, Object>();
HashMap<String, Object> result = new HashMap<String, Object>();

actionMap.put("parent", MetaOmGraph.getCurrentProjectActionId());

MetadataHybrid mdhObj = MetaOmGraph.getActiveProject().getMetadataHybrid();
MetadataCollection mcol = null;
if(mdhObj != null) {
mcol = mdhObj.getMetadataCollection();
}
if(exclude != null) {
boolean [] excludedSamplesBoolean = MetaOmAnalyzer.getExclude();
List<Integer> excludedSamplesInteger = new ArrayList<Integer>();

for(int index=0; index < exclude.length; index++) {
if(exclude[index]) {
excludedSamplesInteger.add(index);
}
}
result.put("Excluded Samples", excludedSamplesInteger);
dataMap.put("Data Column", mcol.getDatacol());
}
else {
result.put("Excluded Samples", new Integer[0]);
}

result.put("result", "OK");

ActionProperties filterMetadataAction = new ActionProperties("filter-metadata", actionMap, dataMap, result,
new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS zzz").format(new Date()));

if(loggingRequired) {
result.put("Sample Action", filterMetadataAction.getCounter()+1);
filterMetadataAction.logActionProperties();
MetaOmGraph.setCurrentSamplesActionId(filterMetadataAction.getActionNumber());
}

return;
}

Expand Down Expand Up @@ -148,7 +236,7 @@ public static void doAnalysis(final MetaOmProject project, String geneList, fina
final Number[] result = new Number[project.getRowCount()];
// final Number[] result;
String message = project.getRowName(entries[row])[project.getDefaultColumn()] + "";

if (method == 1) {
message = message + " - Pearson Correlation";
} else if (method == 2) {
Expand Down Expand Up @@ -368,7 +456,7 @@ public Object construct() {

if ((row == 0) && (bufferSize < 0L)) {
//System.gc();

long freemem = Runtime.getRuntime().freeMemory();
long maxmem = Runtime.getRuntime().maxMemory();
long totmem = Runtime.getRuntime().totalMemory();
Expand Down Expand Up @@ -584,9 +672,9 @@ public Object construct() {
long timeStarted = System.nanoTime();
String timeString = "Preparing...";
for (int row = 0; (row < entries.length) && (!progress.isCanceled()); row++) {

double[] sourceData = project.getIncludedData(entries[row]);


CorrelationCalc calcy = new CorrelationCalc(sourceData, MetaOmAnalyzer.exclude);

Expand Down Expand Up @@ -628,7 +716,7 @@ public Object construct() {
//JOptionPane.showMessageDialog(null, "buff size:"+dataBuffer.size());
} else {
//long st = System.currentTimeMillis();

data = project.getIncludedData(entries[i]);
//long spt = System.currentTimeMillis();
//long elapsedTime = spt - st;
Expand Down Expand Up @@ -656,7 +744,7 @@ public Object construct() {
if ((row == 0) && (i >= entries.length - bufferSize)) {
dataBuffer.add(data);
}

if (nameCol >= 0) {
out.write(rowNames[row][nameCol] + "\t" + rowNames[i][nameCol]);
} else {
Expand Down Expand Up @@ -770,7 +858,7 @@ public static void showExcludeDialog(MetaOmProject myProject, Frame parent) {
}

private static class ExcludeDialog extends JDialog
implements ActionListener, HashLoadable<MetaOmAnalyzer.ExcludeData> {
implements ActionListener, HashLoadable<MetaOmAnalyzer.ExcludeData> {
private MetaOmProject myProject;

private DualTablePanel dtp;
Expand Down Expand Up @@ -857,7 +945,7 @@ public ExcludeDialog(Frame parent, String title, boolean modal, MetaOmProject my
buttonPanel.add(cancelButton);

dtp.getButtonPanel()
.add(Box.createRigidArea(new Dimension(0, metadataExcludeButton.getPreferredSize().height)));
.add(Box.createRigidArea(new Dimension(0, metadataExcludeButton.getPreferredSize().height)));
dtp.getButtonPanel().add(metadataExcludeButton);
dtp.getButtonPanel().add(metadataIncludeButton);
HashtableSavePanel savePanel = new HashtableSavePanel(myProject.getSavedExcludes(), this);
Expand Down
Loading

0 comments on commit 755c6ab

Please sign in to comment.