info.search_in_annotation_label = Search in {0} Label
info.search_in_annotation_description = Search in {0} Description
info.change_threshold_mode_to_enable = Change Threshold Mode to Enable
+label.null_or_unidentifiable_data = Null or unidentifiable data content pasted!
+label.unidentifiable_data = Unidentifiable Data
+label.null_or_invalid_alignment = Null or invalid alignment data!
+label.unable_to_create_alignment = Unable to create alignment
\ No newline at end of file
*/
package jalview.datamodel;
+import jalview.analysis.AlignmentUtils;
+import jalview.io.FastaFile;
+import jalview.util.MessageManager;
+
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashSet;
import java.util.Set;
import java.util.Vector;
-import jalview.analysis.AlignmentUtils;
-import jalview.io.FastaFile;
-import jalview.util.MessageManager;
-
/**
* Data structure to hold and manipulate a multiple sequence alignment
*/
}
return names;
}
+
+ @Override
+ public boolean hasValidSequence()
+ {
+ boolean hasValidSeq = false;
+ for (SequenceI seq : getSequences())
+ {
+ if (seq.getSequenceAsString().matches("(-*[a-zA-Z]-*){1}[a-zA-Z-]*"))
+ {
+ hasValidSeq = true;
+ break;
+ }
+ }
+ return hasValidSeq;
+ }
}
* @return
*/
Set<String> getSequenceNames();
+
+ /**
+ * Checks if the alignment has at least one sequence with one non-gaped
+ * residue
+ *
+ * @return
+ */
+ public boolean hasValidSequence();
}
import jalview.api.AlignmentViewPanel;
import jalview.api.ComplexAlignFile;
import jalview.api.FeaturesDisplayedI;
+import jalview.bin.Jalview;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.ColumnSelection;
import jalview.datamodel.SequenceI;
}
String format = new IdentifyFile().Identify(text, "Paste");
+ if (format == null || format.equalsIgnoreCase("EMPTY DATA FILE"))
+ {
+ System.err.println(MessageManager
+ .getString("label.null_or_unidentifiable_data"));
+ if (!Jalview.isHeadlessMode())
+ {
+ JOptionPane.showMessageDialog(null,
+ MessageManager
+ .getString("label.null_or_unidentifiable_data"),
+ MessageManager.getString("label.unidentifiable_data"),
+ JOptionPane.ERROR_MESSAGE);
+ }
+ return;
+ }
+
// TODO: identify feature, annotation or tree file and parse appropriately.
AlignmentI al = null;
}
}
- if (al != null)
+ if (al != null && al.hasValidSequence())
{
String title = MessageManager.formatMessage(
"label.input_cut_paste_params", new String[]
}
}
}
+ else
+ {
+ System.err.println(MessageManager
+ .getString("label.null_or_invalid_alignment"));
+ if (!Jalview.isHeadlessMode())
+ {
+ JOptionPane
+ .showMessageDialog(
+ null,
+ MessageManager
+ .getString("label.null_or_invalid_alignment"),
+ MessageManager
+ .getString("label.unable_to_create_alignment"),
+ JOptionPane.ERROR_MESSAGE);
+ }
+ }
}
public static final boolean isValidFormat(String format,
boolean forwriting)
{
+ if (format == null)
+ {
+ return false;
+ }
boolean valid = false;
String[] format_list = (forwriting) ? WRITEABLE_FORMATS
: READABLE_FORMATS;
{
Desktop.instance.stopLoading();
System.err.println("The input file \"" + file
- + "\" has no data content!");
+ + "\" has null or unidentifiable data content!");
if (!Jalview.isHeadlessMode())
{
- JOptionPane.showMessageDialog(null, "The input file \""
- + file + "\" has no data content!", "Empty data file",
+ JOptionPane.showMessageDialog(null, "The input file \"" + file
+ + "\" has null or unidentifiable data content!",
+ "Empty data file",
JOptionPane.ERROR_MESSAGE);
}
return;
*/
public String Identify(FileParse source, boolean closeSource)
{
- String reply = "PFAM";
+ String reply = null;
String data;
int length = 0;
boolean lineswereskipped = false;