Skip to content

Commit

Permalink
added more unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriel Pratt committed Aug 28, 2012
1 parent 3200507 commit 70e59cd
Show file tree
Hide file tree
Showing 16 changed files with 306 additions and 182 deletions.
32 changes: 32 additions & 0 deletions clipper/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import os

def data_dir():
"""
Returns the data directory that contains files for data and
documentation.
"""
return os.path.join(os.path.dirname(__file__), 'data')


def test_dir():

"""
Returns the data directory that contains example files for tests and
documentation.
"""
return os.path.join(os.path.dirname(__file__), 'test')

def data_file(fn):
fn = os.path.join(data_dir(), fn)

if not os.path.exists(fn):
raise ValueError("%s does not exist")
return fn


def test_file(fn):
fn = os.path.join(data_dir(), fn)

if not os.path.exists(fn):
raise ValueError("%s does not exist")
return fn
Binary file modified clipper/__init__.pyc
Binary file not shown.
Binary file modified clipper/data/hg19.AS.STRUCTURE_genes.BED.gz
Binary file not shown.
Binary file added clipper/data/test.AS.STRUCTURE_genes.BED.gz
Binary file not shown.
5 changes: 5 additions & 0 deletions clipper/data/test.AS.STRUCTURE_mRNA.lengths
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ENSG00000232113 384
ENSG00000228150 323
ENSG00000223883 437
ENSG00000135750 3141
ENSG00000227280 212
5 changes: 5 additions & 0 deletions clipper/data/test.AS.STRUCTURE_premRNA.lengths
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ENSG00000232113 1147
ENSG00000228150 3088
ENSG00000223883 46051
ENSG00000135750 35997
ENSG00000227280 609
4 changes: 2 additions & 2 deletions clipper/src/call_peak.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ def call_peaks(loc, gene_length, bam_fileobj=None, bam_file=None,
"""

#setup
chrom, gene_name, tx_start, tx_end, signstrand = loc.split("|")
chrom, gene_name, tx_start, tx_end, signstrand = loc


#logic reading bam files
Expand Down Expand Up @@ -436,7 +436,7 @@ def peaks_from_info(wiggle, pos_counts, lengths, loc, gene_length,
#peak_dict['loc'] = loc

#data munging
chrom, gene_name, tx_start, tx_end, signstrand = loc.split("|")
chrom, gene_name, tx_start, tx_end, signstrand = loc
tx_start, tx_end = map(int, [tx_start, tx_end])

#used for poisson calclulation?
Expand Down
Loading

0 comments on commit 70e59cd

Please sign in to comment.