-\r
- public static String FILE = "File";\r
- public static String URL = "URL";\r
- public static String PASTE = "Paste";\r
- public static String CLASSLOADER = "ClassLoader";\r
-\r
- AlignFile afile = null;\r
- String inFile;\r
-\r
- /**\r
- * DOCUMENT ME!\r
- *\r
- * @param inFile DOCUMENT ME!\r
- * @param type DOCUMENT ME!\r
- * @param format DOCUMENT ME!\r
- *\r
- * @return DOCUMENT ME!\r
- */\r
- public SequenceI[] readFile(String inFile, String type, String format)\r
- throws java.io.IOException\r
- {\r
- this.inFile = inFile;\r
- try\r
- {\r
- if (format.equals("FASTA"))\r
- {\r
- afile = new FastaFile(inFile, type);\r
- }\r
- else if (format.equals("MSF"))\r
- {\r
- afile = new MSFfile(inFile, type);\r
- }\r
- else if (format.equals("PileUp"))\r
- {\r
- afile = new PileUpfile(inFile, type);\r
- }\r
- else if (format.equals("CLUSTAL"))\r
- {\r
- afile = new ClustalFile(inFile, type);\r
- }\r
- else if (format.equals("BLC"))\r
- {\r
- afile = new BLCFile(inFile, type);\r
- }\r
- else if (format.equals("PIR"))\r
- {\r
- afile = new PIRFile(inFile, type);\r
- }\r
- else if (format.equals("PFAM"))\r
- {\r
- afile = new PfamFile(inFile, type);\r
- }\r
- else if (format.equals("JnetFile"))\r
- {\r
- afile = new JPredFile(inFile, type);\r
- ( (JPredFile) afile).removeNonSequences();\r
- }\r
- else if (format.equals("PDB"))\r
- {\r
- afile = new MCview.PDBfile(inFile, type);\r
- }\r
-\r
- return afile.getSeqsAsArray();\r
- }\r
- catch (Exception e)\r
- {\r
- e.printStackTrace();\r
- System.err.println("Failed to read alignment using the '" + format +\r
- "' reader.\n"+e);\r
-\r
- if(e.getMessage()!=null && e.getMessage().startsWith(INVALID_CHARACTERS))\r
- throw new java.io.IOException(e.getMessage());\r
-\r
- // Finally test if the user has pasted just the sequence, no id\r
- if(type.equalsIgnoreCase("Paste"))\r
- {\r
- try{\r
- // Possible sequence is just residues with no label\r
- afile = new FastaFile(">UNKNOWN\n" + inFile, "Paste");\r
- return afile.getSeqsAsArray();\r
- }\r
- catch(Exception ex)\r
- {\r
- if(ex.toString().startsWith(INVALID_CHARACTERS))\r
- throw new java.io.IOException(e.getMessage());\r
-\r
- ex.printStackTrace();\r
- }\r
- }\r
-\r
- // If we get to this stage, the format was not supported\r
- throw new java.io.IOException(SUPPORTED_FORMATS);\r
- }\r