}
/**
- * DOCUMENT ME!
- *
- * @param String DOCUMENT ME!
+ * Try to load a features file onto the alignment.
+ * @param file contents or path to retrieve file
+ * @param type access mode of file (see jalview.io.AlignFile)
+ * @return true if features file was parsed corectly.
*/
public boolean parseFeaturesFile(String file, String type)
{
}
}
- // This method will attempt to load a "dropped" file first by testing
- // whether its and Annotation file, then features file. If both are
- // false then the user may have dropped an alignment file onto this
- // AlignFrame
+ /**
+ * Attempt to load a "dropped" file: First by testing
+ * whether it's and Annotation file, then a JNet file, and finally a features file. If all are
+ * false then the user may have dropped an alignment file onto this
+ * AlignFrame.
+ * @param file either a filename or a URL string.
+ */
public void loadJalviewDataFile(String file)
- {
+ {
try
{
String protocol = "File";
if (!isAnnotation)
{
- boolean isGroupsFile = parseFeaturesFile(file,protocol);
- if (!isGroupsFile)
+ // try to see if its a JNet 'concise' style annotation file *before* we try to parse it as a features file
+ String format = new IdentifyFile().Identify(file, protocol);
+ if(format.equalsIgnoreCase("JnetFile"))
{
- String format = new IdentifyFile().Identify(file, protocol);
-
- if(format.equalsIgnoreCase("JnetFile"))
- {
- jalview.io.JPredFile predictions = new jalview.io.JPredFile(
- file, protocol);
- new JnetAnnotationMaker().add_annotation(predictions,
+ jalview.io.JPredFile predictions = new jalview.io.JPredFile(
+ file, protocol);
+ new JnetAnnotationMaker().add_annotation(predictions,
viewport.getAlignment(),
0, false);
- alignPanel.adjustAnnotationHeight();
- alignPanel.paintAlignment(true);
- }
- else
+ isAnnotation=true;
+ }
+ else
+ {
+ // try to parse it as a features file
+ boolean isGroupsFile = parseFeaturesFile(file,protocol);
+ // if it wasn't a features file then we just treat it as a general alignment file to load into the current view.
+ if (!isGroupsFile)
{
new FileLoader().LoadFile(viewport, file, protocol, format);
+ } else {
+ alignPanel.paintAlignment(true);
+ }
}
}
- }
- else
+ if (isAnnotation)
{
- // (isAnnotation)
+
alignPanel.adjustAnnotationHeight();
buildSortByAnnotationScoresMenu();
+ alignPanel.paintAlignment(true);
}
-
}
catch (Exception ex)
{