Unconfigured Ad

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • TGBelgard
    Junior Member
    • Oct 2009
    • 4

    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
  • ffinkernagel
    Senior Member
    • Oct 2009
    • 110

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

    Comment

    • quinlana
      Senior Member
      • Sep 2008
      • 119

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

      Comment

      • TGBelgard
        Junior Member
        • Oct 2009
        • 4

        #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

        • choy
          Member
          • Jul 2009
          • 14

          #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

          • nilshomer
            Nils Homer
            • Nov 2008
            • 1283

            #6
            Any chance of supporting python 3.1 or greater?

            Comment

            • TGBelgard
              Junior Member
              • Oct 2009
              • 4

              #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

              • Mr Mutundes
                Member
                • Jan 2009
                • 17

                #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

                • Mr Mutundes
                  Member
                  • Jan 2009
                  • 17

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

                  Comment

                  • cswarth
                    Member
                    • Mar 2010
                    • 14

                    #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

                    • cswarth
                      Member
                      • Mar 2010
                      • 14

                      #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

                      • bioinfosm
                        Senior Member
                        • Jan 2008
                        • 483

                        #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

                        • maubp
                          Peter (Biopython etc)
                          • Jul 2009
                          • 1544

                          #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

                          • bioinfosm
                            Senior Member
                            • Jan 2008
                            • 483

                            #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

                            • dror
                              Member
                              • May 2010
                              • 18

                              #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

                              • SEQadmin2
                                Nine Things a Sample Prep Scientist Thinks About Before Sequencing
                                by SEQadmin2


                                I’m not a sequencing expert. I’m a purification scientist who uses NGS to evaluate workflows my group develops. With this perspective, we think about the sample first and the NGS workflow second. The sequencer is an exceptionally honest reporter, but it can only report on what you give it, so whether you get clean, interpretable data from an NGS workflow is largely determined before you begin.


                                Here are nine questions we think about, in roughly the order they matter, before...
                                06-18-2026, 07:11 AM
                              • SEQadmin2
                                From Collection to Sequencing: Why Sample Preparation and Preservation Define Sequencing Data
                                by SEQadmin2


                                Data variability is still an issue in sequencing technologies despite the advances in reproducibility and accuracy of these platforms. But the problem does not originate in the sequencing itself, but in the previous steps, before the sample reaches the sequencer.


                                The first step is collection, followed by preservation and sample preparation for analysis. Most scientists overlook those steps, but not being careful might just be skewing the experiment’s results.
                                ...
                                06-02-2026, 10:05 AM
                              • SEQadmin2
                                Single-Cell Sequencing at an Inflection Point: Early Impacts of New Platforms and Emerging Trends
                                by SEQadmin2


                                With the launch of new single-cell sequencing platforms in 2026, the field stands at an exciting inflection point. This article surveys the most impactful advances in the field and discusses how they’re reshaping research in cancer, immunology, and beyond.


                                Introduction

                                Single-cell sequencing technologies have undergone remarkable advances over the past decade, transitioning from low-throughput experimental approaches to highly scalable platforms capable of...
                                05-22-2026, 06:42 AM

                              ad_right_rmr

                              Collapse

                              News

                              Collapse

                              Topics Statistics Last Post
                              Started by SEQadmin2, 06-17-2026, 06:09 AM
                              0 responses
                              21 views
                              0 reactions
                              Last Post SEQadmin2  
                              Started by SEQadmin2, 06-09-2026, 11:58 AM
                              0 responses
                              38 views
                              0 reactions
                              Last Post SEQadmin2  
                              Started by SEQadmin2, 06-05-2026, 10:09 AM
                              0 responses
                              45 views
                              0 reactions
                              Last Post SEQadmin2  
                              Started by SEQadmin2, 06-04-2026, 08:59 AM
                              0 responses
                              49 views
                              0 reactions
                              Last Post SEQadmin2  
                              Working...