-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #87 from MaozGelbart/motifpssm_fixes
FIX: MotifPssmPattern load from file now loads correctly
- Loading branch information
Showing
4 changed files
with
85 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
MEME version 4 | ||
|
||
ALPHABET= ACGT | ||
|
||
strands: + - | ||
|
||
Background letter frequencies | ||
A 0.25 C 0.25 G 0.25 T 0.25 | ||
|
||
MOTIF MA0016.1 MA0016.1.usp | ||
letter-probability matrix: alength= 4 w= 10 nsites= 38 E= 0 | ||
0.000000 0.026316 0.973684 0.000000 | ||
0.026316 0.000000 0.947368 0.026316 | ||
0.000000 0.000000 1.000000 0.000000 | ||
0.000000 0.000000 1.000000 0.000000 | ||
0.000000 0.000000 0.000000 1.000000 | ||
0.000000 0.947368 0.026316 0.026316 | ||
0.921053 0.000000 0.078947 0.000000 | ||
0.131579 0.657895 0.078947 0.131579 | ||
0.131579 0.210526 0.578947 0.078947 | ||
0.157895 0.263158 0.421053 0.157895 | ||
URL http://jaspar.genereg.net/matrix/MA0016.1 | ||
|
||
MOTIF MA0011.2 MA0011.2.br | ||
letter-probability matrix: alength= 4 w= 6 nsites= 12 E= 0 | ||
0.000000 0.833333 0.000000 0.166667 | ||
0.000000 0.083333 0.000000 0.916667 | ||
1.000000 0.000000 0.000000 0.000000 | ||
0.083333 0.083333 0.166667 0.666667 | ||
0.166667 0.000000 0.083333 0.750000 | ||
0.083333 0.166667 0.083333 0.666667 | ||
URL http://jaspar.genereg.net/matrix/MA0011.2 | ||
|
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,19 @@ | ||
MEME version 4 | ||
|
||
ALPHABET= ACGT | ||
|
||
strands: + - | ||
|
||
Background letter frequencies | ||
A 0.25 C 0.25 G 0.25 T 0.25 | ||
|
||
MOTIF MA0011.2 MA0011.2.br | ||
letter-probability matrix: alength= 4 w= 6 nsites= 12 E= 0 | ||
0.000000 0.833333 0.000000 0.166667 | ||
0.000000 0.083333 0.000000 0.916667 | ||
1.000000 0.000000 0.000000 0.000000 | ||
0.083333 0.083333 0.166667 0.666667 | ||
0.166667 0.000000 0.083333 0.750000 | ||
0.083333 0.166667 0.083333 0.666667 | ||
URL http://jaspar.genereg.net/matrix/MA0011.2 | ||
|
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,9 +1,39 @@ | ||
from dnachisel.SequencePattern import SequencePattern | ||
import pytest | ||
from pathlib import Path | ||
|
||
from dnachisel import SequencePattern, MotifPssmPattern | ||
|
||
|
||
@pytest.fixture | ||
def test_single_motif_filepath(): | ||
return str(Path(__file__).parent / 'data' / 'single_motif.meme.txt') | ||
|
||
|
||
@pytest.fixture | ||
def test_multiple_motif_filepath(): | ||
return str(Path(__file__).parent / 'data' / 'multiple_motifs.meme.txt') | ||
|
||
|
||
def test_patterns_from_string(): | ||
pattern = SequencePattern.from_string("6xT") | ||
assert pattern.expression == "TTTTTT" | ||
pattern = SequencePattern.from_string("BsmBI_site") | ||
assert pattern.expression == "CGTCTC" | ||
pattern = SequencePattern.from_string("5x2mer") | ||
assert pattern.expression == '([ATGC]{2})\\1{4}' | ||
assert pattern.expression == '([ATGC]{2})\\1{4}' | ||
|
||
|
||
def test_pssm_pattern_from_file( | ||
test_single_motif_filepath, test_multiple_motif_filepath | ||
): | ||
single_pattern = MotifPssmPattern.list_from_file( | ||
test_single_motif_filepath, "minimal", relative_threshold=0.9 | ||
) | ||
assert len(single_pattern) == 1 | ||
assert all([isinstance(p, MotifPssmPattern) for p in single_pattern]) | ||
|
||
multiple_patterns = MotifPssmPattern.list_from_file( | ||
test_multiple_motif_filepath, "minimal", relative_threshold=0.9 | ||
) | ||
assert len(multiple_patterns) == 2 | ||
assert all([isinstance(p, MotifPssmPattern) for p in multiple_patterns]) |