[Patchwork-commits] r39 - in pkg/patchwork/inst/python: . pysam pysam.egg-info samtools samtools/bcftools samtools/misc samtools/win32 tabix tests
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue Dec 6 15:37:40 CET 2011
Author: sebastian_d
Date: 2011-12-06 15:37:39 +0100 (Tue, 06 Dec 2011)
New Revision: 39
Added:
pkg/patchwork/inst/python/COPYING
pkg/patchwork/inst/python/INSTALL
pkg/patchwork/inst/python/KNOWN_BUGS
pkg/patchwork/inst/python/MANIFEST.in
pkg/patchwork/inst/python/PKG-INFO
pkg/patchwork/inst/python/THANKS
pkg/patchwork/inst/python/ez_setup.py
pkg/patchwork/inst/python/pysam.egg-info/
pkg/patchwork/inst/python/pysam.egg-info/PKG-INFO
pkg/patchwork/inst/python/pysam.egg-info/SOURCES.txt
pkg/patchwork/inst/python/pysam.egg-info/dependency_links.txt
pkg/patchwork/inst/python/pysam.egg-info/not-zip-safe
pkg/patchwork/inst/python/pysam.egg-info/requires.txt
pkg/patchwork/inst/python/pysam.egg-info/top_level.txt
pkg/patchwork/inst/python/pysam/
pkg/patchwork/inst/python/pysam/Pileup.py
pkg/patchwork/inst/python/pysam/TabProxies.c
pkg/patchwork/inst/python/pysam/TabProxies.pxd
pkg/patchwork/inst/python/pysam/TabProxies.pyx
pkg/patchwork/inst/python/pysam/VCF.py
pkg/patchwork/inst/python/pysam/__init__.py
pkg/patchwork/inst/python/pysam/csamtools.c
pkg/patchwork/inst/python/pysam/csamtools.pxd
pkg/patchwork/inst/python/pysam/csamtools.pyx
pkg/patchwork/inst/python/pysam/ctabix.c
pkg/patchwork/inst/python/pysam/ctabix.pxd
pkg/patchwork/inst/python/pysam/ctabix.pyx
pkg/patchwork/inst/python/pysam/cvcf.c
pkg/patchwork/inst/python/pysam/cvcf.pxd
pkg/patchwork/inst/python/pysam/cvcf.pyx
pkg/patchwork/inst/python/pysam/namedtuple.py
pkg/patchwork/inst/python/pysam/pysam_util.c
pkg/patchwork/inst/python/pysam/pysam_util.h
pkg/patchwork/inst/python/pysam/tabix_util.c
pkg/patchwork/inst/python/pysam/version.py
pkg/patchwork/inst/python/samtools/
pkg/patchwork/inst/python/samtools/bam.c.pysam.c
pkg/patchwork/inst/python/samtools/bam.h
pkg/patchwork/inst/python/samtools/bam2bcf.c.pysam.c
pkg/patchwork/inst/python/samtools/bam2bcf.h
pkg/patchwork/inst/python/samtools/bam2bcf_indel.c.pysam.c
pkg/patchwork/inst/python/samtools/bam2depth.c.pysam.c
pkg/patchwork/inst/python/samtools/bam_aux.c.pysam.c
pkg/patchwork/inst/python/samtools/bam_cat.c.pysam.c
pkg/patchwork/inst/python/samtools/bam_color.c.pysam.c
pkg/patchwork/inst/python/samtools/bam_endian.h
pkg/patchwork/inst/python/samtools/bam_import.c.pysam.c
pkg/patchwork/inst/python/samtools/bam_index.c.pysam.c
pkg/patchwork/inst/python/samtools/bam_lpileup.c.pysam.c
pkg/patchwork/inst/python/samtools/bam_maqcns.c.pysam.c
pkg/patchwork/inst/python/samtools/bam_maqcns.h
pkg/patchwork/inst/python/samtools/bam_mate.c.pysam.c
pkg/patchwork/inst/python/samtools/bam_md.c.pysam.c
pkg/patchwork/inst/python/samtools/bam_pileup.c.pysam.c
pkg/patchwork/inst/python/samtools/bam_plcmd.c.pysam.c
pkg/patchwork/inst/python/samtools/bam_rmdup.c.pysam.c
pkg/patchwork/inst/python/samtools/bam_rmdupse.c.pysam.c
pkg/patchwork/inst/python/samtools/bam_sort.c.pysam.c
pkg/patchwork/inst/python/samtools/bam_stat.c.pysam.c
pkg/patchwork/inst/python/samtools/bam_tview.c.pysam.c
pkg/patchwork/inst/python/samtools/bcftools/
pkg/patchwork/inst/python/samtools/bcftools/bcf.c.pysam.c
pkg/patchwork/inst/python/samtools/bcftools/bcf.h
pkg/patchwork/inst/python/samtools/bcftools/bcf2qcall.c.pysam.c
pkg/patchwork/inst/python/samtools/bcftools/bcfutils.c.pysam.c
pkg/patchwork/inst/python/samtools/bcftools/call1.c.pysam.c
pkg/patchwork/inst/python/samtools/bcftools/em.c.pysam.c
pkg/patchwork/inst/python/samtools/bcftools/fet.c.pysam.c
pkg/patchwork/inst/python/samtools/bcftools/index.c.pysam.c
pkg/patchwork/inst/python/samtools/bcftools/kfunc.c.pysam.c
pkg/patchwork/inst/python/samtools/bcftools/kmin.c.pysam.c
pkg/patchwork/inst/python/samtools/bcftools/kmin.h
pkg/patchwork/inst/python/samtools/bcftools/prob1.c.pysam.c
pkg/patchwork/inst/python/samtools/bcftools/prob1.h
pkg/patchwork/inst/python/samtools/bcftools/vcf.c.pysam.c
pkg/patchwork/inst/python/samtools/bedidx.c.pysam.c
pkg/patchwork/inst/python/samtools/bgzf.c.pysam.c
pkg/patchwork/inst/python/samtools/bgzf.h
pkg/patchwork/inst/python/samtools/cut_target.c.pysam.c
pkg/patchwork/inst/python/samtools/errmod.c.pysam.c
pkg/patchwork/inst/python/samtools/errmod.h
pkg/patchwork/inst/python/samtools/faidx.c.pysam.c
pkg/patchwork/inst/python/samtools/faidx.h
pkg/patchwork/inst/python/samtools/glf.c.pysam.c
pkg/patchwork/inst/python/samtools/glf.h
pkg/patchwork/inst/python/samtools/kaln.c.pysam.c
pkg/patchwork/inst/python/samtools/kaln.h
pkg/patchwork/inst/python/samtools/khash.h
pkg/patchwork/inst/python/samtools/klist.h
pkg/patchwork/inst/python/samtools/knetfile.c.pysam.c
pkg/patchwork/inst/python/samtools/knetfile.h
pkg/patchwork/inst/python/samtools/kprobaln.c.pysam.c
pkg/patchwork/inst/python/samtools/kprobaln.h
pkg/patchwork/inst/python/samtools/kseq.h
pkg/patchwork/inst/python/samtools/ksort.h
pkg/patchwork/inst/python/samtools/kstring.c.pysam.c
pkg/patchwork/inst/python/samtools/kstring.h
pkg/patchwork/inst/python/samtools/misc/
pkg/patchwork/inst/python/samtools/misc/md5.c.pysam.c
pkg/patchwork/inst/python/samtools/misc/md5.h
pkg/patchwork/inst/python/samtools/msvc_compat.h
pkg/patchwork/inst/python/samtools/phase.c.pysam.c
pkg/patchwork/inst/python/samtools/pysam.h
pkg/patchwork/inst/python/samtools/razf.c.pysam.c
pkg/patchwork/inst/python/samtools/razf.h
pkg/patchwork/inst/python/samtools/sam.c.pysam.c
pkg/patchwork/inst/python/samtools/sam.h
pkg/patchwork/inst/python/samtools/sam_header.c.pysam.c
pkg/patchwork/inst/python/samtools/sam_header.h
pkg/patchwork/inst/python/samtools/sam_view.c.pysam.c
pkg/patchwork/inst/python/samtools/sample.c.pysam.c
pkg/patchwork/inst/python/samtools/sample.h
pkg/patchwork/inst/python/samtools/win32/
pkg/patchwork/inst/python/samtools/win32/xcurses.h
pkg/patchwork/inst/python/samtools/win32/zconf.h
pkg/patchwork/inst/python/samtools/win32/zlib.h
pkg/patchwork/inst/python/setup.cfg
pkg/patchwork/inst/python/setup.py
pkg/patchwork/inst/python/tabix/
pkg/patchwork/inst/python/tabix/bam_endian.h
pkg/patchwork/inst/python/tabix/bedidx.c.pysam.c
pkg/patchwork/inst/python/tabix/bgzf.c.pysam.c
pkg/patchwork/inst/python/tabix/bgzf.h
pkg/patchwork/inst/python/tabix/bgzip.c.pysam.c
pkg/patchwork/inst/python/tabix/index.c.pysam.c
pkg/patchwork/inst/python/tabix/khash.h
pkg/patchwork/inst/python/tabix/knetfile.c.pysam.c
pkg/patchwork/inst/python/tabix/knetfile.h
pkg/patchwork/inst/python/tabix/kseq.h
pkg/patchwork/inst/python/tabix/ksort.h
pkg/patchwork/inst/python/tabix/kstring.c.pysam.c
pkg/patchwork/inst/python/tabix/kstring.h
pkg/patchwork/inst/python/tabix/msvc_compat.h
pkg/patchwork/inst/python/tabix/pysam.h
pkg/patchwork/inst/python/tabix/tabix.h
pkg/patchwork/inst/python/tests/
pkg/patchwork/inst/python/tests/00README.txt
pkg/patchwork/inst/python/tests/Makefile
pkg/patchwork/inst/python/tests/ex1.fa
pkg/patchwork/inst/python/tests/ex1.sam.gz
pkg/patchwork/inst/python/tests/ex10.sam
pkg/patchwork/inst/python/tests/ex3.sam
pkg/patchwork/inst/python/tests/ex4.sam
pkg/patchwork/inst/python/tests/ex5.sam
pkg/patchwork/inst/python/tests/ex6.sam
pkg/patchwork/inst/python/tests/ex7.sam
pkg/patchwork/inst/python/tests/ex8.sam
pkg/patchwork/inst/python/tests/ex9_fail.bam
pkg/patchwork/inst/python/tests/ex9_nofail.bam
pkg/patchwork/inst/python/tests/example.gtf.gz
pkg/patchwork/inst/python/tests/example.gtf.gz.tbi
pkg/patchwork/inst/python/tests/example.py
pkg/patchwork/inst/python/tests/pysam_test.py
pkg/patchwork/inst/python/tests/segfault_tests.py
pkg/patchwork/inst/python/tests/tabix_test.py
Log:
adding whole pysam
Added: pkg/patchwork/inst/python/COPYING
===================================================================
--- pkg/patchwork/inst/python/COPYING (rev 0)
+++ pkg/patchwork/inst/python/COPYING 2011-12-06 14:37:39 UTC (rev 39)
@@ -0,0 +1,21 @@
+The MIT License
+
+Copyright (c) 2008-2009 Genome Research Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
\ No newline at end of file
Added: pkg/patchwork/inst/python/INSTALL
===================================================================
--- pkg/patchwork/inst/python/INSTALL (rev 0)
+++ pkg/patchwork/inst/python/INSTALL 2011-12-06 14:37:39 UTC (rev 39)
@@ -0,0 +1,50 @@
+System Requirements
+===================
+
+SAMtools depends on the zlib library <http://www.zlib.net>. The latest
+version 1.2.3 is preferred and with the latest version you can compile
+razip and use it to compress a FASTA file. SAMtools' faidx is able to
+index a razip-compressed FASTA file to save diskspace. Older zlib also
+works with SAMtools, but razip cannot be compiled.
+
+The text-based viewer (tview) requires the GNU ncurses library
+<http://www.gnu.org/software/ncurses/>, which comes with Mac OS X and
+most of the modern Linux/Unix distributions. If you do not have this
+library installed, you can still compile the rest of SAMtools by
+manually modifying one line in Makefile.
+
+Pysam requires pyrex (0.9.8 or greater) and python (2.6 or greater).
+It has not been tested on many other platforms.
+
+Compilation
+===========
+
+Unpack the distribution and enter the pysam directory. Type
+
+python setup.py build
+
+to compile.
+
+Installation
+============
+
+Type
+
+ python setup.py install
+
+to install it within the site-packages directory of your python
+distribution. Type
+
+ python setup.py install --help
+
+for more options.
+
+Architecture specific options
+=============================
+
+Pysam has been compiled on various linux systems and works
+with python 2.6 and python 2.5.
+
+Python 2.7 and Python 3 have not been tested.
+
+Windows support does not work yet
Added: pkg/patchwork/inst/python/MANIFEST.in
===================================================================
--- pkg/patchwork/inst/python/MANIFEST.in (rev 0)
+++ pkg/patchwork/inst/python/MANIFEST.in 2011-12-06 14:37:39 UTC (rev 39)
@@ -0,0 +1,52 @@
+#
+# Use .add_data_files and .add_data_dir methods in a appropriate
+# setup.py files to include non-python files such as documentation,
+# data, etc files to distribution. Avoid using MANIFEST.in for that.
+#
+include MANIFEST.in
+include COPYING
+include INSTALL
+include KNOWN_BUGS
+include THANKS
+include ez_setup.py
+include pysam/csamtools.pxd
+include pysam/csamtools.pyx
+include pysam/csamtools.c
+include pysam/ctabix.pxd
+include pysam/ctabix.c
+include pysam/ctabix.pyx
+include pysam/TabProxies.c
+include pysam/TabProxies.pyx
+include pysam/TabProxies.pxd
+include pysam/cvcf.pyx
+include pysam/cvcf.pxd
+include pysam/cvcf.c
+include pysam/pysam_util.h
+include samtools/*.h
+include samtools/*/*.h
+include tabix/*.h
+
+# pysam tests
+include tests/00README.txt
+include tests/Makefile
+include tests/ex1.fa
+include tests/ex1.sam.gz
+include tests/ex3.sam
+include tests/ex4.sam
+include tests/ex5.sam
+include tests/ex6.sam
+include tests/ex7.sam
+include tests/ex8.sam
+include tests/ex9_fail.bam
+include tests/ex9_nofail.bam
+include tests/ex10.sam
+include tests/example.py
+include tests/pysam_test.py
+include tests/segfault_tests.py
+
+# tabix tests
+include tests/tabix_test.py
+include tests/example.gtf.gz
+include tests/example.gtf.gz.tbi
+
+
Added: pkg/patchwork/inst/python/PKG-INFO
===================================================================
--- pkg/patchwork/inst/python/PKG-INFO (rev 0)
+++ pkg/patchwork/inst/python/PKG-INFO 2011-12-06 14:37:39 UTC (rev 39)
@@ -0,0 +1,16 @@
+Metadata-Version: 1.1
+Name: pysam
+Version: 0.5
+Summary: pysam
+Home-page: http://code.google.com/p/pysam/
+Author: Andreas Heger
+Author-email: andreas.heger at gmail.com
+License: MIT
+Description:
+
+ pysam
+ *****
+
+
+Platform: ALL
+Requires: cython (>=0.12)
Added: pkg/patchwork/inst/python/THANKS
===================================================================
--- pkg/patchwork/inst/python/THANKS (rev 0)
+++ pkg/patchwork/inst/python/THANKS 2011-12-06 14:37:39 UTC (rev 39)
@@ -0,0 +1,3 @@
+We would like to thank Heng Li and the other samtools contributors for their support
+and their hard work. As a wrapper, pysam merely tries to make their code accessible
+to the python community - the heavy lifting has been done by the samtools developers.
Added: pkg/patchwork/inst/python/ez_setup.py
===================================================================
--- pkg/patchwork/inst/python/ez_setup.py (rev 0)
+++ pkg/patchwork/inst/python/ez_setup.py 2011-12-06 14:37:39 UTC (rev 39)
@@ -0,0 +1,284 @@
+#!python
+"""Bootstrap setuptools installation
+
+If you want to use setuptools in your package's setup.py, just include this
+file in the same directory with it, and add this to the top of your setup.py::
+
+ from ez_setup import use_setuptools
+ use_setuptools()
+
+If you want to require a specific version of setuptools, set a download
+mirror, or use an alternate download directory, you can do so by supplying
+the appropriate options to ``use_setuptools()``.
+
+This file can also be run as a script to install or upgrade setuptools.
+"""
+import sys
+DEFAULT_VERSION = "0.6c11"
+DEFAULT_URL = "http://pypi.python.org/packages/%s/s/setuptools/" % sys.version[:3]
+
+md5_data = {
+ 'setuptools-0.6b1-py2.3.egg': '8822caf901250d848b996b7f25c6e6ca',
+ 'setuptools-0.6b1-py2.4.egg': 'b79a8a403e4502fbb85ee3f1941735cb',
+ 'setuptools-0.6b2-py2.3.egg': '5657759d8a6d8fc44070a9d07272d99b',
+ 'setuptools-0.6b2-py2.4.egg': '4996a8d169d2be661fa32a6e52e4f82a',
+ 'setuptools-0.6b3-py2.3.egg': 'bb31c0fc7399a63579975cad9f5a0618',
+ 'setuptools-0.6b3-py2.4.egg': '38a8c6b3d6ecd22247f179f7da669fac',
+ 'setuptools-0.6b4-py2.3.egg': '62045a24ed4e1ebc77fe039aa4e6f7e5',
+ 'setuptools-0.6b4-py2.4.egg': '4cb2a185d228dacffb2d17f103b3b1c4',
+ 'setuptools-0.6c1-py2.3.egg': 'b3f2b5539d65cb7f74ad79127f1a908c',
+ 'setuptools-0.6c1-py2.4.egg': 'b45adeda0667d2d2ffe14009364f2a4b',
+ 'setuptools-0.6c10-py2.3.egg': 'ce1e2ab5d3a0256456d9fc13800a7090',
+ 'setuptools-0.6c10-py2.4.egg': '57d6d9d6e9b80772c59a53a8433a5dd4',
+ 'setuptools-0.6c10-py2.5.egg': 'de46ac8b1c97c895572e5e8596aeb8c7',
+ 'setuptools-0.6c10-py2.6.egg': '58ea40aef06da02ce641495523a0b7f5',
+ 'setuptools-0.6c11-py2.3.egg': '2baeac6e13d414a9d28e7ba5b5a596de',
+ 'setuptools-0.6c11-py2.4.egg': 'bd639f9b0eac4c42497034dec2ec0c2b',
+ 'setuptools-0.6c11-py2.5.egg': '64c94f3bf7a72a13ec83e0b24f2749b2',
+ 'setuptools-0.6c11-py2.6.egg': 'bfa92100bd772d5a213eedd356d64086',
+ 'setuptools-0.6c2-py2.3.egg': 'f0064bf6aa2b7d0f3ba0b43f20817c27',
+ 'setuptools-0.6c2-py2.4.egg': '616192eec35f47e8ea16cd6a122b7277',
+ 'setuptools-0.6c3-py2.3.egg': 'f181fa125dfe85a259c9cd6f1d7b78fa',
+ 'setuptools-0.6c3-py2.4.egg': 'e0ed74682c998bfb73bf803a50e7b71e',
+ 'setuptools-0.6c3-py2.5.egg': 'abef16fdd61955514841c7c6bd98965e',
+ 'setuptools-0.6c4-py2.3.egg': 'b0b9131acab32022bfac7f44c5d7971f',
+ 'setuptools-0.6c4-py2.4.egg': '2a1f9656d4fbf3c97bf946c0a124e6e2',
+ 'setuptools-0.6c4-py2.5.egg': '8f5a052e32cdb9c72bcf4b5526f28afc',
+ 'setuptools-0.6c5-py2.3.egg': 'ee9fd80965da04f2f3e6b3576e9d8167',
+ 'setuptools-0.6c5-py2.4.egg': 'afe2adf1c01701ee841761f5bcd8aa64',
+ 'setuptools-0.6c5-py2.5.egg': 'a8d3f61494ccaa8714dfed37bccd3d5d',
+ 'setuptools-0.6c6-py2.3.egg': '35686b78116a668847237b69d549ec20',
+ 'setuptools-0.6c6-py2.4.egg': '3c56af57be3225019260a644430065ab',
+ 'setuptools-0.6c6-py2.5.egg': 'b2f8a7520709a5b34f80946de5f02f53',
+ 'setuptools-0.6c7-py2.3.egg': '209fdf9adc3a615e5115b725658e13e2',
+ 'setuptools-0.6c7-py2.4.egg': '5a8f954807d46a0fb67cf1f26c55a82e',
+ 'setuptools-0.6c7-py2.5.egg': '45d2ad28f9750e7434111fde831e8372',
+ 'setuptools-0.6c8-py2.3.egg': '50759d29b349db8cfd807ba8303f1902',
+ 'setuptools-0.6c8-py2.4.egg': 'cba38d74f7d483c06e9daa6070cce6de',
+ 'setuptools-0.6c8-py2.5.egg': '1721747ee329dc150590a58b3e1ac95b',
+ 'setuptools-0.6c9-py2.3.egg': 'a83c4020414807b496e4cfbe08507c03',
+ 'setuptools-0.6c9-py2.4.egg': '260a2be2e5388d66bdaee06abec6342a',
+ 'setuptools-0.6c9-py2.5.egg': 'fe67c3e5a17b12c0e7c541b7ea43a8e6',
+ 'setuptools-0.6c9-py2.6.egg': 'ca37b1ff16fa2ede6e19383e7b59245a',
+}
+
+import sys, os
+try: from hashlib import md5
+except ImportError: from md5 import md5
+
+def _validate_md5(egg_name, data):
+ if egg_name in md5_data:
+ digest = md5(data).hexdigest()
+ if digest != md5_data[egg_name]:
+ print >>sys.stderr, (
+ "md5 validation of %s failed! (Possible download problem?)"
+ % egg_name
+ )
+ sys.exit(2)
+ return data
+
+def use_setuptools(
+ version=DEFAULT_VERSION, download_base=DEFAULT_URL, to_dir=os.curdir,
+ download_delay=15
+):
+ """Automatically find/download setuptools and make it available on sys.path
+
+ `version` should be a valid setuptools version number that is available
+ as an egg for download under the `download_base` URL (which should end with
+ a '/'). `to_dir` is the directory where setuptools will be downloaded, if
+ it is not already available. If `download_delay` is specified, it should
+ be the number of seconds that will be paused before initiating a download,
+ should one be required. If an older version of setuptools is installed,
+ this routine will print a message to ``sys.stderr`` and raise SystemExit in
+ an attempt to abort the calling script.
+ """
+ was_imported = 'pkg_resources' in sys.modules or 'setuptools' in sys.modules
+ def do_download():
+ egg = download_setuptools(version, download_base, to_dir, download_delay)
+ sys.path.insert(0, egg)
+ import setuptools; setuptools.bootstrap_install_from = egg
+ try:
+ import pkg_resources
+ except ImportError:
+ return do_download()
+ try:
+ pkg_resources.require("setuptools>="+version); return
+ except pkg_resources.VersionConflict, e:
+ if was_imported:
+ print >>sys.stderr, (
+ "The required version of setuptools (>=%s) is not available, and\n"
+ "can't be installed while this script is running. Please install\n"
+ " a more recent version first, using 'easy_install -U setuptools'."
+ "\n\n(Currently using %r)"
+ ) % (version, e.args[0])
+ sys.exit(2)
+ else:
+ del pkg_resources, sys.modules['pkg_resources'] # reload ok
+ return do_download()
+ except pkg_resources.DistributionNotFound:
+ return do_download()
+
+def download_setuptools(
+ version=DEFAULT_VERSION, download_base=DEFAULT_URL, to_dir=os.curdir,
+ delay = 15
+):
+ """Download setuptools from a specified location and return its filename
+
+ `version` should be a valid setuptools version number that is available
+ as an egg for download under the `download_base` URL (which should end
+ with a '/'). `to_dir` is the directory where the egg will be downloaded.
+ `delay` is the number of seconds to pause before an actual download attempt.
+ """
+ import urllib2, shutil
+ egg_name = "setuptools-%s-py%s.egg" % (version,sys.version[:3])
+ url = download_base + egg_name
+ saveto = os.path.join(to_dir, egg_name)
+ src = dst = None
+ if not os.path.exists(saveto): # Avoid repeated downloads
+ try:
+ from distutils import log
+ if delay:
+ log.warn("""
+---------------------------------------------------------------------------
+This script requires setuptools version %s to run (even to display
+help). I will attempt to download it for you (from
+%s), but
+you may need to enable firewall access for this script first.
+I will start the download in %d seconds.
+
+(Note: if this machine does not have network access, please obtain the file
+
+ %s
+
+and place it in this directory before rerunning this script.)
+---------------------------------------------------------------------------""",
+ version, download_base, delay, url
+ ); from time import sleep; sleep(delay)
+ log.warn("Downloading %s", url)
+ src = urllib2.urlopen(url)
+ # Read/write all in one block, so we don't create a corrupt file
+ # if the download is interrupted.
+ data = _validate_md5(egg_name, src.read())
+ dst = open(saveto,"wb"); dst.write(data)
+ finally:
+ if src: src.close()
+ if dst: dst.close()
+ return os.path.realpath(saveto)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+def main(argv, version=DEFAULT_VERSION):
+ """Install or upgrade setuptools and EasyInstall"""
+ try:
+ import setuptools
+ except ImportError:
+ egg = None
+ try:
+ egg = download_setuptools(version, delay=0)
+ sys.path.insert(0,egg)
+ from setuptools.command.easy_install import main
+ return main(list(argv)+[egg]) # we're done here
+ finally:
+ if egg and os.path.exists(egg):
+ os.unlink(egg)
+ else:
+ if setuptools.__version__ == '0.0.1':
+ print >>sys.stderr, (
+ "You have an obsolete version of setuptools installed. Please\n"
+ "remove it from your system entirely before rerunning this script."
+ )
+ sys.exit(2)
+
+ req = "setuptools>="+version
+ import pkg_resources
+ try:
+ pkg_resources.require(req)
+ except pkg_resources.VersionConflict:
+ try:
+ from setuptools.command.easy_install import main
+ except ImportError:
+ from easy_install import main
+ main(list(argv)+[download_setuptools(delay=0)])
+ sys.exit(0) # try to force an exit
+ else:
+ if argv:
+ from setuptools.command.easy_install import main
+ main(argv)
+ else:
+ print "Setuptools version",version,"or greater has been installed."
+ print '(Run "ez_setup.py -U setuptools" to reinstall or upgrade.)'
+
+def update_md5(filenames):
+ """Update our built-in md5 registry"""
+
+ import re
+
+ for name in filenames:
+ base = os.path.basename(name)
+ f = open(name,'rb')
+ md5_data[base] = md5(f.read()).hexdigest()
+ f.close()
+
+ data = [" %r: %r,\n" % it for it in md5_data.items()]
+ data.sort()
+ repl = "".join(data)
+
+ import inspect
+ srcfile = inspect.getsourcefile(sys.modules[__name__])
+ f = open(srcfile, 'rb'); src = f.read(); f.close()
+
+ match = re.search("\nmd5_data = {\n([^}]+)}", src)
+ if not match:
+ print >>sys.stderr, "Internal error!"
+ sys.exit(2)
+
+ src = src[:match.start(1)] + repl + src[match.end(1):]
+ f = open(srcfile,'w')
+ f.write(src)
+ f.close()
+
+
+if __name__=='__main__':
+ if len(sys.argv)>2 and sys.argv[1]=='--md5update':
+ update_md5(sys.argv[2:])
+ else:
+ main(sys.argv[1:])
+
+
+
+
+
+
Added: pkg/patchwork/inst/python/pysam/Pileup.py
===================================================================
--- pkg/patchwork/inst/python/pysam/Pileup.py (rev 0)
+++ pkg/patchwork/inst/python/pysam/Pileup.py 2011-12-06 14:37:39 UTC (rev 39)
@@ -0,0 +1,271 @@
+'''Tools for working with files in the samtools pileup -c format.'''
+import collections
+import pysam
+
+PileupSubstitution = collections.namedtuple( "PileupSubstitution",
+ " ".join( (\
+ "chromosome",
+ "pos",
+ "reference_base",
+ "genotype",
+ "consensus_quality",
+ "snp_quality",
+ "mapping_quality",
+ "coverage",
+ "read_bases",
+ "base_qualities" ) ) )
+
+PileupIndel = collections.namedtuple( "PileupIndel",
+ " ".join( (\
+ "chromosome",
+ "pos",
+ "reference_base",
+ "genotype",
+ "consensus_quality",
+ "snp_quality",
+ "mapping_quality",
+ "coverage",
+ "first_allele",
+ "second_allele",
+ "reads_first",
+ "reads_second",
+ "reads_diff" ) ) )
+
+def iterate( infile ):
+ '''iterate over ``samtools pileup -c`` formatted file.
+
+ *infile* can be any iterator over a lines.
+
+ The function yields named tuples of the type :class:`pysam.Pileup.PileupSubstitution`
+ or :class:`pysam.Pileup.PileupIndel`.
+
+ .. note::
+ The parser converts to 0-based coordinates
+ '''
+
+ conv_subst = (str,lambda x: int(x)-1,str,str,int,int,int,int,str,str)
+ conv_indel = (str,lambda x: int(x)-1,str,str,int,int,int,int,str,str,int,int,int)
+
+ for line in infile:
+ d = line[:-1].split()
+ if d[2] == "*":
+ try:
+ yield PileupIndel( *[x(y) for x,y in zip(conv_indel,d) ] )
+ except TypeError:
+ raise pysam.SamtoolsError( "parsing error in line: `%s`" % line)
+ else:
+ try:
+ yield PileupSubstitution( *[x(y) for x,y in zip(conv_subst,d) ] )
+ except TypeError:
+ raise pysam.SamtoolsError( "parsing error in line: `%s`" % line)
+
+ENCODE_GENOTYPE = {
+ 'A': 'A', 'C': 'C', 'G': 'G', 'T': 'T',
+ 'AA': 'A', 'CC': 'C', 'GG': 'G', 'TT': 'T', 'UU': 'U',
+ 'AG': 'r', 'GA': 'R',
+ 'CT': 'y', 'TC': 'Y',
+ 'AC': 'm', 'CA': 'M',
+ 'GT': 'k', 'TG': 'K',
+ 'CG': 's', 'GC': 'S',
+ 'AT': 'w', 'TA': 'W',
+ }
+
+DECODE_GENOTYPE = {
+ 'A': 'AA',
+ 'C': 'CC',
+ 'G': 'GG',
+ 'T': 'TT',
+ 'r': 'AG', 'R': 'AG',
+ 'y': 'CT', 'Y': 'CT',
+ 'm': 'AC', 'M': 'AC',
+ 'k': 'GT', 'K': 'GT',
+ 's': 'CG', 'S': 'CG',
+ 'w': 'AT', 'W': 'AT',
+ }
+
+##------------------------------------------------------------
+def encodeGenotype( code ):
+ '''encode genotypes like GG, GA into a one-letter code.
+ The returned code is lower case if code[0] < code[1], otherwise
+ it is uppercase.
+ '''
+ return ENCODE_GENOTYPE[ code.upper() ]
+
+def decodeGenotype( code ):
+ '''decode single letter genotypes like m, M into two letters.
+ This is the reverse operation to :meth:`encodeGenotype`.
+ '''
+ return DECODE_GENOTYPE[ code ]
+
+def translateIndelGenotypeFromVCF( vcf_genotypes, ref ):
+ '''translate indel from vcf to pileup format.'''
+
+ # indels
+ def getPrefix( s1, s2 ):
+ '''get common prefix of strings s1 and s2.'''
+ n = min( len( s1), len( s2 ) )
+ for x in range( n ):
+ if s1[x] != s2[x]: return s1[:x]
+ return s1[:n]
+
+ def getSuffix( s1, s2 ):
+ '''get common sufix of strings s1 and s2.'''
+ n = min( len( s1), len( s2 ) )
+ if s1[-1] != s2[-1]: return ""
+ for x in range( -2, -n - 1, -1 ):
+ if s1[x] != s2[x]: return s1[x+1:]
+ return s1[-n:]
+
+ def getGenotype( variant, ref ):
+
+ if variant == ref: return "*", 0
+
+ if len(ref) > len(variant):
+ # is a deletion
+ if ref.startswith(variant):
+ return "-%s" % ref[len(variant):], len(variant) - 1
+ elif ref.endswith( variant ):
+ return "-%s" % ref[:-len(variant)], -1
+ else:
+ prefix = getPrefix( ref, variant )
+ suffix = getSuffix( ref, variant )
+ shared = len(prefix) + len(suffix) - len(variant)
+ # print "-", prefix, suffix, ref, variant, shared, len(prefix), len(suffix), len(ref)
+ if shared < 0:
+ raise ValueError()
+ return "-%s" % ref[len(prefix):-(len(suffix)-shared)], len(prefix) - 1
+
+ elif len(ref) < len(variant):
+ # is an insertion
+ if variant.startswith(ref):
+ return "+%s" % variant[len(ref):], len(ref) - 1
+ elif variant.endswith(ref):
+ return "+%s" % variant[:len(ref)], 0
+ else:
+ prefix = getPrefix( ref, variant )
+ suffix = getSuffix( ref, variant )
+ shared = len(prefix) + len(suffix) - len(ref)
+ if shared < 0:
+ raise ValueError()
+
+ return "+%s" % variant[len(prefix):-(len(suffix)-shared)], len(prefix)
+ else:
+ assert 0, "snp?"
+
+ # in pileup, the position refers to the base
+ # after the coordinate, hence subtract 1
+ #pos -= 1
+
+ genotypes, offsets = [], []
+ is_error = True
+
+ for variant in vcf_genotypes:
+ try:
+ g, offset = getGenotype( variant, ref )
+ except ValueError:
+ break
+
+ genotypes.append( g )
+ if g != "*": offsets.append( offset )
+
+ else:
+ is_error = False
+
+ if is_error:
+ raise ValueError()
+
+ assert len(set(offsets )) == 1, "multiple offsets for indel"
+ offset = offsets[0]
+
+ genotypes = "/".join( genotypes )
+ return genotypes, offset
+
+def vcf2pileup( vcf, sample ):
+ '''convert vcf record to pileup record.'''
+
+ chromosome = vcf.contig
+ pos = vcf.pos
+ reference = vcf.ref
+ allelles = [reference] + vcf.alt
+
+ data = vcf[sample]
+
+ # get genotype
+ genotypes = data["GT"]
+ if len(genotypes) > 1:
+ raise ValueError( "only single genotype per position, %s" % (str(vcf)))
+
+ genotypes = genotypes[0]
+
+ # not a variant
+ if genotypes[0] == ".": return None
+
+ genotypes = [ allelles[int(x)] for x in genotypes if x != "/" ]
+
+ # snp_quality is "genotype quality"
+ snp_quality = consensus_quality = data.get( "GQ", [0])[0]
+ mapping_quality = vcf.info.get( "MQ", [0])[0]
+ coverage = data.get( "DP", 0)
+
+ if len(reference) > 1 or max([len(x) for x in vcf.alt] ) > 1:
+ # indel
+ genotype, offset = translateIndelGenotypeFromVCF( genotypes, reference )
+
+ return PileupIndel( chromosome,
+ pos + offset,
+ "*",
+ genotype,
+ consensus_quality,
+ snp_quality,
+ mapping_quality,
+ coverage,
+ genotype,
+ "<" * len(genotype),
+ 0,
+ 0,
+ 0 )
+
+ else:
+
+ genotype = encodeGenotype( "".join(genotypes) )
+
+
+ read_bases = ""
+ base_qualities = ""
+
+ return PileupSubstitution( chromosome, pos, reference,
+ genotype,
+ consensus_quality,
+ snp_quality,
+ mapping_quality,
+ coverage, read_bases, base_qualities )
+
+
+def iterate_from_vcf( infile, sample ):
+ '''iterate over a vcf-formatted file.
+
+ *infile* can be any iterator over a lines.
+
+ The function yields named tuples of the type :class:`pysam.Pileup.PileupSubstitution`
+ or :class:`pysam.Pileup.PileupIndel`.
+
+ Positions without a snp will be skipped.
+
+ This method is wasteful and written to support same
+ legacy code that expects samtools pileup output.
+
+ Better use the vcf parser directly.
+
+ '''
+
+
+ vcf = pysam.VCF()
+ vcf.connect( infile )
+
+ if sample not in vcf.getsamples():
+ raise KeyErorr( "sample %s not vcf file" )
+
+ for row in vcf.fetch():
+ result = vcf2pileup( row, sample )
+ if result: yield result
+
Added: pkg/patchwork/inst/python/pysam/TabProxies.c
===================================================================
--- pkg/patchwork/inst/python/pysam/TabProxies.c (rev 0)
+++ pkg/patchwork/inst/python/pysam/TabProxies.c 2011-12-06 14:37:39 UTC (rev 39)
@@ -0,0 +1,9919 @@
+/* Generated by Cython 0.13 on Thu May 5 14:57:52 2011 */
+
+#define PY_SSIZE_T_CLEAN
+#include "Python.h"
+#ifndef Py_PYTHON_H
+ #error Python headers needed to compile C extensions, please install development version of Python.
+#else
+
+#include <stddef.h> /* For offsetof */
+#ifndef offsetof
+#define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
+#endif
+
+#if !defined(WIN32) && !defined(MS_WINDOWS)
+ #ifndef __stdcall
+ #define __stdcall
+ #endif
+ #ifndef __cdecl
+ #define __cdecl
+ #endif
+ #ifndef __fastcall
+ #define __fastcall
+ #endif
+#endif
+
+#ifndef DL_IMPORT
+ #define DL_IMPORT(t) t
+#endif
+#ifndef DL_EXPORT
+ #define DL_EXPORT(t) t
+#endif
+
+#ifndef PY_LONG_LONG
+ #define PY_LONG_LONG LONG_LONG
+#endif
+
+#if PY_VERSION_HEX < 0x02040000
+ #define METH_COEXIST 0
+ #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type)
+ #define PyDict_Contains(d,o) PySequence_Contains(d,o)
+#endif
+
+#if PY_VERSION_HEX < 0x02050000
+ typedef int Py_ssize_t;
+ #define PY_SSIZE_T_MAX INT_MAX
+ #define PY_SSIZE_T_MIN INT_MIN
+ #define PY_FORMAT_SIZE_T ""
+ #define PyInt_FromSsize_t(z) PyInt_FromLong(z)
+ #define PyInt_AsSsize_t(o) PyInt_AsLong(o)
+ #define PyNumber_Index(o) PyNumber_Int(o)
+ #define PyIndex_Check(o) PyNumber_Check(o)
+ #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message)
+#endif
+
+#if PY_VERSION_HEX < 0x02060000
+ #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt)
+ #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type)
+ #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size)
+ #define PyVarObject_HEAD_INIT(type, size) \
+ PyObject_HEAD_INIT(type) size,
+ #define PyType_Modified(t)
+
+ typedef struct {
+ void *buf;
+ PyObject *obj;
+ Py_ssize_t len;
+ Py_ssize_t itemsize;
+ int readonly;
+ int ndim;
+ char *format;
+ Py_ssize_t *shape;
+ Py_ssize_t *strides;
+ Py_ssize_t *suboffsets;
+ void *internal;
+ } Py_buffer;
+
+ #define PyBUF_SIMPLE 0
+ #define PyBUF_WRITABLE 0x0001
+ #define PyBUF_FORMAT 0x0004
+ #define PyBUF_ND 0x0008
+ #define PyBUF_STRIDES (0x0010 | PyBUF_ND)
+ #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES)
+ #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES)
+ #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES)
+ #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES)
+
+#endif
+
+#if PY_MAJOR_VERSION < 3
+ #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
+#else
+ #define __Pyx_BUILTIN_MODULE_NAME "builtins"
+#endif
+
+#if PY_MAJOR_VERSION >= 3
+ #define Py_TPFLAGS_CHECKTYPES 0
+ #define Py_TPFLAGS_HAVE_INDEX 0
+#endif
+
+#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3)
+ #define Py_TPFLAGS_HAVE_NEWBUFFER 0
+#endif
+
+#if PY_MAJOR_VERSION >= 3
+ #define PyBaseString_Type PyUnicode_Type
+ #define PyStringObject PyUnicodeObject
+ #define PyString_Type PyUnicode_Type
+ #define PyString_Check PyUnicode_Check
+ #define PyString_CheckExact PyUnicode_CheckExact
+#endif
+
+#if PY_VERSION_HEX < 0x02060000
+ #define PyBytesObject PyStringObject
+ #define PyBytes_Type PyString_Type
+ #define PyBytes_Check PyString_Check
+ #define PyBytes_CheckExact PyString_CheckExact
+ #define PyBytes_FromString PyString_FromString
+ #define PyBytes_FromStringAndSize PyString_FromStringAndSize
+ #define PyBytes_FromFormat PyString_FromFormat
+ #define PyBytes_DecodeEscape PyString_DecodeEscape
+ #define PyBytes_AsString PyString_AsString
+ #define PyBytes_AsStringAndSize PyString_AsStringAndSize
+ #define PyBytes_Size PyString_Size
+ #define PyBytes_AS_STRING PyString_AS_STRING
+ #define PyBytes_GET_SIZE PyString_GET_SIZE
+ #define PyBytes_Repr PyString_Repr
+ #define PyBytes_Concat PyString_Concat
+ #define PyBytes_ConcatAndDel PyString_ConcatAndDel
+ #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type)
+ #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type)
+#endif
+
+#ifndef PySet_CheckExact
+# define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
+#endif
+
+#if PY_MAJOR_VERSION >= 3
+ #define PyInt_Type PyLong_Type
+ #define PyInt_Check(op) PyLong_Check(op)
+ #define PyInt_CheckExact(op) PyLong_CheckExact(op)
+ #define PyInt_FromString PyLong_FromString
+ #define PyInt_FromUnicode PyLong_FromUnicode
+ #define PyInt_FromLong PyLong_FromLong
+ #define PyInt_FromSize_t PyLong_FromSize_t
+ #define PyInt_FromSsize_t PyLong_FromSsize_t
+ #define PyInt_AsLong PyLong_AsLong
+ #define PyInt_AS_LONG PyLong_AS_LONG
+ #define PyInt_AsSsize_t PyLong_AsSsize_t
+ #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
+ #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
+#endif
+
+#if PY_MAJOR_VERSION >= 3
+ #define PyBoolObject PyLongObject
+#endif
+
+
+#if PY_MAJOR_VERSION >= 3
+ #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
+ #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
+#else
+ #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
+ #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
+#endif
+
+#if PY_MAJOR_VERSION >= 3
+ #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
+#endif
+
+#if PY_VERSION_HEX < 0x02050000
+ #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n)))
+ #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a))
+ #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n)))
+#else
+ #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n))
+ #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a))
+ #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n))
+#endif
+
+#if PY_VERSION_HEX < 0x02050000
+ #define __Pyx_NAMESTR(n) ((char *)(n))
+ #define __Pyx_DOCSTR(n) ((char *)(n))
+#else
+ #define __Pyx_NAMESTR(n) (n)
+ #define __Pyx_DOCSTR(n) (n)
+#endif
+
+#ifdef __cplusplus
+#define __PYX_EXTERN_C extern "C"
+#else
+#define __PYX_EXTERN_C extern
+#endif
+
+#if defined(WIN32) || defined(MS_WINDOWS)
+#define _USE_MATH_DEFINES
+#endif
+#include <math.h>
+#define __PYX_HAVE_API__TabProxies
+#include "stdlib.h"
+#include "string.h"
+#include "stdint.h"
+#include "stdio.h"
+#include "pythread.h"
+
+/* inline attribute */
+#ifndef CYTHON_INLINE
+ #if defined(__GNUC__)
+ #define CYTHON_INLINE __inline__
+ #elif defined(_MSC_VER)
+ #define CYTHON_INLINE __inline
+ #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+ #define CYTHON_INLINE inline
+ #else
+ #define CYTHON_INLINE
+ #endif
+#endif
+
+/* unused attribute */
+#ifndef CYTHON_UNUSED
+# if defined(__GNUC__)
+# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
+# define CYTHON_UNUSED __attribute__ ((__unused__))
+# else
+# define CYTHON_UNUSED
+# endif
+# elif defined(__ICC) || defined(__INTEL_COMPILER)
+# define CYTHON_UNUSED __attribute__ ((__unused__))
+# else
+# define CYTHON_UNUSED
+# endif
+#endif
+
+typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/
+
+
+/* Type Conversion Predeclarations */
+
+#define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s)
+#define __Pyx_PyBytes_AsUString(s) ((unsigned char*) PyBytes_AsString(s))
+
+#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
[TRUNCATED]
To get the complete diff run:
svnlook diff /svnroot/patchwork -r 39
More information about the Patchwork-commits
mailing list