SEQanswers

Go Back   SEQanswers > Bioinformatics > Bioinformatics



Similar Threads
Thread Thread Starter Forum Replies Last Post
pybedtools - a Python wrapper for BEDTools daler Bioinformatics 7 09-30-2014 11:10 AM
bowtie wrapper script lh3 Bioinformatics 5 06-28-2012 11:27 AM
pysam IteratorSNPCall output different than the samtools mpileup aggp11 Genomic Resequencing 0 07-13-2011 10:25 AM
pysam pileup wierdness mbreese Bioinformatics 1 06-29-2011 12:04 PM
coverage by strand with pysam desaila Bioinformatics 1 10-15-2010 11:54 AM

Reply
 
Thread Tools
Old 10-19-2009, 08:18 AM   #1
TGBelgard
Junior Member
 
Location: Oxford, UK & Maryland, US

Join Date: Oct 2009
Posts: 4
Default pysam: a python wrapper of samtools

Dear NGS community:

We announce the first release of pysam, a free/open-source lightweight wrapper of SAMtools with a pythonic interface.

The code and documentation can be found at the Pysam website:

http://code.google.com/p/pysam/

The python module wraps most functionality of Heng Li's C implementation of SAMtools (http://samtools.sourceforge.net). We would like to thank Heng Li for his assistance and, of course, all the samtools developers for providing samtools in the first place.

We hope you find it useful and we welcome feedback and comments.

Best wishes,

The pysam developers
TGBelgard is offline   Reply With Quote
Old 10-19-2009, 11:51 PM   #2
ffinkernagel
Senior Member
 
Location: Marburg, Germany

Join Date: Oct 2009
Posts: 110
Default

I've used pysam for a couple of days now and greatly appreciate your effort!
ffinkernagel is offline   Reply With Quote
Old 10-21-2009, 06:27 AM   #3
quinlana
Senior Member
 
Location: Charlottesville

Join Date: Sep 2008
Posts: 119
Default

This is very welcome news, thanks for taking the time to create it. Does it use SWIG?
quinlana is offline   Reply With Quote
Old 10-21-2009, 03:09 PM   #4
TGBelgard
Junior Member
 
Location: Oxford, UK & Maryland, US

Join Date: Oct 2009
Posts: 4
Default

Pysam uses pyrex to wrap the samtools code. Also, note there has been a bugfix release.

Quote:
Originally Posted by quinlana View Post
This is very welcome news, thanks for taking the time to create it. Does it use SWIG?
TGBelgard is offline   Reply With Quote
Old 11-03-2009, 01:31 PM   #5
choy
Member
 
Location: Michigan

Join Date: Jul 2009
Posts: 14
Default pysam w/ 2.4 and 2.5

I tried pysam today and found that it is not compatible with python <2.6.

The reason is because it uses the 'namedtuple' object which is new is python 2.6

I downloaded the following namedtuple implementation and am now able to use pysam with python 2.5 --

http://code.activestate.com/recipes/500261/

Pysam developers -- you might consider making a python2.5 version available too!

Thanks a lot for your sharing this great tool!
choy is offline   Reply With Quote
Old 11-03-2009, 05:42 PM   #6
nilshomer
Nils Homer
 
nilshomer's Avatar
 
Location: Boston, MA, USA

Join Date: Nov 2008
Posts: 1,285
Default

Any chance of supporting python 3.1 or greater?
nilshomer is offline   Reply With Quote
Old 11-04-2009, 06:22 AM   #7
TGBelgard
Junior Member
 
Location: Oxford, UK & Maryland, US

Join Date: Oct 2009
Posts: 4
Default

We intend to support python 3 in the near future (this requires moving to cython from pyrex). For older versions of python 2 (<2.6), we would suggest using choy's work-around (using the namedtuple available from ActiveState code).
TGBelgard is offline   Reply With Quote
Old 12-07-2009, 01:16 AM   #8
Mr Mutundes
Member
 
Location: Sydney, Australia

Join Date: Jan 2009
Posts: 17
Default

Yes, thanks for making this available.

Unfortunately I have not been able to install it and get the compilation errors below. If anyone can help I'd be grateful.

Using:
pysam-0.1.1
Python 2.6.4
Pyrex-0.9.8.5
gcc (GCC) 4.3.2 20081105 (Red Hat 4.3.2-7)
Linux 2.6.27.5-117.fc10.x86_64

pysam-0.1.1: python2.6 setup.py build
running build
running build_py
running build_ext
building 'pysam/csamtools' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Isamtools -I/c/matthew/include/py
thon2.6 -c pysam/csamtools.c -o build/temp.linux-x86_64-2.6/pysam/csamtools.o
In file included from pysam/csamtools.c:35:
samtools/bam.h:341: warning: function declaration isnât a prototype
samtools/bam.h:351: warning: function declaration isnât a prototype
pysam/csamtools.c: In function â:
pysam/csamtools.c:1740: warning: passing argument 7 of â from incompatible pointer type
pysam/csamtools.c: In function â:
pysam/csamtools.c:2020: warning: passing argument 1 of â from incompatible pointer type
pysam/csamtools.c:2023: warning: passing argument 7 of â from incompatible pointer type
pysam/csamtools.c: In function â:
pysam/csamtools.c:4042: warning: assignment from incompatible pointer type
pysam/csamtools.c: In function â:
pysam/csamtools.c:7162: error: â undeclared (first use in this function)
pysam/csamtools.c:7162: error: (Each undeclared identifier is reported only once
pysam/csamtools.c:7162: error: for each function it appears in.)
pysam/csamtools.c:7163: error: â undeclared (first use in this function)
pysam/csamtools.c:7168: error: â undeclared (first use in this function)
pysam/csamtools.c:7191: error: â undeclared (first use in this function)
error: command 'gcc' failed with exit status 1
Mr Mutundes is offline   Reply With Quote
Old 12-08-2009, 12:48 AM   #9
Mr Mutundes
Member
 
Location: Sydney, Australia

Join Date: Jan 2009
Posts: 17
Default

for the record - this was caused by not cleaning up an earlier unsuccessful installation attempt with an older version of pyrex
Mr Mutundes is offline   Reply With Quote
Old 03-23-2010, 01:46 PM   #10
cswarth
Member
 
Location: seattle

Join Date: Mar 2010
Posts: 14
Default compiling pysam under cygwin or mingw32

I apologize if this is not an appropriate forum for this type of thing, but it is the only forum I can find that mentions pysam.

I'm trying to compile the latest version of pysam (0.1.2) under Windows Vista 64-bit (and that is not by choice).

I started using gcc from the cygwin tools, but gcc.exe would not run on this 64-bit system (odd). I switched to MinGW toolchain and got pysam to compile, but it won't link.

The build process for python extensions generates a .def file with an undefined symbol, in this case "initpysam/csamtools". I can see where this symbol name is generated but I am wondering if anyone else has run into this. It seems like it would affect anyone compiling pysam under cygwin or MinGW32.

Thanks in advance,

-csw
cswarth is offline   Reply With Quote
Old 03-24-2010, 09:05 PM   #11
cswarth
Member
 
Location: seattle

Join Date: Mar 2010
Posts: 14
Default

Quote:
Originally Posted by cswarth View Post
I'm trying to compile the latest version of pysam (0.1.2) under Windows Vista 64-bit (and that is not by choice).
I spoke with one of the authors of pysam and he said they had not tried much to make it work under windows. A colleague said it worked well under linux and mac. I compiled it easily under macos, and I'll just dual boot this windows machine with linux. Problem solved.
cswarth is offline   Reply With Quote
Old 11-18-2010, 10:30 AM   #12
bioinfosm
Senior Member
 
Location: USA

Join Date: Jan 2008
Posts: 482
Default

Installation issue:

$ which python
/usr/local/python/2.5.1/bin/python

$ python setup.py install
Traceback (most recent call last):
File "setup.py", line 56, in <module>
from Cython.Distutils import build_ext
ImportError: No module named Cython.Distutils
__________________
--
bioinfosm
bioinfosm is offline   Reply With Quote
Old 11-18-2010, 12:53 PM   #13
maubp
Peter (Biopython etc)
 
Location: Dundee, Scotland, UK

Join Date: Jul 2009
Posts: 1,541
Default

You need to install the Cython library for Python.

See http://www.cython.org/

Last edited by maubp; 11-18-2010 at 12:54 PM. Reason: added URL
maubp is offline   Reply With Quote
Old 11-18-2010, 02:30 PM   #14
bioinfosm
Senior Member
 
Location: USA

Join Date: Jan 2008
Posts: 482
Default

Quote:
Originally Posted by maubp View Post
You need to install the Cython library for Python.

See http://www.cython.org/
that solved it. Thanks!
bioinfosm is offline   Reply With Quote
Old 11-29-2010, 12:39 AM   #15
dror
Member
 
Location: T"A

Join Date: May 2010
Posts: 18
Default running - python setup.py build, i have this error. why!??!

running build
running build_py
running build_ext
building 'csamtools' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DFILE_OFFSET_BITS=64 -D_USE_KNETFILE= -Isamtools -Ipysam -I/usr/include/python2.6 -c pysam/csamtools.c -o build/temp.linux-i686-2.6/pysam/csamtools.o
In file included from pysam/csamtools.c:140:
samtools/razf.h:38:18: error: zlib.h: No such file or directory
In file included from pysam/csamtools.c:140:
samtools/razf.h:91: error: expected specifier-qualifier-list before ‘z_stream’
In file included from pysam/csamtools.c:142:
samtools/bam.h:354: warning: function declaration isn’t a prototype
samtools/bam.h:369: warning: function declaration isn’t a prototype
pysam/csamtools.c: In function ‘__pyx_pf_9csamtools_7Samfile_fetch’:
pysam/csamtools.c:5363: warning: passing argument 7 of ‘bam_fetch’ from incompatible pointer type
samtools/bam.h:596: note: expected ‘bam_fetch_f’ but argument is of type ‘int (*)(struct bam1_t *, void *)’
pysam/csamtools.c: In function ‘__pyx_pf_9csamtools_7Samfile_pileup’:
pysam/csamtools.c:6057: warning: passing argument 1 of ‘bam_plbuf_init’ from incompatible pointer type
samtools/bam.h:525: note: expected ‘bam_pileup_f’ but argument is of type ‘int (*)(uint32_t, uint32_t, int, struct bam_pileup1_t *, void *)’
pysam/csamtools.c:6066: warning: passing argument 7 of ‘bam_fetch’ from incompatible pointer type
samtools/bam.h:596: note: expected ‘bam_fetch_f’ but argument is of type ‘int (*)(struct bam1_t *, void *)’
pysam/csamtools.c: In function ‘__pyx_f_9csamtools_14IteratorColumn_cnext’:
pysam/csamtools.c:10974: warning: assignment discards qualifiers from pointer target type
pysam/csamtools.c: In function ‘__pyx_pf_9csamtools_11AlignedRead_5cigar___set__’:
pysam/csamtools.c:12631: warning: passing argument 4 of ‘pysam_bam_update’ from incompatible pointer type
pysam/pysam_util.h:33: note: expected ‘uint8_t *’ but argument is of type ‘uint32_t *’
pysam/csamtools.c: In function ‘__Pyx_InitGlobals’:
pysam/csamtools.c:21875: warning: this decimal constant is unsigned only in ISO C90
error: command 'gcc' failed with exit status 1
dror is offline   Reply With Quote
Old 11-29-2010, 12:48 AM   #16
dror
Member
 
Location: T"A

Join Date: May 2010
Posts: 18
Default running - python setup.py build, i have this error. why!??!

running build
running build_py
running build_ext
building 'csamtools' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DFILE_OFFSET_BITS=64 -D_USE_KNETFILE= -Isamtools -Ipysam -I/usr/include/python2.6 -c pysam/csamtools.c -o build/temp.linux-i686-2.6/pysam/csamtools.o
In file included from pysam/csamtools.c:140:
samtools/razf.h:38:18: error: zlib.h: No such file or directory
In file included from pysam/csamtools.c:140:
samtools/razf.h:91: error: expected specifier-qualifier-list before ‘z_stream’
In file included from pysam/csamtools.c:142:
samtools/bam.h:354: warning: function declaration isn’t a prototype
samtools/bam.h:369: warning: function declaration isn’t a prototype
pysam/csamtools.c: In function ‘__pyx_pf_9csamtools_7Samfile_fetch’:
pysam/csamtools.c:5363: warning: passing argument 7 of ‘bam_fetch’ from incompatible pointer type
samtools/bam.h:596: note: expected ‘bam_fetch_f’ but argument is of type ‘int (*)(struct bam1_t *, void *)’
pysam/csamtools.c: In function ‘__pyx_pf_9csamtools_7Samfile_pileup’:
pysam/csamtools.c:6057: warning: passing argument 1 of ‘bam_plbuf_init’ from incompatible pointer type
samtools/bam.h:525: note: expected ‘bam_pileup_f’ but argument is of type ‘int (*)(uint32_t, uint32_t, int, struct bam_pileup1_t *, void *)’
pysam/csamtools.c:6066: warning: passing argument 7 of ‘bam_fetch’ from incompatible pointer type
samtools/bam.h:596: note: expected ‘bam_fetch_f’ but argument is of type ‘int (*)(struct bam1_t *, void *)’
pysam/csamtools.c: In function ‘__pyx_f_9csamtools_14IteratorColumn_cnext’:
pysam/csamtools.c:10974: warning: assignment discards qualifiers from pointer target type
pysam/csamtools.c: In function ‘__pyx_pf_9csamtools_11AlignedRead_5cigar___set__’:
pysam/csamtools.c:12631: warning: passing argument 4 of ‘pysam_bam_update’ from incompatible pointer type
pysam/pysam_util.h:33: note: expected ‘uint8_t *’ but argument is of type ‘uint32_t *’
pysam/csamtools.c: In function ‘__Pyx_InitGlobals’:
pysam/csamtools.c:21875: warning: this decimal constant is unsigned only in ISO C90
error: command 'gcc' failed with exit status 1
dror is offline   Reply With Quote
Old 11-29-2010, 01:04 AM   #17
maubp
Peter (Biopython etc)
 
Location: Dundee, Scotland, UK

Join Date: Jul 2009
Posts: 1,541
Default

Quote:
Originally Posted by dror View Post
running build
running build_py
running build_ext
building 'csamtools' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DFILE_OFFSET_BITS=64 -D_USE_KNETFILE= -Isamtools -Ipysam -I/usr/include/python2.6 -c pysam/csamtools.c -o build/temp.linux-i686-2.6/pysam/csamtools.o
In file included from pysam/csamtools.c:140:
samtools/razf.h:38:18: error: zlib.h: No such file or directory
...
The first error is usually the most important. It appears you have not installed zlib (or at least, not installed the development header files for zlib).
maubp is offline   Reply With Quote
Old 11-29-2010, 01:14 AM   #18
dror
Member
 
Location: T"A

Join Date: May 2010
Posts: 18
Default

i installed zlib from the synaptic in ubuntu.
do you know which specific should i install?

after i installed another zlib it run, but with many warning..
an now the installation isn't work...

python setup.py install

running install
running build
running build_py
running build_ext
running install_lib
copying build/lib.linux-i686-2.6/ctabix.so -> /usr/local/lib/python2.6/dist-packages
error: /usr/local/lib/python2.6/dist-packages/ctabix.so: Permission denied
dror is offline   Reply With Quote
Old 11-29-2010, 01:25 AM   #19
maubp
Peter (Biopython etc)
 
Location: Dundee, Scotland, UK

Join Date: Jul 2009
Posts: 1,541
Default

Quote:
Originally Posted by dror View Post
i installed zlib from the synaptic in ubuntu.
do you know which specific should i install?

after i installed another zlib it run, but with many warning..
Did you also install the zlib *-dev package?

(On my machine I think this means installing zlib1g and zlib1g-dev)

Quote:
Originally Posted by dror View Post
an now the installation isn't work...

python setup.py install

running install
running build
running build_py
running build_ext
running install_lib
copying build/lib.linux-i686-2.6/ctabix.so -> /usr/local/lib/python2.6/dist-packages
error: /usr/local/lib/python2.6/dist-packages/ctabix.so: Permission denied
By default it tries to install it at system level, so use sudo:

sudo python setup.py install

Alternatively you could install it under your home folder.
maubp is offline   Reply With Quote
Old 11-29-2010, 03:35 AM   #20
dror
Member
 
Location: T"A

Join Date: May 2010
Posts: 18
Default

thank you very much!!
now its working!!
dror is offline   Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off




All times are GMT -8. The time now is 06:23 PM.


Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Single Sign On provided by vBSSO