// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
//
// Contact: phylosoft @ gmail . com
-// WWW: www.phylosoft.org/
+// WWW: https://sites.google.com/site/cmzmasek/home/software/forester
package org.forester.archaeopteryx;
import javax.swing.tree.TreePath;
import javax.swing.tree.TreeSelectionModel;
+import org.forester.archaeopteryx.tools.ImageLoader;
import org.forester.io.parsers.phyloxml.PhyloXmlDataFormatException;
import org.forester.phylogeny.PhylogenyNode;
import org.forester.phylogeny.data.Accession;
+import org.forester.phylogeny.data.BranchWidth;
import org.forester.phylogeny.data.Confidence;
import org.forester.phylogeny.data.Date;
import org.forester.phylogeny.data.Distribution;
import org.forester.phylogeny.data.Identifier;
import org.forester.phylogeny.data.MultipleUris;
import org.forester.phylogeny.data.PhylogenyData;
+import org.forester.phylogeny.data.PhylogenyDataUtil;
import org.forester.phylogeny.data.Point;
import org.forester.phylogeny.data.Reference;
import org.forester.phylogeny.data.Sequence;
top.add( category );
addSubelementEditable( category, NodePanel.NODE_NAME, phylogeny_node.getName(), PHYLOXML_TAG.NODE_NAME );
String bl = "";
- if ( phylogeny_node.getDistanceToParent() != PhylogenyNode.DISTANCE_DEFAULT ) {
+ if ( phylogeny_node.getDistanceToParent() != PhylogenyDataUtil.BRANCH_LENGTH_DEFAULT ) {
bl = ForesterUtil.FORMATTER_6.format( phylogeny_node.getDistanceToParent() );
}
addSubelementEditable( category, NodePanel.NODE_BRANCH_LENGTH, bl, PHYLOXML_TAG.NODE_BRANCH_LENGTH );
"",
PHYLOXML_TAG.CONFIDENCE_TYPE,
counter );
+ String bw = "1";
+ if ( ( phylogeny_node.getBranchData().getBranchWidth() != null )
+ && ( phylogeny_node.getBranchData().getBranchWidth().getValue() != BranchWidth.BRANCH_WIDTH_DEFAULT_VALUE ) ) {
+ bw = ForesterUtil.FORMATTER_3.format( phylogeny_node.getBranchData().getBranchWidth().getValue() );
+ }
+ addSubelementEditable( category, NodePanel.NODE_BRANCH_WIDTH, bw, PHYLOXML_TAG.NODE_BRANCH_WIDTH );
}
// private void addAnnotation( final DefaultMutableTreeNode top, final Annotation ann, final String name ) {
break;
case NODE_BRANCH_LENGTH:
if ( ForesterUtil.isEmpty( value ) ) {
- getMyNode().setDistanceToParent( PhylogenyNode.DISTANCE_DEFAULT );
+ getMyNode().setDistanceToParent( PhylogenyDataUtil.BRANCH_LENGTH_DEFAULT );
}
else {
try {
}
}
break;
+ case NODE_BRANCH_WIDTH:
+ if ( ForesterUtil.isEmpty( value ) || value.equals( "1" ) ) {
+ if ( getMyNode().getBranchData().getBranchWidth() != null ) {
+ getMyNode().getBranchData().setBranchWidth( new BranchWidth() );
+ }
+ }
+ else {
+ try {
+ final double bw = ForesterUtil.parseDouble( value );
+ if ( bw >= 0 ) {
+ getMyNode().getBranchData().setBranchWidth( new BranchWidth( bw ) );
+ }
+ }
+ catch ( final ParseException e ) {
+ JOptionPane.showMessageDialog( this,
+ "failed to parse branch width from: " + value,
+ "Error",
+ JOptionPane.ERROR_MESSAGE );
+ mtn.setUserObject( "" );
+ }
+ }
+ break;
case CONFIDENCE_VALUE:
double confidence = Confidence.CONFIDENCE_DEFAULT_VALUE;
if ( !ForesterUtil.isEmpty( value ) ) {
}
else {
final String type = getMyNode().getBranchData().getConfidences().get( number ).getType();
- getMyNode().getBranchData().getConfidences().set( number, new Confidence( confidence, type ) );
+ final double sd = getMyNode().getBranchData().getConfidences().get( number ).getStandardDeviation();
+ getMyNode().getBranchData().getConfidences().set( number, new Confidence( confidence, type, sd ) );
}
break;
case CONFIDENCE_TYPE:
}
else {
final double v = getMyNode().getBranchData().getConfidences().get( number ).getValue();
- getMyNode().getBranchData().getConfidences().set( number, new Confidence( v, value ) );
+ final double sd = getMyNode().getBranchData().getConfidences().get( number ).getStandardDeviation();
+ getMyNode().getBranchData().getConfidences().set( number, new Confidence( v, value, sd ) );
}
break;
case TAXONOMY_CODE:
break;
case SEQ_MOL_SEQ:
ForesterUtil.ensurePresenceOfSequence( getMyNode() );
- getMyNode().getNodeData().getSequence().setMolecularSequence( value );
+ getMyNode().getNodeData().getSequence().setMolecularSequence( value.replaceAll( "[^a-zA-Z-]", "" ) );
break;
case SEQ_NAME:
ForesterUtil.ensurePresenceOfSequence( getMyNode() );
private enum PHYLOXML_TAG {
NODE_NAME,
NODE_BRANCH_LENGTH,
+ NODE_BRANCH_WIDTH,
TAXONOMY_CODE,
TAXONOMY_SCIENTIFIC_NAME,
TAXONOMY_AUTHORITY,