码迷,mamicode.com
首页 > 编程语言 > 详细

using samtools commands within python

时间:2014-07-22 22:47:12      阅读:243      评论:0      收藏:0      [点我收藏+]

标签:http   os   io   for   cti   re   

Commands available in csamtools are available as simple function calls. For example:

pysam.sort( "ex1.bam", "output" )

corresponds to the command line:

samtools sort ex1.bam output

Command line options can be provided as arguments:

pysam.sort( "-n", "ex1.bam", "output" )

or:

pysam.sort( "-m", "1000000", "ex1.bam", "output" )

In order to get usage information, try:

print pysam.sort.usage()

Argument errors raise a pysam.SamtoolsError:

pysam.sort()

Traceback (most recent call last):
File "x.py", line 12, in <module>
  pysam.sort()
File "/home/andreas/pysam/build/lib.linux-x86_64-2.6/pysam/__init__.py", line 37, in __call__
  if retval: raise SamtoolsError( "\n".join( stderr ) )
pysam.SamtoolsError: ‘Usage: samtools sort [-n] [-m <maxMem>] <in.bam> <out.prefix>\n‘

Messages from csamtools on stderr are captured and are available using the getMessages() method:

pysam.sort.getMessage()

Note that only the output from the last invocation of a command is stored.

using samtools commands within python,布布扣,bubuko.com

using samtools commands within python

标签:http   os   io   for   cti   re   

原文地址:http://www.cnblogs.com/freemao/p/3861045.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!