BioJava:CookBookItaliano:Alphabets

From BioJava

Jump to: navigation, search

Come posso ottenere l'alfabeto del DNA, dell'RNA o Proteico?

In BioJava gli Alfabeti sono collezioni di Simboli. I più comuni alfabeti biologici (DNA, RNA, protein, etc) sono memorizzati tramite il BioJava AlphabetManager all'avvio e vi si può accedere tramite il nome.


The DNA, RNA and protein alphabets can also be accessed using convenient static methods from DNATools, RNATools and ProteinTools respectively.

Both of these approaches are shown in the example below

import org.biojava.bio.symbol.*;
import java.util.*;
import org.biojava.bio.seq.*;
 
public class AlphabetExample {
  public static void main(String[] args) {
    Alphabet dna, rna, prot, proteinterm ;
 
    //get the DNA alphabet by name
    dna = AlphabetManager.alphabetForName("DNA");
 
    //get the RNA alphabet by name
    rna = AlphabetManager.alphabetForName("RNA");
 
    //get the Protein alphabet by name
    prot = AlphabetManager.alphabetForName("PROTEIN");
    //get the protein alphabet that includes the * termination Symbol
    prot = AlphabetManager.alphabetForName("PROTEIN-TERM");
 
    //get those same Alphabets from the Tools classes
    dna = DNATools.getDNA();
    rna = RNATools.getRNA();
    prot = ProteinTools.getAlphabet();
    //or the one with the * symbol
    proteinterm  = ProteinTools.getTAlphabet();
 
  }
}
Personal tools