import charite.christo.strap.StrapProtein;
import charite.christo.strap.BiojavaSequence2StrapProtein;
import org.biojava.bio.seq.GappedSequence;
import org.biojava.bio.seq.ProteinTools;
import static java.lang.System.*;
/*
  java   DemoBiojavaSequence2StrapProtein
  If you want to add strap-functionality to your biojava project
  you might need to turn Biojava sequence objects into strap objects.
  BiojavaSequence2StrapProtein is a class that extends StrapProtein.
  Protein objects are  constructed with a Biojava gapped sequence object.
*/
public class DemoBiojavaSequence2StrapProtein {
    public static void main(String[] argv){
        try {
            /* prepare a Biojava GappedSequence-object for testing */
            GappedSequence gs=ProteinTools.createGappedProteinSequence("asdfgfghk","name");
            gs.addGapsInSource(3,10);
            out.println("gs.addGapsInSource(3,10); Inserts a gap after the 2nd and before the 3rd residue");
            out.println("In STRAP residue indices start with zero but in Biojava with one.");
            out.println(gs.seqString());

            /* conversion to Strap */
            StrapProtein p=new BiojavaSequence2StrapProtein(gs);
            /* check whether the sequence is OK */
            out.print("p.getResidueType()="+p.getResidueTypeAsString());
            out.print("p.getGappedSequence()="+p.getGappedSequenceAsString());
        } catch(Exception e){ e.printStackTrace(out);}
        exit(0);
    }
}