X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fio%2FAppletFormatAdapter.java;h=ead63c8a82b1b48f5753ed0240304b39af6618a6;hb=2d63cfb4d8f84de5f40670bb301ee8a22db321ff;hp=d55bab5a93ad8b40df63b316c96284a935ec4491;hpb=28787d9646cca5dd77190930f59b7ff32cf995b4;p=jalview.git diff --git a/src/jalview/io/AppletFormatAdapter.java b/src/jalview/io/AppletFormatAdapter.java old mode 100755 new mode 100644 index d55bab5..ead63c8 --- a/src/jalview/io/AppletFormatAdapter.java +++ b/src/jalview/io/AppletFormatAdapter.java @@ -1,19 +1,22 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) - * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2) + * Copyright (C) 2014 The Jalview Authors * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * as published by the Free Software Foundation, either version 3 + * of the License, or (at your option) any later version. * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along with Jalview. If not, see . + * You should have received a copy of the GNU General Public License + * along with Jalview. If not, see . + * The Jalview Authors are detailed in the 'AUTHORS' file. */ package jalview.io; @@ -38,7 +41,7 @@ public class AppletFormatAdapter */ public static final String[] READABLE_FORMATS = new String[] { "BLC", "CLUSTAL", "FASTA", "MSF", "PileUp", "PIR", "PFAM", "STH", - "PDB", "JnetFile" , "RNAML"}; // , "SimpleBLAST" }; + "PDB", "JnetFile", "RNAML", "GENBANK" }; /** * List of valid format strings for use by callers of the formatSequences @@ -52,25 +55,24 @@ public class AppletFormatAdapter * that are writable by the application. */ public static final String[] WRITABLE_EXTENSIONS = new String[] - { "fa,faa,fasta,fastq", "aln", "pfam", "msf", "pir", "blc", "amsa", "jar" }; + { "fa, fasta, mfa, fastq", "aln", "pfam", "msf", "pir", "blc", "amsa", + "jvp", "sto,stk", "jar" }; /** * List of writable formats by the application. Order must correspond with the * WRITABLE_EXTENSIONS list of formats. */ public static final String[] WRITABLE_FNAMES = new String[] - { "Fasta", "Clustal", "PFAM", "MSF", "PIR", "BLC", "AMSA", "Jalview" }; + { "Fasta", "Clustal", "PFAM", "MSF", "PIR", "BLC", "AMSA", "Jalview", + "STH", "Jalview" }; /** * List of readable format file extensions by application in order * corresponding to READABLE_FNAMES */ public static final String[] READABLE_EXTENSIONS = new String[] - { "fa,faa,fasta,fastq", "aln", "pfam", "msf", "pir", "blc", "amsa", "jar", - "sto,stk","xml" }; // , - - // ".blast" - // }; + { "fa,faa,fasta,mfa,fastq", "aln", "pfam", "msf", "pir", "blc", "amsa", + "jar,jvp", "sto,stk", "xml,rnaml", "gb" }; // ".blast" /** * List of readable formats by application in order corresponding to @@ -78,7 +80,7 @@ public class AppletFormatAdapter */ public static final String[] READABLE_FNAMES = new String[] { "Fasta", "Clustal", "PFAM", "MSF", "PIR", "BLC", "AMSA", "Jalview", - "Stockholm","RNAML" };// , + "Stockholm", "RNAML", "GenBank" }; // "SimpleBLAST" // }; @@ -227,7 +229,9 @@ public class AppletFormatAdapter } else if (format.equals("PDB")) { - afile = new MCview.PDBfile(inFile, type); + afile = new MCview.PDBfile(inFile, type); + // Uncomment to test Jmol data based PDB processing: JAL-1213 + // afile = new jalview.ext.jmol.PDBFileWithJmol(inFile, type); } else if (format.equals("STH")) { @@ -241,7 +245,10 @@ public class AppletFormatAdapter { afile = new RnamlFile(inFile, type); } - + else if (format.equals("GENBANK")) + { + afile = new GenBankFile(inFile, type); + } Alignment al = new Alignment(afile.getSeqsAsArray()); afile.addAnnotations(al); @@ -296,7 +303,7 @@ public class AppletFormatAdapter * * @return DOCUMENT ME! */ - public Alignment readFromFile(FileParse source, String format) + public AlignmentI readFromFile(FileParse source, String format) throws java.io.IOException { // TODO: generalise mapping between format string and io. class instances @@ -356,6 +363,10 @@ public class AppletFormatAdapter { afile = new SimpleBlastFile(source); } + else if (format.equals("GENBANK")) + { + afile = new GenBankFile(source); + } Alignment al = new Alignment(afile.getSeqsAsArray()); @@ -453,7 +464,7 @@ public class AppletFormatAdapter } else if (format.equalsIgnoreCase("STH")) { - afile = new StockholmFile(); + afile = new StockholmFile(alignment); } else if (format.equalsIgnoreCase("AMSA")) { @@ -463,7 +474,10 @@ public class AppletFormatAdapter { afile = new RnamlFile(); } - + else if (format.equalsIgnoreCase("GENBANK")) + { + afile = new GenBankFile(); + } else { throw new Exception( @@ -547,7 +561,6 @@ public class AppletFormatAdapter System.out .println("Difference between free memory now and before is " + (memf / (1024.0 * 1024.0) * 1.0) + " MB"); - } catch (Exception e) { System.err.println("Exception when dealing with " + i