YARM samples
Ordering atom names
The sort command can be used in perl to order the @atoms list,
as demonstrated below. The list @by_num_atoms is sorted in
ascending order by residue NUMber. The list @by_num_atoms_reverse is
(surprise!) the reverse of this order...
#!/usr/local/bin/perl
require "/usr/local/yarm/yarm_lib.pl";
# Set the constants
$pdb_file = "dick_xtal.pdb";
%xyz = &Pdb_Read_All( $pdb_file );
%xyz = &Get_Atom_Type( \%xyz, \%nonX_NA );
%xyz = &Pseudo_Methyl( \%xyz );
@atoms = keys %xyz;
@by_num_atoms = sort { $a <=> $b } @atoms;
@by_num_atoms_reverse = reverse sort { $a <=> $b } @atoms;
foreach $atoms ( @by_num_atoms_reverse ) {
print "$atoms\n";
}