[Biojava-l] taxanomical API

Matthew Pocock matthew_pocock@yahoo.co.uk
Mon, 04 Feb 2002 13:42:02 +0000


This is a multi-part message in MIME format.
--------------090509030503070807000800
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Hi.

Does anybody have any strong opinions about taxanomic data in BioJava? I 
was going to pop in a new package org.biojava.bio.taxa with interfaces & 
in-memory implementations of taxonomies. The aim is that this should 
play well with the ebi taxonomy database (and by extention the taxonomy 
stuff in embl & swissprot files). This will not be merged into the 1.2 
release untill/unless it gets very stable very quickly.

All views greatfully accepted. If this code already exists out there 
somewhere, I would be more than happy to take a copy & BioJava'ise it & 
check it in.

I've attached my simple/stupid taxa interface.

Matthew

--------------090509030503070807000800
Content-Type: text/plain;
 name="Taxa.java"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="Taxa.java"

import java.util.*;

/**
 * A taxa within a classification.
 * <P>
 * Taxa may be 'leaf' nodes specifying species, or 'internal' nodes specifying
 * kingdoms and the like.
 *
 * @author Matthew Pocock
 */
public interface Taxa {
  /**
   * The common name of the Taxa.
   * <P>
   * This is the normal name used in common speach, such as 'human'.
   *
   * @return a String representing this taxa's common name
   */
  public String getCommonName();
  
  /**
   * The scientific name of this species.
   * <P>
   * This will be the portion of the scientific classification pertaining to
   * just this node within the classifictaion. It will be something like
   * 'homo sapien' or 'archaeal group 2', rather than the full classification
   * list.
   */
  public String getScientificName();

  /**
   * The parent of this Taxa.
   * <P>
   * Taxas live within a tree data-structure, so every taxa has a single parent
   * except for the root type. This has the null parent.
   *
   * @return the parent Taxa, or null if this is the root type.
   */
  public Taxa getParent();
  
  /**
   * The children of this Taxa.
   * <P>
   * Taxas live within a tree data-structure, so every taxa has zero or more
   * children. In the case of zero children, the empty set is returned.
   * <P>
   * ? read-only ? dynamicaly updated with taxa object ? copy of data ?
   *
   * @return the Set (possibly empty) of all child Taxa
   */
  public Set getChildren();
  
  /**
   * Add a taxa as a child to this one.
   * <P>
   * ? should this be add on getChildren ? is child added or coppied in ?
   *
   * @param child  the Taxa to add as a child
   * @throws ChangeVetoException if for any reason the child can't be added
   */
  public void addChild(Taxa child)
  throws ChangeVetoException;
  
  /**
   * Remove a taxa as a child to this one.
   * <P>
   * ? should this be remove on getChildren ? what if child is not actualy a
   * child ? what if child is equal to but not the same as a child ?
   *
   * @param child  the Taxa to remove as a child
   * @throws ChangeVetoException if for any reason the child can't be removed
   */
  public void removeChild(Taxa child)
  throws ChangeVetoException;
}

--------------090509030503070807000800--