-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Additive and Dominant encoding are implemented and tested
- Loading branch information
Showing
4 changed files
with
67 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 |
---|---|---|
@@ -1,10 +1,30 @@ | ||
""" | ||
Test GenotypeArray methods | ||
""" | ||
import pandas as pd | ||
import pytest | ||
|
||
|
||
# Custom Tests | ||
@pytest.mark.xfail(raises=ValueError) | ||
def test_encoding_additive(data): | ||
def test_encoding_extra_alt(data): | ||
"""Fail encoding when there are multiple alt alleles""" | ||
data.encode_additive() | ||
|
||
|
||
def test_encoding_additive(data_for_encoding): | ||
expected = pd.array([0, 1, 2, None], dtype='UInt8') | ||
result = data_for_encoding.encode_additive() | ||
assert (result == expected).all() | ||
# Test using series accessor | ||
result_series = pd.Series(data_for_encoding).genotype.encode_additive() | ||
assert (pd.Series(result) == result_series).all() | ||
|
||
|
||
def test_encoding_dominant(data_for_encoding): | ||
expected = pd.array([0, 1, 1, None], dtype='UInt8') | ||
result = data_for_encoding.encode_dominant() | ||
assert (result == expected).all() | ||
# Test using series accessor | ||
result_series = pd.Series(data_for_encoding).genotype.encode_dominant() | ||
assert (pd.Series(result) == result_series).all() | ||
|