import java.util.*;

import javagene.seq.*;
import javagene.io.*;
import javagene.util.*;

/**
 * Illustrate use of the AminoAcid and Nucleotide classes.
 */
public class Bio
{
    
    public static void mainString[] args )
    throws Exception
    {
         
        // create a sample sequence
        SeqI seq= new SeqFast"atatatatacgcgcg""sample id""sample desc" );
        
        //
        // The Nucleotide class
        //
         
        // get complements
        String s4= Nucleotide.dnaComplementseq.toString() );
        String s5= Nucleotide.dnaReverseComplementseq.toString() );
        
        // Using "ambiguous" nucleotides: 
        // Here we count the purines (IUPAC "R" matches both "A" and "G" )
        int count= 0;
        forLocation loc: seq.bounds() )
        {
            String s= seq.toStringloc );
            ifNucleotide.R.matches) ) count++;
        }
        
        
        // JavaGene is fluent in RNA
        String s8= Nucleotide.rnaReverseComplementseq.toString() );
        
        assert Nucleotide.isWobbleComplement'G','U' );
        assert Nucleotide.isWobbleComplement'G','C' );
        assert ! Nucleotide.isWobbleComplement'G','A' );
        
        //
        // The AminoAcid class
        //
         
        // translate nucleotide string to amino acid string
        String aa= AminoAcid.translateseq.toString() );
        
        // check if codons are synonymous (two ways)
        assert AminoAcid.lookup"att").isSynonym"ATC" );      
        assert AminoAcid.CYS == AminoAcid.lookup"TGC" );
        
        //note that the STOP codon is treated like an AA        
        assert AminoAcid.STOP.isSynonym"TAA" );
               

    }
    
}
Java2html