+ \r
+ public static RNAStructScoreManager readRNAStruct(String workDirectory,\r
+ String structFile) throws IOException, FileNotFoundException {\r
+ \r
+ assert !compbio.util.Util.isEmpty(workDirectory);\r
+ assert !compbio.util.Util.isEmpty(structFile);\r
+ // The stdout from RNAalifold\r
+ File sFile = new File(compbio.engine.client.Util.getFullPath(\r
+ workDirectory, structFile));\r
+ // Base pair probability matrix (-p option)\r
+ File aliFile = new File(compbio.engine.client.Util.getFullPath(\r
+ workDirectory, "alifold.out"));\r
+ // Check that stdout file exists\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
+ // Check that base pair probability file exists\r
+ if(!aliFile.exists()) {\r
+ log.warn("The file alifold.out is not found for the jobId "\r
+ + workDirectory + "Is the -p or --MEA option not specified?");\r
+ return RNAStructReader.readRNAStructStream(new FileInputStream(sFile));\r
+ \r
+ } else {\r
+ return RNAStructReader.readRNAStructStream(new FileInputStream(sFile), \r
+ new FileInputStream(aliFile));\r
+ }\r
+ }\r
+ \r
+\r
+ \r
+ public static String readFile(File inputFile) throws \r
+ FileNotFoundException, IOException {\r
+\r
+ BufferedReader input = new BufferedReader(new FileReader(inputFile));\r
+\r
+ String file = new String();\r
+ String line = new String();\r
+\r
+ while (true) {\r
+ line = input.readLine();\r
+\r
+ if (line != null) {\r
+ file = file + line + "\r\n";\r
+ } else break;\r
+ }\r
+ // Close file\r
+ input.close();\r
+ return file;\r
+ }\r