diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/CyActivator.java b/src/main/java/de/hhu/ba/yoshikoWrapper/CyActivator.java index 35f5c1ce67dc5170b2ee415fc2343b291f7c2dc7..149563f1238675f7d5e280c739d3df83019cf44a 100644 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/CyActivator.java +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/CyActivator.java @@ -59,6 +59,10 @@ import de.hhu.ba.yoshikoWrapper.core.YoshikoLoader; import de.hhu.ba.yoshikoWrapper.gui.HintManager; import de.hhu.ba.yoshikoWrapper.gui.MainPanel; +/** + * Entry point for the application as required by the Cytoscape API + * Registers services and sets up resources for Yoshiko + */ public class CyActivator extends AbstractCyActivator { public CyActivator() { @@ -68,12 +72,13 @@ public class CyActivator extends AbstractCyActivator { @Override public void start(BundleContext context) throws Exception { //Initialize cytoscape configuration system + //This is responsible for saving/loading configuration ConfigurationManager cm = new ConfigurationManager("yoshikoWrapper", "yoshiko.props"); Properties propsReaderServiceProps = new Properties(); propsReaderServiceProps.setProperty("cyPropertyName", "yoshiko.props"); registerAllServices(context,cm,propsReaderServiceProps); - //Create symbolic links to give other classes access + //Create symbolic links to give other classes access to Cytoscape Services CyCore.cy = getService(context, CyApplicationManager.class); CyCore.dialogTaskManager = getService(context, DialogTaskManager.class); CyCore.registrar = getService(context, CyServiceRegistrar.class); @@ -96,10 +101,10 @@ public class CyActivator extends AbstractCyActivator { //Store a reference to the Version YoshUtil.version = context.getBundle().getVersion(); - //Set language according to settings + //Set language according to settings -> Default to enUS LocalizationManager.switchLanguage(cm.getProperties().getProperty("locale", "enUS")); - //Attempt to find the yoshiko lib in r a previously stored location + //Attempt to find the yoshiko lib in a previously stored location and load it if (!YoshikoLoader.isLibraryLoaded()){ String pathToYosh = cm.getProperties().getProperty("pathToYoshiko"); if (pathToYosh != null && pathToYosh != "null") { @@ -108,7 +113,7 @@ public class CyActivator extends AbstractCyActivator { } - //main panel + //Initialize and register main panel MainPanel mainPanel = new MainPanel(); registerService(context,mainPanel,CytoPanelComponent.class, new Properties()); @@ -121,6 +126,7 @@ public class CyActivator extends AbstractCyActivator { registerService(context,netChangeListener, SessionLoadedListener.class, new Properties()); registerService(context,netChangeListener, SetCurrentNetworkListener.class, new Properties()); + //Show Startup-Hint HintManager.showMappingHint(Hint.FIRST_START); } diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/EditCostPanel.java b/src/main/java/de/hhu/ba/yoshikoWrapper/gui/EditCostPanel.java index 660df5c4129bfd52046eb0bc75acfb6a3461bed1..1d67f7a5bfef0c14bd6e90ab5a8bb9f86204e1f3 100644 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/EditCostPanel.java +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/gui/EditCostPanel.java @@ -43,9 +43,13 @@ public class EditCostPanel extends JPanel { private final JLabel icLabel; private final JLabel dcLabel; + private final HelpButton helpButton; + public EditCostPanel() { //Initialize components + helpButton = new HelpButton(); + columnMapper = new ColumnMapper(); icField = new DoubleInputField(Double.NEGATIVE_INFINITY,0); @@ -57,11 +61,11 @@ public class EditCostPanel extends JPanel { icLabel = new JLabel(LocalizationManager.get("defaultInsertion")); dcLabel = new JLabel(LocalizationManager.get("defaultDeletion")); - //Group the labels with their text fields + //Add components SwingUtil.addAll(this,icLabel,icField); SwingUtil.addAll(this,dcLabel,dcField); - + SwingUtil.addAll(helpButton); SwingUtil.addAll(this,columnMapper); @@ -69,12 +73,14 @@ public class EditCostPanel extends JPanel { GroupLayout layout = new GroupLayout(this); layout.setHorizontalGroup(layout.createParallelGroup() + .addComponent(helpButton,Alignment.TRAILING) .addComponent(columnMapper) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(Alignment.LEADING) .addComponent(icLabel) .addComponent(dcLabel) ) + .addGap(4) .addGroup(layout.createParallelGroup(Alignment.LEADING) .addComponent(icField) .addComponent(dcField) @@ -83,13 +89,16 @@ public class EditCostPanel extends JPanel { ); layout.setVerticalGroup(layout.createSequentialGroup() + .addComponent(helpButton) .addComponent(columnMapper) - .addGroup(layout.createParallelGroup() + .addGroup(layout.createParallelGroup(Alignment.BASELINE) .addComponent(icLabel) + .addGap(4) .addComponent(icField) ) - .addGroup(layout.createParallelGroup() + .addGroup(layout.createParallelGroup(Alignment.BASELINE) .addComponent(dcLabel) + .addGap(4) .addComponent(dcField) ) ); diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/HelpButton.java b/src/main/java/de/hhu/ba/yoshikoWrapper/gui/HelpButton.java new file mode 100644 index 0000000000000000000000000000000000000000..19b00f789b66d8d714dd00f4da58e94c09daeb6f --- /dev/null +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/gui/HelpButton.java @@ -0,0 +1,39 @@ +package de.hhu.ba.yoshikoWrapper.gui; + +import java.awt.Insets; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.io.IOException; +import java.net.URI; + +import javax.swing.JButton; + +import de.hhu.ba.yoshikoWrapper.core.GraphicsLoader; +import de.hhu.ba.yoshikoWrapper.core.LocalizationManager; +import de.hhu.ba.yoshikoWrapper.help.HelpLinks; + +@SuppressWarnings("serial") +public class HelpButton extends JButton{ + public HelpButton() { + super(GraphicsLoader.getInfoIcon(12)); + setMargin(new Insets(0,0,0,0)); + setToolTipText(LocalizationManager.get("tooltip_helpButton")); + addActionListener( + new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + URI uri = HelpLinks.getHelpLink(getParent().getClass()); + if (uri != null) { + try { + java.awt.Desktop.getDesktop().browse(uri); + } catch (IOException ex) { + ex.printStackTrace(); + } + } + } + + } + + ); + } +} diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/MainPanel.java b/src/main/java/de/hhu/ba/yoshikoWrapper/gui/MainPanel.java index b6c4d40728b0dfa5338961319759a8cb98c34142..3a97ea88cf03566b1ae68809433631c457a77fe0 100644 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/gui/MainPanel.java +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/gui/MainPanel.java @@ -96,7 +96,7 @@ public class MainPanel extends JPanel implements CytoPanelComponent { //Initialize Swing components header = new YoshikoHeader(); - about = new JButton(GraphicsLoader.getInfoIcon(16)); + about = new JButton(LocalizationManager.get("aboutButton"),GraphicsLoader.getInfoIcon(16)); about.addActionListener(new ActionListener() { @Override diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/help/HelpLinks.java b/src/main/java/de/hhu/ba/yoshikoWrapper/help/HelpLinks.java new file mode 100644 index 0000000000000000000000000000000000000000..cd73d0adafae758eebe24039851dca1ce490ac80 --- /dev/null +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/help/HelpLinks.java @@ -0,0 +1,35 @@ +package de.hhu.ba.yoshikoWrapper.help; + +import java.net.URI; +import java.net.URISyntaxException; +import java.util.HashMap; + +import de.hhu.ba.yoshikoWrapper.gui.EditCostPanel; + +public final class HelpLinks { + + private static final String docLocation = "file:///home/philipp/workspace/cs/BachelorThesis/YoshikoWrapper/thesis/tex/Thesis.pdf"; + + private static final HashMap <Class<?>,URI> helpLinks; + + static { + helpLinks = new HashMap<Class<?>,URI>(); + try { + helpLinks.put(EditCostPanel.class, (buildURI("subsubsection.2.2.1"))); + } catch (URISyntaxException e) { + e.printStackTrace(); + } + } + + public static URI getHelpLink(Class<?> c) { + if (helpLinks.containsKey(c)) { + return helpLinks.get(c); + } + return null; + } + + private static URI buildURI(String fragment) throws URISyntaxException { + return new URI(null,docLocation,fragment); + } + +} diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/help/package-info.java b/src/main/java/de/hhu/ba/yoshikoWrapper/help/package-info.java new file mode 100644 index 0000000000000000000000000000000000000000..31f319e65698ab030a6e52c224a1c7b08f79d846 --- /dev/null +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/help/package-info.java @@ -0,0 +1 @@ +package de.hhu.ba.yoshikoWrapper.help; \ No newline at end of file diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/swig/CoreAlgorithm.java b/src/main/java/de/hhu/ba/yoshikoWrapper/swig/CoreAlgorithm.java index 4ae599e58c322923ebdb3ddb144a70af53349eb8..53f898899dc96ded618242cbf87b4b061c5ec030 100644 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/swig/CoreAlgorithm.java +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/swig/CoreAlgorithm.java @@ -40,12 +40,12 @@ public class CoreAlgorithm { return (cPtr == 0) ? null : new ClusterEditingSolutions(cPtr, false); } - public void cancel() { - LibraryInterfaceJNI.CoreAlgorithm_cancel(swigCPtr, this); - } - public void registerCplexInformer(CplexInformer informer) { LibraryInterfaceJNI.CoreAlgorithm_registerCplexInformer(swigCPtr, this, CplexInformer.getCPtr(informer), informer); } + public void cancel() { + LibraryInterfaceJNI.CoreAlgorithm_cancel(swigCPtr, this); + } + } diff --git a/src/main/java/de/hhu/ba/yoshikoWrapper/swig/LibraryInterfaceJNI.java b/src/main/java/de/hhu/ba/yoshikoWrapper/swig/LibraryInterfaceJNI.java index 48f3c2538da2bf3bb1b3ad844ca5dc2a6657048f..7048875c1a01367e1e6bcb58af2f9aa8599c18ed 100644 --- a/src/main/java/de/hhu/ba/yoshikoWrapper/swig/LibraryInterfaceJNI.java +++ b/src/main/java/de/hhu/ba/yoshikoWrapper/swig/LibraryInterfaceJNI.java @@ -66,8 +66,8 @@ public class LibraryInterfaceJNI { public final static native void CplexInformer_director_connect(CplexInformer obj, long cptr, boolean mem_own, boolean weak_global); public final static native void CplexInformer_change_ownership(CplexInformer obj, long cptr, boolean take_or_release); public final static native long CoreAlgorithm_run(long jarg1, CoreAlgorithm jarg1_); - public final static native void CoreAlgorithm_cancel(long jarg1, CoreAlgorithm jarg1_); public final static native void CoreAlgorithm_registerCplexInformer(long jarg1, CoreAlgorithm jarg1_, long jarg2, CplexInformer jarg2_); + public final static native void CoreAlgorithm_cancel(long jarg1, CoreAlgorithm jarg1_); public final static native void delete_CoreAlgorithm(long jarg1); public final static native String getVersionString(); public final static native void setTimeLimit(int jarg1); diff --git a/src/main/resources/YoshikoStrings.properties b/src/main/resources/YoshikoStrings.properties index 70c004bedc06fd346e0704b3eed593a5e996c3a1..7f746036358937dd8a529e6a8d648efed5ac39bb 100644 --- a/src/main/resources/YoshikoStrings.properties +++ b/src/main/resources/YoshikoStrings.properties @@ -1,16 +1,16 @@ #------------------------------------------------------------------------------- # Copyright (C) 2017 Philipp Spohr -# +# # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: -# +# # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. -# +# # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -19,56 +19,58 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. #------------------------------------------------------------------------------- -resultsPanelTitle = Yoshiko Results -yoshVersion = Yoshiko Version -wrapperVersion = Yoshiko Plugin for Cytoscape Version -resolveLibPath = Resolve Yoshiko Library Path -yoshTask = Performing Yoshiko Algorithm -solution = Solution -restartNeeded = Changes only take effect after restart! -noLibTitle = Library not loaded! -noLibMessage = There is no Yoshiko Library currently loaded! You might have to specify its location. +about = INSERT SOME AMAZING INFO ABOUT THIS APPLICATION,\n THE AUTHOR AND WHERE TO FIND MORE INFO HERE\n <a href=\"www.hhu.de\" >LINK</a> +aboutButton = About Yoshiko +aboutTitle = Yoshiko Plugin Info cluster = Cluster -clusterSize = Cluster Size: -multFactor = Multiplicative Factor for SNR: -paidCost = Paid a total modification cost of: clusterFound = Clusters found: -deleteSolution = Do you really want to delete this solution? -warning = Warning -timeLimitILP = Use time limit for ILP (s): -timedOutTitle = Timeout -timedOutMessage = The ILP exceeded the time-limit! +clusterSize = Cluster Size: +continueTimeout = The ILP has exceeded the given time limit. Do you want to continue? (This may take a long time) cost = Cost: -nrSolutions = Number of Solutions: -redRuleChooserTitle = Reduction Rules -discardSolution = Discard createMetaGraph = Create Meta-Graph -metaGraph = Meta Graph -showAdvanced = Show advanced options -editingCostPanel = Editing Costs -libraryPanel = Library -defaultInsertion = Default insertion cost: +currentGap = [ILP] Current Instance Gap defaultDeletion = Default deletion cost: -switchLanguage = Plugin language +defaultInsertion = Default insertion cost: +deleteSolution = Do you really want to delete this solution? +disableMultiThreading = Disable Multithreading +discardSolution = Discard +editingCostPanel = Editing Costs +firstStart = Thanks for using the Yoshiko Clustering Tool!\nIt appears, that this is your first time using this tool.\nIf you want an in-depth explanation of the algorithm please refer to: [INSERT COOL LINK HERE] +gap = Gap +getYoshiko = Get Yoshiko Library icTooltip = This value is used to determine what the algorithm pays when inserting an edge.\nExisting mappings overwrite this value.\nA higher value means that the algorithm is less likely to insert edges in order to generate a cluster. -operationMode = Operation Mode -run = Perform Algorithm -nodes = Nodes -continueTimeout = The ILP has exceeded the given time limit. Do you want to continue? (This may take a long time) -timeoutTitle = Timeout -incompleteResult = This run yielded no usable result! -optimal = Optimal Solution -notOptimal = Non-Optimal Solution ilpMarker = ILP Properties -timeoutMarker = Timed Out +incompleteResult = This run yielded no usable result! instance = Instance -gap = Gap -currentGap = [ILP] Current Instance Gap -disableMultiThreading = Disable Multithreading -yoshikoHint = Yoshiko Hint -aboutTitle = Yoshiko Plugin Info -getYoshiko = Get Yoshiko Library +libraryPanel = Library +metaGraph = Meta Graph +multFactor = Multiplicative Factor for SNR: noFeasible = No feasible solution found! +noLibMessage = There is no Yoshiko Library currently loaded! You might have to specify its location. +noLibTitle = Library not loaded! noMappingHint = You haven't mapped the cost value to a column in your edge table.\nYoshiko runs significantly faster and generates better solutions if you map values. -firstStart = Thanks for using the Yoshiko Clustering Tool!\nIt appears, that this is your first time using this tool.\nIf you want an in-depth explanation of the algorithm please refer to: [INSERT COOL LINK HERE] -about = INSERT SOME AMAZING INFO ABOUT THIS APPLICATION,\n THE AUTHOR AND WHERE TO FIND MORE INFO HERE\n <a href=\"www.hhu.de\" >LINK</a> \ No newline at end of file +nodes = Nodes +notOptimal = Non-Optimal Solution +nrSolutions = Number of Solutions: +operationMode = Operation Mode +optimal = Optimal Solution +paidCost = Paid a total modification cost of: +redRuleChooserTitle = Reduction Rules +resolveLibPath = Resolve Yoshiko Library Path +restartNeeded = Changes only take effect after restart! +resultsPanelTitle = Yoshiko Results +run = Perform Algorithm +showAdvanced = Show advanced options +solution = Solution +switchLanguage = Plugin language +timeLimitILP = Use time limit for ILP (s): +timedOutMessage = The ILP exceeded the time-limit! +timedOutTitle = Timeout +timeoutMarker = Timed Out +timeoutTitle = Timeout +tooltip_helpButton = Show in-depth help for this component +warning = Warning +wrapperVersion = Yoshiko Plugin for Cytoscape Version +yoshTask = Performing Yoshiko Algorithm +yoshVersion = Yoshiko Version +yoshikoHint = Yoshiko Hint \ No newline at end of file diff --git a/thesis/tex/.gitignore b/thesis/tex/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..91d7ce4d6e217830768085593ea3fce3175070a9 --- /dev/null +++ b/thesis/tex/.gitignore @@ -0,0 +1,5 @@ +*.out +*.aux +*.gz +*.log +*.toc diff --git a/thesis/tex/Chapter/dm_impl.tex b/thesis/tex/Chapter/dm_impl.tex new file mode 100644 index 0000000000000000000000000000000000000000..5fd0654cd52f3c916d93f332a881268995497bcf --- /dev/null +++ b/thesis/tex/Chapter/dm_impl.tex @@ -0,0 +1 @@ +The Yoshiko Wrapper provides a clean and simple interface to generate the model. diff --git a/thesis/tex/Chapter/dm_theory.tex b/thesis/tex/Chapter/dm_theory.tex new file mode 100644 index 0000000000000000000000000000000000000000..3b59bff440bb91783a42f4ee0f7903a8bb883483 --- /dev/null +++ b/thesis/tex/Chapter/dm_theory.tex @@ -0,0 +1,9 @@ +The Yoshiko algorithm models the data as a complete graph +$G=(V,E)$ +with an associated edge-cost function +$C: E \rightarrow \mathbb{R} +\cup \lbrace -\infty \rbrace +\cup \lbrace \infty \rbrace $. +As many input instances do not describe a full graph, missing edges and costs need to be modeled. +This is achieved by using default values for insertion or deletion. +A default insertion cost is used whenever the input instance does not contain an edge. \ No newline at end of file diff --git a/thesis/tex/Thesis.pdf b/thesis/tex/Thesis.pdf new file mode 100644 index 0000000000000000000000000000000000000000..ec03507e8e31722c79eae799cbd08b26f839bc39 Binary files /dev/null and b/thesis/tex/Thesis.pdf differ diff --git a/thesis/tex/Thesis.tex b/thesis/tex/Thesis.tex new file mode 100644 index 0000000000000000000000000000000000000000..b43458736c8a738c746833bd27e8748eba287b99 --- /dev/null +++ b/thesis/tex/Thesis.tex @@ -0,0 +1,45 @@ +\documentclass[10pt,a4paper]{article} + +\usepackage[utf8]{inputenc} +\usepackage[english]{babel} +\usepackage{amsmath} +\usepackage{amsfonts} +\usepackage{amssymb} +\usepackage{abstract} +\usepackage{hyperref} + +\hypersetup{ + linktoc=all +} + +\author{Philipp Spohr} + +\title{Developing and evaluating a Cytoscape app for graph-based clustering} + + + + +\begin{document} + +\maketitle + +\cleardoublepage + +\begin{abstract} + +\end{abstract} + +\tableofcontents + +\clearpage + +\section{Introduction} +\section{The Yoshiko-App for Cytoscape} + \subsection{Technical Details} + \subsection{Algorithm} + \subsubsection{Data Modeling} + \paragraph{Theory} + \input{Chapter/dm_theory} + \paragraph{Implementation} + \input{Chapter/dm_impl} +\end{document} \ No newline at end of file