Imported Upstream version 0.7
[pysam.git] / pysam / __init__.py
index ec0439f17290876217c610355072aa4f4d074efa..f4f1138d01d537dda24976775aa1c92ed3dd5c2d 100644 (file)
@@ -48,7 +48,7 @@ class SamtoolsDispatcher(object):
         '''execute a samtools command
         '''
         retval, stderr, stdout = csamtools._samtools_dispatch( self.dispatch, args )
-        if retval: raise SamtoolsError( "\n".join( stderr ) )
+        if retval: raise SamtoolsError( 'csamtools returned with error %i: %s' % (retval, "\n".join( stderr ) ))
         self.stderr = stderr
         # samtools commands do not propagate the return code correctly.
         # I have thus added this patch to throw if there is output on stderr.
@@ -86,19 +86,31 @@ class SamtoolsDispatcher(object):
 #
 # import is a python reserved word.
 SAMTOOLS_DISPATCH = { 
+    # samtools 'documented' commands
     "view" : ( "view", None ),
     "sort" : ( "sort", None),
-    "samimport": ( "import", None),
-    "pileup" : ( "pileup", ( (("-c",), Pileup.iterate ), ), ),
+    "mpileup" : ( "mpileup", None),
+    "depth" : ("depth", None),
     "faidx" : ("faidx", None),
     "tview" : ("tview", None),
     "index" : ("index", None),
+    "idxstats" : ("idxstats", None),
     "fixmate" : ("fixmate", None),
-    "glfview" : ("glfview", None),
     "flagstat" : ("flagstat", None),
     "calmd" : ("calmd", None),
     "merge" : ("merge", None),  
-    "rmdup" : ("rmdup", None) }
+    "rmdup" : ("rmdup", None),
+    "reheader" : ("reheader", None),
+    "cat" : ("cat", None),
+    "targetcut" : ("targetcut", None),
+    "phase" : ("phase", None),
+    # others
+    "samimport": ( "import", None),
+    "bam2fq" : ("bam2fq", None),
+    # obsolete
+    # "pileup" : ( "pileup", ( (("-c",), Pileup.iterate ), ), ),
+
+ }
 
 # instantiate samtools commands as python functions
 for key, options in SAMTOOLS_DISPATCH.iteritems():