label.sequences_selection_not_aligned = Sequences in selection are not aligned
label.problem_reading_tree_file = Problem reading tree file
label.possible_problem_with_tree_file = Possible problem with tree file
+label.tree_url_example = Please enter a complete URL, \"for example http://purl.org/phylo/treebase/phylows/study/TB2:S15480?format=nexus\"
+label.load_tree_url = Tree from URL
label.select_at_least_three_bases_in_at_least_one_sequence_to_cDNA_translation = Please select at least three bases in at least one sequence in order to perform a cDNA translation.
label.translation_failed = Translation Failed
label.error_when_translating_sequences_submit_bug_report = Unfortunately, something went wrong when translating your sequences.\nPlease take a look in the Jalview java console\nand submit a bug report including the stacktrace.
label.input_alignment = Input Alignment
label.couldnt_import_as_vamsas_session = Couldn't import {0} as a new vamsas session.
label.vamsas_document_import_failed = Vamsas Document Import Failed
-label.couldnt_locate = Couldn't locate {0}
+label.couldnt_locate = Could not locate {0}
label.url_not_found = URL not found
label.new_sequence_url_link = New sequence URL link
label.cannot_edit_annotations_in_wrapped_view = Cannot edit annotations in wrapped view
import jalview.viewmodel.AlignmentViewport;
import java.awt.Dimension;
+import java.net.URL;
import java.util.Map;
import org.forester.archaeopteryx.Archaeopteryx;
return bindFrameToJalview(aptxApp);
}
- public static MainFrame createInstanceFromUrl()
+ public static MainFrame createInstanceFromUrl(URL url)
{
return null;
import jalview.ext.forester.DataConversions;
import jalview.ext.forester.ForesterMatrix;
import jalview.ext.treeviewer.ExternalTreeBuilderI;
+import jalview.util.MappingUtils;
import jalview.util.MessageManager;
import java.util.HashMap;
NodeData nodeData = sequenceNode.getNodeData();
nodeData.setSequence(seq);
- ExternalTreeBuilderI.putWithDuplicationCheck(nodesWithAlignment,
+ MappingUtils.putWithDuplicationCheck(nodesWithAlignment,
sequenceNode, sequence);
- ExternalTreeBuilderI.putWithDuplicationCheck(alignmentWithNodes,
+ MappingUtils.putWithDuplicationCheck(alignmentWithNodes,
sequence, sequenceNode);
rootNode.addAsChild(sequenceNode);
}
import jalview.datamodel.SequenceI;
import jalview.ext.forester.DataConversions;
import jalview.ext.treeviewer.ExternalLoadedTreeAssociationI;
-import jalview.ext.treeviewer.ExternalTreeBuilderI;
+import jalview.util.MappingUtils;
import java.util.HashMap;
import java.util.List;
.createForesterSequence(nodeSequence, true);
treeNode.getNodeData().setSequence(foresterNodeSeq);
- ExternalTreeBuilderI.putWithDuplicationCheck(alignmentWithNodes,
+ MappingUtils.putWithDuplicationCheck(alignmentWithNodes,
nodeSequence, treeNode);
- ExternalTreeBuilderI.putWithDuplicationCheck(nodesWithAlignment,
+ MappingUtils.putWithDuplicationCheck(nodesWithAlignment,
treeNode, nodeSequence);
public void loadTree(AlignViewport viewport)
{
- NewickFile fin = null;
+ NewickFile fin = null; // old tree
try
{
AptxInit.createInstanceFromFile(filePath, viewport);
fin = new NewickFile(filePath, DataSourceType.FILE);
viewport.setCurrentTree(viewport.getAlignPanel().alignFrame
.showNewickTree(fin, filePath).getTree());
+
} catch (Exception ex)
{
JvOptionPane.showMessageDialog(Desktop.desktop, ex.getMessage(),
public String generateTreeName();
- /**
- * probably move
- *
- * @param map
- * @param key
- * @param value
- * @return
- */
- static <K, V> Map<K, V> putWithDuplicationCheck(Map<K, V> map, K key,
- V value)
- {
- if (!map.containsKey(key))
- {
- map.put(key, value);
- }
- else
- {
- jalview.bin.Cache.log.warn(
- "Attempt to add duplicate entry detected for map with key: "
- + key.toString() + " and value: " + value.toString());
- }
-
- return map;
-
- }
-
}
//
// import jalview.viewmodel.AlignmentViewport;
//
-// import javax.swing.JInternalFrame;
-//
/// **
+// *
// * Interface for loading in existing trees to an external tree viewer.
// *
// * @author kjvanderheide
// *
-// * @param <F>
-// * Frame of the tree viewer.
// */
-// public interface ExternalTreeParserI<F extends JInternalFrame>
+// public interface ExternalTreeParserI
// {
-// public void loadTreeFile(AlignmentViewport viewport);
+// public ExternalTreeI loadTreeFile(AlignmentViewport viewport);
//
-// public void loadTreeUrl(AlignmentViewport viewport);
+// public ExternalTreeI loadTreeUrl(AlignmentViewport viewport);
//
// }
import java.io.File;
import java.io.FileWriter;
import java.io.PrintWriter;
+import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
chooser.setDialogTitle(
MessageManager.getString("label.select_newick_like_tree_file")); // modify
chooser.setToolTipText(
- MessageManager.getString("label.load_tree_file"));
+ MessageManager.getString("label.load_tree_for_sequence_set"));
for (SupportedTreeFileFilter treeFormat : SupportedTreeFileFilter
.values())
{
}
}
+ public void chooseTreeUrl()
+ {
+ URL treeUrl;
+
+ String urlString = JvOptionPane.showInputDialog(this,
+ MessageManager.getString("label.tree_url_example"),
+ MessageManager.getString("label.load_tree_url"),
+ JvOptionPane.QUESTION_MESSAGE);
+ if ((urlString != null) && (!urlString.isEmpty()))
+ {
+ try
+ {
+ treeUrl = new URL(urlString);
+ AptxInit.createInstanceFromUrl(treeUrl);
+
+ } catch (MalformedURLException e)
+ {
+ JvOptionPane.showMessageDialog(this,
+ MessageManager.formatMessage(
+ "exception.failed_to_read_data_from_source",
+ new String[]
+ { urlString }),
+ MessageManager.getString("label.url_not_found")
+ , JvOptionPane.ERROR_MESSAGE);
+ }
+
+ }
+
+
+ // final String url_string = JOptionPane
+ // .showInputDialog( this,
+ // message,
+ // "Use URL/webservice to obtain a phylogeny",
+ // JOptionPane.QUESTION_MESSAGE );
+ // boolean nhx_or_nexus = false;
+ // if ( ( url_string != null ) && ( url_string.length() > 0 ) ) {
+ // try {
+ // url = new URL( url_string );
+ }
+
/**
* DOCUMENT ME!
*
@Override
protected void loadTreeUrlItem_actionPerformed(ActionEvent e)
{
- AptxInit.createInstanceFromUrl();
-
+ chooseTreeUrl();
}
@Override
if (format == null)
{
JvOptionPane.showInternalMessageDialog(Desktop.desktop,
- MessageManager.formatMessage("label.couldnt_locate",
- new Object[]
+ MessageManager.formatMessage(
+ "label.couldnt_locate",
+ new String[]
{ url }),
MessageManager.getString("label.url_not_found"),
JvOptionPane.WARNING_MESSAGE);
JMenuItem loadTreeFile = new JMenuItem(
MessageManager.getString("label.from_file"));
- // loadTreeMenuItem.setActionCommand(
- // MessageManager.getString());
+
loadTreeFile.addActionListener(new ActionListener()
{
@Override
MessageManager.getString("label.export_image"));
JMenu loadTreeMenu = new JMenu(
MessageManager.getString("label.load_associated_tree"));
- loadTreeMenu.setActionCommand("label.load_tree_for_sequence_set");
+ // loadTreeMenu.setToolTipText(
+ // MessageManager.getString("label.load_tree_for_sequence_set"));
JMenu fileMenu = new JMenu(MessageManager.getString("action.file"));
// JAL-574
// selectMenu.addSeparator();
// selectMenu.add(listenToViewSelections);
+
+
}
/**
}
}
}
+
+
+ public static <K, V> Map<K, V> putWithDuplicationCheck(Map<K, V> map, K key,
+ V value)
+ {
+ if (!map.containsKey(key))
+ {
+ map.put(key, value);
+ }
+ else
+ {
+ jalview.bin.Cache.log.warn(
+ "Attempt to add duplicate entry detected for map with key: "
+ + key.toString() + " and value: " + value.toString());
+ }
+
+ return map;
+
+ }
}