File: usage

package info (click to toggle)
conservation-code 20110309.0-8
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 608 kB
  • sloc: python: 512; sh: 24; makefile: 21
file content (43 lines) | stat: -rw-r--r-- 1,518 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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: