public final static boolean ALLOW_DDBJ_BLAST = false;
public final static String PRG_NAME = "Archaeopteryx";
final static String VERSION = "0.971 9M";
- final static String PRG_DATE = "2012.03.29";
+ final static String PRG_DATE = "2012.04.09";
final static String DEFAULT_CONFIGURATION_FILE_NAME = "_aptx_configuration_file";
final static String[] DEFAULT_FONT_CHOICES = { "Verdana", "Tahoma",
"Arial", "Helvetica", "Dialog", "Lucida Sans", "SansSerif", "Sans-serif", "Sans" };
if ( _mainpanel.getCurrentScrollPane() == null ) {
return;
}
- displayedPhylogenyMightHaveChanged( false );
+ getCurrentTreePanel().updateSetOfCollapsedExternalNodes();
+ displayedPhylogenyMightHaveChanged( true );
_mainpanel.getCurrentTreePanel().updateOvSettings();
_mainpanel.getCurrentTreePanel().validate();
_mainpanel.validate();
node.setCollapse( false );
}
tp.resetNodeIdToDistToLeafMap();
- tp.updateSetOfCollapsedExternalNodes( t );
+ tp.updateSetOfCollapsedExternalNodes();
t.recalculateNumberOfExternalDescendants( false );
tp.setNodeInPreorderToNull();
t.hashIDs();
phy.hashIDs();
phy.recalculateNumberOfExternalDescendants( true );
getCurrentTreePanel().resetNodeIdToDistToLeafMap();
- getCurrentTreePanel().updateSetOfCollapsedExternalNodes( phy );
+ getCurrentTreePanel().updateSetOfCollapsedExternalNodes();
getCurrentTreePanel().calculateLongestExtNodeInfo();
getCurrentTreePanel().setNodeInPreorderToNull();
getCurrentTreePanel().recalculateMaxDistanceToRoot();
if ( !node.isExternal() && !node.isRoot() ) {
final boolean collapse = !node.isCollapse();
AptxUtil.collapseSubtree( node, collapse );
- updateSetOfCollapsedExternalNodes( _phylogeny );
+ updateSetOfCollapsedExternalNodes();
_phylogeny.recalculateNumberOfExternalDescendants( true );
resetNodeIdToDistToLeafMap();
calculateLongestExtNodeInfo();
}
setWaitCursor();
AptxUtil.collapseSpeciesSpecificSubtrees( _phylogeny );
- updateSetOfCollapsedExternalNodes( _phylogeny );
+ updateSetOfCollapsedExternalNodes();
_phylogeny.recalculateNumberOfExternalDescendants( true );
resetNodeIdToDistToLeafMap();
calculateLongestExtNodeInfo();
paintNodeBox( _root.getXcoord(), _root.getYcoord(), _root, g, to_pdf, to_graphics_file, isInFoundNodes( _root ) );
}
- void updateSetOfCollapsedExternalNodes( final Phylogeny phy ) {
+ void updateSetOfCollapsedExternalNodes() {
+ final Phylogeny phy = getPhylogeny();
_collapsed_external_nodeid_set.clear();
- E: for( final PhylogenyNodeIterator it = phy.iteratorExternalForward(); it.hasNext(); ) {
- final PhylogenyNode ext_node = it.next();
- PhylogenyNode n = ext_node;
- while ( !n.isRoot() ) {
- if ( n.isCollapse() ) {
- _collapsed_external_nodeid_set.add( ext_node.getId() );
- continue E;
- }
- n = n.getParent();
+ if ( phy != null ) {
+ E: for( final PhylogenyNodeIterator it = phy.iteratorExternalForward(); it.hasNext(); ) {
+ final PhylogenyNode ext_node = it.next();
+ PhylogenyNode n = ext_node;
+ while ( !n.isRoot() ) {
+ if ( n.isCollapse() ) {
+ _collapsed_external_nodeid_set.add( ext_node.getId() );
+ ext_node.setCollapse( true );
+ continue E;
+ }
+ n = n.getParent();
+ }
}
}
}
public final class NHXtags {
- public static final String CUSTOM_DATA_ON_NODE = "XN=";
- public static final String COLOR = "C=";
- public static final String PARENT_BRANCH_WIDTH = "W=";
- public static final String SUBTREE_NEIGHBORS = "SNn=";
- public static final String SUPER_ORTHOLOGOUS = "SOn=";
- public static final String ORTHOLOGOUS = "On=";
- public static final String TAXONOMY_ID = "T=";
- public static final String SUPPORT = "B=";
- public static final String IS_DUPLICATION = "D=";
- public static final String ANNOTATION = "AN="; //TODO fix on website NHXv2
- public static final String SPECIES_NAME = "S=";
- public static final String DOMAIN_STRUCTURE = "DS=";
- public static final String GENE_NAME = "GN=";
- public static final String GENE_NAME_SYNONYM = "G=";
- public static final String SEQUENCE_ACCESSION = "AC=";
- public static final String NODE_IDENTIFIER = "ID="; //TODO fix on website NHXv2
- public static final Object BRANCH_WIDTH = "W=";
- @Deprecated
- public static final String BINARY_DOMAIN_COMBINATIONS = "GDC=";
- @Deprecated
- public static final String DOMAINS_SEPARATOR = "\\|";
- @Deprecated
- public static final String DOMAINS = "GD=";
- @Deprecated
- public static final String EC_NUMBER = "E=";
+ public static final String CUSTOM_DATA_ON_NODE = "XN=";
+ public static final String COLOR = "C=";
+ public static final String PARENT_BRANCH_WIDTH = "W=";
+ public static final String SUBTREE_NEIGHBORS = "SNn=";
+ public static final String SUPER_ORTHOLOGOUS = "SOn=";
+ public static final String ORTHOLOGOUS = "On=";
+ public static final String TAXONOMY_ID = "T=";
+ public static final String SUPPORT = "B=";
+ public static final String IS_DUPLICATION = "D=";
+ public static final String ANNOTATION = "AN=";
+ public static final String SPECIES_NAME = "S=";
+ public static final String DOMAIN_STRUCTURE = "DS=";
+ public static final String GENE_NAME = "GN=";
+ public static final String GENE_NAME_SYNONYM = "G=";
+ public static final String SEQUENCE_ACCESSION = "AC=";
+ public static final String NODE_IDENTIFIER = "ID=";
+ public static final Object BRANCH_WIDTH = "W=";
}
}
node.setDistanceToParent( d );
}
+ if ( xml_element.isHasAttribute( PhyloXmlMapping.NODE_COLLAPSE ) ) {
+ final String collapse_str = xml_element.getAttribute( PhyloXmlMapping.NODE_COLLAPSE );
+ if ( !ForesterUtil.isEmpty( collapse_str ) && collapse_str.trim().equalsIgnoreCase( "true" ) ) {
+ node.setCollapse( true );
+ }
+ }
for( int i = 0; i < xml_element.getNumberOfChildElements(); ++i ) {
final XmlElement element = xml_element.getChildElement( i );
final String qualified_name = element.getQualifiedName();
public static final String PHYLOGENY_TYPE_ATTR = "type";
public static final String CLADE = "clade";
public static final String NODE_NAME = "name";
+ public static final String NODE_COLLAPSE = "collapse";
public static final String SEQUENCE = "sequence";
public static final String SEQUENCE_NAME = "name";
public static final String SEQUENCE_SYMBOL = "symbol";
public static void toPhyloXml( final Writer w, final PhylogenyNode node, final int level, final String indentation )
throws IOException {
String ind = "";
- if ( indentation.length() > 0 ) {
+ if ( ( indentation != null ) && ( indentation.length() > 0 ) ) {
ind = indentation + PhylogenyWriter.PHYLO_XML_INTENDATION_BASE;
}
if ( !ForesterUtil.isEmpty( node.getName() ) ) {
}
PhylogenyDataUtil.appendOpen( getWriter(), PhyloXmlMapping.CLADE );
}
- if ( indentation != null ) {
- PhyloXmlNodeWriter.toPhyloXml( getWriter(), node, getPhyloXmlLevel(), indentation.toString() );
- }
- else {
- PhyloXmlNodeWriter.toPhyloXml( getWriter(), node, getPhyloXmlLevel(), "" );
- }
+ PhyloXmlNodeWriter.toPhyloXml( getWriter(),
+ node,
+ getPhyloXmlLevel(),
+ indentation != null ? indentation.toString() : "" );
if ( node.isExternal() ) {
getWriter().write( ForesterUtil.LINE_SEPARATOR );
if ( indentation != null ) {
if ( isIndentPhyloxml() ) {
getWriter().write( createIndentation().toString() );
}
- PhylogenyDataUtil.appendOpen( getWriter(), PhyloXmlMapping.CLADE );
+ if ( node.isCollapse() ) {
+ PhylogenyDataUtil.appendOpen( getWriter(),
+ PhyloXmlMapping.CLADE,
+ PhyloXmlMapping.NODE_COLLAPSE,
+ "true" );
+ }
+ else {
+ PhylogenyDataUtil.appendOpen( getWriter(), PhyloXmlMapping.CLADE );
+ }
}
else if ( ( getOutputFormt() == FORMAT.NHX ) || ( getOutputFormt() == FORMAT.NH ) ) {
getBuffer().append( "(" );