Skip to content
Commits on Source (2)
......@@ -8,7 +8,11 @@ bdist:
python setup.py bdist --formats=egg
install:
python setup.py install
@which pip > /dev/null
@pip freeze|grep 'pbcore=='>/dev/null \
&& pip uninstall -y pbcore \
|| echo -n ''
@pip install ./
pylint:
pylint --errors-only pbcore/
......@@ -59,3 +63,8 @@ pip-install:
publish-to-pypi:
@echo "I'm not going to do this for you, but you can do it by:"
@echo " % python setup.py sdist upload -r pypi"
xsd-codegen:
rm -f pbcore/io/dataset/pyxb/DataSetXsd.py
./bin/updateXSDs.py ../xsd-datamodels/PacBioDatasets.xsd pbcore/io/dataset/pyxb/
......@@ -2,17 +2,17 @@
type module >& /dev/null || . /mnt/software/Modules/current/init/bash
set -ex
NX3PBASEURL=http://nexus/repository/unsupported/pitchfork/gcc-4.9.2
NX3PBASEURL=http://nexus/repository/unsupported/pitchfork/gcc-6.4.0
export PATH=$PWD/build/bin:/mnt/software/a/anaconda2/4.2.0/bin:$PATH
export PYTHONUSERBASE=$PWD/build
export CFLAGS="-I/mnt/software/a/anaconda2/4.2.0/include"
PIP="pip --cache-dir=$bamboo_build_working_directory/.pip"
module load gcc/4.9.2
module load gcc
rm -rf build
mkdir -p build/bin build/lib build/include build/share
$PIP install --user \
$NX3PBASEURL/pythonpkgs/pysam-0.9.1.4-cp27-cp27mu-linux_x86_64.whl
$NX3PBASEURL/pythonpkgs/pysam-0.13-cp27-cp27mu-linux_x86_64.whl
$PIP install --user -r requirements.txt
$PIP install --user -r requirements-dev.txt
$PIP install --user -e ./
......
#!/usr/bin/env python
from __future__ import print_function
import argparse
import tempfile
import shutil
......@@ -10,7 +11,7 @@ import shlex
def get_files(xsd_dir):
print "Searching ", xsd_dir
print("Searching ", xsd_dir)
files = []
for path, subdirs, fns in os.walk(xsd_dir):
for fn in fns:
......@@ -22,16 +23,16 @@ def copy_xsds(xsd, dest):
"""Go ahead and copy all xsds, there will likely be many dependencies. If
not, xsds are small"""
files = get_files(os.path.dirname(xsd))
print "Copying:"
print("Copying:")
for f in files:
print f
print(f)
for fn in files:
shutil.copy(fn, dest)
def generate_pyxb(xsd, outdir, modname):
cmd = "pyxbgen -u {x} -m {m} --binding-root {p}".format(x=xsd, m=modname,
p=outdir)
print cmd
print(cmd)
subprocess.call(shlex.split(cmd))
if __name__ == "__main__":
......@@ -47,4 +48,4 @@ if __name__ == "__main__":
xsd_name = os.path.basename(args.xsd)
generate_pyxb(os.path.join(tempd, xsd_name), args.outdir, args.mod_name)
shutil.rmtree(tempd)
print("please view commit b7ef4238b63 for additional diffs required for python3 support")
......@@ -12,9 +12,9 @@
# serve to show the default.
import sys, os
globals = {}
execfile("../pbcore/__init__.py", globals)
__VERSION__ = globals["__VERSION__"]
# don't forget to update setup.py and pbcore/__init__.py too
__VERSION__ = '1.5.0'
# If extensions (or modules to document with autodoc) are in another directory,
......
#################################################################################
# Copyright (c) 2011-2015, Pacific Biosciences of California, Inc.
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of Pacific Biosciences nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY
# THIS LICENSE. THIS SOFTWARE IS PROVIDED BY PACIFIC BIOSCIENCES AND ITS
# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL PACIFIC BIOSCIENCES OR
# ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#################################################################################
from __future__ import absolute_import
__VERSION__ = "1.4.2"
# don't forget to update setup.py and doc/conf.py too
__VERSION__ = "1.5.0"
#################################################################################
# Copyright (c) 2011-2015, Pacific Biosciences of California, Inc.
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of Pacific Biosciences nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY
# THIS LICENSE. THIS SOFTWARE IS PROVIDED BY PACIFIC BIOSCIENCES AND ITS
# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL PACIFIC BIOSCIENCES OR
# ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#################################################################################
from __future__ import absolute_import
from .chemistry import *
#################################################################################
# Copyright (c) 2011-2015, Pacific Biosciences of California, Inc.
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of Pacific Biosciences nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY
# THIS LICENSE. THIS SOFTWARE IS PROVIDED BY PACIFIC BIOSCIENCES AND ITS
# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL PACIFIC BIOSCIENCES OR
# ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#################################################################################
from __future__ import absolute_import
__all__ = ["tripleFromMetadataXML",
"decodeTriple",
......@@ -54,7 +25,7 @@ def _loadBarcodeMappingsFromFile(mapFile):
mappings[(bindingKit, sequencingKit, softwareVersion)] = sequencingChemistry
return mappings
except:
raise ChemistryLookupError, "Error loading chemistry mapping xml"
raise ChemistryLookupError("Error loading chemistry mapping xml")
def _loadBarcodeMappings():
mappingFname = resource_filename(Requirement.parse('pbcore'),'pbcore/chemistry/resources/mapping.xml')
......@@ -87,8 +58,7 @@ def tripleFromMetadataXML(metadataXmlPath):
instrumentControlVersion = ".".join(verComponents)
return (bindingKit, sequencingKit, instrumentControlVersion)
except Exception as e:
raise ChemistryLookupError, \
("Could not find, or extract chemistry information from, %s" % (metadataXmlPath,))
raise ChemistryLookupError("Could not find, or extract chemistry information from, %s" % (metadataXmlPath,))
def decodeTriple(bindingKit, sequencingKit, softwareVersion):
"""
......
......@@ -329,71 +329,68 @@
<SoftwareVersion>5.0</SoftwareVersion>
</Mapping>
<!--=====================================-->
<!-- Updating PA version from 5.0 -> 5.1 -->
<!--=====================================-->
<!-- PA5.1 backward compatibility with iguana chemistry -->
<!-- 2.1 binding kit with 2.0 sequencing plate -->
<Mapping>
<SequencingChemistry>S/P2-C2/5.0</SequencingChemistry>
<BindingKit>100-862-200</BindingKit>
<BindingKit>101-365-900</BindingKit>
<SequencingKit>100-861-800</SequencingKit>
<SoftwareVersion>5.1</SoftwareVersion>
<SoftwareVersion>5.0</SoftwareVersion>
</Mapping>
<Mapping>
<SequencingChemistry>S/P2-C2/5.0</SequencingChemistry>
<BindingKit>100-862-200</BindingKit>
<BindingKit>101-365-900</BindingKit>
<SequencingKit>101-093-700</SequencingKit>
<SoftwareVersion>5.1</SoftwareVersion>
<SoftwareVersion>5.0</SoftwareVersion>
</Mapping>
<!-- Sequel® Sequencing Plate Silwet -->
<!-- 2.1 binding kit with 2.1 sequencing plate (silwet) -->
<!-- SG1/16509P Chemistry update (binding kit only) with 5.0 basecaller (no new training) -->
<Mapping>
<SequencingChemistry>S/P2-C2/5.0</SequencingChemistry>
<BindingKit>100-862-200</BindingKit>
<BindingKit>101-365-900</BindingKit>
<SequencingKit>101-309-500</SequencingKit>
<SoftwareVersion>5.1</SoftwareVersion>
<SoftwareVersion>5.0</SoftwareVersion>
</Mapping>
<!-- Sequel® Sequencing Plate Silwet (4 rxn) -->
<!-- SG1/16509P Chemistry update (binding kit only) with 5.0 basecaller (no new training) -->
<Mapping>
<SequencingChemistry>S/P2-C2/5.0</SequencingChemistry>
<BindingKit>100-862-200</BindingKit>
<BindingKit>101-365-900</BindingKit>
<SequencingKit>101-309-400</SequencingKit>
<SoftwareVersion>5.1</SoftwareVersion>
<SoftwareVersion>5.0</SoftwareVersion>
</Mapping>
<!-- 2.1 binding kit with 2.0 sequencing plate -->
<!-- SG1/16509P Chemistry update (binding kit only) with 5.0 basecaller (no new training, prototype parts) -->
<Mapping>
<SequencingChemistry>S/P2-C2/5.0</SequencingChemistry>
<BindingKit>101-365-900</BindingKit>
<SequencingKit>100-861-800</SequencingKit>
<SoftwareVersion>5.1</SoftwareVersion>
<BindingKit>101-490-800</BindingKit>
<SequencingKit>101-490-900</SequencingKit>
<SoftwareVersion>5.0</SoftwareVersion>
</Mapping>
<!-- SG1/16509P Chemistry update (binding kit only) with 5.0 basecaller (no new training, prototype parts) -->
<Mapping>
<SequencingChemistry>S/P2-C2/5.0</SequencingChemistry>
<BindingKit>101-365-900</BindingKit>
<SequencingKit>101-093-700</SequencingKit>
<SoftwareVersion>5.1</SoftwareVersion>
<BindingKit>101-490-800</BindingKit>
<SequencingKit>101-491-000</SequencingKit>
<SoftwareVersion>5.0</SoftwareVersion>
</Mapping>
<!-- 2.1 binding kit with 2.1 sequencing plate (silwet) -->
<!-- SG1/16509P Chemistry update (binding kit only) with 5.1 primary (no new training) -->
<!-- SG1/16509P Chemistry update (binding kit only) with 5.0 basecaller (no new training, prototype parts) -->
<Mapping>
<SequencingChemistry>S/P2-C2/5.0</SequencingChemistry>
<BindingKit>101-365-900</BindingKit>
<SequencingKit>101-309-500</SequencingKit>
<SoftwareVersion>5.1</SoftwareVersion>
<BindingKit>101-500-400</BindingKit>
<SequencingKit>101-490-900</SequencingKit>
<SoftwareVersion>5.0</SoftwareVersion>
</Mapping>
<!-- SG1/16509P Chemistry update (binding kit only) with 5.1 primary (no new training) -->
<!-- SG1/16509P Chemistry update (binding kit only) with 5.0 basecaller (no new training, prototype parts) -->
<Mapping>
<SequencingChemistry>S/P2-C2/5.0</SequencingChemistry>
<BindingKit>101-365-900</BindingKit>
<SequencingKit>101-309-400</SequencingKit>
<SoftwareVersion>5.1</SoftwareVersion>
<BindingKit>101-500-400</BindingKit>
<SequencingKit>101-491-000</SequencingKit>
<SoftwareVersion>5.0</SoftwareVersion>
</Mapping>
</MappingTable>
#################################################################################
# Copyright (c) 2011-2015, Pacific Biosciences of California, Inc.
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of Pacific Biosciences nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY
# THIS LICENSE. THIS SOFTWARE IS PROVIDED BY PACIFIC BIOSCIENCES AND ITS
# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL PACIFIC BIOSCIENCES OR
# ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#################################################################################
from __future__ import absolute_import
from pkg_resources import Requirement, resource_filename
......@@ -177,3 +149,6 @@ def getEmptyAlignedBam():
def getMappingXml():
return _getAbsPath("chemistry.xml")
def getWeird():
return _getAbsPath("weird.fa")
"""Doctest resources"""
from __future__ import absolute_import
import os
from pkg_resources import Requirement, resource_filename
......
>chr1
acgtacgtacgtact
\ No newline at end of file
#################################################################################$$
# Copyright (c) 2011,2012, Pacific Biosciences of California, Inc.
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# * Neither the name of Pacific Biosciences nor the names of its contributors
# may be used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY PACIFIC BIOSCIENCES AND ITS CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL PACIFIC BIOSCIENCES OR ITS
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#################################################################################$$
from __future__ import absolute_import
from __future__ import division
try:
import h5py
......@@ -36,6 +10,7 @@ except ImportError:
import numpy as n
from pbcore.io.FofnIO import readFofn
from functools import reduce
BARCODE_DELIMITER = "--"
BC_DS_PATH = "BarcodeCalls/best"
......@@ -79,11 +54,11 @@ class LabeledZmw(object):
return self._bestScore
@property
def averageScore(self):
return 0 if self.nScored <= 0 else self.bestScore/self.nScored
return 0 if self.nScored <= 0 else self.bestScore//self.nScored
@property
def scoreRatio(self):
return 1 if self.secondBestScore == 0 or self.bestScore == 0 else \
self.bestScore/(1.0 * self.secondBestScore)
self.bestScore/self.secondBestScore
@property
def secondBestIdx(self):
return self._secondBestIdx
......@@ -270,7 +245,7 @@ class MPBarcodeH5Reader(object):
return [ self.labeledZmwFromHoleNumber(r) for r in item ]
elif entryType == bool or issubclass(entryType, n.bool_):
return [ self.labeledZmwFromHoleNumber(r) for r in n.flatnonzero(item) ]
raise TypeError, "Invalid type for BasH5Reader slicing"
raise TypeError("Invalid type for BasH5Reader slicing")
class BarcodeH5Fofn(object):
......
#################################################################################
# Copyright (c) 2011-2015, Pacific Biosciences of California, Inc.
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of Pacific Biosciences nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY
# THIS LICENSE. THIS SOFTWARE IS PROVIDED BY PACIFIC BIOSCIENCES AND ITS
# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL PACIFIC BIOSCIENCES OR
# ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#################################################################################
# Authors: David Alexander, Jim Bullard
from __future__ import absolute_import
__all__ = [ "BasH5Reader" ,
"BaxH5Reader" ,
"BasH5Collection" ]
......@@ -146,7 +118,7 @@ class Zmw(CommonEqualityMixin, ExtraBaseRegionsMixin):
insert, used to forming the CCS consensus.
"""
if not self.baxH5.hasConsensusBasecalls:
raise ValueError, "No CCS reads in this file"
raise ValueError("No CCS reads in this file")
return self.baxH5._ccsNumPasses[self.index]
@property
......@@ -167,7 +139,7 @@ class Zmw(CommonEqualityMixin, ExtraBaseRegionsMixin):
specified extent of the polymerase read.
"""
if not self.baxH5.hasRawBasecalls:
raise ValueError, "No raw reads in this file"
raise ValueError("No raw reads in this file")
hqStart, hqEnd = self.hqRegion
readStart = hqStart if readStart is None else readStart
readEnd = hqEnd if readEnd is None else readEnd
......@@ -195,7 +167,7 @@ class Zmw(CommonEqualityMixin, ExtraBaseRegionsMixin):
@property
def ccsRead(self):
if not self.baxH5.hasConsensusBasecalls:
raise ValueError, "No CCS reads in this file"
raise ValueError("No CCS reads in this file")
baseOffset = self.baxH5._ccsOffsetsByHole[self.holeNumber]
if (baseOffset[1] - baseOffset[0]) <= 0:
return None
......@@ -233,7 +205,7 @@ class ZmwRead(CommonEqualityMixin):
self.offsetBegin <=
self.offsetEnd <=
zmwOffsetEnd):
raise IndexError, "Invalid slice of Zmw!"
raise IndexError("Invalid slice of Zmw!")
def _getBasecallsGroup(self):
return self.baxH5._basecallsGroup
......@@ -326,7 +298,7 @@ class BaxH5Reader(object):
self.filename = op.abspath(op.expanduser(filename))
self.file = h5py.File(self.filename, "r")
except IOError:
raise IOError, ("Invalid or nonexistent bax/bas file %s" % filename)
raise IOError("Invalid or nonexistent bax/bas file %s" % filename)
#
# Raw base calls?
......@@ -423,7 +395,7 @@ class BaxH5Reader(object):
try:
fh = h5py.File(op.abspath(op.expanduser(regionH5Filename)), "r")
except IOError:
raise IOError, ("Invalid or nonexistent file %s" % regionH5Filename)
raise IOError("Invalid or nonexistent file %s" % regionH5Filename)
self._loadRegions(fh)
fh.close()
......@@ -435,7 +407,7 @@ class BaxH5Reader(object):
if not np.in1d(rgnHoleNumbers, baxHoleNumbers).all():
msg = "Region file (%s) does not contain the same hole numbers as " \
"bas/bax file (%s)"
raise IOError, (msg % (regionH5Filename, self.filename))
raise IOError(msg % (regionH5Filename, self.filename))
@property
def sequencingZmws(self):
......@@ -540,7 +512,7 @@ class BaxH5Reader(object):
if triple:
return triple
else:
raise ChemistryLookupError, "Could not find chemistry barcodes in file or companion metadata.xml"
raise ChemistryLookupError("Could not find chemistry barcodes in file or companion metadata.xml")
@property
def sequencingChemistry(self):
......@@ -561,7 +533,7 @@ class BaxH5Reader(object):
if tripleFromXML is not None:
self._sequencingChemistry = decodeTriple(*tripleFromXML)
else:
raise ChemistryLookupError, "Chemistry information could not be found for this file"
raise ChemistryLookupError("Chemistry information could not be found for this file")
return self._sequencingChemistry
def __len__(self):
......@@ -674,7 +646,7 @@ class BasH5Reader(object):
self.filename = op.abspath(op.expanduser(filename))
self.file = h5py.File(self.filename, "r")
except IOError:
raise IOError, ("Invalid or nonexistent bas/bax file %s" % filename)
raise IOError("Invalid or nonexistent bas/bax file %s" % filename)
# Is this a multi-part or single-part?
......@@ -773,7 +745,7 @@ class BasH5Reader(object):
return [ self._getitemScalar(r) for r in holeNumbers ]
elif entryType == bool or issubclass(entryType, np.bool_):
return [ self._getitemScalar(r) for r in np.flatnonzero(holeNumbers) ]
raise TypeError, "Invalid type for BasH5Reader slicing"
raise TypeError("Invalid type for BasH5Reader slicing")
@property
def movieName(self):
......
#################################################################################
# Copyright (c) 2011-2015, Pacific Biosciences of California, Inc.
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of Pacific Biosciences nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY
# THIS LICENSE. THIS SOFTWARE IS PROVIDED BY PACIFIC BIOSCIENCES AND ITS
# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL PACIFIC BIOSCIENCES OR
# ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#################################################################################
# Author: David Alexander
"""
Streaming I/O support for FASTA files.
"""
from __future__ import absolute_import
__all__ = [ "FastaRecord",
"FastaReader",
......@@ -293,7 +264,9 @@ def loadFastaIndex(faidxFilename, fastaView):
newlineWidth = blen - lineWidth # 2 for DOS, 1 for UNIX
header_ = fastaView[offsetEnd:offset]
assert (header_[0] == ">" and header_[-1] == "\n")
header = header_[1:-newlineWidth]
# used to use 1:-newlineWidth here, but when DOS encoded
# and single-line, single-entry FASTA, sometimes newlineWidth = 0
header = header_[1:].rstrip('\r\n')
id, comment = splitFastaHeader(header)
q, r = divmod(length, lineWidth)
numNewlines = q + (r > 0)
......@@ -324,7 +297,7 @@ class MmappedFastaSequence(Sequence):
if isinstance(spec, slice):
start, stop, stride = spec.indices(len(self))
if stride != 1:
raise ValueError, "Unsupported stride"
raise ValueError("Unsupported stride")
elif spec < 0:
start = self.faiRecord.length + spec
stop = start + 1
......@@ -334,7 +307,7 @@ class MmappedFastaSequence(Sequence):
stop = start + 1
stride = 1
if not (0 <= start <= stop <= self.faiRecord.length):
raise IndexError, "Out of bounds"
raise IndexError("Out of bounds")
startOffset = fileOffset(self.faiRecord, start)
endOffset = fileOffset(self.faiRecord, stop)
snip = self.view[startOffset:endOffset].translate(None, "\r\n")
......@@ -457,7 +430,7 @@ class IndexedFastaReader(ReaderBase, Sequence):
elif key in self.contigLookup:
return IndexedFastaRecord(self.view, self.contigLookup[key])
else:
raise IndexError, "Contig not in FastaTable"
raise IndexError("Contig not in FastaTable")
def __iter__(self):
return (self[i] for i in xrange(len(self)))
......
#################################################################################
# Copyright (c) 2011-2015, Pacific Biosciences of California, Inc.
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of Pacific Biosciences nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY
# THIS LICENSE. THIS SOFTWARE IS PROVIDED BY PACIFIC BIOSCIENCES AND ITS
# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL PACIFIC BIOSCIENCES OR
# ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#################################################################################
# Author: David Alexander
"""
I/O support for FASTQ files
"""
from __future__ import absolute_import
__all__ = [ "FastqRecord",
"FastqReader",
......
#################################################################################
# Copyright (c) 2011-2015, Pacific Biosciences of California, Inc.
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of Pacific Biosciences nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY
# THIS LICENSE. THIS SOFTWARE IS PROVIDED BY PACIFIC BIOSCIENCES AND ITS
# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL PACIFIC BIOSCIENCES OR
# ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,g SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#################################################################################
# Authors: David Alexander
from __future__ import absolute_import
from pbcore.io.base import getFileHandle
from os.path import dirname, isabs, join, abspath, expanduser
import xml.etree.ElementTree as ET
......@@ -62,7 +34,7 @@ def readFofn(f):
elif fofnRoot is not None:
yield join(fofnRoot, path)
else:
raise IOError, "Cannot handle relative paths in StringIO FOFN"
raise IOError("Cannot handle relative paths in StringIO FOFN")
def readInputXML(fname):
tree = ET.parse(fname)
......
#################################################################################
# Copyright (c) 2011-2015, Pacific Biosciences of California, Inc.
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of Pacific Biosciences nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY
# THIS LICENSE. THIS SOFTWARE IS PROVIDED BY PACIFIC BIOSCIENCES AND ITS
# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL PACIFIC BIOSCIENCES OR
# ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#################################################################################
# Author: David Alexander
"""
......@@ -36,6 +6,7 @@ I/O support for GFF3 files.
The specification for the GFF format is available at
http://www.sequenceontology.org/gff3.shtml
"""
from __future__ import absolute_import
__all__ = [ "Gff3Record",
"GffReader",
......
#################################################################################
# Copyright (c) 2017, Pacific Biosciences of California, Inc.
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of Pacific Biosciences nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY
# THIS LICENSE. THIS SOFTWARE IS PROVIDED BY PACIFIC BIOSCIENCES AND ITS
# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL PACIFIC BIOSCIENCES OR
# ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#################################################################################
# Author: Lance Hepler
from __future__ import absolute_import
from __future__ import print_function
"""
......
#################################################################################
# Copyright (c) 2011-2015, Pacific Biosciences of California, Inc.
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of Pacific Biosciences nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY
# THIS LICENSE. THIS SOFTWARE IS PROVIDED BY PACIFIC BIOSCIENCES AND ITS
# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL PACIFIC BIOSCIENCES OR
# ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#################################################################################
from __future__ import absolute_import
from .BasH5IO import *
from .FastaIO import *
......