import charite.christo.strap.StrapProtein; import static java.lang.System.*; /* java DemoProtein_gaps Gaps are used to align proteins. They account for inserts and deletions during evolution. This demo shows several ways how gaps are introduced in protein objects. */ public class DemoProtein_gaps { public static void main(String argv[]) { final StrapProtein p= new StrapProtein(); p.setName("myName"); p.setResidueType("ASDFG"); out.println("There are several ways how gaps can be added to a sequence:"); out.println(); p.setResidueGap(3,2); out.println("p.setResidueGap(3,2) results in " +p.getGappedSequenceAsString()); out.println(); p.setResidueGap(new int[]{0,0,2,0,0}); out.println("p.setResidueGap(new int[]{0,0,2,0,0}) results in " +p.getGappedSequenceAsString()); out.println(); p.setGappedSequence("AS DFG"); out.println("p.setGappedSequence(\"AS DFG\"); results in " +p.getGappedSequenceAsString()); out.println(); /* The method applyGappedSequence infers the gaps from a given gapped sequence. */ /* Any non-letter is a gap. What letters are used does not matter. */ p.inferGapsFromGappedSequence("AAAA A".getBytes()); out.println("p.inferGapsFromGappedSequence(\"AAAA A\"); results in " +p.getGappedSequenceAsString()); out.println(); /* The residue column gives the horizontal position of a residue */ out.println("The residue column is larger than the residue index when there are gaps:"); out.println("getResidueColumn(3)="+p.getResidueColumn(3)); out.println("getMaxColumn() is the total length minus 1: "+p.getMaxColumn()); exit(0); } }