#!/usr/bin/perl -w # Count charge of polypeptide as in [1] # (c) 2008 Tobias Abenius, licence: GPL # 1. Yu Shi, Coreceptor Usage and Sensitivity to Neutralization of HIV-1 & HIV-2 sub charge($) { @aa = split //, $_[0]; $charge = (grep /[rk]/i, @aa)-(grep /[ed]/i, @aa); return $charge; } if ($#ARGV != 0) { print "Syntax: perl $0 \n"; exit 1; } print STDERR "Reading sequences separated by newline from file '$ARGV[0]'\n"; while($seq = <>) { $charge = charge($seq); print $charge."\n"; }