-
Notifications
You must be signed in to change notification settings - Fork 1
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 #3 from refgenie/dev
Release 0.2.0
- Loading branch information
Showing
48 changed files
with
1,559 additions
and
964 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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
name: Lint | ||
|
||
on: [pull_request] | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-python@v2 | ||
- uses: psf/black@stable |
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,21 @@ | ||
name: Run codecov | ||
|
||
on: | ||
pull_request: | ||
branches: [master] | ||
|
||
jobs: | ||
pytest: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
python-version: [3.9] | ||
os: [ubuntu-latest] | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Upload coverage to Codecov | ||
uses: codecov/codecov-action@v2 | ||
with: | ||
file: ./coverage.xml | ||
name: py-${{ matrix.python-version }}-${{ matrix.os }} |
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,30 @@ | ||
name: Run pytests | ||
|
||
on: | ||
pull_request: | ||
branches: [master, dev] | ||
|
||
jobs: | ||
pytest: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
python-version: ["3.8", "3.11"] | ||
os: [ubuntu-latest] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install test dependencies | ||
run: if [ -f requirements/requirements-test.txt ]; then pip install -r requirements/requirements-test.txt; fi | ||
|
||
- name: Install package | ||
run: python -m pip install . | ||
|
||
- name: Run pytest tests | ||
run: pytest tests -x -vv --cov=./ --cov-report=xml |
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 was deleted.
Oops, something went wrong.
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,55 @@ | ||
# from itertools import compress | ||
# from collections import Counter | ||
# overlap = sum((Counter(A) & Counter(B)).values()) | ||
# A=example1 | ||
# B=example4 | ||
# overlap | ||
# all = list(A) + list(set(B) - set(list(A))) | ||
# A_compressed = list(compress(A, B)) | ||
# B_compressed = list(compress(B, A)) | ||
# A_filtered = list(filter(lambda x: x in B, A)) | ||
# B_filtered = list(filter(lambda x: x in A, B)) | ||
# len(A_compressed) == len(B_compressed) | ||
# C_compressed = list(compress(C, A)) | ||
|
||
# from itertools import filter | ||
|
||
|
||
def array_overlap(A, B): | ||
A_filtered = list(filter(lambda x: x in B, A)) | ||
B_filtered = list(filter(lambda x: x in A, B)) | ||
A_count = len(A_filtered) | ||
B_count = len(B_filtered) | ||
overlap = min(len(A_filtered), len(B_filtered)) | ||
if A_count + B_count < 1: | ||
# order match requires at least 2 matching elements | ||
order = None | ||
elif not (A_count == B_count): | ||
# duplicated matches means order match is undefined | ||
order = None | ||
else: | ||
order = A_filtered == B_filtered | ||
return {"overlap": overlap, "order-match": order} | ||
|
||
|
||
example1 = ["A", "B", "C", "D"] | ||
example2 = ["A", "B", "C"] | ||
example3 = ["A", "B", "C", "B"] | ||
example4 = ["B", "B", "B", "B"] | ||
example5 = ["X", "A", "B", "Y", "C", "D", "E"] | ||
example6 = ["A", "B", "C", "D", "B"] | ||
example7 = ["A", "B", "C", "D", "A"] | ||
example8 = ["A", "B", "C", "D", "B", "A"] | ||
|
||
|
||
compatoverlap(example1, example2) | ||
compatoverlap(example1, example3) | ||
compatoverlap(example2, example3) | ||
compatoverlap(example1, example4) | ||
compatoverlap(example1, example5) | ||
compatoverlap(example3, example5) | ||
compatoverlap(example5, example3) | ||
compatoverlap(example3, example6) | ||
compatoverlap(example6, example7) | ||
compatoverlap(example7, example8) | ||
compatoverlap(example8, example8) |
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,38 @@ | ||
{ | ||
"array_elements":{ | ||
"a":{ | ||
"lengths":3, | ||
"names":3, | ||
"sequences":3, | ||
"sorted_name_length_pairs":3 | ||
}, | ||
"a_and_b":{ | ||
"lengths":2, | ||
"names":2, | ||
"sequences":0, | ||
"sorted_name_length_pairs":2 | ||
}, | ||
"a_and_b_same_order":{ | ||
"lengths":true, | ||
"names":true, | ||
"sequences":null, | ||
"sorted_name_length_pairs":true | ||
}, | ||
"b":{ | ||
"lengths":2, | ||
"names":2, | ||
"sequences":2, | ||
"sorted_name_length_pairs":2 | ||
} | ||
}, | ||
"attributes":{ | ||
"a_and_b":[ | ||
"lengths", | ||
"names", | ||
"sequences", | ||
"sorted_name_length_pairs" | ||
], | ||
"a_only":[], | ||
"b_only":[] | ||
} | ||
} |
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,38 @@ | ||
{ | ||
"array_elements":{ | ||
"a":{ | ||
"lengths":2, | ||
"names":2, | ||
"sequences":2, | ||
"sorted_name_length_pairs":2 | ||
}, | ||
"a_and_b":{ | ||
"lengths":2, | ||
"names":2, | ||
"sequences":2, | ||
"sorted_name_length_pairs":2 | ||
}, | ||
"a_and_b_same_order":{ | ||
"lengths":true, | ||
"names":true, | ||
"sequences":true, | ||
"sorted_name_length_pairs":true | ||
}, | ||
"b":{ | ||
"lengths":2, | ||
"names":2, | ||
"sequences":2, | ||
"sorted_name_length_pairs":2 | ||
} | ||
}, | ||
"attributes":{ | ||
"a_and_b":[ | ||
"lengths", | ||
"names", | ||
"sequences", | ||
"sorted_name_length_pairs" | ||
], | ||
"a_only":[], | ||
"b_only":[] | ||
} | ||
} |
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,38 @@ | ||
{ | ||
"array_elements":{ | ||
"a":{ | ||
"lengths":3, | ||
"names":3, | ||
"sequences":3, | ||
"sorted_name_length_pairs":3 | ||
}, | ||
"a_and_b":{ | ||
"lengths":3, | ||
"names":3, | ||
"sequences":3, | ||
"sorted_name_length_pairs":3 | ||
}, | ||
"a_and_b_same_order":{ | ||
"lengths":false, | ||
"names":false, | ||
"sequences":false, | ||
"sorted_name_length_pairs":true | ||
}, | ||
"b":{ | ||
"lengths":3, | ||
"names":3, | ||
"sequences":3, | ||
"sorted_name_length_pairs":3 | ||
} | ||
}, | ||
"attributes":{ | ||
"a_and_b":[ | ||
"lengths", | ||
"names", | ||
"sequences", | ||
"sorted_name_length_pairs" | ||
], | ||
"a_only":[], | ||
"b_only":[] | ||
} | ||
} |
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,6 @@ | ||
>chrX | ||
TTGGGGAA | ||
>chr1 | ||
GGAA | ||
>chr2 | ||
GCGC |
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,3 @@ | ||
chrX 8 6 8 9 | ||
chr1 4 21 4 5 | ||
chr2 4 32 4 5 |
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,2 @@ | ||
chr1 4 6 4 5 | ||
chr2 4 17 4 5 |
Binary file not shown.
Binary file not shown.
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,6 @@ | ||
>chrX | ||
TTGGGGAA | ||
>chr1 | ||
GGAA | ||
>chr2 | ||
GCGC |
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,3 @@ | ||
chrX 8 6 8 9 | ||
chr1 4 21 4 5 | ||
chr2 4 32 4 5 |
Oops, something went wrong.