Skip to content

Commit

Permalink
1.2.3 release
Browse files Browse the repository at this point in the history
  • Loading branch information
lilit-nersisyan committed Jul 9, 2014
1 parent 45a705e commit a0b942e
Show file tree
Hide file tree
Showing 7 changed files with 181 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,13 @@ public class KeggParserPanel extends JPanel implements CytoPanelComponent {

private static final long serialVersionUID = 8292806967891823933L;


public KeggParserPanel() {

JLabel lbXYZ = new JLabel("KEGGParser Panel label ");
this.setPreferredSize(new Dimension(300, getHeight()));
this.add(lbXYZ);
this.setVisible(true);
}


public Component getComponent() {
return this;
}
Expand Down
13 changes: 7 additions & 6 deletions src/main/java/org/cytoscape/keggparser/com/EKGMLNodeAttrs.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ public enum EKGMLNodeAttrs {
KGML_NAME("name", ""),
KGML_TYPE("type", ""),
KGML_LINK("link", ""),
KGML_WIDTH("width", ""),
KGML_HEIGHT("height", ""),
KGML_FGCOLOR("fgcolor", ""),
KGML_BGCOLOR("bgcolor", ""),
KGML_X("x", ""),
KGML_Y("y", "");
KGML_WIDTH("width", "30"),
KGML_HEIGHT("height", "10"),
KGML_FGCOLOR("fgcolor", "#FFFFFF"),
KGML_BGCOLOR("bgcolor", "#FFFFFF"),
KGML_X("x", "0"),
KGML_Y("y", "0"),
KGML_COORDS("coords", "");

private String attribute;
private String defaultValue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -802,8 +802,6 @@ private void enableComponents() {
jb_loadDataset.setText(xmlFile.getName() + "_" +
jcb_selectTissue.getSelectedItem().toString() + " loaded");
}


}


Expand Down
141 changes: 110 additions & 31 deletions src/main/java/org/cytoscape/keggparser/parsing/SaxHandler.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package org.cytoscape.keggparser.parsing;

import org.cytoscape.keggparser.com.*;
import org.slf4j.LoggerFactory;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
Expand Down Expand Up @@ -34,41 +33,121 @@ public void startElement(String uri, String localName, String qName, Attributes
node.setLink(attributes.getValue(EKGMLNodeAttrs.KGML_LINK.getAttrName()));
}
else if (qName.equals("graphics")){
node.setGraphicsName(attributes.getValue(EKGMLNodeAttrs.KGML_NAME.getAttrName()));
node.setFgColorAttr(attributes.getValue(EKGMLNodeAttrs.KGML_FGCOLOR.getAttrName()));
node.setFgColor(Color.decode(attributes.getValue(EKGMLNodeAttrs.KGML_FGCOLOR.getAttrName())));
node.setBgColorAttr(attributes.getValue(EKGMLNodeAttrs.KGML_BGCOLOR.getAttrName()));
node.setBgColor(Color.decode(attributes.getValue(EKGMLNodeAttrs.KGML_BGCOLOR.getAttrName())));
node.setShape(attributes.getValue(EKGMLNodeAttrs.KGML_TYPE.getAttrName()));
int x;
try {
x = Integer.parseInt(attributes.getValue(EKGMLNodeAttrs.KGML_X.getAttrName()));
} catch (IllegalArgumentException e1 ){

try {
x = (int) Double.parseDouble(attributes.getValue(EKGMLNodeAttrs.KGML_X.getAttrName()));
} catch (IllegalArgumentException e2 ){
LoggerFactory.getLogger(SaxHandler.class).warn(e2.getMessage());
x = 0;
}
String value;
if ((value = attributes.getValue(EKGMLNodeAttrs.KGML_NAME.getAttrName()))!=null)
node.setGraphicsName(value);
else {
ParsingReportGenerator.getInstance()
.append("Attribute " + EKGMLNodeAttrs.KGML_NAME.getAttrName()
+ " name does not exist for node " + node.toString());
node.setGraphicsName(EKGMLNodeAttrs.KGML_NAME.getDefaultValue());
}
if((value = attributes.getValue(EKGMLNodeAttrs.KGML_FGCOLOR.getAttrName()))!=null)
node.setFgColorAttr(value);
else {
ParsingReportGenerator.getInstance()
.appendLine("Attribute "
+ EKGMLNodeAttrs.KGML_FGCOLOR.getAttrName()
+ " does not exist for node " + node.toString());
node.setFgColorAttr(EKGMLNodeAttrs.KGML_FGCOLOR.getDefaultValue());
}
node.setX(x);
int y;
try {
y = Integer.parseInt(attributes.getValue(EKGMLNodeAttrs.KGML_Y.getAttrName()));
} catch (IllegalArgumentException e1 ){

try {
y = (int) Double.parseDouble(attributes.getValue(EKGMLNodeAttrs.KGML_Y.getAttrName()));
} catch (IllegalArgumentException e2 ){
LoggerFactory.getLogger(SaxHandler.class).warn(e2.getMessage());
y = 0;
node.setFgColor(Color.decode
(attributes.getValue(EKGMLNodeAttrs.KGML_FGCOLOR.getAttrName())));
} catch (Exception e){
ParsingReportGenerator.getInstance()
.appendLine("Could not set "
+ EKGMLNodeAttrs.KGML_FGCOLOR.getAttrName()
+ " for node " + node.toString());
node.setFgColor(Color.decode(EKGMLNodeAttrs.KGML_FGCOLOR.getDefaultValue()));
}

if ((value = attributes.getValue(EKGMLNodeAttrs.KGML_BGCOLOR.getAttrName()))!=null)
node.setBgColorAttr(value);
else {
ParsingReportGenerator.getInstance().appendLine("Attribute "
+ EKGMLNodeAttrs.KGML_BGCOLOR.getAttrName()
+ "name does not exist for node " + node.toString());
node.setBgColorAttr(EKGMLNodeAttrs.KGML_BGCOLOR.getDefaultValue());
}
try{
node.setBgColor(Color.decode(attributes.getValue(EKGMLNodeAttrs.KGML_BGCOLOR.getAttrName())));
} catch (Exception e){
ParsingReportGenerator.getInstance().appendLine("Could not set "
+ EKGMLNodeAttrs.KGML_BGCOLOR.getAttrName()
+ " for node " + node.toString());
node.setBgColor(Color.decode(EKGMLNodeAttrs.KGML_BGCOLOR.getDefaultValue()));
}

if ((value = attributes.getValue(EKGMLNodeAttrs.KGML_TYPE.getAttrName()))!=null)
node.setShape(value);
else {
ParsingReportGenerator.getInstance().appendLine("Attribute "
+ EKGMLNodeAttrs.KGML_TYPE.getAttrName()
+ " does not exist for node " + node.toString());
node.setShape(EKGMLNodeAttrs.KGML_TYPE.getDefaultValue());
}

int x = (int) Double.parseDouble(EKGMLNodeAttrs.KGML_X.getDefaultValue());
int y = (int) Double.parseDouble(EKGMLNodeAttrs.KGML_Y.getDefaultValue());
int width = (int) Double.parseDouble(EKGMLNodeAttrs.KGML_WIDTH.getDefaultValue());
int height = (int) Double.parseDouble(EKGMLNodeAttrs.KGML_HEIGHT.getDefaultValue());

if ((value = attributes.getValue(EKGMLNodeAttrs.KGML_COORDS.getAttrName())) != null){
String[] coords = value.split(",");
if (coords.length != 4) {
ParsingReportGenerator.getInstance()
.appendLine(EKGMLNodeAttrs.KGML_COORDS.getAttrName()
+ " attribute contains "
+ coords.length + " elements, instead of 4");
} else{
try{
x = (int) Double.parseDouble(coords[0]);
y = (int) Double.parseDouble(coords[1]);
int x2 = (int) Double.parseDouble(coords[2]);
int y2 = (int) Double.parseDouble(coords[3]);
if(x2 - x > 1)
width = x2 - x;
else
width = 5;
if (y2 - y > 1)
height = y2 - y;
else
height = 5;
} catch (Exception e){
}
}
} else{
if ((value = attributes.getValue(EKGMLNodeAttrs.KGML_X.getAttrName()))!=null) {
try {
x = (int) Double.parseDouble(value);
} catch (Exception e) {
}
}
if ((value = attributes.getValue(EKGMLNodeAttrs.KGML_Y.getAttrName()))!=null) {
try {
y = (int) Double.parseDouble(value);
} catch (Exception e) {
}
}
if ((value = attributes.getValue(EKGMLNodeAttrs.KGML_WIDTH.getAttrName()))!=null) {
try {
width = (int) Double.parseDouble(value);
} catch (Exception e) {
}
}
if ((value = attributes.getValue(EKGMLNodeAttrs.KGML_HEIGHT.getAttrName()))!=null) {
try {
height = (int) Double.parseDouble(value);
} catch (Exception e) {
}
}
}
node.setY(y);

node.setWidth(Integer.parseInt(attributes.getValue(EKGMLNodeAttrs.KGML_WIDTH.getAttrName())));
node.setHeight(Integer.parseInt(attributes.getValue(EKGMLNodeAttrs.KGML_HEIGHT.getAttrName())));
node.setX(x);
node.setY(y);
node.setWidth(width);
node.setHeight(height);
}
else if (qName.equals("component")){
node.addComponentId(Integer.parseInt(attributes.getValue(EKGMLNodeAttrs.KGML_ID.getAttrName())));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ private void loadBioGpsData(File source) {

public void createGeneCardsXML(File sourceFile, File outFile) {
try {
loadBioGpsData(sourceFile);
loadBioGpsData(sourceFile);
// System.out.println(tissueList);
// System.out.println(expMap.toString());
DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
Expand Down
27 changes: 27 additions & 0 deletions src/main/main.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/java" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="keggtranslator-api-2.3.0" level="project" />
<orderEntry type="library" name="Maven: org.cytoscape:application-api:3.0.2" level="project" />
<orderEntry type="library" name="Maven: org.cytoscape:swing-application-api:3.0.2" level="project" />
<orderEntry type="library" name="Maven: org.cytoscape:event-api:3.0.2" level="project" />
<orderEntry type="library" name="Maven: org.cytoscape:model-api:3.0.2" level="project" />
<orderEntry type="library" name="Maven: org.cytoscape:service-api:3.0.2" level="project" />
<orderEntry type="library" name="Maven: org.cytoscape:session-api:3.0.2" level="project" />
<orderEntry type="library" name="Maven: org.cytoscape:viewmodel-api:3.0.2" level="project" />
<orderEntry type="library" name="Maven: org.cytoscape:vizmap-api:3.0.2" level="project" />
<orderEntry type="library" name="Maven: org.cytoscape:work-swing-api:3.0.2" level="project" />
<orderEntry type="library" name="Maven: org.osgi:org.osgi.core:4.2.0" level="project" />
<orderEntry type="library" name="Maven: org.ops4j.pax.logging:pax-logging-api:1.5.2" level="project" />
<orderEntry type="library" name="Maven: org.cytoscape:work-api:3.0.2" level="project" />
<orderEntry type="library" name="Maven: org.cytoscape:presentation-api:3.0.2" level="project" />
<orderEntry type="library" name="Maven: com.google.code.gson:gson:2.2.1" level="project" />
</component>
</module>

36 changes: 36 additions & 0 deletions src/test/test.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/java" isTestSource="true" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="main" />
<orderEntry type="library" name="Maven: org.osgi:org.osgi.core:4.2.0" level="project" />
<orderEntry type="library" name="Maven: org.cytoscape:swing-application-api:3.0.2" level="project" />
<orderEntry type="library" name="Maven: org.cytoscape:service-api:test-jar:tests:3.0.2" level="project" />
<orderEntry type="library" name="Maven: org.cytoscape:work-swing-api:3.0.2" level="project" />
<orderEntry type="library" name="Maven: org.cytoscape:session-api:3.0.2" level="project" />
<orderEntry type="library" name="Maven: org.cytoscape:model-api:3.0.2" level="project" />
<orderEntry type="library" name="Maven: org.cytoscape:viewmodel-api:3.0.2" level="project" />
<orderEntry type="library" name="Maven: org.cytoscape:vizmap-api:3.0.2" level="project" />
<orderEntry type="library" name="Maven: org.cytoscape:application-api:3.0.2" level="project" />
<orderEntry type="library" name="Maven: org.cytoscape:event-api:3.0.2" level="project" />
<orderEntry type="module-library" scope="TEST">
<library name="JUnit4">
<CLASSES>
<root url="jar://$APPLICATION_HOME_DIR$/lib/junit-4.11.jar!/" />
<root url="jar://$APPLICATION_HOME_DIR$/lib/hamcrest-core-1.3.jar!/" />
<root url="jar://$APPLICATION_HOME_DIR$/lib/hamcrest-library-1.3.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="library" name="Maven: org.easytesting:fest-swing:1.2.1" level="project" />
<orderEntry type="library" name="Maven: org.easytesting:fest-util:1.1.3" level="project" />
</component>
</module>

0 comments on commit a0b942e

Please sign in to comment.