import charite.christo.strap.*;
import java.io.File;
import static java.lang.System.*;
/*
java DemoProtein_residueSets a1_SaccharomycesCerevisiae.pdb
This demo shows how to convert an expression residue positions into a boolean array.
Example: 1-3,5-6 ==> XXX.XXX....
If the number is followed by a colon, then the PDB-residue positions is used.
Example 4:A is the residue of chain A with the PDB-number 4
*/
public class DemoResidueSubset2 {
public static void main(String argv[]) {
/* Make a protein instance. */
final int OFFSET=1;
final StrapProtein p= StrapProtein.newInstance(new File(argv[0]));
{
final String s="2-3,4,5,9";
out.println(s+" ==> "+toString(p.residueSubsetAsBooleanArray(s,OFFSET)));
}
{
/* You can also refere to the pdb residue number and chain. */
final String s="2:A-3:A,4:A,5:A,9:A";
out.println(s+" ==> "+toString(p.residueSubsetAsBooleanArray(s,OFFSET)));
}
exit(0);
}
private static StringBuffer toString(boolean bb[]) {
final StringBuffer sb=new StringBuffer(bb.length);
for(boolean b:bb) sb.append(b ? 'X' : '.');
return sb;
}
}