Seqanswers Leaderboard Ad

Collapse

Announcement

Collapse
No announcement yet.
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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:



    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

  • #2
    I've used pysam for a couple of days now and greatly appreciate your effort!

    Comment


    • #3
      This is very welcome news, thanks for taking the time to create it. Does it use SWIG?

      Comment


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

        Originally posted by quinlana View Post
        This is very welcome news, thanks for taking the time to create it. Does it use SWIG?

        Comment


        • #5
          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 --



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

          Thanks a lot for your sharing this great tool!

          Comment


          • #6
            Any chance of supporting python 3.1 or greater?

            Comment


            • #7
              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).

              Comment


              • #8
                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

                Comment


                • #9
                  for the record - this was caused by not cleaning up an earlier unsuccessful installation attempt with an older version of pyrex

                  Comment


                  • #10
                    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

                    Comment


                    • #11
                      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.

                      Comment


                      • #12
                        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

                        Comment


                        • #13
                          You need to install the Cython library for Python.

                          See http://www.cython.org/
                          Last edited by maubp; 11-18-2010, 01:54 PM. Reason: added URL

                          Comment


                          • #14
                            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

                            Comment


                            • #15
                              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

                              Comment

                              Latest Articles

                              Collapse

                              • seqadmin
                                Recent Advances in Sequencing Technologies
                                by seqadmin







                                Innovations in next-generation sequencing technologies and techniques are driving more precise and comprehensive exploration of complex biological systems. Current advancements include improved accessibility for long-read sequencing and significant progress in single-cell and 3D genomics. This article explores some of the most impactful developments in the field over the past year.

                                Long-Read Sequencing
                                Long-read sequencing has...
                                12-02-2024, 01:49 PM
                              • seqadmin
                                Genetic Variation in Immunogenetics and Antibody Diversity
                                by seqadmin



                                The field of immunogenetics explores how genetic variations influence immune responses and susceptibility to disease. In a recent SEQanswers webinar, Oscar Rodriguez, Ph.D., Postdoctoral Researcher at the University of Louisville, and Ruben Martínez Barricarte, Ph.D., Assistant Professor of Medicine at Vanderbilt University, shared recent advancements in immunogenetics. This article discusses their research on genetic variation in antibody loci, antibody production processes,...
                                11-06-2024, 07:24 PM

                              ad_right_rmr

                              Collapse

                              News

                              Collapse

                              Topics Statistics Last Post
                              Started by seqadmin, 12-02-2024, 09:29 AM
                              0 responses
                              145 views
                              0 likes
                              Last Post seqadmin  
                              Started by seqadmin, 12-02-2024, 09:06 AM
                              0 responses
                              51 views
                              0 likes
                              Last Post seqadmin  
                              Started by seqadmin, 12-02-2024, 08:03 AM
                              0 responses
                              42 views
                              0 likes
                              Last Post seqadmin  
                              Started by seqadmin, 11-22-2024, 07:36 AM
                              0 responses
                              72 views
                              0 likes
                              Last Post seqadmin  
                              Working...
                              X