-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
152 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,52 @@ | ||
import os.path as osp | ||
from coolbox.api import * | ||
|
||
HERE = osp.dirname(osp.abspath(__file__)) | ||
DATA_DIR = f"{HERE}/test_data" | ||
test_interval = "chr9:4000000-6000000" | ||
empty_interval = "chr10:4000000-6000000" | ||
test_itv = test_interval.replace(':', '_').replace('-', '_') | ||
|
||
|
||
def test_vlines(): | ||
def test_vlines(test_interval, tmp_dir): | ||
vlines = Vlines([("chr9", 4000000), | ||
"chr9:5000000-6000000", | ||
("chr1", 4000000)]) | ||
with vlines: | ||
frame = XAxis() + XAxis() | ||
fig = frame.plot(test_interval) | ||
fig.savefig("/tmp/test_coolbox_vline.pdf") | ||
fig.savefig(f"{tmp_dir}/test_coolbox_vline.pdf") | ||
|
||
|
||
def test_highlights(): | ||
def test_highlights(test_interval, tmp_dir): | ||
highlights = HighLights([ | ||
("chr9", 4000000, 5000000), | ||
"chr9:5000000-6000000", | ||
]) | ||
with highlights: | ||
frame = XAxis() + XAxis() | ||
fig = frame.plot(test_interval) | ||
fig.savefig("/tmp/test_coolbox_highlights.pdf") | ||
fig = frame.plot(test_interval, close_fig=False) | ||
fig.savefig(f"{tmp_dir}/test_coolbox_highlights.pdf") | ||
|
||
|
||
def test_bigwig_coverage(): | ||
def test_bigwig_coverage(data_dir, test_itv, test_interval, tmp_dir): | ||
frame = XAxis() +\ | ||
BigWig(f"{DATA_DIR}/bigwig_{test_itv}.bw", style="line:1") + \ | ||
BigWigCoverage(f"{DATA_DIR}/bigwig_{test_itv}.bw", style="fill", color="red", alpha=0.3) +\ | ||
BigWigCoverage(f"{DATA_DIR}/bigwig_{test_itv}.bw", style="fill", color="blue", alpha=0.3) | ||
BigWig(f"{data_dir}/bigwig_{test_itv}.bw", style="line:1") + \ | ||
BigWigCoverage(f"{data_dir}/bigwig_{test_itv}.bw", style="fill", color="red", alpha=0.3) +\ | ||
BigWigCoverage(f"{data_dir}/bigwig_{test_itv}.bw", style="fill", color="blue", alpha=0.3) | ||
fig = frame.plot(test_interval) | ||
fig.savefig("/tmp/test_coolbox_bwcov.pdf") | ||
fig.savefig(f"{tmp_dir}/test_coolbox_bwcov.pdf") | ||
|
||
|
||
def test_arcs_coverage(): | ||
def test_arcs_coverage(data_dir, test_itv, test_interval, tmp_dir): | ||
frame = XAxis() + \ | ||
BigWig(f"{DATA_DIR}/bigwig_{test_itv}.bw", style="fill", alpha=0.5) + \ | ||
ArcsCoverage(f"{DATA_DIR}/bedpe_{test_itv}.bedpe") | ||
BigWig(f"{data_dir}/bigwig_{test_itv}.bw", style="fill", alpha=0.5) + \ | ||
ArcsCoverage(f"{data_dir}/bedpe_{test_itv}.bedpe") | ||
fig = frame.plot(test_interval) | ||
fig.savefig("/tmp/test_coolbox_arcscov.pdf") | ||
fig.savefig(f"{tmp_dir}/test_coolbox_arcscov.pdf") | ||
|
||
|
||
def test_tad_coverage(): | ||
def test_tad_coverage(data_dir, test_itv, test_interval, tmp_dir): | ||
frame = XAxis() + \ | ||
Cool(f"{DATA_DIR}/cool_{test_itv}.mcool") + \ | ||
TADCoverage(f"{DATA_DIR}/tad_{test_itv}.bed") | ||
Cool(f"{data_dir}/cool_{test_itv}.mcool") + \ | ||
TADCoverage(f"{data_dir}/tad_{test_itv}.bed") | ||
fig = frame.plot(test_interval) | ||
fig.savefig("/tmp/test_coobox_tadcov.pdf") | ||
fig.savefig(f"{tmp_dir}/test_coobox_tadcov.pdf") | ||
|
||
|
||
if __name__ == '__main__': | ||
test_highlights(GenomeRange("chr9:3000000-7000000"), "/tmp") | ||
#test_vlines(GenomeRange("chr9:4000000-6000000"), "/tmp") |
Oops, something went wrong.