[Biojava-l] biojava API - is it current?

hz5 at njit.edu hz5 at njit.edu
Fri Apr 18 12:48:53 EDT 2003


I got this code from Biojava in Anger(to create a customized Alphabets):
****************************************************************
import org.biojava.bio.symbol.*;
import org.biojava.bio.*;
import java.util.*;
public class Binary {
  public static void main(String[] args) {
    //make the "zero" Symbol with no annotation
    Symbol zero =
        AlphabetManager.createSymbol("A", Annotation.EMPTY_ANNOTATION);

    //make the "one" Symbol
    Symbol one =
        AlphabetManager.createSymbol("B", Annotation.EMPTY_ANNOTATION);
    //System.out.println(one.getToken());

    //collect the Symbols in a Set
    Set symbols = new HashSet();
    symbols.add(zero); symbols.add(one);

    //make the Binary Alphabet
    FiniteAlphabet binary = new SimpleAlphabet(symbols, "Binary");

    //iterate through the symbols to show everything works
    for (Iterator i = binary.iterator(); i.hasNext(); ) {
      Symbol sym = (Symbol)i.next();
      System.out.println(sym.getName());
    }

    //it is usual to register newly creates Alphabets with the AlphabetManager
    AlphabetManager.registerAlphabet(binary.getName(), binary);

    /*
     * The newly created Alphabet will have been registered with the
     * AlphabetManager under the name "Binary". If you retreive an instance
     * of it using this name it should be canonical with the previous instance
     */
    Alphabet alpha = AlphabetManager.alphabetForName("Binary");

    //check canonical status
    System.out.println(alpha == binary);
  }
}
****************************************************************
on line 6-8:
    //make the "zero" Symbol with no annotation
    Symbol zero =
        AlphabetManager.createSymbol("A", Annotation.EMPTY_ANNOTATION);

however, by looking at the api at http://www.biojava.org/docs/api/, I can only 
see 3 createSymbol methods in AlphabetManager class, none of them taking 2 
arguments:
---static Symbol createSymbol(char token, Annotation annotation, java.util.List 
symList, Alphabet alpha)
---static Symbol createSymbol(char token, Annotation annotation, java.util.Set 
symSet, Alphabet alpha)
---static AtomicSymbol createSymbol(char token, java.lang.String name, 
Annotation annotation)

The wierd thing is that the program can compile, I am using:
biojava-1.3pre1.jar     13-Jan-2003 18:23   2.2M  
bytecode-0.91.jar       01-Sep-2002 09:37    59k  
jakarta-regexp.jar      02-Jul-2001 05:30    29k  
xerces.jar              14-Aug-2001 12:02   1.7M


Then I change the code and let it take 3 arguments as stated in the api:
---static AtomicSymbol createSymbol(char token, java.lang.String name, 
Annotation annotation)

    //make the "zero" Symbol with no annotation
    AtomicSymbol zero =
        AlphabetManager.createSymbol('c', "A", Annotation.EMPTY_ANNOTATION);

It won't compile, says:
Note: D:\projects\Normalization Normenclature of Peptide Ligand\Binary.java 
uses or overrides a deprecated API.
Note: Recompile with -deprecation for details.

No idea why is this, does this mean that the api currently on the web is not 
for the versiion of biojave I am using, if so, how can I get a copy of biojava 
that go with the current api at http://www.biojava.org/docs/api/?

Thanks!
Haibo





=========================================================
Haibo Zhang, PhD student
Computational Biology, NJIT & Rutgers University
Center for Applied Genomics, PHRI
http://afs13.njit.edu/~hz5


More information about the Biojava-l mailing list