medusa.dataio
Class DataLoader
- java.lang.Object
-
- medusa.dataio.DataLoader
-
- All Implemented Interfaces:
- java.lang.Runnable
public class DataLoader extends java.lang.Object implements java.lang.RunnableClass for saving, loading and exporting Graph objects to text file formats. Also writes graphs to postscript and pajek formats.
-
-
Field Summary
Fields Modifier and Type Field and Description static intLOAD_MEDUSAstatic intLOAD_TABBED
-
Constructor Summary
Constructors Constructor and Description DataLoader()DataLoader(int x, int y)Constructs a new DataLoader and passes the graph size information.DataLoader(int x, int y, java.lang.String fileName)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidconvertToRealDistances(Graph g)GraphgetGraph()intgetProgress()java.lang.StringgetStatus()booleanisBusy()Lets other methods know if the DataLoader is busy.booleanisDone()Graphload(java.lang.String fileName)Loads a medusa format file.GraphloadSimplest(java.lang.String fileName)Loads the simplest possible file of three columns: node1 node2 identity This can be used for instance by biologists who run BLAST searches with the -m 8 option.voidnormalizePositions(Graph g)GraphreadParameters(java.lang.String edges, java.lang.String nodes)For applets.voidrun()voidsave(BasicGraph graph, java.lang.String fileName)Writes the graph to filevoidsave(Graph graph, java.lang.String fileName, double scale)This method is not very nice...voidsaveAsArena3D(Graph g, java.lang.String saveFileName)voidsaveAsBiolayout(Graph g, java.lang.String saveFileName)voidsaveAsCytoscape(Graph g, java.lang.String saveFileName)voidsaveAsEPS(Graph g, java.lang.String saveFileName, MedusaSettings ss, int nodeSize, int fontSize)voidsaveAsGraphViz(Graph g, java.lang.String saveFileName)voidsaveAsPajek(Graph g, java.lang.String saveFileName)voidsaveAsPS(Graph g, java.lang.String saveFileName, MedusaSettings ss)Draw the graph to postscript formatvoidsaveAsPS(Graph g, java.lang.String saveFileName, MedusaSettings ss, int nodeSize, int fontSize)voidsaveHTMLParameters(Graph g, java.lang.String fileName)voidsetFileName(java.lang.String fileName)The file to load.voidsetLoadType(int loadType)voidstart()voidstop()
-
-
-
Field Detail
-
LOAD_MEDUSA
public static final int LOAD_MEDUSA
- See Also:
- Constant Field Values
-
LOAD_TABBED
public static final int LOAD_TABBED
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DataLoader
public DataLoader(int x, int y)Constructs a new DataLoader and passes the graph size information. Usually, graphs are 600x600 in size.- Parameters:
width-height-
-
DataLoader
public DataLoader(int x, int y, java.lang.String fileName)- Parameters:
width-height-fileName-
-
DataLoader
public DataLoader()
-
-
Method Detail
-
setLoadType
public void setLoadType(int loadType)
-
start
public void start()
-
stop
public void stop()
-
getGraph
public Graph getGraph()
- Returns:
- the graph object
-
run
public void run()
- Specified by:
runin interfacejava.lang.Runnable
-
isDone
public boolean isDone()
-
getStatus
public java.lang.String getStatus()
-
getProgress
public int getProgress()
-
isBusy
public boolean isBusy()
Lets other methods know if the DataLoader is busy.- Returns:
- true if busy
-
setFileName
public void setFileName(java.lang.String fileName)
The file to load. Set this before running the load thread.- Parameters:
fileName-
-
save
public void save(BasicGraph graph, java.lang.String fileName) throws java.io.IOException
Writes the graph to file- Parameters:
graph-fileName-- Throws:
java.io.IOException
-
save
public void save(Graph graph, java.lang.String fileName, double scale) throws java.io.IOException
This method is not very nice... will need to be rewritten. The scale function is generally messy.- Throws:
java.io.IOException
-
load
public Graph load(java.lang.String fileName) throws java.io.IOException, DataFormatException
Loads a medusa format file.- Parameters:
fileName- File to load- Returns:
- returns a Graph object which is passed to Medusa
- Throws:
java.io.IOExceptionDataFormatException
-
loadSimplest
public Graph loadSimplest(java.lang.String fileName) throws java.io.IOException, DataFormatException
Loads the simplest possible file of three columns: node1 node2 identity This can be used for instance by biologists who run BLAST searches with the -m 8 option. If identity is greater than 1.0, it is rescaled.- Parameters:
fileName-- Returns:
- Throws:
java.io.IOExceptionDataFormatException
-
readParameters
public Graph readParameters(java.lang.String edges, java.lang.String nodes)
For applets. Get parameter lines, e.g nodes and edges, from the applet context and create a new graph.- Parameters:
edges-nodes-- Returns:
-
convertToRealDistances
public void convertToRealDistances(Graph g)
-
normalizePositions
public void normalizePositions(Graph g)
-
saveAsPS
public void saveAsPS(Graph g, java.lang.String saveFileName, MedusaSettings ss) throws java.io.IOException
Draw the graph to postscript format- Throws:
java.io.IOException
-
saveAsPS
public void saveAsPS(Graph g, java.lang.String saveFileName, MedusaSettings ss, int nodeSize, int fontSize) throws java.io.IOException
- Throws:
java.io.IOException
-
saveAsEPS
public void saveAsEPS(Graph g, java.lang.String saveFileName, MedusaSettings ss, int nodeSize, int fontSize) throws java.io.IOException
- Throws:
java.io.IOException
-
saveAsPajek
public void saveAsPajek(Graph g, java.lang.String saveFileName) throws java.io.IOException
- Throws:
java.io.IOException
-
saveAsArena3D
public void saveAsArena3D(Graph g, java.lang.String saveFileName) throws java.io.IOException
- Throws:
java.io.IOException
-
saveAsBiolayout
public void saveAsBiolayout(Graph g, java.lang.String saveFileName) throws java.io.IOException
- Throws:
java.io.IOException
-
saveAsCytoscape
public void saveAsCytoscape(Graph g, java.lang.String saveFileName) throws java.io.IOException
- Throws:
java.io.IOException
-
saveAsGraphViz
public void saveAsGraphViz(Graph g, java.lang.String saveFileName) throws java.io.IOException
- Throws:
java.io.IOException
-
saveHTMLParameters
public void saveHTMLParameters(Graph g, java.lang.String fileName) throws java.io.IOException
- Throws:
java.io.IOException
-
-
DMelt 3.0 © DataMelt by jWork.ORG