// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
//
// Contact: phylosoft @ gmail . com
-// WWW: www.phylosoft.org/forester
+// WWW: https://sites.google.com/site/cmzmasek/home/software/forester
package org.forester.phylogeny;
private Confidence _confidence;
private Identifier _identifier;
private boolean _rerootable;
- private HashMap<Integer, PhylogenyNode> _id_to_node_map;
+ private HashMap<Long, PhylogenyNode> _id_to_node_map;
private List<PhylogenyNode> _external_nodes_set;
private Collection<Sequence> _sequenceRelationQueries;
private Collection<SequenceRelation.SEQUENCE_RELATION_TYPE> _relevant_sequence_relation_types;
* Finds the PhylogenyNode of this Phylogeny which has a matching ID number.
* @return PhylogenyNode with matching ID, null if not found
*/
- public PhylogenyNode getNode( final int id ) throws NoSuchElementException {
+ public PhylogenyNode getNode( final long id ) throws NoSuchElementException {
if ( isEmpty() ) {
throw new NoSuchElementException( "attempt to get node in an empty phylogeny" );
}
return nodes;
}
+ public List<PhylogenyNode> getNodesViaSequenceSymbol( final String seq_name ) {
+ if ( isEmpty() ) {
+ return null;
+ }
+ final List<PhylogenyNode> nodes = new ArrayList<PhylogenyNode>();
+ for( final PhylogenyNodeIterator iter = iteratorPreorder(); iter.hasNext(); ) {
+ final PhylogenyNode n = iter.next();
+ if ( n.getNodeData().isHasSequence() && n.getNodeData().getSequence().getSymbol().equals( seq_name ) ) {
+ nodes.add( n );
+ }
+ }
+ return nodes;
+ }
+
public List<PhylogenyNode> getNodesViaTaxonomyCode( final String taxonomy_code ) {
if ( isEmpty() ) {
return null;
return;
}
_id_to_node_map = null;
- int max = 0;
+ long max = 0;
for( final PhylogenyNodeIterator it = iteratorPreorder(); it.hasNext(); ) {
final PhylogenyNode node = it.next();
if ( node.isRoot() ) {
* @param id
* ID (int) of PhylogenyNode of this Phylogeny
*/
- public void reRoot( final int id ) {
+ public void reRoot( final long id ) {
reRoot( getNode( id ) );
}
_identifier = identifier;
}
- public void setIdToNodeMap( final HashMap<Integer, PhylogenyNode> idhash ) {
+ public void setIdToNodeMap( final HashMap<Long, PhylogenyNode> idhash ) {
_id_to_node_map = idhash;
}
return;
} // unRoot()
- private HashMap<Integer, PhylogenyNode> getIdToNodeMap() {
+ private HashMap<Long, PhylogenyNode> getIdToNodeMap() {
return _id_to_node_map;
}
if ( isEmpty() ) {
return;
}
- setIdToNodeMap( new HashMap<Integer, PhylogenyNode>() );
+ setIdToNodeMap( new HashMap<Long, PhylogenyNode>() );
for( final PhylogenyNodeIterator iter = iteratorPreorder(); iter.hasNext(); ) {
final PhylogenyNode node = iter.next();
getIdToNodeMap().put( node.getId(), node );