import jalview.datamodel.Alignment;
import jalview.datamodel.AlignmentAnnotation;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.AlignmentView;
import jalview.datamodel.Alignment;
import jalview.datamodel.AlignmentAnnotation;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.AlignmentView;
/**
* List of valid format strings used in the isValidFormat method
*/
public static final String[] READABLE_FORMATS = new String[]
{ "BLC", "CLUSTAL", "FASTA", "MSF", "PileUp", "PIR", "PFAM", "STH",
/**
* List of valid format strings used in the isValidFormat method
*/
public static final String[] READABLE_FORMATS = new String[]
{ "BLC", "CLUSTAL", "FASTA", "MSF", "PileUp", "PIR", "PFAM", "STH",
- "PDB", "JnetFile", "RNAML", PhylipFile.FILE_DESC, JSONFile.FILE_DESC,
+ "PDB", "JnetFile", "RNAML", PhylipFile.FILE_DESC, JSONFile.FILE_DESC, IdentifyFile.GFF3File,
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,
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,
*/
public static final String[] READABLE_FNAMES = new String[]
{ "Fasta", "Clustal", "PFAM", "MSF", "PIR", "BLC", "AMSA", "Stockholm",
*/
public static final String[] READABLE_FNAMES = new String[]
{ "Fasta", "Clustal", "PFAM", "MSF", "PIR", "BLC", "AMSA", "Stockholm",
- "RNAML", PhylipFile.FILE_DESC, JSONFile.FILE_DESC, "Jalview",
+ "RNAML", PhylipFile.FILE_DESC, JSONFile.FILE_DESC, IdentifyFile.GFF3File, "Jalview",
- public AppletFormatAdapter(AlignViewportI viewport)
+ public AppletFormatAdapter(AlignmentViewPanel viewpanel)
+ {
+ this.viewpanel = viewpanel;
+ }
+
+ public AppletFormatAdapter(AlignmentViewPanel alignPanel,
+ AlignExportSettingI settings)
if (format.equals("FASTA"))
{
alignFile = new FastaFile(inFile, type);
if (format.equals("FASTA"))
{
alignFile = new FastaFile(inFile, type);
else if (format.equals(JSONFile.FILE_DESC))
{
alignFile = new JSONFile(inFile, type);
else if (format.equals(JSONFile.FILE_DESC))
{
alignFile = new JSONFile(inFile, type);
}
else if (format.equals(HtmlFile.FILE_DESC))
{
alignFile = new HtmlFile(inFile, type);
}
else if (format.equals(HtmlFile.FILE_DESC))
{
alignFile = new HtmlFile(inFile, type);
}
else if (format.equals("RNAML"))
{
alignFile = new RnamlFile(inFile, type);
}
}
else if (format.equals("RNAML"))
{
alignFile = new RnamlFile(inFile, type);
}
-
- al = new Alignment(alignFile.getSeqsAsArray());
-
- alignFile.addAnnotations(al);
-
- return al;
+ else if (format.equals(IdentifyFile.GFF3File))
+ {
+ alignFile = new Gff3File(inFile, type);
+ }
+ return buildAlignmentFrom(alignFile);
{
// Possible sequence is just residues with no label
alignFile = new FastaFile(">UNKNOWN\n" + inFile, "Paste");
{
// Possible sequence is just residues with no label
alignFile = new FastaFile(">UNKNOWN\n" + inFile, "Paste");
// If we get to this stage, the format was not supported
throw new java.io.IOException(SUPPORTED_FORMATS);
}
// If we get to this stage, the format was not supported
throw new java.io.IOException(SUPPORTED_FORMATS);
}
{
// Possible sequence is just residues with no label
alignFile = new FastaFile(">UNKNOWN\n" + inFile, "Paste");
{
// Possible sequence is just residues with no label
alignFile = new FastaFile(">UNKNOWN\n" + inFile, "Paste");
+ * boilerplate method to handle data from an AlignFile and construct a new
+ * alignment or import to an existing alignment
+ *
+ * @param alignFile2
+ * @return AlignmentI instance ready to pass to a UI constructor
+ */
+ private AlignmentI buildAlignmentFrom(AlignFile alignFile2)
+ {
+ // Standard boilerplate for creating alignment from parser
+ // alignFile.configureForView(viewpanel);
+
+ AlignmentI al = new Alignment(alignFile.getSeqsAsArray());
+
+ alignFile.addAnnotations(al);
+
+ alignFile.addGroups(al);
+
+ return al;
+ }
+
+ /**
* @return flatfile in a string
*/
public String formatSequences(String format, boolean jvsuffix,
* @return flatfile in a string
*/
public String formatSequences(String format, boolean jvsuffix,
- AlignmentView selvew = av.getAlignmentView(selectedOnly, false);
- AlignmentI aselview = selvew.getVisibleAlignment(av
+ AlignmentView selvew = ap.getAlignViewport().getAlignmentView(
+ selectedOnly, false);
+ AlignmentI aselview = selvew.getVisibleAlignment(ap.getAlignViewport()
- afile.setViewport(viewport);
- // Add groups to AlignFile
- afile.seqGroups = alignment.getGroups();
-
- // Add non auto calculated annotation to AlignFile
- for (AlignmentAnnotation annot : alignment.getAlignmentAnnotation())
- {
- if (annot != null && !annot.autoCalculated)
- {
- if (annot.label.equals("PDB.CATempFactor"))
- {
- continue;
- }
- afile.annotations.add(annot);
- }
- }
- afile.setSeqs(alignment.getSequencesArray());
-
+ // check whether we were given a specific alignment to export, rather than
+ // the one in the viewpanel
+ if (viewpanel == null || viewpanel.getAlignment() == null
+ || viewpanel.getAlignment() != alignment)
+ {
+ afile.setSeqs(alignment.getSequencesArray());
+ }
+ else
+ {
+ afile.setSeqs(viewpanel.getAlignment().getSequencesArray());
+ }
new IdentifyFile().Identify(args[i], FILE));
t1 += System.currentTimeMillis();
System.gc();
new IdentifyFile().Identify(args[i], FILE));
t1 += System.currentTimeMillis();
System.gc();