|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbiggests.gui.BiggestsIO
public class BiggestsIO
Title: BiGGEsTS's Input/Output
Description: Provides methods for reading data from and writing data to files, for copying, deleting and creating directories and files. Restoring and saving sessions. Downloading, compressing/decompressing files.
Copyright: Copyright (C) 2007 Joana Gonçalves This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
Field Summary | |
---|---|
static int |
BUF_SIZE
The size of the buffer. |
static java.lang.String |
JPG
Image format: JPG |
static int |
MAX_HEIGHT
Maximum image height. |
static int |
MAX_WIDTH
Maximum image width. |
static java.lang.String |
PDF
Image format: PDF |
static java.lang.String |
PNG
Image format: PNG |
static java.lang.String |
SVG
Image format: SVG |
Constructor Summary | |
---|---|
BiggestsIO()
|
Method Summary | |
---|---|
static void |
copy(de.schlichtherle.io.File source,
de.schlichtherle.io.File destination)
Copies a file to another location. |
static void |
deleteFolderContent(java.lang.String pathToFolder)
Deletes a directory content. |
static void |
download(java.lang.String address,
java.lang.String localFilePath,
ProgressBarFrame progressFrame,
java.lang.String message)
Downloads the file from the Internet located in the specified address . |
static void |
downloadGeneAssociationFile(java.lang.String geneAssociationFilesURL,
java.lang.String pathToGOFiles,
java.lang.String geneAssociationFileName,
ProgressBarFrame progressFrame)
Downloads gene association file. |
static void |
downloadGeneOntologyFile(java.lang.String geneOntologyFilesURL,
java.lang.String pathToGOFiles,
java.lang.String geneOntologyFileName,
ProgressBarFrame progressFrame)
Downloads gene ontology file. |
static void |
exportBiclustersGroupTXTAsDiscreteValuedMatrices(smadeira.biclustering.BiclusteringInDiscretizedMatrix biclustering,
de.schlichtherle.io.File dir)
|
static void |
exportBiclustersGroupTXTAsRealValuedMatrices(smadeira.biclustering.Biclustering biclustering,
de.schlichtherle.io.File dir)
|
static void |
exportBiclustersGroupTXTAsSubsetOfRowsAndCols(smadeira.biclustering.Biclustering biclustering,
de.schlichtherle.io.File file)
|
static void |
exportBiclustersGroupTXTForRegulatorySnapshots(smadeira.biclustering.Biclustering biclustering,
de.schlichtherle.io.File dir)
|
static void |
exportBiclusterTXTAsDiscreteValuedMatrix(smadeira.biclustering.CCC_Bicluster bicluster,
de.schlichtherle.io.File file)
|
static void |
exportBiclusterTXTAsRealValuedMatrix(smadeira.biclustering.Bicluster bicluster,
de.schlichtherle.io.File file)
|
static void |
exportBiclusterTXTAsSubsetOfRowsAndCols(smadeira.biclustering.Bicluster bicluster,
de.schlichtherle.io.File file)
|
static void |
exportBiclusterTXTForRegulatorySnapshots(smadeira.biclustering.Bicluster bicluster,
de.schlichtherle.io.File genesFile,
de.schlichtherle.io.File expressionFile)
|
static void |
exportComponentToImage(java.awt.Component component,
int x,
int y,
int width,
int height,
java.lang.String format,
java.lang.String filePath)
Exports a GUI component to an image file. |
static void |
exportComponentToImage(java.awt.Component component,
java.lang.String format,
java.lang.String filePath)
Exports a GUI component to an image file. |
static void |
exportDiscretizedTXT(smadeira.biclustering.DiscretizedExpressionMatrix matrix,
de.schlichtherle.io.File file)
|
static void |
exportOriginalOrPreprocessedTXT(smadeira.biclustering.IMatrix matrix,
de.schlichtherle.io.File file)
Writes a chart to an output stream in SVG document format. |
static java.lang.String |
findFileExtensionInDirectoryPath(java.lang.String fileExtension,
java.lang.String directoryPath)
Finds the first file with a specific file extension in some specific directory. |
static java.lang.String |
findFileInDirectoryPath(java.lang.String filename,
java.lang.String directoryPath)
Finds for a specific filename in a specific directory path. |
static boolean |
getStop()
Returns the value of stop flag. |
static void |
gunzipFile(de.schlichtherle.io.File file_input,
de.schlichtherle.io.File dir_output)
Gunzips the input archive. |
static void |
initializeFolders(java.lang.String[] paths)
Creates a set of directories with the specified paths. |
static java.lang.String[][] |
readConversionEntriesFromFileTXT(java.lang.String filePath,
char separator)
Reads conversion file entries from a text file. |
static java.lang.Object[][] |
readExpressionDataFromFileTXT(java.lang.String file,
char separator,
float missingValue)
Reads gene expression data from a txt file. |
static void |
restoreSession(BiggestsFrame frame,
java.lang.String pathToSessionArchive)
Restores a session from a .zip archive file. |
static void |
restoreSession2(BiggestsFrame frame,
java.lang.String pathToSessionArchive)
Restores a session from a .zip archive file. |
static void |
saveSession(DatasetTree tree,
java.lang.String pathToFunctionResults,
java.lang.String pathToSessionArchive)
Saves a session to a .zip archive file. |
static void |
saveSession2(DatasetTree tree,
java.lang.String pathToFunctionResults,
java.lang.String pathToSessionArchive)
Saves a session to a .zip archive file. |
static void |
setStop(boolean st)
Sets stop flag. |
static void |
writeComponentAsPDF(de.schlichtherle.io.File out,
javax.swing.JComponent component,
int width,
int height,
com.lowagie.text.pdf.FontMapper mapper)
Writes a chart to an output stream in PDF format. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int BUF_SIZE
public static final java.lang.String PNG
public static final java.lang.String JPG
public static final java.lang.String SVG
public static final java.lang.String PDF
public static final int MAX_WIDTH
public static final int MAX_HEIGHT
Constructor Detail |
---|
public BiggestsIO()
Method Detail |
---|
public static void setStop(boolean st)
st
- the boolean
valuepublic static boolean getStop()
boolean
value of stop flagpublic static void initializeFolders(java.lang.String[] paths) throws java.io.IOException
paths
- the String[]
paths of the directories to
be created
java.io.IOException
- when some directory could not be createdpublic static void deleteFolderContent(java.lang.String pathToFolder)
pathToFolder
- the String
path to the specified
directory#deleteRecursively(File[] files)
public static java.lang.String findFileInDirectoryPath(java.lang.String filename, java.lang.String directoryPath) throws java.io.IOException, java.lang.Exception
null
othwerwise.
filename
- the filename String
to search fordirectoryPath
- the directory path String
, where
to search for the given filename
String
java.io.IOException
- if the directory does not exist
java.lang.Exception
- if the directory path is not validpublic static java.lang.String findFileExtensionInDirectoryPath(java.lang.String fileExtension, java.lang.String directoryPath) throws java.io.IOException, java.lang.Exception
null
pointer othwerwise.
fileExtension
- the String
which contains the file
extension to search for; must start with "."directoryPath
- the String
which contains the path
to the directory where to search for the file
String
java.io.IOException
- if the directory does not exist
java.lang.Exception
- if the directory path or the file extension is not validpublic static void copy(de.schlichtherle.io.File source, de.schlichtherle.io.File destination) throws java.io.IOException
source
- the File
to copy to another locationdestination
- the File
which is the destination target
java.io.IOException
- when it is not possible to copy the filepublic static java.lang.Object[][] readExpressionDataFromFileTXT(java.lang.String file, char separator, float missingValue) throws java.io.FileNotFoundException, java.io.IOException
file
- String
the filepath which contains
the file to readseparator
- the char
acter that delimits the datamissingValue
- float
the value to fill missings
java.io.FileNotFoundException
java.io.IOException
public static java.lang.String[][] readConversionEntriesFromFileTXT(java.lang.String filePath, char separator) throws java.io.FileNotFoundException, java.io.IOException
separator
character.
filePath
- String
the path of the file with
conversion entries to readseparator
- the char
acter that delimits the data
java.io.FileNotFoundException
java.io.IOException
public static void saveSession(DatasetTree tree, java.lang.String pathToFunctionResults, java.lang.String pathToSessionArchive) throws java.io.NotSerializableException, java.io.FileNotFoundException, java.io.IOException
tree
- the DatasetTree
which contains datasets
loaded and manipulated in the sessionpathToFunctionResults
- String
the path to directory
which contains the files resulting from function analysispathToSessionArchive
- String
the path to the
resulting archive file
java.io.NotSerializableException
- if one of the objects that system
tried to write to a file is not serializable
java.io.FileNotFoundException
- if files could not be found
java.io.IOException
- if could not write/read from filespublic static void saveSession2(DatasetTree tree, java.lang.String pathToFunctionResults, java.lang.String pathToSessionArchive) throws java.io.NotSerializableException, java.io.FileNotFoundException, java.io.IOException
tree
- the DatasetTree
which contains datasets
loaded and manipulated in the sessionpathToFunctionResults
- String
the path to directory
which contains the files resulting from function analysispathToSessionArchive
- String
the path to the
resulting archive file
java.io.NotSerializableException
- if one of the objects that system
tried to write to a file is not serializable
java.io.FileNotFoundException
- if files could not be found
java.io.IOException
- if could not write/read from filespublic static void restoreSession(BiggestsFrame frame, java.lang.String pathToSessionArchive) throws java.lang.Exception
DatasetTree
and a directory named Function_Results
which contains
resulting files from function analysis.
frame
- the BiGGEsTS main windowpathToSessionArchive
- String
the path to the zip
archive which contains the files of the session to restore
java.lang.Exception
- if the format of the session files could not be recognizedpublic static void restoreSession2(BiggestsFrame frame, java.lang.String pathToSessionArchive) throws java.lang.Exception
DatasetTree
and a directory named Function_Results
which contains
resulting files from function analysis.
frame
- the BiGGEsTS main windowpathToSessionArchive
- String
the path to the zip
archive which contains the files of the session to restore
java.lang.Exception
- if the format of the session files could not be recognizedpublic static void downloadGeneOntologyFile(java.lang.String geneOntologyFilesURL, java.lang.String pathToGOFiles, java.lang.String geneOntologyFileName, ProgressBarFrame progressFrame) throws java.lang.Exception
geneOntologyFilesURL
- String
the URL where
gene ontology files can be foundpathToGOFiles
- String
the path to gene ontology
files directory/foldergeneOntologyFileName
- String
the name of the
gene ontology file to be downloaded (usually gene_ontology.obo)progressFrame
- ProgressBarFrame
the progress bar to
send information about the progress of the operation
java.lang.Exception
public static void downloadGeneAssociationFile(java.lang.String geneAssociationFilesURL, java.lang.String pathToGOFiles, java.lang.String geneAssociationFileName, ProgressBarFrame progressFrame) throws java.lang.Exception
geneAssociationFilesURL
- String
the URL where
gene association files can be foundpathToGOFiles
- String
the path to gene ontology
files directory/foldergeneAssociationFileName
- String
the name of the
gene ontology file to be downloaded (usually gene_ontology.obo)progressFrame
- ProgressBarFrame
the progress bar to
send information about the progress of the operation
java.lang.Exception
public static void download(java.lang.String address, java.lang.String localFilePath, ProgressBarFrame progressFrame, java.lang.String message) throws java.io.IOException, java.lang.Exception
address
. The downloaded file is stored in
localFilePath
(this path already contains the name
of the file).
address
- String
the address of the file to downloadlocalFilePath
- String
the local file path to store
the downloaded fileprogressFrame
- ProgressBarFramemessage
- String
java.io.IOException
- if input and/or output stream could not be closed
java.lang.Exception
- if file could not be downloadedpublic static void gunzipFile(de.schlichtherle.io.File file_input, de.schlichtherle.io.File dir_output) throws java.io.IOException, java.lang.Exception
file_input
- the input gzipped File
dir_output
- File
directory to send the gunzipped file to
java.io.IOException
java.lang.Exception
public static void exportComponentToImage(java.awt.Component component, java.lang.String format, java.lang.String filePath) throws java.io.IOException
filePath
and must contain the appropriate file extension.
component
- Component
the component to export to imageformat
- String
the format of the image (PNG or JPG)filePath
- String
the path to the image file
java.io.IOException
- if the component cannot be exported to the image filepublic static void exportComponentToImage(java.awt.Component component, int x, int y, int width, int height, java.lang.String format, java.lang.String filePath) throws java.io.IOException
x
- and y
-coordinates (left-most
top corner), with width
width and
height
height from the original component's image.
The path of the file is given in filePath
and must
contain the appropriate file extension.
component
- Component
the component to export to imagex
- int
the initial x
-coordinate
of the original image from which the final image will
be produced (left-most top corner)y
- int
the initial y
-coordinate
of the original image from which the final image will
be produced (left-most top corner)width
- int
the width of the image to produceheight
- int
the height of the image to produceformat
- String
the format of the image (PNG or JPG)filePath
- String
the path to the image file
java.io.IOException
- if the component cannot be exported to the image filepublic static void writeComponentAsPDF(de.schlichtherle.io.File out, javax.swing.JComponent component, int width, int height, com.lowagie.text.pdf.FontMapper mapper) throws com.lowagie.text.DocumentException, java.io.IOException
out
- the OutputStream
chart
- the JFreeChart
width
- int the widthheight
- int the heightmapper
- FontMapper
java.io.IOException
com.lowagie.text.DocumentException
public static void exportOriginalOrPreprocessedTXT(smadeira.biclustering.IMatrix matrix, de.schlichtherle.io.File file) throws java.io.IOException
out
- the Writer
output streamchart
- the JFreeChart
width
- int the widthheight
- int the height
java.io.IOException
public static void exportDiscretizedTXT(smadeira.biclustering.DiscretizedExpressionMatrix matrix, de.schlichtherle.io.File file) throws java.io.IOException
java.io.IOException
public static void exportBiclusterTXTAsSubsetOfRowsAndCols(smadeira.biclustering.Bicluster bicluster, de.schlichtherle.io.File file) throws java.io.IOException
java.io.IOException
public static void exportBiclusterTXTForRegulatorySnapshots(smadeira.biclustering.Bicluster bicluster, de.schlichtherle.io.File genesFile, de.schlichtherle.io.File expressionFile) throws java.io.IOException
java.io.IOException
public static void exportBiclusterTXTAsRealValuedMatrix(smadeira.biclustering.Bicluster bicluster, de.schlichtherle.io.File file) throws java.io.IOException
java.io.IOException
public static void exportBiclusterTXTAsDiscreteValuedMatrix(smadeira.biclustering.CCC_Bicluster bicluster, de.schlichtherle.io.File file) throws java.io.IOException
java.io.IOException
public static void exportBiclustersGroupTXTAsSubsetOfRowsAndCols(smadeira.biclustering.Biclustering biclustering, de.schlichtherle.io.File file) throws java.io.IOException
java.io.IOException
public static void exportBiclustersGroupTXTForRegulatorySnapshots(smadeira.biclustering.Biclustering biclustering, de.schlichtherle.io.File dir) throws java.io.IOException
java.io.IOException
public static void exportBiclustersGroupTXTAsRealValuedMatrices(smadeira.biclustering.Biclustering biclustering, de.schlichtherle.io.File dir) throws java.io.IOException
java.io.IOException
public static void exportBiclustersGroupTXTAsDiscreteValuedMatrices(smadeira.biclustering.BiclusteringInDiscretizedMatrix biclustering, de.schlichtherle.io.File dir) throws java.io.IOException
java.io.IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |