|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectutil.io.FileUtils
public class FileUtils
Util class which contains some necessary but rather specific I/O methods (mostly file I/O) for the JASPr code. As such, not a lot of these methods can be salvaged for use in other programs.
Constructor Summary | |
---|---|
FileUtils()
|
Method Summary | |
---|---|
static CrossValidationData |
fillCrossValFiles(int posLength,
int negLength,
java.io.File posFile,
java.io.File negFile,
boolean isDonor)
|
static java.io.File |
fillCrossValTrainingFile(int currentFold,
int posLength,
int negLength,
java.io.File posFile,
java.io.File negFile,
boolean isDonor)
Creates and fills the temporary file with data for crossvalidation. |
static java.lang.String |
getExtension(java.lang.String fileName)
Returns the extension of a filename |
static int |
getLinesInFile(java.io.File file)
Returns the number of lines (terminated by a carriage return) in the file |
static void |
main(java.lang.String[] args)
|
static java.io.File |
makeCopy_DestroyOriginal(java.io.File original)
This method makes an identical copy of a file (new filename is old filename with _copy attached at the end), and then deletes the original. |
static void |
mergeAndDeleteResults(java.io.File f_d,
java.io.File f_a,
java.io.File r_d,
java.io.File r_a,
java.lang.String name)
This method merges the results from 4 different files, by sorting them on the number which is in the first column (it is assumed that the files are thus well-formatted). |
static CrossValidationData |
seperateData(java.util.SortedSet<java.lang.Integer> randomPosTest,
java.util.SortedSet<java.lang.Integer> randomNegTest,
java.io.File posFile,
java.io.File negFile,
java.io.File training,
java.io.File test)
|
static void |
writeCrossValidation(CrossValidationResult result,
Options options,
org.apache.log4j.Logger logger,
boolean isDonor,
java.io.File featureFile,
int trainPos,
int testPos,
int trainNeg,
int testNeg)
This methods writes the results of a crossvalidation to a file. |
static void |
writeRocGnuPlotCommand(java.util.List<RocCurveData> fileNames,
java.lang.String path,
boolean isDonor)
This method generates the Gnuplot-commands to display the roc-curves (only possible with cross-validation). |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FileUtils()
Method Detail |
---|
public static void main(java.lang.String[] args)
public static void mergeAndDeleteResults(java.io.File f_d, java.io.File f_a, java.io.File r_d, java.io.File r_a, java.lang.String name)
f_d
- The file with forward donor data resultsf_a
- The file with forward acceptor data resultsr_d
- The file with reverse donor data resultsr_a
- The file with reverse acceptor data resultsname
- The name of the resultin merged file
TODO : pretty specific and dependent code, better would be and array/list of files,
a name for the resulting file, an index for designating which column to sort on (
in the files to be merged) and the split-character (most likely tab or space).public static java.io.File makeCopy_DestroyOriginal(java.io.File original)
original
- The original file
public static void writeRocGnuPlotCommand(java.util.List<RocCurveData> fileNames, java.lang.String path, boolean isDonor)
fileNames
- A list with all the filenames and data which contain roc-curve datapath
- The path in which to place the resulting gnuplot-command fileisDonor
- Indicates whether we are dealing with donors or acceptorspublic static int getLinesInFile(java.io.File file)
file
- The file of which we want the number of lines
public static java.lang.String getExtension(java.lang.String fileName)
fileName
- The name of the file
public static void writeCrossValidation(CrossValidationResult result, Options options, org.apache.log4j.Logger logger, boolean isDonor, java.io.File featureFile, int trainPos, int testPos, int trainNeg, int testNeg)
result
- The crossvalidation resultoptions
- The different Jaspr optionslogger
- The logging facility (used for error-output)isDonor
- indicates whether we are dealing with donor or acceptor datafeatureFile
- The file containing the training-features (used for determining the total amount of positives and negatives)trainPos
- The number positive training examples usedtestPos
- The number of positive test examples usedtrainNeg
- The number of negative training examples usedtestNeg
- The number of negative test examples usedpublic static java.io.File fillCrossValTrainingFile(int currentFold, int posLength, int negLength, java.io.File posFile, java.io.File negFile, boolean isDonor)
currentFold
- The current subset (starting from 1)posLength
- The length of the subset for the positive filenegLength
- The length of the subset for the negative fileposFile
- The positive filenegFile
- The negative fileisDonor
- Indicates whether this concerns a donor svm (just for naming purposes)
java.lang.Exception
public static CrossValidationData fillCrossValFiles(int posLength, int negLength, java.io.File posFile, java.io.File negFile, boolean isDonor)
public static CrossValidationData seperateData(java.util.SortedSet<java.lang.Integer> randomPosTest, java.util.SortedSet<java.lang.Integer> randomNegTest, java.io.File posFile, java.io.File negFile, java.io.File training, java.io.File test) throws java.lang.Exception
java.lang.Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |