Skip to content

Commit

Permalink
Added 1 bamCompare function
Browse files Browse the repository at this point in the history
  • Loading branch information
gerikson committed Jan 20, 2025
1 parent 74e5313 commit fa70398
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions pydeeptools/deeptools/test/test_r_bamCompare.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import pytest
from deeptools.bamCompare2 import r_bamcompare
import os.path
import filecmp
from os import unlink

ROOT = os.path.dirname(os.path.abspath(__file__)) + "/test_data/"
BAMFILE_A = ROOT + "test1.bam"
BAMFILE_B = ROOT + "test2.bam"


def test_r_bamcompare():
bamifile1 = BAMFILE_A
bamifile2 = BAMFILE_B
ofile = ROOT + "r_bamcompare_output.bedgraph"
ofiletype = "bedgraph"
norm = "None"
effective_genome_size = 0
scalefactorsmethod = "None"
operation = "ratio"
pseudocount = 0
# filtering options
ignoreduplicates = False
minmappingquality = 0
samflaginclude = 0
samflagexclude = 0
minfraglen = 0
maxfraglen = 0
nproc = 1
_ignorechr = []
binsize = 500
regions = []
verbose = False

# Call the Rust function
r_bamcompare(
bamifile1, bamifile2, ofile, ofiletype, norm, effective_genome_size, scalefactorsmethod, operation,
pseudocount, ignoreduplicates, minmappingquality, samflaginclude, samflagexclude, minfraglen, maxfraglen, nproc,
_ignorechr, binsize, regions, verbose
)
# Add assertions to verify the expected behavior
expected = ['3R\t0\t500\t0.6213592\n',
'3R\t500\t1000\t0.8252427\n',
'3R\t1000\t1500\t0.2\n',]
_foo = open(ofile, 'r')
resp = _foo.readlines()
_foo.close()
assert f"{resp}" == f"{expected}", f"{resp} != {expected}"
unlink(ofile)

0 comments on commit fa70398

Please sign in to comment.