import charite.christo.strap.StrapProtein; import charite.christo.strap.StrapProtein; import charite.christo.strap.ResidueAnnotation; import static java.lang.System.*; /* java DemoResidueAnnotation_NT Instead of specifying amino acid positions, nucleotides can be specified. */ public class DemoResidueAnnotation_NT { public static void main(String argv[]) { final StrapProtein p=new StrapProtein(); p.setNucleotides("ACGGGGGAAAAAACCCCCTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT",StrapProtein.FORWARD); out.println("getNucleotides()="+p.getNucleotidesAsString()); out.println("getNucleotidesCurrentStrand()="+p.getNucleotidesCurrentStrandAsString()); out.println("getResidueType()="+p.getResidueTypeAsString()); /* Creates a new residue selection with the given nucleotide positions. */ final ResidueAnnotation annotation=new ResidueAnnotation(p); annotation.setSelectedNucleotides("3,7,10-11"); p.addResidueSelection(annotation); /* Now print the selected nucleotides and selected amino acids. */ /* "X" means selected and dot means not selected. */ out.print("\n\nannotation.getSelectedNucleotides():"); printBool(annotation.getSelectedNucleotides(),annotation.getSelectedNucleotidesOffset()); /* An amino acid is selected when at least one of the three nucleotides of the triplet is selected. */ out.print("\n\nannotation.getSelectedAminoacids():"); printBool(annotation.getSelectedAminoacids(), annotation.getSelectedAminoacidsOffset()); out.println(); exit(0); } private static void printBool(boolean bb[],int offset) { for(int i=0;i<offset;i++) out.print('-'); for(boolean b:bb) out.print(b ? "X" : "."); } }