import charite.christo.strap.StrapProtein; import charite.christo.strap.StrapProtein; import charite.christo.strap.ResidueAnnotation; import static java.lang.System.*; import static charite.christo.ChConstants.*; /* java DemoResidueAnnotation Residue annotations associate text to a set of residues. The text is an array of key value pairs. */ public class DemoResidueAnnotation { public static void main(String argv[]) { final StrapProtein p=new StrapProtein(); p.setResidueType("ASDFGHKL"); out.println("p.getResidueType()="+p.getResidueTypeAsString()); final ResidueAnnotation annotation=new ResidueAnnotation(p); p.addResidueSelection(annotation); /* Text attributes like remarks can be added. */ /* Beside REMARK several other type of text attributes exist. */ /* Please see the STRAP manual for details. */ annotation.setValue("Remark","a remark"); /* The difference to a classical Map is that you can add a 2nd remark. */ /* Using the key ResidueAnnotation.REMARK, both entries can be retrieved. */ annotation.setValue("Remark","another remark"); /* Specify the selected residues */ /* Indices out of range are ignored. */ annotation.setSelectedAminoacids("3-5,7,70-79,900-1000"); /* print an "X" for selected and a dot for not selected. */ printBool(annotation.getSelectedAminoacids(), annotation.getSelectedAminoacidsOffset()); out.println(); /* All residue selections can be retrieved from the protein object.*/ /* In this example there is only one residue selection. */ out.println("The number of ResidueAnnotation-objects in p is "+p.getResidueAnnotations().length); 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" : "."); } }