please do

# The following script is a demonstration of
# how to add commands to the user interface
# via scripting. In this case, the commands
# will act on the current active layer.

open pdb from download "1bbb.pdb"; 
print "you have new commands in the script submenu of the edit menu";

menu "select_charged";
menu "select_positive";
menu "select_negative";
silent stop;

#thank you

# Here are the subroutines that can be called
# by clicking on their names. You should not
# click on them, as they need to be called as
# subroutines.


select_charged:
{
# conceptually not the most efficient way,
# to do it, but interesting teaching example

	$l = get active_layer;
	sub select_positive;
	$SEL1 = get selection of $l;
	sub select_negative;
	$SEL2 = get selection of $l;
	$SEL = $SEL1 + $SEL2;
	select $SEL;
	return;
}

select_positive:
{
	$l = get active_layer;
	if (ask "Shall I include His residues?" == 1)
	{ select in $l res "K","R","H"; }
	else {  select in $l res "K","R";}
	return;
}

select_negative:
{
	$l = get active_layer;
	select in $l res "D","E";
	return;
}

