Author: Laszlo Kajan <lkajan@rostlab.org>
Description: usage() takes print stream parameter
--- a/score_conservation.py
+++ b/score_conservation.py
@@ -99,7 +99,7 @@
     aa_to_index[aa] = i
 
 
-def usage():
+def usage( __file = sys.stdout ):
     print( """\nUSAGE:\nscore_conservation [options] alignfile\n\t -alignfile must be in fasta, Stockholm or clustal format.\n\nOPTIONS:\n\t
     -a\treference sequence. Print scores in reference to a specific sequence (ignoring gaps). Default prints the entire column. [sequence name]\n\t
     -b\tlambda for window heuristic linear combination. Default=.5 [real in [0,1]]\n
@@ -113,7 +113,7 @@
     -p\tuse gap penalty. Lower the score of columns that contain gaps. Default=True [True|False]\n\t
     -s\tconservation estimation method. \n\t\tOptions: shannon_entropy, property_entropy, property_relative_entropy, vn_entropy, relative_entropy, js_divergence, sum_of_pairs. Default=js_divergence\n\t
     -w\twindow size. Number of residues on either side included in the window. Default=3 [int]\n\t
-    """ )
+    """, file=__file)
     
     
 
@@ -740,17 +740,17 @@
 
 # parse options and args -- see usage()
 if len(sys.argv) < 2: 
-    usage()
+    usage(__file=sys.stderr)
     sys.exit(2)
 
 try:
     opts, args = getopt.getopt(sys.argv[1:], "hl:d:m:o:s:w:g:p:b:a:n")
 except getopt.GetoptError:
-    usage()
+    usage(__file=sys.stderr)
     sys.exit(1)
 
 if len(args) < 1: 
-    usage()
+    usage(__file=sys.stderr)
     sys.exit(1)
 
 for opt, arg in opts:
