Commits

pch...@saturn.nhgri.nih.gov  committed b1416ff Merge

Changes from James Taylor's bx-python; doesn't fix error in bed_intersect.pl

  • Participants
  • Parent commits 74b09f7, f74aec0

Comments (0)

Files changed (51)

 
 # Object files
 *.so
+*.pyd
 
 # egg-info for inplace builds
 bx_python.egg-info
 
 # IDE project files
 *.kpf
+
+# windows shortcuts
+*.lnk
+
+# nose egg
+nose*.egg

File doc/Makefile

+# Makefile for Sphinx documentation
+#
+
+# You can set these variables from the command line.
+SPHINXOPTS    =
+SPHINXBUILD   = sphinx-build
+PAPER         =
+
+# Internal variables.
+PAPEROPT_a4     = -D latex_paper_size=a4
+PAPEROPT_letter = -D latex_paper_size=letter
+ALLSPHINXOPTS   = -d build/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
+
+.PHONY: help clean html web pickle htmlhelp latex changes linkcheck
+
+help:
+	@echo "Please use \`make <target>' where <target> is one of"
+	@echo "  html      to make standalone HTML files"
+	@echo "  apidoc    to run epydoc" 
+	@echo "  pickle    to make pickle files"
+	@echo "  json      to make JSON files"
+	@echo "  htmlhelp  to make HTML files and a HTML help project"
+	@echo "  latex     to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
+	@echo "  changes   to make an overview over all changed/added/deprecated items"
+	@echo "  linkcheck to check all external links for integrity"
+
+clean:
+	-rm -rf docbuild/*
+
+html:
+	mkdir -p build/html build/doctrees
+	$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) docbuild/html
+	@echo
+	@echo "Build finished. The HTML pages are in docbuild/html."
+
+apidoc:
+	mkdir -p build/html/apidoc
+	epydoc --docformat restructuredtext ../lib/bx -o docbuild/html/apidoc
+	@echo
+	@echo "Epydoc finished. The pages are in docbuild/html/apidoc."
+
+
+pickle:
+	mkdir -p build/pickle build/doctrees
+	$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) docbuild/pickle
+	@echo
+	@echo "Build finished; now you can process the pickle files."
+
+web: pickle
+
+json:
+	mkdir -p build/json build/doctrees
+	$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) docbuild/json
+	@echo
+	@echo "Build finished; now you can process the JSON files."
+
+htmlhelp:
+	mkdir -p build/htmlhelp build/doctrees
+	$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) docbuild/htmlhelp
+	@echo
+	@echo "Build finished; now you can run HTML Help Workshop with the" \
+	      ".hhp project file in build/htmlhelp."
+
+latex:
+	mkdir -p build/latex build/doctrees
+	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) docbuild/latex
+	@echo
+	@echo "Build finished; the LaTeX files are in build/latex."
+	@echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \
+	      "run these through (pdf)latex."
+
+changes:
+	mkdir -p build/changes build/doctrees
+	$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) docbuild/changes
+	@echo
+	@echo "The overview file is in build/changes."
+
+linkcheck:
+	mkdir -p build/linkcheck build/doctrees
+	$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) docbuild/linkcheck
+	@echo
+	@echo "Link check complete; look for any errors in the above output " \
+	      "or in build/linkcheck/output.txt."

File doc/source/conf.py

+# -*- coding: utf-8 -*-
+#
+# BxPython documentation build configuration file, created by
+# sphinx-quickstart on Fri May 08 10:18:22 2009.
+#
+# This file is execfile()d with the current directory set to its containing dir.
+#
+# The contents of this file are pickled, so don't put values in the namespace
+# that aren't pickleable (module imports are okay, they're removed automatically).
+#
+# Note that not all possible configuration values are present in this
+# autogenerated file.
+#
+# All configuration values have a default; values that are commented out
+# serve to show the default.
+
+import sys, os
+
+# If your extensions are in another directory, add it here. If the directory
+# is relative to the documentation root, use os.path.abspath to make it
+# absolute, like shown here.
+#sys.path.append(os.path.abspath('.'))
+curr_dir = os.path.dirname( __file__ )
+bx_dir = os.path.join( curr_dir, '..', '..', 'lib')
+sys.path.insert( 0, bx_dir )
+import bx
+
+# General configuration
+# ---------------------
+
+# Add any Sphinx extension module names here, as strings. They can be extensions
+# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
+extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.intersphinx']
+
+# Add any paths that contain templates here, relative to this directory.
+templates_path = ['templates']
+
+# The suffix of source filenames.
+source_suffix = '.rst'
+
+# The encoding of source files.
+#source_encoding = 'utf-8'
+
+# The master toctree document.
+master_doc = 'index'
+
+# General information about the project.
+project = u'bx-python'
+copyright = u'2009, James Taylor'
+
+# The version info for the project you're documenting, acts as replacement for
+# |version| and |release|, also used in various other places throughout the
+# built documents.
+#
+# The short X.Y version.
+version = bx.__version__
+
+# The full version, including alpha/beta/rc tags.
+release = version
+
+# The language for content autogenerated by Sphinx. Refer to documentation
+# for a list of supported languages.
+#language = None
+
+# There are two options for replacing |today|: either, you set today to some
+# non-false value, then it is used:
+#today = ''
+# Else, today_fmt is used as the format for a strftime call.
+#today_fmt = '%B %d, %Y'
+
+# List of documents that shouldn't be included in the build.
+#unused_docs = []
+
+# List of directories, relative to source directory, that shouldn't be searched
+# for source files.
+exclude_trees = []
+
+# The reST default role (used for this markup: `text`) to use for all documents.
+#default_role = None
+
+# If true, '()' will be appended to :func: etc. cross-reference text.
+#add_function_parentheses = True
+
+# If true, the current module name will be prepended to all description
+# unit titles (such as .. function::).
+#add_module_names = True
+
+# If true, sectionauthor and moduleauthor directives will be shown in the
+# output. They are ignored by default.
+#show_authors = False
+
+# The name of the Pygments (syntax highlighting) style to use.
+pygments_style = 'sphinx'
+
+
+# Options for HTML output
+# -----------------------
+
+# The style sheet to use for HTML and HTML Help pages. A file of that name
+# must exist either in Sphinx' static/ path, or in one of the custom paths
+# given in html_static_path.
+html_style = 'base.css'
+
+# The name for this set of Sphinx documents.  If None, it defaults to
+# "<project> v<release> documentation".
+#html_title = None
+
+# A shorter title for the navigation bar.  Default is the same as html_title.
+#html_short_title = None
+
+# The name of an image file (relative to this directory) to place at the top
+# of the sidebar.
+#html_logo = None
+
+# The name of an image file (within the static path) to use as favicon of the
+# docs.  This file should be a Windows icon file (.ico) being 16x16 or 32x32
+# pixels large.
+#html_favicon = None
+
+# Add any paths that contain custom static files (such as style sheets) here,
+# relative to this directory. They are copied after the builtin static files,
+# so a file named "default.css" will overwrite the builtin "default.css".
+html_static_path = ['static']
+
+# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
+# using the given strftime format.
+#html_last_updated_fmt = '%b %d, %Y'
+
+# If true, SmartyPants will be used to convert quotes and dashes to
+# typographically correct entities.
+#html_use_smartypants = True
+
+# Custom sidebar templates, maps document names to template names.
+html_index = 'index.html'
+html_sidebars = { 'index': 'indexsidebar.html'}
+
+# Additional templates that should be rendered to pages, maps page names to
+# template names.
+##html_additional_pages = {
+##    'index': 'index.html',
+##}
+
+# If false, no module index is generated.
+#html_use_modindex = True
+
+# If false, no index is generated.
+#html_use_index = True
+
+# If true, the index is split into individual pages for each letter.
+#html_split_index = False
+
+# If true, the reST sources are included in the HTML build as _sources/<name>.
+#html_copy_source = True
+
+# If true, an OpenSearch description file will be output, and all pages will
+# contain a <link> tag referring to it.  The value of this option must be the
+# base URL from which the finished HTML is served.
+#html_use_opensearch = ''
+
+# If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml").
+#html_file_suffix = ''
+
+# Output file base name for HTML help builder.
+htmlhelp_basename = 'bx-doc'
+
+
+# Options for LaTeX output
+# ------------------------
+
+# The paper size ('letter' or 'a4').
+#latex_paper_size = 'letter'
+
+# The font size ('10pt', '11pt' or '12pt').
+#latex_font_size = '10pt'
+
+# Grouping the document tree into LaTeX files. List of tuples
+# (source start file, target name, title, author, document class [howto/manual]).
+latex_documents = [
+  ('index', 'bx-python.tex', ur'bx-python Documentation',
+   ur'James Taylor', 'manual'),
+]
+
+# The name of an image file (relative to this directory) to place at the top of
+# the title page.
+#latex_logo = None
+
+# For "manual" documents, if this is true, then toplevel headings are parts,
+# not chapters.
+#latex_use_parts = False
+
+# Additional stuff for the LaTeX preamble.
+#latex_preamble = ''
+
+# Documents to append as an appendix to all manuals.
+#latex_appendices = []
+
+# If false, no module index is generated.
+#latex_use_modindex = True
+
+
+# Example configuration for intersphinx: refer to the Python standard library.
+#intersphinx_mapping = {'http://docs.python.org/dev': None}

File doc/source/contents.rst

+
+
+bx-python documentation contents
+================================
+
+Browse the Python API `class documentation <apidoc/index.html>`_ 
+
+Contents:
+
+.. toctree::
+   :maxdepth: 2
+
+   modules/index.rst 
+
+* :ref:`genindex`
+* :ref:`modindex`
+* :ref:`search`
+

File doc/source/index.rst

+About bx-python
+===============
+
+The bx-python project is a python library and associated set of scripts to allow for rapid implementation of genome scale analyses. The library contains a variety of useful modules, but the particular strengths are:
+
+ * Classes for reading and working with genome-scale multiple local alignments (in MAF, AXT, and LAV formats)
+ * Generic data structure for indexing on disk files that contain blocks of data associated with intervals on various sequences (used, for example, to provide random access to individual alignments in huge files; optomized for use over network filesystems)
+ * Data structures for working with intervals on sequences
+ * "Binned bitsets" which act just like chromosome sized bit arrays, but lazily allocate regions and allow large blocks of all set or all unset bits to be stored compactly
+ * "Intersecter" for performing fast intersection tests that preserve both query and target intervals and associated annotation 
+
+These tools have been used in a variety of published research, and are a fundamental part of the ongoing Galaxy and ESPERR projects.
+
+Contents
+========
+
+.. toctree::
+   :maxdepth: 2
+
+   modules/index.rst
+
+Indices and tables
+==================
+
+* :ref:`genindex`
+* :ref:`modindex`
+* :ref:`search`
+

File doc/source/static/base.css

+@import url(tripoli.base.css);
+
+html {
+    font-family: 'Verdana', sans-serif;
+    color: #333333;
+}
+body {
+    padding: 3em 3em;
+}
+
+h1.pageheader {
+    font-variant: small-caps;
+    margin-top: 0;
+    border-top: solid 1px;
+    padding-top: 2px;
+    border-bottom: solid 1px;
+    border-color: #CCCCCC;
+    margin-bottom: 1em;
+}
+
+h1.pageheader a {
+    color: inherit;
+    text-decoration: inherit;
+    border: none;
+}
+
+.content h1, .content h2, .content h3, .content h4, .content h5, .content h6 {
+    font-family: 'Hoefler Text', 'Georgia', serif;
+    font-weight: normal;
+    color: #666666;
+    /* border-bottom: solid #666666 1px; */
+}
+
+.content h1.pagetitle {
+    color: #c33;
+}
+
+#main {
+}
+
+.colpad {
+    padding: 0 2em;
+}
+
+#main > .inner {
+    min-width: 70em;
+    max-width: 90em;
+    margin: auto;
+    height: 100%;
+}
+
+#left {
+    background: white;
+    margin-right: 36%; /* 31em; */
+    padding-right: 3%;
+    height: 100%;
+}
+
+#right {
+    float: right;
+    width: 33%; /* 28em; */
+    padding-left: 3%; 
+    border-left: solid #CCCCCC 1px;
+}
+
+.sidebar {
+    font-size: 1em;
+}
+
+.sidebar ul {
+    margin-left: 0;
+}
+
+.sidebar ul li {
+    list-style-type: none;
+    margin-bottom: 0.6em;
+}
+
+.sidebar ul.pages {
+    margin-left: 5px;
+    margin-top: 0.6em;
+}
+
+.sidebar ul.pages li {
+    background: url(hbullet.png) 0 0.4em no-repeat;
+    padding-left: 25px;
+    list-style-type: none;
+}
+
+.sidebar ul.pages li {
+}
+
+.sidebar h1 {
+    clear: both;
+}
+
+.sidebar .publications .info {
+    color: #666666;
+}
+
+.postinfo {
+    color: #666666;
+    font-size: 92%;
+    margin-top: -1em;
+}
+
+.postreadlink {
+    margin-top: -1em;
+}
+
+.sidebar .posts .info {
+    color: #666666;
+}
+
+.comments_title {
+    margin-top: 2em;
+}
+
+label {
+    display: block;
+}
+
+#footer {
+    clear: both;
+}
+
+a, a:link, a:visited {
+    text-decoration: none;
+    border-bottom: dotted #666666 1px;
+    color: black;
+}
+
+a:hover {
+ color: #CC3333;
+}
+
+li {
+    list-style: square;
+}
+
+table.layout td {
+    vertical-align: top;
+    padding-left: 2em;
+    padding-right: 2em;
+    border-left: solid #999999 1px
+}
+
+hr {
+    border: none;
+    height: 1px;
+    background: #999999; 
+}	

File doc/source/static/tripoli.base.css

+/*
+ *   Tripoli is a generic CSS standard for HTML rendering. 
+ *   Copyright (C) 2007 David Hellsing
+ *   
+ *   http://devkick.com/lab/tripoli/
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+**/
+
+/*
+_______________________________
+RESET */
+
+*
+{
+	text-decoration:none;
+	font-size:1em;
+	outline:none;
+	margin:0;
+	padding:0;
+}
+
+code,kbd,samp,pre,tt,var,textarea,input,select,isindex,listing,xmp,plaintext
+{
+	font:inherit;
+	white-space:normal;
+}
+
+a,img,a img,iframe,form,abbr,acronym,object,applet,table,a abbr,a acronym
+{
+	border-width:0;
+}
+
+dfn,i,cite,var,address,em
+{
+	font-style:normal;
+}
+
+th,b,strong,h1,h2,h3,h4,h5,h6,dt
+{
+	font-weight:normal;
+}
+
+caption,th,td
+{
+	text-align:left;
+}
+
+html
+{
+	background:white;
+	color:black;
+	line-height:1;
+	font-family:arial, sans-serif;
+}
+
+/* \*/
+
+html
+{
+	font-family:sans-serif;
+}
+
+/* */
+
+q
+{
+	quotes:"\201C""\201D""\2018""\2019";
+}
+
+ul,ol,dir,menu
+{
+	list-style:none;
+}
+
+sub,sup
+{
+	vertical-align:baseline;
+}
+
+a
+{
+	color:inherit;
+}
+
+/*
+_______________________________
+DISABLE DEPRECATED HTML */
+
+font,basefont
+{
+	color:inherit;
+	font:inherit;
+	font-size:100%;
+}
+
+
+center,*[align]
+{
+	text-align:inherit;
+}
+
+s,strike,u
+{
+	text-decoration:inherit;
+}
+
+img
+{
+	border:none;
+	margin:0;
+}
+
+ol
+{
+	list-style-type:decimal;
+}
+
+body
+{
+	background-color:transparent;
+}
+
+tr,th,td
+{
+	width:auto;
+	height:auto;
+	background-color:transparent;
+	vertical-align:inherit;
+	border:none;
+}
+
+table[border],.content table[border]
+{
+	border-collapse:separate;
+	border-spacing:0;
+}
+
+nobr
+{
+	white-space:normal;
+}
+
+marquee
+{
+	overflow:visible;
+	-moz-binding:none;
+}
+
+blink
+{
+	text-decoration:none;
+}
+
+/*
+_______________________________
+GENERAL */
+
+html
+{
+	font-size:125%;
+}
+
+body
+{
+	font-size:50%;
+}
+
+a
+{
+	text-decoration:underline;
+}
+
+strong,th,thead td,h1,h2,h3,h4,h5,h6,dt
+{
+	font-weight:bold;
+}
+
+cite,em,dfn
+{
+	font-style:italic;
+}
+
+code,kbd,samp,pre,tt,var,input[type='text'],input[type='password'],textarea
+{
+	font-size:100%;
+	font-family:mono-space,monospace;
+}
+
+pre
+{
+	white-space:pre;
+}
+
+pre *
+{
+	font-size:100%;
+	white-space:pre;
+}
+
+del
+{
+	text-decoration:line-through;
+}
+
+ins,dfn
+{
+	border-bottom:1px solid black;
+}
+
+small,sup,sub
+{
+	font-size:85%;
+}
+
+big
+{
+	font-size:125%;
+	line-height:80%;
+}
+
+abbr,acronym
+{
+	text-transform:uppercase;
+	font-size:85%;
+	letter-spacing:.1em;
+}
+
+abbr[title],acronym[title],dfn[title]
+{
+	cursor:help;
+	border-bottom:1px dotted black;
+}
+
+sup
+{
+	vertical-align:super;
+}
+
+sub
+{
+	vertical-align:sub;
+}
+
+blockquote
+{
+	padding-left:2.2em;
+}
+
+hr
+{
+	display:none; /* We will re-reset it later for content */
+}
+
+:lang(af),:lang(nl),:lang(pl)
+{
+	quotes:'\201E' '\201D' '\201A' '\2019';
+}
+
+:lang(bg),:lang(cs),:lang(de),:lang(is),:lang(lt),:lang(sk),:lang(sr),:lang(ro)
+{
+	quotes:'\201E' '\201C' '\201A' '\2018';
+}
+
+:lang(da),:lang(hr)
+{
+	quotes:'\00BB' '\00AB' '\203A' '\2039';
+}
+
+:lang(el),:lang(es),:lang(sq),:lang(tr)
+{
+	quotes:'\00AB' '\00BB' '\2039' '\203A';
+}
+
+:lang(en-GB)
+{
+	quotes:'\2018' '\2019' '\201C' '\201D';
+}
+
+:lang(fi),:lang(sv)
+{
+	quotes:'\201D' '\201D' '\2019' '\2019';
+}
+
+:lang(fr)
+{
+	quotes:'\ab\2005' '\2005\bb' '\2039\2005' '\2005\203a';
+}
+
+*[lang|='en'] q:before
+{
+	content:'\201C';
+}
+
+*[lang|='en'] q:after
+{
+	content:'\201D';
+}
+
+*[lang|='en'] q q:before
+{
+	content:'\2018';
+}
+
+*[lang|='en'] q q:after
+{
+	content:'\2019';
+}
+
+input,select,button
+{
+	cursor:pointer;
+}
+
+input[type='text'],input[type='password']
+{
+	cursor:text;
+}
+
+input[type='hidden']
+{
+	display:none;
+}
+
+/*
+_______________________________
+CONTENT */
+
+.content
+{
+	font-size:1.2em;
+	line-height:1.6em;
+}
+
+.content h1
+{
+	font-size:1.6em;
+	line-height:1;
+	margin:1em 0 .5em;
+}
+
+.content h2
+{
+	font-size:1.5em;
+	line-height:1;
+	margin:1.07em 0 .535em;
+}
+
+.content h3
+{
+	font-size:1.4em;
+	line-height:1;
+	margin:1.14em 0 .57em;
+}
+
+.content h4
+{
+	font-size:1.3em;
+	line-height:1;
+	margin:1.23em 0 .615em;
+}
+
+.content h5
+{
+	font-size:1.2em;
+	line-height:1;
+	margin:1.33em 0 .67em;
+}
+
+.content h6
+{
+	font-size:1em;
+	line-height:1;
+	margin:1.6em 0 .8em;
+}
+
+.content hr
+{
+	display:block;
+	background:black;
+	color:black;
+	width:100%;
+	height:1px;
+	border:none;
+}
+
+.content ul
+{
+	list-style:disc outside;
+}
+
+.content ol
+{
+	list-style:decimal outside;
+}
+
+.content table
+{
+	border-collapse:collapse;
+}
+
+.content hr,.content p,.content ul,.content ol,.content dl,.content pre, .content address,.content table,.content form
+{
+	margin-bottom:1.6em;
+}
+
+.content p+p
+{
+	margin-top:-.8em;
+}
+
+.content fieldset
+{
+	margin:1.6em 0;
+	padding:1.6em;
+}
+
+/* \*/
+
+.content legend
+{
+	padding-left:.8em;
+	padding-right:.8em;
+}
+
+/* */
+
+@media all and (min-width: 0px) /* for Opera 8 */
+{ 
+	.content legend
+	{
+		margin-bottom:1.6em;
+	}
+	.content fieldset
+	{
+		margin-top:0;
+	}
+	.content[class^='content'] fieldset
+	{
+		margin-top:1.6em;
+	}
+}
+
+.content fieldset>*:first-child
+{
+	margin-top:0;
+}
+
+.content textarea,.content input[type='text']
+{
+	padding:.1em .2em;
+}
+
+.content input
+{
+	padding:.2em .1em;
+}
+
+.content select
+{
+	padding:.2em .1em 0;
+}
+
+.content select[multiple]
+{
+	margin-bottom:.8em;
+}
+
+.content option
+{
+	padding:0 .4em .1em;
+}
+
+.content button
+{
+	padding:.3em .5em;
+}
+
+.content input[type='radio']
+{
+	position:relative;
+	bottom:-.2em;
+}
+
+.content dt
+{
+	margin-top:.8em;
+	margin-bottom:.4em;
+}
+
+.content ul,.content ol
+{
+	margin-left:2.2em;
+}
+
+.content caption,.content form div
+{
+	padding-bottom:.8em;
+}
+
+.content ul ul,content ol ul,.content ul ol,content ol ol
+{
+	margin-bottom:0;
+}
+
+/*
+_______________________________
+END */

File doc/source/templates/index.html

+{% extends "layout.html" %}
+{% set title = 'bx python' %}
+{% block body %}
+  <h1>Welcome</h1>
+
+  <p>
+    
+    The <b>bx-python</b> project is a python library and associated set of scripts to allow for rapid implementation of genome scale analyses. The library contains a variety of useful modules, but the particular strengths are:
+
+    <ul>
+      <li>Classes for reading and working with genome-scale multiple local alignments (in MAF, AXT, and LAV formats)</li>
+     <li>Generic data structure for indexing on disk files that contain blocks of data associated with intervals on various sequences (used, for example, to provide random access to individual alignments in huge files; optomized for use over network filesystems)
+     </li>
+     <li>Data structures for working with intervals on sequences</li>
+     <li>"Binned bitsets" which act just like chromosome sized bit arrays, but lazily allocate regions and allow large blocks of all set or all unset bits to be stored compactly</li>
+     <li>"Intersecter" for performing fast intersection tests that preserve both query and target intervals and associated annotation </li>
+
+      These tools have been used in a variety of published research, and are a fundamental part of the ongoing Galaxy and ESPERR projects.
+      
+    </ul>
+    
+  </p>
+
+  <h1>Documentation</h1>
+
+  <ul>
+    <li><a href="{{ pathto("contents") }}">Contents</a></li>
+    <li><a href="{{ pathto("search") }}">Search</a></li>
+    <li><a href="{{ pathto("genindex") }}">General Index</a></li>
+    <li><a href="{{ pathto("modindex") }}">Module Index</a></li>
+    <li><a href="apidoc/index.html">API documentation</a></li>
+  </ul>
+
+{% endblock %}

File doc/source/templates/indexsidebar.html

+<h3>About bx-python</h3>
+
+<p>Current version: <b>{{ version }}</b></p>
+
+<h3>Download</h3>
+
+<p align="center">
+  <a href="http://bitbucket.org/james_taylor/bx-python">bx-python source</a>
+</p>

File doc/source/templates/layout.html

+{% extends "!layout.html" %}
+
+{%- block document %}
+    <div id="main">
+        <div class="inner">
+            <div id="title" class="content">
+                <h1 class="pageheader">
+                    <a href="{{pathto('index')}}">bx-python</a>
+                </h1>
+            </div>	
+            <div id="right">
+                <div class="content secondary sidebar">
+                    {{ relbar() }}
+                    {{ sidebar() }}
+                </div>
+            </div>
+            <div id="left" class="document">
+                <div class="documentwrapper">
+                    {%- if builder != 'htmlhelp' %}
+                      <div class="bodywrapper">
+                    {%- endif %}
+                    <div class="body content">
+                        {% block body %} {% endblock %}
+                    </div>
+                    {%- if builder != 'htmlhelp' %}
+                      </div>
+                    {%- endif %}
+                </div>
+            </div>
+        </div>
+    </div>
+{%- endblock %}
+
+{% block doctype %}
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+{% endblock %}
+
+{% block rootrellink %}
+        <li><a href="{{ pathto('index') }}">bx-python home</a></li>
+        <li><a href="{{ pathto('contents') }}">Table of contents</a></li>
+{% endblock %}
+
+{# Sidebar and already handled #}
+
+{% block relbar1 %}{% endblock %}
+{% block relbar2 %}{% endblock %}
+
+{% block sidebar1 %}{% endblock %}
+{% block sidebar2 %}{% endblock %}
+
+{% block footer %}{% endblock %}
 This file can also be run as a script to install or upgrade setuptools.
 """
 import sys
-DEFAULT_VERSION = "0.6c6"
-DEFAULT_URL     = "http://cheeseshop.python.org/packages/%s/s/setuptools/" % sys.version[:3]
+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.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.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:
-        from md5 import md5
         digest = md5(data).hexdigest()
         if digest != md5_data[egg_name]:
             print >>sys.stderr, (
             sys.exit(2)
     return data
 
-
 def use_setuptools(
     version=DEFAULT_VERSION, download_base=DEFAULT_URL, to_dir=os.curdir,
     download_delay=15
     this routine will print a message to ``sys.stderr`` and raise SystemExit in
     an attempt to abort the calling script.
     """
-    try:
-        import setuptools
-        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)
-    except ImportError:
+    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
-
-    import pkg_resources
     try:
-        pkg_resources.require("setuptools>="+version)
-
+        import pkg_resources
+    except ImportError:
+        return do_download()       
+    try:
+        pkg_resources.require("setuptools>="+version); return
     except pkg_resources.VersionConflict, e:
-        # XXX could we install in a subprocess here?
-        print >>sys.stderr, (
+        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.\n\n(Currently using %r)"
-        ) % (version, e.args[0])
-        sys.exit(2)
+            " 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,
             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:
                 os.unlink(egg)
     else:
         if setuptools.__version__ == '0.0.1':
-            # tell the user to uninstall obsolete version
-            use_setuptools(version)
+            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
             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
-    from md5 import md5
 
     for name in filenames:
         base = os.path.basename(name)
 
 
 
+

File lib/bx/__init__.py

 """
 Shamelessly ripped off of py.std
 """
+__version__ = '0.5.0'
 
 class Std( object ):
     def __init__( self ):

File lib/bx/align/sitemask/cpg.py

         
     def __call__( self, block ):
         if not block: return block
+        if len(block.components) < 2:
+            return
         cpglist = list_cpg_restricted( \
             string.upper(block.components[0].text), \
             string.upper(block.components[1].text) )
         
     def __call__( self, block ):
         if not block: return block
+        if len(block.components) < 2:
+            return
         cpglist = list_cpg( \
             string.upper(block.components[0].text), \
             string.upper(block.components[1].text) )
             
         return block
 
+#Mak nonCpG sites
+class nonCpG( Masker ):
+    def __init__( self, mask = '?' ):
+        self.mask = mask
+        self.masked = 0
+        self.total = 0
+        
+    def __call__( self, block ):
+        if not block: return block
+        if len(block.components) < 2:
+            return
+        noncpglist = list_non_cpg( \
+            string.upper(block.components[0].text), \
+            string.upper(block.components[1].text) )
+
+        # now we have a fast list of non-CpG columns, iterate/mask
+        self.masked += len(noncpglist)
+        self.total += len(block.components[0].text)
+        for component in block.components:
+            component.text = mask_columns( noncpglist, component.text, self.mask )
+            
+        return block
+    
 def mask_columns( masklist, text, mask ):
     templist = list()
     for position in masklist:

File lib/bx/align/sitemask/sitemask_tests.py

+"""
+Tests for `bx.align.maf.sitemask`.
+"""
+
+import sys,tempfile
+import unittest
+from StringIO import StringIO
+import cpg
+import bx.align.maf
+
+test_maf_cpg = """##maf version=1 scoring=none
+a score=0
+s apple  34 64 + 110 AGGGA---GTTCGTCACT------GTCGTAAGGGTTCAGA--CTGTCTATGTATACACAAGTTGTGTTGCA--ACCG
+s orange 19 61 - 100 AGGGATGCGTT--TCACTGCTATCGTCGTA----TTCAGACTTCG-CTATCT------GAGTTGT---GCATTACCG
+"""
+
+cpg_inclusive_result = [
+"##maf,version=1",
+"a,score=0",
+"s,apple,34,64,+,110,AGGGA---GTTCGTCACT------GT##TAAGGGTTCAGA--CTGTCTATGTATACACAAGTTGTGTTGCA--ACCG", 
+"s,orange,19,61,-,100,AGGGATG#GTT--TCACTGCTAT#GT##TA----TTCAGACTTCG-CTATCT------GAGTTGT---GCATTACCG" 
+]
+
+cpg_restricted_result = [
+"##maf,version=1",
+"a,score=0",
+"s,apple,34,64,+,110,A##GA---#TT##TC#C#------#T##TA###GTTC#GA--C##TC#A#G#ATAC####GT#G#GT#GC#--AC#G", 
+"s,orange,19,61,-,100,A##GA#G##TT--TC#C#GC#AT##T##TA----TTC#GAC#T##-C#A#C#------##GT#G#---GC#TTAC#G"                          
+]
+
+noncpg_result = [
+"##maf,version=1",
+"a,score=0",
+"s,apple,34,64,+,110,#GG##---G##CG##A#T------G#CG##AGG####A##--#TG##T#T#T####ACAA##T#T##T##A--##CG", 
+"s,orange,19,61,-,100,#GG##T#CG##--##A#T##T##CG#CG##----###A###T#CG-#T#T#T------GA##T#T---##A####CG" 
+]
+
+def test_cpg_inclusive():
+    reader = bx.align.maf.Reader( StringIO( test_maf_cpg ) )
+    out = tempfile.NamedTemporaryFile('w')
+    writer = bx.align.maf.Writer( out )
+    cpgfilter = cpg.Inclusive( mask='#' )
+    cpgfilter.run( reader, writer.write )
+    out.seek(0)
+    j=0
+    for line in file(out.name):
+        line = line.strip()
+        if not(line):
+            continue
+        assert cpg_inclusive_result[j] == ",".join(line.split())
+        j+=1
+    
+def test_cpg_restricted():
+    reader = bx.align.maf.Reader( StringIO( test_maf_cpg ) )
+    out = tempfile.NamedTemporaryFile('w')
+    writer = bx.align.maf.Writer( out )
+    cpgfilter = cpg.Restricted( mask='#' )
+    cpgfilter.run( reader, writer.write )
+    out.seek(0)
+    j=0
+    for line in file(out.name):
+        line = line.strip()
+        if not(line):
+            continue
+        assert cpg_restricted_result[j] == ",".join(line.split())
+        j+=1
+
+def test_non_cpg():
+    reader = bx.align.maf.Reader( StringIO( test_maf_cpg ) )
+    out = tempfile.NamedTemporaryFile('w')
+    writer = bx.align.maf.Writer( out )
+    cpgfilter = cpg.nonCpG( mask='#' )
+    cpgfilter.run( reader, writer.write )
+    out.seek(0)
+    j=0
+    for line in file(out.name):
+        line = line.strip()
+        if not(line):
+            continue
+        assert noncpg_result[j] == ",".join(line.split())
+        j+=1
+

File lib/bx/align/tools/chop.py

+"""
+Support for chopping a list of alignment blocks to only the portion that
+intersects a particular interval.
+"""
+
 def chop_list( blocks, src, start, end ):
+    """
+    For each alignment block in the sequence `blocks`, chop out the portion
+    of the block that overlaps the interval [`start`,`end`) in the
+    component/species named `src`.
+    """
     new_blocks = []
     for block in blocks: 
         ref = block.get_component_by_src( src )

File lib/bx/align/tools/fuse.py

     """
     Try to fuse a list of blocks by progressively fusing each adjacent pair.
     """
-    rval = []
     last = None
     for m in mafs:
         if last is None:
             if fused:
                 last = fused
             else:
-                rval.append( last )
+                yield last
                 last = m
-    if last: rval.append( last )
-    return rval
+    if last:
+        yield last
 
 def fuse( m1, m2 ):
     """
                 self.last = m
     def close( self ):
         if self.last: self.maf_writer.write( self.last )
-        self.maf_writer.close()
+        self.maf_writer.close()

File lib/bx/align/tools/thread.py

 """
-Tools for "threading" out specific species from aligments (removing other
+Tools for "threading" out specific species from alignments (removing other
 species and fixing alignment text).
 """
 
     
     >>> mafs = [ block1, block2 ]
     
-    >>> threaded = thread( mafs, [ "hg18", "panTro1" ] )
+    >>> threaded = [ t for t in thread( mafs, [ "hg18", "panTro1" ] ) ]
     
     >>> len( threaded )
     2
     <BLANKLINE>
     
     """
-    new = []
     for m in mafs:
         new_maf = deepcopy( m )
         new_components = get_components_for_species( new_maf, species )	
             remove_all_gap_columns( new_components )          
             new_maf.components = new_components
             new_maf.score = 0.0
-            new.append( new_maf )   
-    return new
+            new_maf.text_size = len(new_components[0].text)
+            yield new_maf
         
 def get_components_for_species( alignment, species ):
     """Return the component for each species in the list `species` or None"""

File lib/bx/arrays/__init__.py

+"""
+Classes for working with arrays of data.
+"""