import jalview.datamodel.AlignmentAnnotation;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.AlignmentView;
+import jalview.datamodel.SequenceGroup;
import jalview.util.MessageManager;
import java.io.File;
public static final String[] READABLE_EXTENSIONS = new String[]
{ "fa, fasta, mfa, fastq", "aln", "pfam", "msf", "pir", "blc", "amsa",
"sto,stk", "xml,rnaml", PhylipFile.FILE_EXT, JSONFile.FILE_EXT,
- "jar,jvp", "html" };
+ "jar,jvp", HtmlFile.FILE_EXT };
/**
* List of readable formats by application in order corresponding to
*/
public static final String[] READABLE_FNAMES = new String[]
{ "Fasta", "Clustal", "PFAM", "MSF", "PIR", "BLC", "AMSA", "Stockholm",
- "RNAML", PhylipFile.FILE_DESC, JSONFile.FILE_DESC, "Jalview", "HTML" };
+ "RNAML", PhylipFile.FILE_DESC, JSONFile.FILE_DESC, "Jalview",
+ HtmlFile.FILE_DESC };
/**
* List of valid format strings for use by callers of the formatSequences
this.inFile = inFile;
try
{
+ Alignment al;
if (format.equals("FASTA"))
{
afile = new FastaFile(inFile, type);
{
afile = new PhylipFile(inFile, type);
}
- else if (format.equals(JSONFile.FILE_DESC))
- {
- afile = new JSONFile(inFile, type);
- }
+ else if (format.equals(JSONFile.FILE_DESC))
+ {
+ afile = new JSONFile(inFile, type);
+ al = new Alignment(afile.getSeqsAsArray());
+ afile.addAnnotations(al);
+ for (SequenceGroup sg : afile.getSeqGroups())
+ {
+ al.addGroup(sg);
+ }
+ return al;
+ }
+ else if (format.equals(HtmlFile.FILE_DESC))
+ {
+ afile = new HtmlFile(inFile, type);
+ al = new Alignment(afile.getSeqsAsArray());
+ afile.addAnnotations(al);
+ for (SequenceGroup sg : afile.getSeqGroups())
+ {
+ al.addGroup(sg);
+ }
+ return al;
+ }
else if (format.equals("RNAML"))
{
afile = new RnamlFile(inFile, type);
}
- Alignment al = new Alignment(afile.getSeqsAsArray());
+ al = new Alignment(afile.getSeqsAsArray());
- afile.addAnnotations(al);
- afile.addSeqGroups(al);
+ // afile.addAnnotations(al);
+ // afile.addSeqGroups(al);
return al;
} catch (Exception e)
String type = source.type;
try
{
+ Alignment al;
if (format.equals("FASTA"))
{
afile = new FastaFile(source);
{
afile = new PhylipFile(source);
}
- else if (format.equals(JSONFile.FILE_DESC))
- {
- afile = new JSONFile(source);
- }
- Alignment al = new Alignment(afile.getSeqsAsArray());
-
- afile.addAnnotations(al);
- afile.addSeqGroups(al);
+ else if (format.equals(JSONFile.FILE_DESC))
+ {
+ afile = new JSONFile(source);
+ al = new Alignment(afile.getSeqsAsArray());
+ afile.addAnnotations(al);
+ afile.addSeqGroups(al);
+ return al;
+ }
+ else if (format.equals(HtmlFile.FILE_DESC))
+ {
+ afile = new HtmlFile(source);
+ }
+ al = new Alignment(afile.getSeqsAsArray());
return al;
} catch (Exception e)