-/* Copyright (c) 2009 Peter Troshin\r
+/* Copyright (c) 2011 Peter Troshin\r
* \r
- * JAva Bioinformatics Analysis Web Services (JABAWS) @version: 1.0 \r
+ * JAva Bioinformatics Analysis Web Services (JABAWS) @version: 2.0 \r
* \r
* This library is free software; you can redistribute it and/or modify it under the terms of the\r
* Apache License version 2 as published by the Apache Software Foundation\r
package compbio.runner;\r
\r
import java.io.File;\r
+import java.io.FileInputStream;\r
import java.io.FileNotFoundException;\r
import java.io.FileOutputStream;\r
import java.io.IOException;\r
import compbio.data.sequence.Alignment;\r
import compbio.data.sequence.ClustalAlignmentUtil;\r
import compbio.data.sequence.FastaSequence;\r
+import compbio.data.sequence.RNAstruct;\r
import compbio.data.sequence.Score;\r
import compbio.data.sequence.SequenceUtil;\r
import compbio.data.sequence.UnknownFileFormatException;\r
+ e.getLocalizedMessage(), e);\r
}\r
}\r
+ \r
+ public static void writeClustalInput(List<FastaSequence> sequences,\r
+ ConfiguredExecutable<?> exec, char gapChar) throws JobSubmissionException {\r
+ \r
+ try {\r
+ File filein = new File(exec.getInput());\r
+ FileOutputStream fout = new FileOutputStream(filein);\r
+ log.debug("File path: " + filein.getAbsolutePath());\r
+ SequenceUtil.writeClustal(fout, sequences, gapChar);\r
+ fout.close();\r
+ } catch (IOException e) {\r
+ log.error("IOException while writing input file into the disk: "\r
+ + e.getLocalizedMessage(), e);\r
+ throw new JobSubmissionException(\r
+ "We are sorry but JABAWS server seems to have a problem! "\r
+ + e.getLocalizedMessage(), e);\r
+ }\r
+ }\r
+ \r
+ public static final RNAstruct readRNAStructFile(String workDirectory,\r
+ String structFile) throws IOException, FileNotFoundException {\r
+ assert !compbio.util.Util.isEmpty(workDirectory);\r
+ assert !compbio.util.Util.isEmpty(structFile);\r
+ File sfile = new File(compbio.engine.client.Util.getFullPath(\r
+ workDirectory, structFile));\r
+ log.trace("RNAALIFOLD OUTPUT FILE PATH: " + sfile.getAbsolutePath());\r
+ if(!(sfile.exists() && sfile.length() > 0)) {\r
+ throw new FileNotFoundException("Result for the jobId "\r
+ + workDirectory + "with file name " + structFile\r
+ + " is not found!");\r
+ }\r
+ return compbio.data.sequence.SequenceUtil.readRNAalifoldResults(\r
+ new FileInputStream(sfile));\r
+ }\r
+ \r
+ \r
\r
}\r