import java.io.FileNotFoundException;\r
import java.io.FileOutputStream;\r
import java.io.IOException;\r
+import java.util.Arrays;\r
import java.util.List;\r
+import java.util.ArrayList;\r
import java.util.Map;\r
+import java.util.Set;\r
+import java.util.TreeSet;\r
+import java.util.TreeMap;\r
+import java.util.regex.Pattern;\r
+import java.util.regex.Matcher;\r
+import java.util.Scanner;\r
+\r
+\r
+\r
\r
import org.apache.log4j.Logger;\r
\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.RNAStructScoreManager;\r
import compbio.data.sequence.Score;\r
+import compbio.data.sequence.ScoreManager;\r
+import compbio.data.sequence.Range;\r
+import compbio.data.sequence.RNAStructReader;\r
import compbio.data.sequence.SequenceUtil;\r
import compbio.data.sequence.UnknownFileFormatException;\r
import compbio.engine.client.ConfExecutable;\r
+ e.getLocalizedMessage(), e);\r
}\r
}\r
+\r
\r
- // OUT OF USE\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
-// 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
- public static String readRNAStruct(String workDirectory,\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
- File sfile = new File(compbio.engine.client.Util.getFullPath(\r
+ // The stdout from RNAalifold\r
+ File sFile = new File(compbio.engine.client.Util.getFullPath(\r
workDirectory, structFile));\r
- if(!(sfile.exists() && sfile.length() > 0)) {\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
- return readFile(sfile);\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
input.close();\r
return file;\r
}\r
- \r
- \r
-\r
}\r
+\r
+\r