import charite.christo.strap.StrapProtein; import charite.christo.interfaces.*; import charite.christo.strap.extensions.PairAlignerNeoBioPROXY; import charite.christo.strap.extensions.MultipleAlignerClustalW; import static java.lang.System.*; import charite.christo.CacheResult; /* java DemoSequenceAligner1 This demo shows how proteins are aligned using automatic procedures. In STRAP are a few implementations of SequenceAligner. Most alignment methods can also align more than two sequences if getMaxNumberOfSequences() returns a number larger than two. */ public class DemoSequenceAligner1 { public static void main(String[] argv){ /* Enable cache */ CacheResult.setEnabled(true); final byte[][] seqs={ "ASDFGHKL".getBytes(), "TEYGKL".getBytes(), "ATDYGHKL".getBytes(), }; /* Make an instance and set the sequences */ final SequenceAligner aligner=new MultipleAlignerClustalW(); aligner.setSequences(seqs); /* First start computation, then retrieve the result. */ aligner.compute(); final byte[] ss[]=aligner.getAlignedSequences(); /* Some alignment methods can cluster similar sequences together */ /* This information is obtained with the following method: */ final int[] order= aligner instanceof SequenceAlignerSorting ? ((SequenceAlignerSorting)aligner).getIndicesOfSequences() : null; out.println(); for(int i=0;i<ss.length;i++) { if (order!=null) out.print(order[i]+" "); out.println(" "+new String(ss[i])); } /* Save result cache */ CacheResult.save(); System.exit(0); } }