-
Notifications
You must be signed in to change notification settings - Fork 4
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
157 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
thing count | ||
foo 1212 | ||
bar 232 | ||
baz 565 | ||
qux 999 |
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,5 @@ | ||
thing count | ||
foo 1212 | ||
bar 232 | ||
baz 565 | ||
qux 999 |
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,4 @@ | ||
x,y | ||
1,"this line has a comma, and a double "" quote" | ||
2,"this line has a comma, and an escaped \" quote" | ||
3,this line has a comment # don't read this |
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,78 @@ | ||
|
||
import pandas as pd | ||
|
||
from countess.plugins.hgvs_parser import HgvsParserPlugin | ||
from countess.core.logger import MultiprocessLogger | ||
|
||
logger = MultiprocessLogger() | ||
|
||
df1 = pd.DataFrame([ | ||
{'hgvs': 'NC_000017.11:g.[43124022G>C;43124175C>T;43124111A>G]', | ||
'guides': '43124022G>C;43124111A>G' } | ||
]) | ||
|
||
def test_hgvs_parser(): | ||
|
||
plugin = HgvsParserPlugin() | ||
plugin.set_parameter('column', 'hgvs') | ||
plugin.set_parameter('guides_col', 'guides') | ||
|
||
df = plugin.process_dataframe(df1, logger) | ||
|
||
assert df['var_1'].iloc[0] == '43124175C>T' | ||
assert df['guide_1'].iloc[0] == True | ||
assert df['guide_2'].iloc[0] == True | ||
|
||
def test_hgvs_parser_guides_str(): | ||
|
||
plugin = HgvsParserPlugin() | ||
plugin.set_parameter('column', 'hgvs') | ||
plugin.set_parameter('guides_str', '43124022G>C;43124111A>G') | ||
|
||
df = plugin.process_dataframe(df1, logger) | ||
|
||
assert df['var_1'].iloc[0] == '43124175C>T' | ||
assert df['guide_1'].iloc[0] == True | ||
assert df['guide_2'].iloc[0] == True | ||
|
||
def test_hgvs_parser_split(): | ||
plugin = HgvsParserPlugin() | ||
plugin.set_parameter('column', 'hgvs') | ||
plugin.set_parameter('guides_col', 'guides') | ||
plugin.set_parameter('split', True) | ||
|
||
df = plugin.process_dataframe(df1, logger) | ||
|
||
assert df['loc_1'].iloc[0] == '43124175' | ||
assert df['var_1'].iloc[0] == 'C>T' | ||
assert df['guide_1'].iloc[0] == True | ||
assert df['guide_2'].iloc[0] == True | ||
|
||
def test_hgvs_parser_multi(): | ||
|
||
plugin = HgvsParserPlugin() | ||
plugin.set_parameter('column', 'hgvs') | ||
plugin.set_parameter('guides_str', '43124022G>C') | ||
plugin.set_parameter('multi', True) | ||
plugin.set_parameter('max_var', 2) | ||
|
||
df = plugin.process_dataframe(df1, logger) | ||
|
||
assert df['var'].iloc[0] == '43124175C>T' | ||
assert df['var'].iloc[1] == '43124111A>G' | ||
|
||
def test_hgvs_parser_split_and_multi(): | ||
|
||
plugin = HgvsParserPlugin() | ||
plugin.set_parameter('column', 'hgvs') | ||
plugin.set_parameter('guides_str', '43124022G>C') | ||
plugin.set_parameter('split', True) | ||
plugin.set_parameter('multi', True) | ||
plugin.set_parameter('max_var', 2) | ||
|
||
df = plugin.process_dataframe(df1, logger) | ||
|
||
assert df['var'].iloc[0] == 'C>T' | ||
assert df['var'].iloc[1] == 'A>G' | ||
assert df['loc'].iloc[0] == '43124175' | ||
assert df['loc'].iloc[1] == '43124111' |