import charite.christo.strap.*; import static java.lang.System.*; /* java DemoProtein_aminoAcids This demo shows how protein objects are created. */ public class DemoProtein_aminoAcids { public static void main(String argv[]) { /* Make a protein instance. */ /* The null in the constructor denotes that we do not need a reference to an StrapAlign object. */ /* However, within the graphical program STRAP all proteins contain a reference to the StrapAlign object. */ final StrapProtein p=new StrapProtein(); /* give the protein a name */ p.setName("myName"); /* The methods accepting strings as argument are convenient but slower than the byte array based methods */ p.setResidueType("ASDFGHKL"); /* Retrieve the residue type using the fast and inconvenient way */ final byte[] resTyp=p.getResidueType(); out.println("The sequence is="+new String(resTyp,0,p.countResidues())); /* NOTE: new String(resTyp) is not correct because the byte array might exceed the number of residues. */ /* The number of bytes converted to String must be limited by countResidues(). */ /* The following is more convenient but more time consuming: */ out.println("The sequence is "+p.getResidueTypeAsString()); /* What are the coordinates in proteins defined only from sequences? */ /* Undefined fields of the protein object are null. */ /* In the present case the 3D coordinates are null. */ out.println("The c-Alpha coordinates are not set. What will the get-method return?"); out.println("p.getResidueCalpha()="+p.getResidueCalpha()); exit(0); } }