#!/usr/local/bin/perl -w =pod mark-no v. 11 Jul 1996, Dave Schweisguth Marks chemical shifts which are expected to be non-observable in an ssd =cut ### Preliminaries require 5.002; # Perl 5.002 required use strict; # Require optional-but-desirable practices use vars qw($whatami); # Exempt globals from 'use strict' use Churn qw(retrieve_ssd store_fd); ### Parameters # Environment ($whatami = $0) =~ s|.*/||; # `basename $0` my $isatty = -t STDIN; # Configuration my %nos = ( # Non-observable spins for each residue a => [qw(h61 h62)], g => [qw(h21 h22)] ); # Initialization (don't change these) $| = 1; # Interleave STDOUT and STDERR properly my($ssd, $seg, $res, $type, $no); ### Arguments and error-checking # Parse args my($arg, $sign, $first, $rest); while (@ARGV and ($sign, $first, $rest) = ($ARGV[0] =~ /^([\-+])(.)(.*)/)) { if ($sign eq '+' && $first !~ /[\0]/) { # -/+ switches &usage("$sign$first is not an option.\n"); } if ($first =~ /[\0]/) { # Switches with arguments (none at the moment) shift; $arg = $rest ne '' ? $rest : @ARGV ? shift : &usage("$sign$first requires an argument.\n"); } elsif ($rest eq '') { shift; } else { $ARGV[0] = "$sign$rest"; } if ($first eq 'u') { &usage(0); } else { &usage("$sign$first is not an option.\n"); } } sub usage { warn $_[0] ? "$whatami: $_[0]" : '', < 1 || @ARGV == 0 && $isatty) { &usage("Specify or provide on standard input a single spin-system database.\n"); } elsif (@ARGV == 0) { $ARGV[0] = '-'; } ### Do it $ssd = &retrieve_ssd(shift) || exit 1; # Read spin system database or die foreach $seg (keys %{$$ssd{segs}}) { foreach $res (keys %{$$ssd{segs}{$seg}}) { $type = $$ssd{segs}{$seg}{$res}{type}; if ($nos{$type}) { foreach $no (@{$nos{$type}}) { $$ssd{segs}{$seg}{$res}{spins}{$no} = 'no'; } } } } &store_fd($ssd, 'STDOUT'); exit;