Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
jpiper committed Dec 9, 2013
2 parents aa94ae0 + cb869ba commit aec49a2
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 15 deletions.
8 changes: 7 additions & 1 deletion CHANGES
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
0.1.2 - 2013-12-09
==================
Fix issue where BED intervals with chromosome names not starting with "c" were silently being ignored (reported by Aaron Hardin)
Fix clint dependency issue (no longer requires custom version of clint)
Fix spelling error in CHANGES

0.1.1 - 2013-12-05
==================
Misc. small bug fixes
Fixed Python 2.6 Compatability
Fixed Python 2.6 Compatibility
Added JSON export script

0.1.0 - 2013-09-01
Expand Down
10 changes: 8 additions & 2 deletions examples/example.bed
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
track name=exampleFile description="This is an example" useScore=1
chr6 170863142 170863532 0 0 +
#This is a comment line and should be ignored.
#The following lines should also be ignores as they are valid BED Headers
browser position chr6:170863142-170863532
browser hide all
track name="ItemRGBDemo" description="Item RGB demonstration" visibility=2
itemRgb="On"
visibility=2 colorByStrand="255,0,0 0,0,255"
chr6 170863142 170863532 0 0 +
34 changes: 27 additions & 7 deletions pyDNase/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
__version__ = "0.1.1"
__version__ = "0.1.2"

import os
import numpy as np
Expand Down Expand Up @@ -246,12 +246,12 @@ def loadBEDFile(self,filename):

#This is done so that if a malformed BED record is detected, no intervals are loaded.
records = []

intervalCount = max(enumerate(open(filename)))[0] + 1
for _ in progress.bar(range(intervalCount)):
line = BEDfile.readline()
#NOTE! Assume that lines not starting with c are comments or track descriptions.
if line[0] == "c":
#Skip lines in the bed files which are UCSC track metadata or comments
if not self.__isBEDHeader(line):
records.append(self.__parseBEDString(line))

for i in records:
Expand All @@ -270,6 +270,22 @@ def __malformedBEDline(self,BEDString):
exceptionString = "Malformed BED line: {0}".format(BEDString)
raise Exception(exceptionString)

def __isBEDHeader(self,string):
"""
Returns True/False whether a line in a bed file should be ignored according to
http://genome.ucsc.edu/goldenPath/help/customTrack.html#TRACK
"""
if string[0] == "#":
return True

headers = ["name","description","type","visibility","color","itemRgb","useScore","group",
"priority","db","offset","maxItems","url","htmlUrl","bigDataUrl","track","browser"]

for each in headers:
if string.startswith(each):
return True
return False

def __parseBEDString(self,BEDString):
"""
Parses the following BED formats
Expand All @@ -292,9 +308,13 @@ def __parseBEDString(self,BEDString):
self.__malformedBEDline(BEDString)

#Default if only Chrom Start End is detected
chrom = BEDSplit[0]
startbp = int(BEDSplit[1])
endbp = int(BEDSplit[2])
try:
chrom = BEDSplit[0]
startbp = int(BEDSplit[1])
endbp = int(BEDSplit[2])
except:
self.__malformedBEDline(BEDString)

label = 0
score = 0
strand = "+"
Expand Down
7 changes: 2 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

setup(
name='pyDNase',
version="0.1.1",
version="0.1.2",
description='DNase-seq analysis library',
long_description=open('README.rst',"rt").read(),
author='Jason Piper',
Expand All @@ -29,15 +29,12 @@
'pyDNase.footprinting',
],

#Uses a custom version of clint that has a time estimator on the progress bar
dependency_links = ["http://github.com/jpiper/clint/tarball/develop#egg=clint-0.3.0p"],

install_requires=[
"numpy",
"scipy",
"matplotlib",
"pysam",
"clint==0.3.0p"
"clint"
],

package_data = {'pyDNase':["data/*"]},
Expand Down

0 comments on commit aec49a2

Please sign in to comment.