-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update
cstag.to_html
to represent repeat substitutions
- Loading branch information
Showing
6 changed files
with
313 additions
and
13 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
|
||
setuptools.setup( | ||
name="cstag", | ||
version="0.2.3", | ||
version="0.3.0", | ||
author="Akihiro Kuno", | ||
author_email="[email protected]", | ||
description="Python module to manipulate the minimap2's CS tag", | ||
|
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 |
---|---|---|
@@ -0,0 +1,87 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
|
||
<head> | ||
<style> | ||
h1 { | ||
font-family: Consolas, 'Courier New', monospace; | ||
color: #333; | ||
padding: 0.1em 0; | ||
border-top: solid 3px #333; | ||
border-bottom: solid 3px #333; | ||
} | ||
|
||
.p_seq { | ||
font-family: Consolas, 'Courier New', monospace; | ||
color: #585858; | ||
word-wrap: break-word; | ||
letter-spacing: 0.15em; | ||
} | ||
|
||
.p_legend { | ||
font-family: Consolas, 'Courier New', monospace; | ||
color: #585858; | ||
word-wrap: break-word; | ||
} | ||
|
||
.Ins { | ||
color: #333; | ||
border: 0.1em solid; | ||
background-color: #ee827c; | ||
font-weight: bold; | ||
# border-radius: 5px; | ||
} | ||
|
||
.Del { | ||
color: #333; | ||
border: 0.1em solid; | ||
background-color: #a0d8ef; | ||
font-weight: bold; | ||
# border-radius: 5px; | ||
} | ||
|
||
.Sub { | ||
color: #333; | ||
border: 0.1em solid; | ||
background-color: #98d98e; | ||
font-weight: bold; | ||
# border-radius: 5px; | ||
} | ||
|
||
.Splice { | ||
color: #333; | ||
border: 0.1em solid; | ||
background-color: #f8e58c; | ||
font-weight: bold; | ||
} | ||
|
||
.Unknown { | ||
color: #333; | ||
border: 0.1em solid; | ||
background-color: #c0c6c9; | ||
font-weight: bold; | ||
# border-radius: 5px; | ||
} | ||
|
||
</style> | ||
</head> | ||
|
||
<body> | ||
|
||
<h1>Example</h1> | ||
|
||
<p class="p_legend"> | ||
Labels: | ||
<span class="Ins">Insertion</span> | ||
<span class="Del">Deletion</span> | ||
<span class="Sub">Substitution</span> | ||
<span class="Splice">Splicing</span> | ||
<span class="Unknown">Unknown</span> | ||
</p> | ||
<hr> | ||
|
||
<p class='p_seq'>A<span class='Sub'>TG</span>A</p> | ||
|
||
</body> | ||
|
||
</html> |
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 |
---|---|---|
@@ -0,0 +1,87 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
|
||
<head> | ||
<style> | ||
h1 { | ||
font-family: Consolas, 'Courier New', monospace; | ||
color: #333; | ||
padding: 0.1em 0; | ||
border-top: solid 3px #333; | ||
border-bottom: solid 3px #333; | ||
} | ||
|
||
.p_seq { | ||
font-family: Consolas, 'Courier New', monospace; | ||
color: #585858; | ||
word-wrap: break-word; | ||
letter-spacing: 0.15em; | ||
} | ||
|
||
.p_legend { | ||
font-family: Consolas, 'Courier New', monospace; | ||
color: #585858; | ||
word-wrap: break-word; | ||
} | ||
|
||
.Ins { | ||
color: #333; | ||
border: 0.1em solid; | ||
background-color: #ee827c; | ||
font-weight: bold; | ||
# border-radius: 5px; | ||
} | ||
|
||
.Del { | ||
color: #333; | ||
border: 0.1em solid; | ||
background-color: #a0d8ef; | ||
font-weight: bold; | ||
# border-radius: 5px; | ||
} | ||
|
||
.Sub { | ||
color: #333; | ||
border: 0.1em solid; | ||
background-color: #98d98e; | ||
font-weight: bold; | ||
# border-radius: 5px; | ||
} | ||
|
||
.Splice { | ||
color: #333; | ||
border: 0.1em solid; | ||
background-color: #f8e58c; | ||
font-weight: bold; | ||
} | ||
|
||
.Unknown { | ||
color: #333; | ||
border: 0.1em solid; | ||
background-color: #c0c6c9; | ||
font-weight: bold; | ||
# border-radius: 5px; | ||
} | ||
|
||
</style> | ||
</head> | ||
|
||
<body> | ||
|
||
<h1>Example</h1> | ||
|
||
<p class="p_legend"> | ||
Labels: | ||
<span class="Ins">Insertion</span> | ||
<span class="Del">Deletion</span> | ||
<span class="Sub">Substitution</span> | ||
<span class="Splice">Splicing</span> | ||
<span class="Unknown">Unknown</span> | ||
</p> | ||
<hr> | ||
|
||
<p class='p_seq'>A<span class='Sub'>TG</span></p> | ||
|
||
</body> | ||
|
||
</html> |
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 |
---|---|---|
@@ -0,0 +1,87 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
|
||
<head> | ||
<style> | ||
h1 { | ||
font-family: Consolas, 'Courier New', monospace; | ||
color: #333; | ||
padding: 0.1em 0; | ||
border-top: solid 3px #333; | ||
border-bottom: solid 3px #333; | ||
} | ||
|
||
.p_seq { | ||
font-family: Consolas, 'Courier New', monospace; | ||
color: #585858; | ||
word-wrap: break-word; | ||
letter-spacing: 0.15em; | ||
} | ||
|
||
.p_legend { | ||
font-family: Consolas, 'Courier New', monospace; | ||
color: #585858; | ||
word-wrap: break-word; | ||
} | ||
|
||
.Ins { | ||
color: #333; | ||
border: 0.1em solid; | ||
background-color: #ee827c; | ||
font-weight: bold; | ||
# border-radius: 5px; | ||
} | ||
|
||
.Del { | ||
color: #333; | ||
border: 0.1em solid; | ||
background-color: #a0d8ef; | ||
font-weight: bold; | ||
# border-radius: 5px; | ||
} | ||
|
||
.Sub { | ||
color: #333; | ||
border: 0.1em solid; | ||
background-color: #98d98e; | ||
font-weight: bold; | ||
# border-radius: 5px; | ||
} | ||
|
||
.Splice { | ||
color: #333; | ||
border: 0.1em solid; | ||
background-color: #f8e58c; | ||
font-weight: bold; | ||
} | ||
|
||
.Unknown { | ||
color: #333; | ||
border: 0.1em solid; | ||
background-color: #c0c6c9; | ||
font-weight: bold; | ||
# border-radius: 5px; | ||
} | ||
|
||
</style> | ||
</head> | ||
|
||
<body> | ||
|
||
<h1>Example</h1> | ||
|
||
<p class="p_legend"> | ||
Labels: | ||
<span class="Ins">Insertion</span> | ||
<span class="Del">Deletion</span> | ||
<span class="Sub">Substitution</span> | ||
<span class="Splice">Splicing</span> | ||
<span class="Unknown">Unknown</span> | ||
</p> | ||
<hr> | ||
|
||
<p class='p_seq'><span class='Sub'>TG</span>A</p> | ||
|
||
</body> | ||
|
||
</html> |
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,13 +1,49 @@ | ||
import os | ||
from pathlib import Path | ||
import filecmp | ||
import tempfile | ||
from src.cstag import to_html | ||
|
||
|
||
def test_html(): | ||
cs = "cs:Z:=AC+GGG=T-ACGT*at~gt10cg=GNNN" | ||
description = "Example" | ||
cs_html = to_html(cs, description) | ||
output = tempfile.NamedTemporaryFile().name | ||
Path(output).write_text(cs_html) | ||
assert filecmp.cmp(output, Path("tests", "data", "to_html", "report.html")) | ||
|
||
def test_html_repeat_substitution(): | ||
cs = "cs:Z:=A*at*ag=A" | ||
description = "Example" | ||
cs_html = to_html(cs, description) | ||
test = [h for h in cs_html.split("\n") if h.count("<p class='p_seq'>")] | ||
test = test[0].split() | ||
answer = Path("tests", "data", "to_html", "report_substitution.html").read_text().split("\n") | ||
answer = [h for h in answer if h.count(r"<p class='p_seq'>")] | ||
answer = answer[0].split() | ||
assert test == answer | ||
|
||
|
||
def test_html_repeat_substitution_start(): | ||
cs = "cs:Z:*at*ag=A" | ||
description = "Example" | ||
cs_html = to_html(cs, description) | ||
test = [h for h in cs_html.split("\n") if h.count("<p class='p_seq'>")] | ||
test = test[0].split() | ||
answer = Path("tests", "data", "to_html", "report_substitution_start.html").read_text().split("\n") | ||
answer = [h for h in answer if h.count(r"<p class='p_seq'>")] | ||
answer = answer[0].split() | ||
assert test == answer | ||
|
||
|
||
def test_html_repeat_substitution_end(): | ||
cs = "cs:Z:=A*at*ag" | ||
description = "Example" | ||
to_html(cs, output, description) | ||
cs_html = to_html(cs, description) | ||
test = [h for h in cs_html.split("\n") if h.count("<p class='p_seq'>")] | ||
test = test[0].split() | ||
answer = Path("tests", "data", "to_html", "report_substitution_end.html").read_text().split("\n") | ||
answer = [h for h in answer if h.count(r"<p class='p_seq'>")] | ||
answer = answer[0].split() | ||
assert test == answer | ||
|
||
assert filecmp.cmp(output + ".html", os.path.join("tests", "data", "to_html", "report.html")) |