Skip to content

Commit

Permalink
Added def test_r_bamcoverage_RPKM_with_effectivegenomesize_and_scalef…
Browse files Browse the repository at this point in the history
…actor():
  • Loading branch information
gerikson committed Jan 20, 2025
1 parent 3f207df commit 74e5313
Showing 1 changed file with 45 additions and 2 deletions.
47 changes: 45 additions & 2 deletions pydeeptools/deeptools/test/test_r_bamcoverage.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
from deeptools.hp import r_bamcoverage
from deeptools.bamCoverage2 import r_bamcoverage
import os.path
import filecmp
from os import unlink
Expand Down Expand Up @@ -136,4 +136,47 @@ def test_r_bamcoverage_RPKM_with_effectivegenomesize():
resp = _foo.readlines()
_foo.close()
assert f"{resp}" == f"{expected}", f"{resp} != {expected}"
unlink(ofile)
unlink(ofile)

def test_r_bamcoverage_RPKM_with_effectivegenomesize_and_scalefactor():
bamifile = BAMFILE_B
ofile = ROOT + "testB.bedgraph"
ofiletype = "bedgraph"
norm = "RPKM"
effectivegenomesize = 142573017
scalefactor = 2.0
mnase = False
offset = [1, -1] # Adjusted to a regular Python list
extendreads = 0
centerreads = False
filterrnastrand = "none"
blacklist = ""
ignorechr = []
skipnoncovregions = False
smoothlength = 0
binsize = 50
ignoreduplicates = False
minmappingquality = 0
samflaginclude = 0
samflagexclude = 0
minfraglen = 0
maxfraglen = 0
nproc = 1
regions = []
verbose = False


# Call the Rust function
r_bamcoverage(
bamifile, ofile, ofiletype, norm, effectivegenomesize, scalefactor, mnase, offset, extendreads,
centerreads, filterrnastrand, blacklist, ignorechr, skipnoncovregions, smoothlength,
binsize, ignoreduplicates, minmappingquality, samflaginclude, samflagexclude, minfraglen, maxfraglen,
nproc, regions, verbose
)
# Add assertions to verify the expected behavior
expected = ['3R\t0\t50\t0\n', '3R\t50\t150\t2\n', '3R\t150\t200\t4\n']
_foo = open(ofile, 'r')
resp = _foo.readlines()
_foo.close()
assert f"{resp}" == f"{expected}", f"{resp} != {expected}"
unlink(ofile)

0 comments on commit 74e5313

Please sign in to comment.