Skip to content
This repository has been archived by the owner on Mar 9, 2022. It is now read-only.

v1.0.1a1 #14

Merged
merged 189 commits into from
Dec 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
189 commits
Select commit Hold shift + click to select a range
3b6b166
Added zenodo shield.
ggirelli Feb 26, 2021
324d386
Bump rich from 9.12.0 to 9.12.3 (#11)
dependabot[bot] Mar 1, 2021
797e088
Bump rich from 9.12.3 to 9.12.4 (#12)
dependabot[bot] Mar 2, 2021
2bd9484
Bump pandas from 1.2.2 to 1.2.3 (#13)
dependabot[bot] Mar 3, 2021
17262e6
Added parser functions for HUSH, oligo-melting, and OligoArrayAux
ggirelli Mar 4, 2021
3327bfc
Added assert for dtype compatibility
ggirelli Mar 4, 2021
d612345
Added dtypes and expected database columns
ggirelli Mar 4, 2021
08cc43d
Changed entry points for db related actions
ggirelli Mar 4, 2021
82add47
Implemented db make script
ggirelli Mar 4, 2021
b3b6a9d
Added final message.
ggirelli Mar 4, 2021
2bfc2a2
Cosmetic changes.
ggirelli Mar 4, 2021
3695b11
Added interface for database-related scripts.
ggirelli Mar 4, 2021
3fea634
Cleaned
ggirelli Mar 4, 2021
5436c94
Added basic info script
ggirelli Mar 4, 2021
a983756
Added DataBase and Record classes
ggirelli Mar 4, 2021
84cdbe5
Simplified using DataBase class.
ggirelli Mar 4, 2021
02c87f4
Prepared to store other information on chromosomes (e.g., record no)
ggirelli Mar 4, 2021
578c2be
Implemented script to dump tsv to std.
ggirelli Mar 4, 2021
7dc0307
Updated chromosome-related asserts, logs, and properties
ggirelli Mar 4, 2021
23cb4a8
Added header printing and tqdm progression
ggirelli Mar 4, 2021
876f5bf
Added chromosome prefix option. Switched from defaultdict to dict for…
ggirelli Mar 4, 2021
85b5ea4
Added dump description
ggirelli Mar 4, 2021
1a6fbe0
Added record sorting step.
ggirelli Mar 5, 2021
7e21bfd
Added sorted check
ggirelli Mar 5, 2021
d010151
Cosmetic
ggirelli Mar 5, 2021
947adab
Added ChromosomeData and ChromosomeIndex classes
ggirelli Mar 5, 2021
302360b
Added missing declaration and exposed chromosome index
ggirelli Mar 5, 2021
a252cab
Switched from rich to tqdm. Fixed index visibility in wrappers
ggirelli Mar 5, 2021
37b7247
Added options for region dumping.
ggirelli Mar 5, 2021
6890bfd
Removed redundant function
ggirelli Mar 5, 2021
f5bd5e0
Implemented database jumping and window walk
ggirelli Mar 5, 2021
103a591
Updated version tag and promoted to beta. Added 3.9 to GHAction.
ggirelli Mar 5, 2021
dd4a1a4
Added Typed classifier
ggirelli Mar 5, 2021
7d4ff90
Linked new database and old walker.
ggirelli Mar 5, 2021
8bf9174
Removed old database module.
ggirelli Mar 5, 2021
e86ca7a
Added indexing progress bar
ggirelli Mar 5, 2021
90f9a38
Fixed dump of a region.
ggirelli Mar 5, 2021
98d84e8
Changed default database index bin size to 100 kb
ggirelli Mar 5, 2021
c99a8c1
Fixed issue of empty index bins.
ggirelli Mar 5, 2021
7b83f40
Blacked.
ggirelli Mar 5, 2021
ee681cd
Refactored ChromosomeData and added ChromosomeDict class.
ggirelli Mar 7, 2021
4bf7410
Dropped sequence_length column. Fixed pickling of ChromosomeData.
ggirelli Mar 7, 2021
4b0ff94
Added reindex entry point.
ggirelli Mar 7, 2021
0ad125b
Bump rich from 9.12.4 to 9.13.0 (#15)
dependabot[bot] Mar 8, 2021
a5fc5ac
Bump tqdm from 4.58.0 to 4.59.0 (#16)
dependabot[bot] Mar 8, 2021
ed99f13
Split chromosome classes from database. Added docstrings.
ggirelli Mar 16, 2021
464ccae
Implementing new walker.
ggirelli Mar 16, 2021
de84d4e
Implemented walker with growing focus region.
ggirelli Mar 16, 2021
280daa4
Moved database walking to walker class
ggirelli Mar 16, 2021
90ea0e4
Added tests.
ggirelli Mar 16, 2021
09bd0b6
Added test_data to package.
ggirelli Mar 16, 2021
aa20dd2
Added pytest setup
ggirelli Mar 16, 2021
3db1938
Fixed pytest setup
ggirelli Mar 16, 2021
988c910
Added pytest to and updated dependencies
ggirelli Mar 16, 2021
90a5fea
Moved GenomicRegion to new region module
ggirelli Mar 16, 2021
6c2200e
Moved pytest and black to dev dependencies
ggirelli Mar 16, 2021
76b8228
Implemented region builder and multi walk
ggirelli Mar 16, 2021
5671620
Implementing new query script
ggirelli Mar 16, 2021
35e00ed
Fixed decoding
ggirelli Mar 16, 2021
e8951ac
Added docstrings
ggirelli Mar 16, 2021
1fae137
Hidden some prototype code tagged by vulture
ggirelli Mar 16, 2021
90f93c3
Fixed links
ggirelli Mar 23, 2021
262d501
Fixed link to repo
ggirelli Mar 23, 2021
d31a1ad
Fixed threads check.
ggirelli Mar 23, 2021
e61f20a
Updated version management.
ggirelli Mar 23, 2021
5a0c7b8
Dropped support for Python 3.7
ggirelli Mar 23, 2021
13f7c43
Removed default number of queried probes.
ggirelli Mar 23, 2021
446402f
Bump rich from 9.13.0 to 10.0.0 (#19)
dependabot[bot] Mar 29, 2021
a0613f7
Bump numpy from 1.20.1 to 1.20.2 (#18)
dependabot[bot] Mar 29, 2021
fd6db39
Bump rich from 10.0.0 to 10.0.1 (#20)
dependabot[bot] Mar 31, 2021
f971539
Bump tqdm from 4.59.0 to 4.60.0 (#23)
dependabot[bot] Apr 6, 2021
99fe0bd
Bump pytest from 6.2.2 to 6.2.3 (#22)
dependabot[bot] Apr 6, 2021
bb319cb
Bump rich from 10.0.1 to 10.1.0 (#21)
dependabot[bot] Apr 6, 2021
d352095
Bump pandas from 1.2.3 to 1.2.4 (#24)
dependabot[bot] Apr 14, 2021
d8cef92
Bump black from 20.8b1 to 21.4b0 (#25)
dependabot[bot] Apr 26, 2021
8d5e77d
Bump black from 21.4b0 to 21.4b1 (#26)
dependabot[bot] Apr 28, 2021
ac943ee
Bump black from 21.4b1 to 21.4b2 (#27)
dependabot[bot] Apr 29, 2021
815e7f2
Bump black from 21.4b2 to 21.5b0 (#28)
dependabot[bot] May 5, 2021
3b3968e
Bump pytest from 6.2.3 to 6.2.4 (#29)
dependabot[bot] May 5, 2021
1f97dc5
Bump rich from 10.1.0 to 10.2.0 (#32)
dependabot[bot] May 15, 2021
2f35974
Bump black from 21.5b0 to 21.5b1 (#31)
dependabot[bot] May 15, 2021
342972f
Bump numpy from 1.20.2 to 1.20.3 (#30)
dependabot[bot] May 15, 2021
7fc6254
Bump rich from 10.2.0 to 10.2.2 (#34)
dependabot[bot] May 21, 2021
a1042de
Bump black from 21.5b1 to 21.5b2 (#36)
dependabot[bot] Jun 1, 2021
0511be3
Bump tqdm from 4.60.0 to 4.61.0 (#35)
dependabot[bot] Jun 1, 2021
5e9d01e
Bump rich from 10.2.2 to 10.3.0 (#37)
dependabot[bot] Jun 14, 2021
4961f18
Bump black from 21.5b2 to 21.6b0 (#38)
dependabot[bot] Jun 14, 2021
b647e52
Bump tqdm from 4.61.0 to 4.61.1 (#39)
dependabot[bot] Jun 14, 2021
f9f454b
Bump rich from 10.3.0 to 10.4.0 (#40)
dependabot[bot] Jun 21, 2021
f519ca6
Bump pandas from 1.2.4 to 1.2.5 (#41)
dependabot[bot] Jun 22, 2021
82cec89
Bump numpy from 1.20.3 to 1.21.0 (#42)
dependabot[bot] Jun 23, 2021
223bd89
Bump pandas from 1.2.5 to 1.3.0 (#43)
dependabot[bot] Jul 3, 2021
e9790c3
Bump rich from 10.4.0 to 10.5.0 (#45)
dependabot[bot] Jul 6, 2021
632b055
Bump tqdm from 4.61.1 to 4.61.2 (#44)
dependabot[bot] Jul 6, 2021
f9759e8
Bump rich from 10.5.0 to 10.6.0 (#46)
dependabot[bot] Jul 14, 2021
54fe12b
Bump black from 21.6b0 to 21.7b0 (#47)
dependabot[bot] Jul 20, 2021
147aa5c
Bump numpy from 1.21.0 to 1.21.1 (#48)
dependabot[bot] Jul 20, 2021
4349df9
Bump tqdm from 4.61.2 to 4.62.0 (#50)
dependabot[bot] Aug 4, 2021
b2bb4d0
Bump pandas from 1.3.0 to 1.3.1 (#49)
dependabot[bot] Aug 4, 2021
cabf2a9
Bump rich from 10.6.0 to 10.7.0 (#51)
dependabot[bot] Aug 11, 2021
aa1de01
Bump tqdm from 4.62.0 to 4.62.1 (#52)
dependabot[bot] Aug 16, 2021
d0a9461
Bump pandas from 1.3.1 to 1.3.2 (#53)
dependabot[bot] Aug 16, 2021
26ae68d
Bump tqdm from 4.62.1 to 4.62.2 (#54)
dependabot[bot] Aug 24, 2021
e4ff3c1
Bump rich from 10.7.0 to 10.9.0 (#55)
dependabot[bot] Aug 30, 2021
be59c50
Bump black from 21.7b0 to 21.8b0 (#56)
dependabot[bot] Aug 30, 2021
d69a897
Bump pytest from 6.2.4 to 6.2.5 (#57)
dependabot[bot] Aug 31, 2021
8f3f621
'Refactored by Sourcery' (#58)
sourcery-ai[bot] Sep 8, 2021
6e3db9b
Blacked, flaked, and mypyed
ggirelli Sep 8, 2021
a11bb35
Bump pandas from 1.3.2 to 1.3.3 (#59)
dependabot[bot] Sep 13, 2021
c155467
Bump black from 21.8b0 to 21.9b0 (#60)
dependabot[bot] Sep 16, 2021
48f0506
Bump rich from 10.9.0 to 10.10.0 (#61)
dependabot[bot] Sep 21, 2021
ee1dbd7
Bump tqdm from 4.62.2 to 4.62.3 (#62)
dependabot[bot] Sep 21, 2021
db7f2c5
Bump rich from 10.10.0 to 10.11.0 (#63)
dependabot[bot] Sep 25, 2021
0445b7d
Argparse to click (#65)
ggirelli Oct 6, 2021
98ef3bf
Blacked
ggirelli Oct 6, 2021
4af8835
'Refactored by Sourcery' (#67)
sourcery-ai[bot] Oct 6, 2021
11fbe3d
Blacked.
ggirelli Oct 6, 2021
2ce16cc
Now passing tests.
ggirelli Oct 6, 2021
433e4bf
Added biopython dependency and extract_kmers script. (#68)
ggirelli Oct 6, 2021
3bc8a7a
'Refactored by Sourcery' (#70)
sourcery-ai[bot] Oct 6, 2021
8cfe1b5
Improved extract_kmers script
ggirelli Oct 6, 2021
84f0c08
'Refactored by Sourcery' (#71)
sourcery-ai[bot] Oct 6, 2021
dc66122
Mypyed after sorcery refactoring
ggirelli Oct 6, 2021
daac6ed
Bump rich from 10.11.0 to 10.12.0 (#72)
dependabot[bot] Oct 6, 2021
03ecb79
Added autocompletion. (#73)
ggirelli Oct 6, 2021
dee0d87
Fixed __path__
ggirelli Oct 6, 2021
e9e1895
Added missing fasta header starting character
ggirelli Oct 7, 2021
41a2581
Bump click from 8.0.1 to 8.0.3 (#75)
dependabot[bot] Oct 12, 2021
9f3a9d5
Added compatibility with previous database pickled arguments.
ggirelli Oct 15, 2021
b25dbc5
Merge branch 'dev' of github.com:ggirelli/ifpd2 into dev
ggirelli Oct 15, 2021
dd0f5bc
Added pre-commits.
ggirelli Oct 18, 2021
b8ef91c
Fixed spelling
ggirelli Oct 18, 2021
22ac841
Added support for hush gzipped files
ggirelli Oct 18, 2021
676e3ca
Create .deepsource.toml
ggirelli Oct 19, 2021
c70335b
Fix comparison constant position (#76)
deepsource-autofix[bot] Oct 19, 2021
25a8923
Replace `dict` call with comprehension (#77)
deepsource-autofix[bot] Oct 19, 2021
20b2ec3
Remove unnecessary use of comprehension (#78)
deepsource-autofix[bot] Oct 19, 2021
4c79e9d
Change methods not using its bound instance to staticmethods (#79)
deepsource-autofix[bot] Oct 19, 2021
9bf303e
Remove assert statement from non-test files (#80)
deepsource-autofix[bot] Oct 19, 2021
92b0db8
Set `check` flag to `True` (#82)
deepsource-autofix[bot] Oct 19, 2021
9e02ab3
Remove implicit `object` from the base class (#83)
deepsource-autofix[bot] Oct 19, 2021
2157cf9
Remove assert statement from non-test files (#84)
deepsource-autofix[bot] Oct 19, 2021
fdff793
Refactor unnecessary `else` / `elif` when `if` block has a `continue`…
deepsource-autofix[bot] Oct 19, 2021
993e517
Refactor unnecessary `else` / `elif` when `if` block has a `return` s…
deepsource-autofix[bot] Oct 19, 2021
b1d8869
Use literal syntax to create data structure (#87)
deepsource-autofix[bot] Oct 19, 2021
5af06fd
Merge collapsible `if` statements (#88)
deepsource-autofix[bot] Oct 19, 2021
45147b9
fix: added docstring explaining emptiness.
ggirelli Oct 19, 2021
7adec2c
fix: added docstring explaining emptiness.
ggirelli Oct 19, 2021
157592d
Refactor unnecessary `else` / `elif` when `if` block has a `raise` st…
deepsource-autofix[bot] Oct 19, 2021
0adc056
Remove unnecessary `pass` (#90)
deepsource-autofix[bot] Oct 19, 2021
8155fda
Remove methods with unnecessary super delegation. (#91)
deepsource-autofix[bot] Oct 19, 2021
06dfffc
fix: probe selection & unreachable statements
ggirelli Oct 19, 2021
48bd548
Remove unused private attribute (#92)
deepsource-autofix[bot] Oct 19, 2021
02a1db0
fix: Multi-line docstring closing quotes should be on a separate line
ggirelli Oct 19, 2021
15908e9
Merge branch 'dev' of github.com:ggirelli/ifpd2 into dev
ggirelli Oct 19, 2021
9dd7dbc
fix: swapped single for double quotes
ggirelli Oct 19, 2021
8f6c3c7
fix: inconsistent return statements
ggirelli Oct 19, 2021
c483d81
fix: blacked.
ggirelli Oct 19, 2021
1b9062a
fix: process from shell, escaping parameters
ggirelli Oct 19, 2021
f382ee7
fix: inconsistent return statements
ggirelli Oct 19, 2021
398ae79
fix: removed unused private attribute
ggirelli Oct 19, 2021
9c5ce0b
fix: escaping shell subprocess cmd
ggirelli Oct 19, 2021
1f3920c
fix: open files with `with` statement
ggirelli Oct 19, 2021
0b742ea
fix: quoted upon subprocess spawning
ggirelli Oct 19, 2021
33111c0
Merge collapsible `with` statements (#95)
deepsource-autofix[bot] Oct 19, 2021
4a8491d
fix: blacked
ggirelli Oct 19, 2021
200d602
'Refactored by Sourcery' (#81)
sourcery-ai[bot] Oct 19, 2021
92a0cbe
Dropped broken scripts test.
ggirelli Oct 19, 2021
fde5546
Merge branch 'dev' of github.com:ggirelli/ifpd2 into dev
ggirelli Oct 19, 2021
6d1f0cb
fix: added test placeholder
ggirelli Oct 19, 2021
b77570a
Bump pandas from 1.3.3 to 1.3.4 (#97)
dependabot[bot] Oct 29, 2021
b64314d
Bump black from 21.9b0 to 21.10b0 (#98)
dependabot[bot] Nov 1, 2021
f331e7e
Bump rich from 10.12.0 to 10.13.0 (#99)
dependabot[bot] Nov 8, 2021
bf614dd
Bump black from 21.10b0 to 21.11b0 (#100)
dependabot[bot] Nov 18, 2021
f641a2d
Bump rich from 10.13.0 to 10.14.0 (#101)
dependabot[bot] Nov 18, 2021
08b58e1
Bump black from 21.11b0 to 21.11b1 (#102)
dependabot[bot] Nov 19, 2021
bfd189a
fix: wrong condition of path_exists function
ggirelli Nov 26, 2021
569fc93
fix: correct variable names
ggirelli Nov 26, 2021
e010fd6
fix: assertions on input params
ggirelli Nov 26, 2021
60c1a79
Bump rich from 10.14.0 to 10.15.0 (#103)
dependabot[bot] Nov 29, 2021
b681c6d
Bump rich from 10.15.0 to 10.15.1 (#104)
dependabot[bot] Nov 30, 2021
a35f108
Bump rich from 10.15.1 to 10.15.2 (#105)
dependabot[bot] Dec 3, 2021
54cdf58
Bump black from 21.11b1 to 21.12b0 (#106)
dependabot[bot] Dec 7, 2021
4222d53
Merge branch 'dev' of github.com:ggirelli/ifpd2 into dev
ggirelli Dec 7, 2021
3e6967d
fix: minor assert change
ggirelli Dec 7, 2021
6f9cef5
fix: trove classifier
ggirelli Dec 7, 2021
c8b44e3
doc: updated with version flag
ggirelli Dec 7, 2021
53fbcdd
docs: updated version flag
ggirelli Dec 7, 2021
8adbe8c
feat: updated lock file
ggirelli Dec 7, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .deepsource.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version = 1

[[analyzers]]
name = "shell"
enabled = true

[[analyzers]]
name = "secrets"
enabled = true

[[analyzers]]
name = "python"
enabled = true

[analyzers.meta]
runtime_version = "3.x.x"
12 changes: 6 additions & 6 deletions .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
fail-fast: true
matrix:
os: ["ubuntu-latest"]
python-version: [3.7, 3.8]
python-version: [3.8, 3.9]
runs-on: ${{ matrix.os }}
steps:
# Checkout repo and setup python
Expand All @@ -62,8 +62,8 @@ jobs:
- name: Install dependencies
run: poetry install
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
# run test suite
# - name: Test
# run: |
# source .venv/bin/activate
# pytest radiantkit/tests/
# run: test suite
- name: Test
run: |
source .venv/bin/activate
pytest ifpd2/tests/
38 changes: 38 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
default_language_version:
python: python3.8
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: "v4.0.1"
hooks:
- id: check-added-large-files
- id: check-ast
- id: check-docstring-first
- id: check-yaml
- repo: https://github.com/pre-commit/mirrors-mypy
rev: "v0.910-1"
hooks:
- id: mypy
- repo: https://github.com/psf/black
rev: "21.9b0"
hooks:
- id: black
- repo: https://github.com/PyCQA/flake8
rev: "4.0.1"
hooks:
- id: flake8
args: ["--count", "--select=E9,F63,F7,F82", "--show-source", "--statistics"]
- id: flake8
args: ["--count", "--exit-zero", "--max-complexity=5", "--max-line-length=88", "--ignore=E203", "--statistics"]
- repo: https://github.com/jendrikseipp/vulture
rev: "v2.3"
hooks:
- id: vulture
- repo: https://github.com/codespell-project/codespell
rev: v2.1.0
hooks:
- id: codespell
entry: codespell --ignore-words=ignore-spelling-words.txt
language: python
types: [text]
17 changes: 14 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,20 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.


## Unreleased
### ...
- ...

## [1.0.1a1] - 2021-12-07
### Added
- New entry points: `db make`, `db dump`, `db info`, `db merge`, and `db_reindex`.
- Module `io` with parsing functions for output generated via oligo-melting, hush, or OligoArrayAux.
- Assert for compatibility with a given dtype. (only max value currently checked)

### Changed
- New database format.
- `dbchk` entry point changed to `db check`.
- Dropped sequence length column, as it can be inferred from the end/start columns.
- Removed `-X` default from `query`.

## [1.0.0-alpha] - 2021-02-26

[1.0.0-alpha] https://github.com/ggirelli/ifpd/releases/tag/v1.0.0-alpha
[1.0.1a1] https://github.com/ggirelli/ifpd2/releases/tag/v1.0.1a1
[1.0.0-alpha] https://github.com/ggirelli/ifpd2/releases/tag/v1.0.0-alpha
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
# iFISH Probe Design (II)

![](https://img.shields.io/github/license/ggirelli/ifpd2.svg?style=flat) ![](https://github.com/ggirelli/ifpd2/workflows/Python%20package/badge.svg?branch=main&event=push)
[![DOI](https://zenodo.org/badge/210782569.svg)](https://zenodo.org/badge/latestdoi/210782569) ![](https://img.shields.io/github/license/ggirelli/ifpd2.svg?style=flat) ![](https://github.com/ggirelli/ifpd2/workflows/Python%20package/badge.svg?branch=main&event=push)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/ifpd2) ![PyPI - Format](https://img.shields.io/pypi/format/ifpd2) ![PyPI - Status](https://img.shields.io/pypi/status/ifpd2)
![](https://img.shields.io/github/release/ggirelli/ifpd2.svg?style=flat) ![](https://img.shields.io/github/release-date/ggirelli/ifpd2.svg?style=flat) ![](https://img.shields.io/github/languages/code-size/ggirelli/ifpd2.svg?style=flat)
![](https://img.shields.io/github/watchers/ggirelli/ifpd2.svg?label=Watch&style=social) ![](https://img.shields.io/github/stars/ggirelli/ifpd2.svg?style=social)

[PyPi](https://pypi.org/project/ifpd2/) | [docs](https://ggirelli.github.io/ifpd2/)

`ifpd2` is a Python3.7+ package containing tools for selection of complementary oligonucleotides to build iFISH probes. It is based on our previous `ifpd` package, but works with a different and more detailed database format, allowing for more precise control on the probe design process. Read the online [documentation](https://ggirelli.github.io/ifpd2/) for more details.
`ifpd2` is a Python3.8+ package containing tools for selection of complementary oligonucleotides to build iFISH probes. It is based on our previous `ifpd` package, but works with a different and more detailed database format, allowing for more precise control on the probe design process. Read the online [documentation](https://ggirelli.github.io/ifpd2/) for more details.

## Requirements

`ifpd2` is fully implemented in Python3.7+, thus you need the corresponding Python version to run it. Check out [here](https://realpython.com/installing-python/) how to install Python+ on your machine if you don't have it yet.
`ifpd2` is fully implemented in Python3.8+, thus you need the corresponding Python version to run it. Check out [here](https://realpython.com/installing-python/) how to install Python+ on your machine if you don't have it yet.

`ifpd2` has been tested with Python 3.7 and 3.8. We recommend installing it using `pipx` (see [below](https://github.com/ggirelli/ifpd2#installation)) to avoid dependency conflicts with other packages. The packages it depends on are listed in our [dependency graph](https://github.com/ggirelli/ifpd2/network/dependencies). We use [`poetry`](https://github.com/python-poetry/poetry) to handle our dependencies.
`ifpd2` has been tested with Python 3.8 and 3.9. We recommend installing it using `pipx` (see [below](https://github.com/ggirelli/ifpd2#installation)) to avoid dependency conflicts with other packages. The packages it depends on are listed in our [dependency graph](https://github.com/ggirelli/ifpd2/network/dependencies). We use [`poetry`](https://github.com/python-poetry/poetry) to handle our dependencies.

## Installation

Expand Down
23 changes: 19 additions & 4 deletions ifpd2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,32 @@
@contact: gigi.ga90@gmail.com
"""

from ifpd2.const import __version__
from ifpd2 import asserts
from ifpd2 import database, walker
from ifpd2 import asserts, dataclasses, fasta, io
from ifpd2 import walker, walker2
from ifpd2 import chromosome, database, region
from ifpd2 import oligo, probe, probe_set

from importlib.metadata import version, PackageNotFoundError
from typing import List

try:
__version__ = version(__name__)
except PackageNotFoundError:
pass

__all__ = [
"__version__",
"asserts",
"database",
"dataclasses",
"fasta",
"io",
"walker",
"walker2",
"chromosome",
"database",
"region",
"oligo",
"probe",
"probe_set",
]
__path__: List[str]
56 changes: 43 additions & 13 deletions ifpd2/asserts.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,37 +4,67 @@
"""

import logging
import numpy as np # type: ignore
import sys
from typing import Callable


def ert_type(x, stype, label):
assert isinstance(x, stype), f"{label} should be {stype}, {type(x)} instead"
if not isinstance(x, stype):
raise AssertionError(f"{label} should be {stype}, {type(x)} instead")


def ert_multiTypes(x, types, label):
cond = any([isinstance(x, t) for t in types])
assert cond, f"{label} should be one of {types}, {type(x)} instead"
cond = any(isinstance(x, t) for t in types)
if not cond:
raise AssertionError(f"{label} should be one of {types}, {type(x)} instead")


def ert_nonNeg(x, label, include_zero=False):
if not include_zero:
assert x > 0, f"{label} should be greater than 0"
else:
assert x >= 0, f"{label} should be greater than or equal to 0"
if x <= 0:
raise AssertionError(f"{label} should be greater than 0")
elif x < 0:
raise AssertionError(f"{label} should be greater than or equal to 0")


def ert_inInterv(x, vmin, vmax, label, leftClose=False, rightClose=True):
if leftClose:
if rightClose:
assert x >= vmin and x <= vmax, f"expected {vmin}<={label}<={vmax}"
else:
assert x >= vmin and x < vmax, f"expected {vmin}<={label}<{vmax}"
if x < vmin or x > vmax:
raise AssertionError(f"expected {vmin}<={label}<={vmax}")
elif x < vmin or x >= vmax:
raise AssertionError(f"expected {vmin}<={label}<{vmax}")
elif rightClose:
if x <= vmin or x > vmax:
raise AssertionError(f"expected {vmin}<{label}<={vmax}")
elif x <= vmin or x >= vmax:
raise AssertionError(f"expected {vmin}<{label}<{vmax}")


def ert_in_dtype(x, dtype):
if dtype.startswith("f"):
if x > np.finfo(dtype).max:
raise AssertionError(
" ".join(
[
"expected to be lower than {dtype} max:",
f"{x} < {np.finfo(dtype).max}",
]
)
)
elif dtype.startswith("u") or dtype.startswith("i"):
if x > np.iinfo(dtype).max:
raise AssertionError(
" ".join(
[
"expected to be lower than {dtype} max:",
f"{x} < {np.iinfo(dtype).max}",
]
)
)
else:
if rightClose:
assert x > vmin and x <= vmax, f"expected {vmin}<{label}<={vmax}"
else:
assert x > vmin and x < vmax, f"expected {vmin}<{label}<{vmax}"
logging.warning(f"assert not implemented for dtype '{dtype}'")


def enable_rich_assert(fun: Callable) -> Callable:
Expand Down
29 changes: 29 additions & 0 deletions ifpd2/autocomplete/.ifpd2-complete.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
_ifpd2_completion() {
local IFS=$'\n'
local response

response=$(env COMP_WORDS="${COMP_WORDS[*]}" COMP_CWORD=$COMP_CWORD _IFPD2_COMPLETE=bash_complete $1)

for completion in $response; do
IFS=',' read type value <<< "$completion"

if [[ $type == 'dir' ]]; then
COMREPLY=()
compopt -o dirnames
elif [[ $type == 'file' ]]; then
COMREPLY=()
compopt -o default
elif [[ $type == 'plain' ]]; then
COMPREPLY+=($value)
fi
done

return 0
}

_ifpd2_completion_setup() {
complete -o nosort -F _ifpd2_completion ifpd2
}

_ifpd2_completion_setup;

22 changes: 22 additions & 0 deletions ifpd2/autocomplete/.ifpd2-complete.fish
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
function _ifpd2_completion;
set -l response;

for value in (env _IFPD2_COMPLETE=fish_complete COMP_WORDS=(commandline -cp) COMP_CWORD=(commandline -t) ifpd2);
set response $response $value;
end;

for completion in $response;
set -l metadata (string split "," $completion);

if test $metadata[1] = "dir";
__fish_complete_directories $metadata[2];
else if test $metadata[1] = "file";
__fish_complete_path $metadata[2];
else if test $metadata[1] = "plain";
echo $metadata[2];
end;
end;
end;

complete --no-files --command ifpd2 --arguments "(_ifpd2_completion)";

35 changes: 35 additions & 0 deletions ifpd2/autocomplete/.ifpd2-complete.zsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#compdef ifpd2

_ifpd2_completion() {
local -a completions
local -a completions_with_descriptions
local -a response
(( ! $+commands[ifpd2] )) && return 1

response=("${(@f)$(env COMP_WORDS="${words[*]}" COMP_CWORD=$((CURRENT-1)) _IFPD2_COMPLETE=zsh_complete ifpd2)}")

for type key descr in ${response}; do
if [[ "$type" == "plain" ]]; then
if [[ "$descr" == "_" ]]; then
completions+=("$key")
else
completions_with_descriptions+=("$key":"$descr")
fi
elif [[ "$type" == "dir" ]]; then
_path_files -/
elif [[ "$type" == "file" ]]; then
_path_files -f
fi
done

if [ -n "$completions_with_descriptions" ]; then
_describe -V unsorted completions_with_descriptions -U
fi

if [ -n "$completions" ]; then
compadd -U -V unsorted -a completions
fi
}

compdef _ifpd2_completion ifpd2;

Loading