import charite.christo.strap.StrapProtein;
import charite.christo.protein.PDB_Parser;
import charite.christo.protein.ProteinWriter1;
import charite.christo.interfaces.ProteinWriter;
import charite.christo.protein.ProteinParser;
import charite.christo.ByteArray;
import static java.lang.System.*;
/*
  java   DemoResidueSubset hs_EscherichiaColi.pdb
  Terminal parts of a protein can be cut off, providing
  the beginning  and the end position of the segment of interest.
  The residues  of interest are given as a String expression:  "10-13".
  The residues do not need to be consecutive, and comma separated expressions are possible. 
  For referring to pdb-residue number and pdb-chains use the Rasmol syntax: number-colon-chain.
*/
public class DemoResidueSubset {
    public static void main(String argv[]) {
        /* Usually only cAlpha atoms are read. Here we are also interested in side chain atoms. */
        final StrapProtein p= StrapProtein.newInstance(new java.io.File(argv[0]),ProteinParser.SIDE_CHAIN_ATOMS);
        out.println("10-13 means residues 10,11,12,13");
        /* The following expressions are equivalent:  10,11,12,13 or   10-12,13  */
        /* For PDB structures you can also refere to the PDB-number and chain: 10:A-13:A */
        p.setResidueSubset("10-13");
        final ProteinWriter pw=new ProteinWriter1();
        final long mode=ProteinWriter.PDB|ProteinWriter.ATOM_LINES|ProteinWriter.SIDE_CHAIN_ATOMS;
        final ByteArray sb=new ByteArray("Seq=").append(p.getResidueType()).append("\n").append(p.getResidueType()).append("\n");
        pw.toText(p,null,mode,sb);
        out.println("\n\n"+sb);
        exit(0);
    }
}