mirror of
https://github.com/metabarcoding/obitools4.git
synced 2026-03-25 21:40:52 +00:00
Compare commits
229 Commits
Release_4.
...
Release_4.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f798f22434 | ||
|
|
248bc9f672 | ||
|
|
7a7db703f1 | ||
|
|
da195ac5cb | ||
|
|
20a0a09f5f | ||
|
|
7d8c578c57 | ||
|
|
d7f615108f | ||
|
|
71574f240b | ||
|
|
c98501a898 | ||
|
|
23f145a4c2 | ||
|
|
fe6d74efbf | ||
|
|
cff8135468 | ||
|
|
02ab683fa0 | ||
|
|
de88e7eecd | ||
|
|
e3c41fc11b | ||
|
|
aa2e94dd6f | ||
|
|
a43e6258be | ||
|
|
12ca62b06a | ||
|
|
09ac15a76b | ||
|
|
16f72e6305 | ||
|
|
6c6c369ee2 | ||
|
|
c5dd477675 | ||
|
|
afcb43b352 | ||
|
|
b26b76cbf8 | ||
|
|
aa468ec462 | ||
|
|
00dcd78e84 | ||
|
|
60f27c1dc8 | ||
|
|
28162ac36f | ||
|
|
1a1adb83ac | ||
|
|
05de9ca58e | ||
|
|
500144051a | ||
|
|
740f66b4c7 | ||
|
|
b49aba9c09 | ||
|
|
52244cdb64 | ||
|
|
0678181023 | ||
|
|
f55dd553c7 | ||
|
|
4a383ac6c9 | ||
|
|
371e702423 | ||
|
|
ac0d3f3fe4 | ||
|
|
547135c747 | ||
|
|
f4a919732e | ||
|
|
e681666aaa | ||
|
|
adf2486295 | ||
|
|
272f5c9c35 | ||
|
|
c1b9503ca6 | ||
|
|
86e60aedd0 | ||
|
|
961abcea7b | ||
|
|
57c65f9d50 | ||
|
|
e65b2a5efe | ||
|
|
3e5f3f76b0 | ||
|
|
ccc827afd3 | ||
|
|
cef29005a5 | ||
|
|
4603d7973e | ||
|
|
8bc47c13d3 | ||
|
|
07cdd6f758 | ||
|
|
432da366e2 | ||
|
|
2d7dc7d09d | ||
|
|
5e12ed5400 | ||
|
|
7500ee1d15 | ||
|
|
5a1d66bf06 | ||
|
|
0844dcc607 | ||
|
|
7f4ebe757e | ||
|
|
5150947e23 | ||
|
|
d17a9520b9 | ||
|
|
29bf4ce871 | ||
|
|
d7ed9d343e | ||
|
|
82b6bb1ab6 | ||
|
|
6d204f6281 | ||
|
|
7a6d552450 | ||
|
|
412b54822c | ||
|
|
730d448fc3 | ||
|
|
04f3af3e60 | ||
|
|
997b6e8c01 | ||
|
|
f239e8da92 | ||
|
|
ed28d3fb5b | ||
|
|
43b285587e | ||
|
|
8d53d253d4 | ||
|
|
8c26fc9884 | ||
|
|
235a7e202a | ||
|
|
27fa984a63 | ||
|
|
add9d89ccc | ||
|
|
9965370d85 | ||
|
|
8a2bb1fe82 | ||
|
|
efc3f3af29 | ||
|
|
1c6ab1c559 | ||
|
|
38dcd98d4a | ||
|
|
7b23985693 | ||
|
|
d31e677304 | ||
|
|
6cb7a5a352 | ||
|
|
3424d3057f | ||
|
|
f9324dd8f4 | ||
|
|
f1b9ac4a13 | ||
|
|
e065e2963b | ||
|
|
13ff892ac9 | ||
|
|
c0ecaf90ab | ||
|
|
a57cfda675 | ||
|
|
c2f38e737b | ||
|
|
0aec5ba4df | ||
|
|
67e5b6ef24 | ||
|
|
3b1aa2869e | ||
|
|
7542e33010 | ||
|
|
03b5ce9397 | ||
|
|
2d52322876 | ||
|
|
fd80249b85 | ||
|
|
5a3705b6bb | ||
|
|
2ab6f67d58 | ||
|
|
8b379d30da | ||
|
|
8448783499 | ||
|
|
d1c31c54de | ||
|
|
7a9dc1ab3b | ||
|
|
3a1cf4fe97 | ||
|
|
83926c91e1 | ||
|
|
937a483aa6 | ||
|
|
dada70e6b1 | ||
|
|
62e5a93492 | ||
|
|
f21f51ae62 | ||
|
|
3b5d4ba455 | ||
|
|
50d11ce374 | ||
|
|
52d5f6fe11 | ||
|
|
78caabd2fd | ||
|
|
65bd29b955 | ||
|
|
b18c9b7ac6 | ||
|
|
78df7db18d | ||
|
|
fc08c12ab0 | ||
|
|
0339e4dffa | ||
|
|
706b44c37f | ||
|
|
fbe7d15dc3 | ||
|
|
b5cf586f17 | ||
|
|
286e27d6ba | ||
|
|
996ec69bd9 | ||
|
|
5f9182d25b | ||
|
|
9913fa8354 | ||
|
|
7b23314651 | ||
|
|
1e541eac4c | ||
|
|
13cd4c86ac | ||
|
|
75dd535201 | ||
|
|
573acafafc | ||
|
|
0067152c2b | ||
|
|
791d253edc | ||
|
|
6245d7f684 | ||
|
|
13d610aff7 | ||
|
|
db284f1d44 | ||
|
|
51b3e83d32 | ||
|
|
8671285d02 | ||
|
|
51d11aa36d | ||
|
|
fb6f857d8c | ||
|
|
d4209b4549 | ||
|
|
ef05d4975f | ||
|
|
4588bf8b5d | ||
|
|
090633850d | ||
|
|
15a058cf63 | ||
|
|
2f5f7634d6 | ||
|
|
48138b605c | ||
|
|
aed22c12a6 | ||
|
|
443a9b3ce3 | ||
|
|
7e90537379 | ||
|
|
d3d15acc6c | ||
|
|
bd4a0b5ca5 | ||
|
|
952f85f312 | ||
|
|
4774438644 | ||
|
|
6a8061cc4f | ||
|
|
e2563cd8df | ||
|
|
f2e81adf95 | ||
|
|
f27e9bc91e | ||
|
|
773e54965d | ||
|
|
ceca33998b | ||
|
|
b9bee5f426 | ||
|
|
c10df073a7 | ||
|
|
d3dac1b21f | ||
|
|
0df082da06 | ||
|
|
2452aef7a9 | ||
|
|
337954592d | ||
|
|
8a28c9ae7c | ||
|
|
b6b18c0fa1 | ||
|
|
67e2758d63 | ||
|
|
00f2dc2697 | ||
|
|
c50a0f409d | ||
|
|
7c4042df6b | ||
|
|
0a567f621c | ||
|
|
9acb4a85a8 | ||
|
|
3137c1f841 | ||
|
|
ffd67252c3 | ||
|
|
757448cb1e | ||
|
|
4ae3336135 | ||
|
|
d066bb6878 | ||
|
|
becb995e3d | ||
|
|
c58d9772ac | ||
|
|
67c0d00a4d | ||
|
|
4fe0db63ff | ||
|
|
ccd3b06532 | ||
|
|
5d0f996625 | ||
|
|
abfa8f357a | ||
|
|
795df34d1a | ||
|
|
f2525d7b07 | ||
|
|
39dd3e3ce8 | ||
|
|
f41a6fbb60 | ||
|
|
00b0edc15a | ||
|
|
ad2461a656 | ||
|
|
40fb4e9767 | ||
|
|
d29a56dcbf | ||
|
|
69ef1758a2 | ||
|
|
3d06978808 | ||
|
|
7884a74f9c | ||
|
|
36327c79c8 | ||
|
|
f3d8707c08 | ||
|
|
7633fc4d23 | ||
|
|
f5d79d0bc4 | ||
|
|
03f4e88a17 | ||
|
|
9471fedfa1 | ||
|
|
4b65bfce84 | ||
|
|
fc75974c68 | ||
|
|
422f11cceb | ||
|
|
fefc360f80 | ||
|
|
3e00d39d47 | ||
|
|
9e8a7fd9be | ||
|
|
74280e4704 | ||
|
|
7255c71576 | ||
|
|
241f2286f2 | ||
|
|
b37fc39ead | ||
|
|
2b4a633c30 | ||
|
|
05bf2bfd6c | ||
|
|
65ae82622e | ||
|
|
373464cb06 | ||
|
|
cd330db672 | ||
|
|
31bfc88eb9 | ||
|
|
bdb96dda94 | ||
|
|
3f57935328 | ||
|
|
886b5d9a96 | ||
|
|
f83032e643 |
19
.github/workflows/obitest.yml
vendored
Normal file
19
.github/workflows/obitest.yml
vendored
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
name: "Run the obitools command test suite"
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
- V*
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Setup Go
|
||||||
|
uses: actions/setup-go@v2
|
||||||
|
with:
|
||||||
|
go-version: '1.23'
|
||||||
|
- name: Checkout obitools4 project
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Run tests
|
||||||
|
run: make githubtests
|
||||||
175
.github/workflows/release.yml
vendored
Normal file
175
.github/workflows/release.yml
vendored
Normal file
@@ -0,0 +1,175 @@
|
|||||||
|
name: Create Release on Tag
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- "Release_*"
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
# First run tests
|
||||||
|
test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Setup Go
|
||||||
|
uses: actions/setup-go@v5
|
||||||
|
with:
|
||||||
|
go-version: "1.23"
|
||||||
|
- name: Checkout obitools4 project
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Run tests
|
||||||
|
run: make githubtests
|
||||||
|
|
||||||
|
# Build binaries for each platform
|
||||||
|
build:
|
||||||
|
needs: test
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- os: ubuntu-latest
|
||||||
|
goos: linux
|
||||||
|
goarch: amd64
|
||||||
|
output_name: linux_amd64
|
||||||
|
- os: ubuntu-latest
|
||||||
|
goos: linux
|
||||||
|
goarch: arm64
|
||||||
|
output_name: linux_arm64
|
||||||
|
cross_compile: true
|
||||||
|
- os: macos-latest
|
||||||
|
goos: darwin
|
||||||
|
goarch: amd64
|
||||||
|
output_name: darwin_amd64
|
||||||
|
- os: macos-latest
|
||||||
|
goos: darwin
|
||||||
|
goarch: arm64
|
||||||
|
output_name: darwin_arm64
|
||||||
|
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Setup Go
|
||||||
|
uses: actions/setup-go@v5
|
||||||
|
with:
|
||||||
|
go-version: "1.23"
|
||||||
|
|
||||||
|
- name: Extract version from tag
|
||||||
|
id: get_version
|
||||||
|
run: |
|
||||||
|
TAG=${GITHUB_REF#refs/tags/Release_}
|
||||||
|
echo "version=$TAG" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Install cross-compilation tools (Linux ARM64 only)
|
||||||
|
if: matrix.cross_compile
|
||||||
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y gcc-aarch64-linux-gnu
|
||||||
|
|
||||||
|
- name: Build binaries
|
||||||
|
env:
|
||||||
|
GOOS: ${{ matrix.goos }}
|
||||||
|
GOARCH: ${{ matrix.goarch }}
|
||||||
|
CC: ${{ matrix.cross_compile && 'aarch64-linux-gnu-gcc' || '' }}
|
||||||
|
VERSION: ${{ steps.get_version.outputs.version }}
|
||||||
|
run: |
|
||||||
|
make obitools
|
||||||
|
mkdir -p artifacts
|
||||||
|
cd build
|
||||||
|
for binary in *; do
|
||||||
|
tar -czf ../artifacts/${binary}_${VERSION}_${{ matrix.output_name }}.tar.gz ${binary}
|
||||||
|
done
|
||||||
|
|
||||||
|
- name: Upload artifacts
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: binaries-${{ matrix.output_name }}
|
||||||
|
path: artifacts/*
|
||||||
|
|
||||||
|
# Create the release
|
||||||
|
create-release:
|
||||||
|
needs: build
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Extract version from tag
|
||||||
|
id: get_version
|
||||||
|
run: |
|
||||||
|
TAG=${GITHUB_REF#refs/tags/Release_}
|
||||||
|
echo "version=$TAG" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Download all artifacts
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
path: release-artifacts
|
||||||
|
|
||||||
|
- name: Prepare release directory
|
||||||
|
run: |
|
||||||
|
mkdir -p release
|
||||||
|
find release-artifacts -type f -name "*.tar.gz" -exec cp {} release/ \;
|
||||||
|
ls -lh release/
|
||||||
|
|
||||||
|
- name: Generate Release Notes
|
||||||
|
env:
|
||||||
|
VERSION: ${{ steps.get_version.outputs.version }}
|
||||||
|
run: |
|
||||||
|
PREV_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "")
|
||||||
|
|
||||||
|
echo "# OBITools4 Release ${VERSION}" > release_notes.md
|
||||||
|
echo "" >> release_notes.md
|
||||||
|
|
||||||
|
if [ -n "$PREV_TAG" ]; then
|
||||||
|
echo "## Changes since ${PREV_TAG}" >> release_notes.md
|
||||||
|
echo "" >> release_notes.md
|
||||||
|
git log ${PREV_TAG}..HEAD --pretty=format:"- %s" >> release_notes.md
|
||||||
|
else
|
||||||
|
echo "## Changes" >> release_notes.md
|
||||||
|
echo "" >> release_notes.md
|
||||||
|
git log --pretty=format:"- %s" -n 20 >> release_notes.md
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "" >> release_notes.md
|
||||||
|
echo "" >> release_notes.md
|
||||||
|
echo "## Installation" >> release_notes.md
|
||||||
|
echo "" >> release_notes.md
|
||||||
|
echo "Download the appropriate binary for your system and extract it:" >> release_notes.md
|
||||||
|
echo "" >> release_notes.md
|
||||||
|
echo "### Linux (AMD64)" >> release_notes.md
|
||||||
|
echo '```bash' >> release_notes.md
|
||||||
|
echo "tar -xzf <tool>_${VERSION}_linux_amd64.tar.gz" >> release_notes.md
|
||||||
|
echo '```' >> release_notes.md
|
||||||
|
echo "" >> release_notes.md
|
||||||
|
echo "### Linux (ARM64)" >> release_notes.md
|
||||||
|
echo '```bash' >> release_notes.md
|
||||||
|
echo "tar -xzf <tool>_${VERSION}_linux_arm64.tar.gz" >> release_notes.md
|
||||||
|
echo '```' >> release_notes.md
|
||||||
|
echo "" >> release_notes.md
|
||||||
|
echo "### macOS (Intel)" >> release_notes.md
|
||||||
|
echo '```bash' >> release_notes.md
|
||||||
|
echo "tar -xzf <tool>_${VERSION}_darwin_amd64.tar.gz" >> release_notes.md
|
||||||
|
echo '```' >> release_notes.md
|
||||||
|
echo "" >> release_notes.md
|
||||||
|
echo "### macOS (Apple Silicon)" >> release_notes.md
|
||||||
|
echo '```bash' >> release_notes.md
|
||||||
|
echo "tar -xzf <tool>_${VERSION}_darwin_arm64.tar.gz" >> release_notes.md
|
||||||
|
echo '```' >> release_notes.md
|
||||||
|
echo "" >> release_notes.md
|
||||||
|
echo "Available tools: Replace \`<tool>\` with one of the obitools commands." >> release_notes.md
|
||||||
|
|
||||||
|
- name: Create GitHub Release
|
||||||
|
uses: softprops/action-gh-release@v1
|
||||||
|
with:
|
||||||
|
name: Release ${{ steps.get_version.outputs.version }}
|
||||||
|
body_path: release_notes.md
|
||||||
|
files: release/*
|
||||||
|
draft: false
|
||||||
|
prerelease: false
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
151
.gitignore
vendored
151
.gitignore
vendored
@@ -1,120 +1,33 @@
|
|||||||
cpu.pprof
|
**/cpu.pprof
|
||||||
cpu.trace
|
**/cpu.trace
|
||||||
test
|
**/test
|
||||||
bin
|
**/bin
|
||||||
vendor
|
**/vendor
|
||||||
*.fastq
|
**/*.fastq
|
||||||
*.fasta
|
**/*.fasta
|
||||||
*.fastq.gz
|
**/*.fastq.gz
|
||||||
*.fasta.gz
|
**/*.fasta.gz
|
||||||
.DS_Store
|
**/.DS_Store
|
||||||
*.gml
|
**/*.gml
|
||||||
*.log
|
**/*.log
|
||||||
/argaly
|
**/xxx*
|
||||||
|
**/*.sav
|
||||||
/obiconvert
|
**/*.old
|
||||||
/obicount
|
**/*.tgz
|
||||||
/obimultiplex
|
**/*.yaml
|
||||||
/obipairing
|
**/*.csv
|
||||||
/obipcr
|
|
||||||
/obifind
|
|
||||||
/obidistribute
|
|
||||||
/obiuniq
|
|
||||||
/build
|
|
||||||
/Makefile.old
|
|
||||||
.Rproj.user
|
|
||||||
obitools.Rproj
|
|
||||||
Stat_error.knit.md
|
|
||||||
.Rhistory
|
|
||||||
Stat_error.nb.html
|
|
||||||
Stat_error.Rmd
|
|
||||||
|
|
||||||
/.luarc.json
|
|
||||||
/doc/TAXO/
|
|
||||||
/doc/results/
|
|
||||||
/doc/_main.log
|
|
||||||
/doc/_book/_main.tex
|
|
||||||
/doc/_freeze/
|
|
||||||
/doc/tutorial_files/
|
|
||||||
/doc/wolf_data/
|
|
||||||
/taxdump/
|
|
||||||
/.vscode/
|
|
||||||
|
|
||||||
/Algo-Alignement.numbers
|
|
||||||
/Estimate_proba_true_seq.html
|
|
||||||
/Estimate_proba_true_seq.nb.html
|
|
||||||
/Estimate_proba_true_seq.Rmd
|
|
||||||
/modele_error_euka.qmd
|
|
||||||
/obitools.code-workspace
|
|
||||||
.DS_Store
|
|
||||||
.RData
|
|
||||||
x
|
|
||||||
xxx
|
|
||||||
y
|
|
||||||
/doc/wolf_diet.tgz
|
|
||||||
/doc/man/depends
|
|
||||||
/sample/wolf_R1.fasta.gz
|
|
||||||
/sample/wolf_R2.fasta.gz
|
|
||||||
/sample/euka03.ecotag.fasta.gz
|
|
||||||
/sample/ratio.csv
|
|
||||||
/sample/STD_PLN_1.dat
|
|
||||||
/sample/STD_PLN_2.dat
|
|
||||||
/sample/subset_Pasvik_R1.fastq.gz
|
|
||||||
/sample/subset_Pasvik_R2.fastq.gz
|
|
||||||
/sample/test_gobitools.fasta.bz2
|
|
||||||
euka03.csv*
|
|
||||||
gbbct793.seq.gz
|
|
||||||
gbinv1003.seq.gz
|
|
||||||
gbpln210.seq
|
|
||||||
/doc/book/OBITools-V4.aux
|
|
||||||
/doc/book/OBITools-V4.fdb_latexmk
|
|
||||||
/doc/book/OBITools-V4.fls
|
|
||||||
/doc/book/OBITools-V4.log
|
|
||||||
/doc/book/OBITools-V4.pdf
|
|
||||||
/doc/book/OBITools-V4.synctex.gz
|
|
||||||
/doc/book/OBITools-V4.tex
|
|
||||||
/doc/book/OBITools-V4.toc
|
|
||||||
getoptions.adoc
|
|
||||||
Archive.zip
|
|
||||||
.DS_Store
|
|
||||||
sample/.DS_Store
|
|
||||||
sample/consensus_graphs/specimen_hac_plants_Vern_disicolor_.gml
|
|
||||||
93954
|
|
||||||
Bact03.e5.gb_R254.obipcr.idx.fasta.save
|
|
||||||
sample/test.obipcr.log
|
|
||||||
Bact02.e3.gb_R254.obipcr.fasta.gz
|
|
||||||
Example_Arth03.ngsfilter
|
|
||||||
SPER01.csv
|
|
||||||
SPER03.csv
|
|
||||||
wolf_diet_ngsfilter.txt
|
|
||||||
xx
|
xx
|
||||||
xxx.gb
|
|
||||||
yyy_geom.csv
|
.rhistory
|
||||||
yyy_LCS.csv
|
/.vscode
|
||||||
yyy.json
|
/build
|
||||||
bug_obimultiplex/toto
|
/bugs
|
||||||
bug_obimultiplex/toto_mapping
|
|
||||||
bug_obimultiplex/tutu
|
/ncbitaxo
|
||||||
bug_obimultiplex/tutu_mapping
|
|
||||||
bug_obipairing/GIT1_GH_ngsfilter.txt
|
!/obitests/**
|
||||||
doc/book/TAXO/citations.dmp
|
!/sample/**
|
||||||
doc/book/TAXO/delnodes.dmp
|
LLM/**
|
||||||
doc/book/TAXO/division.dmp
|
*_files
|
||||||
doc/book/TAXO/gc.prt
|
|
||||||
doc/book/TAXO/gencode.dmp
|
entropy.html
|
||||||
doc/book/TAXO/merged.dmp
|
|
||||||
doc/book/TAXO/names.dmp
|
|
||||||
doc/book/TAXO/nodes.dmp
|
|
||||||
doc/book/TAXO/readme.txt
|
|
||||||
doc/book/wolf_data/Release-253/ncbitaxo/citations.dmp
|
|
||||||
doc/book/wolf_data/Release-253/ncbitaxo/delnodes.dmp
|
|
||||||
doc/book/wolf_data/Release-253/ncbitaxo/division.dmp
|
|
||||||
doc/book/wolf_data/Release-253/ncbitaxo/gc.prt
|
|
||||||
doc/book/wolf_data/Release-253/ncbitaxo/gencode.dmp
|
|
||||||
doc/book/wolf_data/Release-253/ncbitaxo/merged.dmp
|
|
||||||
doc/book/wolf_data/Release-253/ncbitaxo/names.dmp
|
|
||||||
doc/book/wolf_data/Release-253/ncbitaxo/nodes.dmp
|
|
||||||
doc/book/wolf_data/Release-253/ncbitaxo/readme.txt
|
|
||||||
doc/book/results/toto.tasta
|
|
||||||
sample/.DS_Store
|
|
||||||
GO
|
|
||||||
103
Makefile
103
Makefile
@@ -2,8 +2,9 @@
|
|||||||
#export GOBIN=$(GOPATH)/bin
|
#export GOBIN=$(GOPATH)/bin
|
||||||
#export PATH=$(GOBIN):$(shell echo $${PATH})
|
#export PATH=$(GOBIN):$(shell echo $${PATH})
|
||||||
|
|
||||||
|
GOFLAGS=
|
||||||
GOCMD=go
|
GOCMD=go
|
||||||
GOBUILD=$(GOCMD) build # -compiler gccgo -gccgoflags -O3
|
GOBUILD=$(GOCMD) build $(GOFLAGS)
|
||||||
GOGENERATE=$(GOCMD) generate
|
GOGENERATE=$(GOCMD) generate
|
||||||
GOCLEAN=$(GOCMD) clean
|
GOCLEAN=$(GOCMD) clean
|
||||||
GOTEST=$(GOCMD) test
|
GOTEST=$(GOCMD) test
|
||||||
@@ -16,6 +17,12 @@ PACKAGES_SRC:= $(wildcard pkg/*/*.go pkg/*/*/*.go)
|
|||||||
PACKAGE_DIRS:=$(sort $(patsubst %/,%,$(dir $(PACKAGES_SRC))))
|
PACKAGE_DIRS:=$(sort $(patsubst %/,%,$(dir $(PACKAGES_SRC))))
|
||||||
PACKAGES:=$(notdir $(PACKAGE_DIRS))
|
PACKAGES:=$(notdir $(PACKAGE_DIRS))
|
||||||
|
|
||||||
|
GITHOOK_SRC_DIR=git-hooks
|
||||||
|
GITHOOKS_SRC:=$(wildcard $(GITHOOK_SRC_DIR)/*)
|
||||||
|
|
||||||
|
GITHOOK_DIR=.git/hooks
|
||||||
|
GITHOOKS:=$(patsubst $(GITHOOK_SRC_DIR)/%,$(GITHOOK_DIR)/%,$(GITHOOKS_SRC))
|
||||||
|
|
||||||
OBITOOLS_SRC:= $(wildcard cmd/obitools/*/*.go)
|
OBITOOLS_SRC:= $(wildcard cmd/obitools/*/*.go)
|
||||||
OBITOOLS_DIRS:=$(sort $(patsubst %/,%,$(dir $(OBITOOLS_SRC))))
|
OBITOOLS_DIRS:=$(sort $(patsubst %/,%,$(dir $(OBITOOLS_SRC))))
|
||||||
OBITOOLS:=$(notdir $(OBITOOLS_DIRS))
|
OBITOOLS:=$(notdir $(OBITOOLS_DIRS))
|
||||||
@@ -53,27 +60,31 @@ endif
|
|||||||
|
|
||||||
OUTPUT:=$(shell mktemp)
|
OUTPUT:=$(shell mktemp)
|
||||||
|
|
||||||
all: obitools
|
all: install-githook obitools
|
||||||
|
|
||||||
|
obitools: $(patsubst %,$(OBITOOLS_PREFIX)%,$(OBITOOLS))
|
||||||
|
|
||||||
|
install-githook: $(GITHOOKS)
|
||||||
|
|
||||||
|
$(GITHOOK_DIR)/%: $(GITHOOK_SRC_DIR)/%
|
||||||
|
@echo installing $$(basename $@)...
|
||||||
|
@mkdir -p $(GITHOOK_DIR)
|
||||||
|
@cp $< $@
|
||||||
|
@chmod +x $@
|
||||||
|
|
||||||
packages: $(patsubst %,pkg-%,$(PACKAGES))
|
|
||||||
obitools: $(patsubst %,$(OBITOOLS_PREFIX)%,$(OBITOOLS))
|
|
||||||
|
|
||||||
update-deps:
|
update-deps:
|
||||||
go get -u ./...
|
go get -u ./...
|
||||||
|
|
||||||
test:
|
test: .FORCE
|
||||||
$(GOTEST) ./...
|
$(GOTEST) ./...
|
||||||
|
|
||||||
man:
|
|
||||||
make -C doc man
|
|
||||||
obibook:
|
|
||||||
make -C doc obibook
|
|
||||||
doc: man obibook
|
|
||||||
|
|
||||||
macos-pkg:
|
obitests:
|
||||||
@bash pkgs/macos/macos-installer-builder-master/macOS-x64/build-macos-x64.sh \
|
@for t in $$(find obitests -name test.sh -print) ; do \
|
||||||
OBITools \
|
bash $${t} || exit 1;\
|
||||||
0.0.1
|
done
|
||||||
|
|
||||||
|
githubtests: obitools obitests
|
||||||
|
|
||||||
$(BUILD_DIR):
|
$(BUILD_DIR):
|
||||||
mkdir -p $@
|
mkdir -p $@
|
||||||
@@ -83,19 +94,61 @@ $(foreach P,$(PACKAGE_DIRS),$(eval $(call MAKE_PKG_RULE,$(P))))
|
|||||||
|
|
||||||
$(foreach P,$(OBITOOLS_DIRS),$(eval $(call MAKE_OBITOOLS_RULE,$(P))))
|
$(foreach P,$(OBITOOLS_DIRS),$(eval $(call MAKE_OBITOOLS_RULE,$(P))))
|
||||||
|
|
||||||
pkg/obioptions/version.go: .FORCE
|
pkg/obioptions/version.go: version.txt .FORCE
|
||||||
ifneq ($(strip $(COMMIT_ID)),)
|
@version=$$(cat version.txt); \
|
||||||
@cat $@ \
|
cat $@ \
|
||||||
| sed -E 's/^var _Commit = "[^"]*"/var _Commit = "'$(COMMIT_ID)'"/' \
|
| sed -E 's/^var _Version = "[^"]*"/var _Version = "Release '$$version'"/' \
|
||||||
| sed -E 's/^var _Version = "[^"]*"/var _Version = "'"$(LAST_TAG)"'"/' \
|
|
||||||
> $(OUTPUT)
|
> $(OUTPUT)
|
||||||
|
|
||||||
@diff $@ $(OUTPUT) 2>&1 > /dev/null \
|
@diff $@ $(OUTPUT) 2>&1 > /dev/null \
|
||||||
|| echo "Update version.go : $@ to $(LAST_TAG) ($(COMMIT_ID))" \
|
|| (echo "Update version.go to $$(cat version.txt)" && mv $(OUTPUT) $@)
|
||||||
&& mv $(OUTPUT) $@
|
|
||||||
|
|
||||||
@rm -f $(OUTPUT)
|
@rm -f $(OUTPUT)
|
||||||
endif
|
|
||||||
|
|
||||||
.PHONY: all packages obitools man obibook doc update-deps .FORCE
|
bump-version:
|
||||||
.FORCE:
|
@echo "Incrementing version..."
|
||||||
|
@current=$$(cat version.txt); \
|
||||||
|
echo " Current version: $$current"; \
|
||||||
|
major=$$(echo $$current | cut -d. -f1); \
|
||||||
|
minor=$$(echo $$current | cut -d. -f2); \
|
||||||
|
patch=$$(echo $$current | cut -d. -f3); \
|
||||||
|
new_patch=$$((patch + 1)); \
|
||||||
|
new_version="$$major.$$minor.$$new_patch"; \
|
||||||
|
echo " New version: $$new_version"; \
|
||||||
|
echo "$$new_version" > version.txt
|
||||||
|
@echo "✓ Version updated in version.txt"
|
||||||
|
@$(MAKE) pkg/obioptions/version.go
|
||||||
|
|
||||||
|
jjnew:
|
||||||
|
@echo "$(YELLOW)→ Creating a new commit...$(NC)"
|
||||||
|
@echo "$(BLUE)→ Documenting current commit...$(NC)"
|
||||||
|
@jj auto-describe
|
||||||
|
@echo "$(BLUE)→ Done.$(NC)"
|
||||||
|
@jj new
|
||||||
|
@echo "$(GREEN)✓ New commit created$(NC)"
|
||||||
|
|
||||||
|
jjpush:
|
||||||
|
@echo "$(YELLOW)→ Pushing commit to repository...$(NC)"
|
||||||
|
@echo "$(BLUE)→ Documenting current commit...$(NC)"
|
||||||
|
@jj auto-describe
|
||||||
|
@echo "$(BLUE)→ Creating new commit for version bump...$(NC)"
|
||||||
|
@jj new
|
||||||
|
@$(MAKE) bump-version
|
||||||
|
@echo "$(BLUE)→ Documenting version bump commit...$(NC)"
|
||||||
|
@jj auto-describe
|
||||||
|
@version=$$(cat version.txt); \
|
||||||
|
tag_name="Release_$$version"; \
|
||||||
|
echo "$(BLUE)→ Pushing commits and creating tag $$tag_name...$(NC)"; \
|
||||||
|
jj git push --change @; \
|
||||||
|
git tag -a "$$tag_name" -m "Release $$version" 2>/dev/null || echo "Tag $$tag_name already exists"; \
|
||||||
|
git push origin "$$tag_name" 2>/dev/null || echo "Tag already pushed"
|
||||||
|
@echo "$(GREEN)✓ Commits and tag pushed to repository$(NC)"
|
||||||
|
|
||||||
|
jjfetch:
|
||||||
|
@echo "$(YELLOW)→ Pulling latest commits...$(NC)"
|
||||||
|
@jj git fetch
|
||||||
|
@jj new master@origin
|
||||||
|
@echo "$(GREEN)✓ Latest commits pulled$(NC)"
|
||||||
|
|
||||||
|
.PHONY: all obitools update-deps obitests githubtests jjnew jjpush jjfetch bump-version .FORCE
|
||||||
|
.FORCE:
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ curl -L https://raw.githubusercontent.com/metabarcoding/obitools4/master/install
|
|||||||
bash -s -- --install-dir test_install --obitools-prefix k
|
bash -s -- --install-dir test_install --obitools-prefix k
|
||||||
```
|
```
|
||||||
|
|
||||||
In this case, the binaries will be installed in the `test_install` directory and all command names will be prefixed with the letter `k`. Thus `obigrep` will be named `kobigrep`.
|
In this case, the binaries will be installed in the `test_install` directory and all command names will be prefixed with the letter `k`. Thus, `obigrep` will be named `kobigrep`.
|
||||||
|
|
||||||
## Continuing the analysis...
|
## Continuing the analysis...
|
||||||
|
|
||||||
|
|||||||
319
Release-notes.md
319
Release-notes.md
@@ -1,51 +1,190 @@
|
|||||||
# OBITools release notes
|
# OBITools release notes
|
||||||
|
|
||||||
## Latest changes
|
## New changes
|
||||||
|
|
||||||
|
### Bug fixes
|
||||||
|
|
||||||
|
- In `obipairing` correct the misspelling of the `obiparing_*` tags where the `i`
|
||||||
|
was missing to `obipairing_`.
|
||||||
|
|
||||||
|
- In `obigrep` the **-C** option that excludes sequences too abundant was not
|
||||||
|
functional.
|
||||||
|
|
||||||
|
- In `obitaxonomy` the **-l** option that lists all the taxonomic rank defined by
|
||||||
|
a taxonomy was not functional
|
||||||
|
|
||||||
|
- The file type guesser was not using enough data to be able to correctly detect
|
||||||
|
file format when sequences were too long in fastq and fasta or when lines were
|
||||||
|
to long in CSV files. That's now corrected
|
||||||
|
|
||||||
|
- Options **--fasta** or **--fastq** usable to specify input format were ignored.
|
||||||
|
They are now correctly considered
|
||||||
|
|
||||||
|
- The `obiannotate` command were crashing when a selection option was used but
|
||||||
|
no editing option.
|
||||||
|
|
||||||
|
- The `--fail-on-taxonomy` led to an error on merged taxa even when the
|
||||||
|
`--update-taxid` option was used.
|
||||||
|
|
||||||
|
- The `--compressed` option was not correctly named. It was renamed to `--compress`
|
||||||
|
|
||||||
|
### Enhancement
|
||||||
|
|
||||||
|
- Some sequences in the Genbank and EMBL databases are several gigabases long. The
|
||||||
|
sequence parser had to reallocate and recopy memory many times to read them,
|
||||||
|
resulting in a complexity of O(N^2) for reading such large sequences.
|
||||||
|
The new file chunk reader has a linear algorithm that speeds up the reading
|
||||||
|
of very long sequences.
|
||||||
|
|
||||||
|
- A new option **--csv** is added to every obitools to indicate that the input
|
||||||
|
format is CSV
|
||||||
|
|
||||||
|
- The new version of obitools are now printing the taxids in a fancy way
|
||||||
|
including the scientific name and the taxonomic rank (`"taxon:9606 [Homo
|
||||||
|
sapiens]@species"`). But if you need the old fashion raw taxid, a new option
|
||||||
|
**--raw-taxid** has been added to get obitools printing the taxids without any
|
||||||
|
decorations (`"9606"`).
|
||||||
|
|
||||||
|
|
||||||
|
## March 1st, 2025. Release 4.4.0
|
||||||
|
|
||||||
|
A new documentation website is available at https://obitools4.metabarcoding.org.
|
||||||
|
Its development is still in progress.
|
||||||
|
|
||||||
|
The biggest step forward in this new version is taxonomy management. The new
|
||||||
|
version is now able to handle taxonomic identifiers that are not just integer
|
||||||
|
values. This is a first step towards an easy way to handle other taxonomy
|
||||||
|
databases soon, such as the GBIF or Catalog of Life taxonomies. This version
|
||||||
|
is able to handle files containing taxonomic information created by previous
|
||||||
|
versions of OBITools, but files created by this new version may have some
|
||||||
|
problems to be analyzed by previous versions, at least for the taxonomic
|
||||||
|
information.
|
||||||
|
|
||||||
|
|
||||||
|
### Breaking changes
|
||||||
|
|
||||||
|
- In `obimultiplex`, the short version of the **--tag-list** option used to
|
||||||
|
specify the list of tags and primers to be used for the demultiplexing has
|
||||||
|
been changed from `-t` to `-s`.
|
||||||
|
|
||||||
|
- The command `obifind` is now renamed `obitaxonomy`.
|
||||||
|
|
||||||
|
- The **--taxdump** option used to specify the path to the taxdump containing
|
||||||
|
the NCBI taxonomy has been renamed to **--taxonomy**.
|
||||||
|
|
||||||
|
### Bug fixes
|
||||||
|
|
||||||
|
- Correction of a bug when using paired sequence file with the **--out** option.
|
||||||
|
|
||||||
|
- Correction of a bug in `obitag` when trying to annotate very short sequences of
|
||||||
|
4 bases or less.
|
||||||
|
|
||||||
|
|
||||||
|
- In `obipairing`, correct the stats `seq_a_single` and `seq_b_single` when
|
||||||
|
on right alignment mode
|
||||||
|
|
||||||
|
- Not really a bug but the memory impact of `obiuniq` has been reduced by reducing
|
||||||
|
the batch size and not reading the qualities from the fastq files as `obiuniq`
|
||||||
|
is producing only fasta output without qualities.
|
||||||
|
|
||||||
|
- In `obitag`, correct the wrong assignment of the **obitag_bestmatch**
|
||||||
|
attribute.
|
||||||
|
|
||||||
|
- In `obiclean`, the **--no-progress-bar** option disables all progress bars,
|
||||||
|
not just the data.
|
||||||
|
|
||||||
|
- Several fixes in reading FASTA and FASTQ files, including some code
|
||||||
|
simplification and factorization.
|
||||||
|
|
||||||
|
- Fixed a bug in all obitools that caused the same file to be processed
|
||||||
|
multiple times, when specifying a directory name as input.
|
||||||
|
|
||||||
|
|
||||||
|
### New features
|
||||||
|
|
||||||
|
- `obigrep` add a new **--valid-taxid** option to keep only sequence with a
|
||||||
|
valid taxid
|
||||||
|
|
||||||
|
- `obiclean` add a new **--min-sample-count** option with a default value of 1,
|
||||||
|
asking to filter out sequences which are not occurring in at least the
|
||||||
|
specified number of samples.
|
||||||
|
|
||||||
|
- `obitoaxonomy` a new **--dump|D** option allows for dumping a sub-taxonomy.
|
||||||
|
|
||||||
|
- Taxonomy dump can now be provided as a four-columns CSV file to the
|
||||||
|
**--taxonomy** option.
|
||||||
|
|
||||||
|
- NCBI Taxonomy dump does not need to be uncompressed and unarchived anymore. The
|
||||||
|
path of the tar and gziped dump file can be directly specified using the
|
||||||
|
**--taxonomy** option.
|
||||||
|
|
||||||
|
- Most of the time obitools identify automatically sequence file format. But
|
||||||
|
it fails sometimes. Two new option **--fasta** and **--fastq** are added to
|
||||||
|
allow the processing of the rare fasta and fastq files not recognized.
|
||||||
|
|
||||||
|
- In `obiscript`, adds new methods to the Lua sequence object:
|
||||||
|
- `md5_string()`: returning the MD5 check sum as a hexadecimal string,
|
||||||
|
- `subsequence(from,to)`: allows extracting a subsequence on a 0 based
|
||||||
|
coordinate system, upper bound excluded like in go.
|
||||||
|
- `reverse_complement`: returning a sequence object corresponding to the
|
||||||
|
reverse complement of the current sequence.
|
||||||
|
|
||||||
|
### Enhancement
|
||||||
|
|
||||||
|
- All obitools now have a **--taxonomy** option. If specified, the taxonomy is
|
||||||
|
loaded first and taxids annotating the sequences are validated against that
|
||||||
|
taxonomy. A warning is issued for any invalid taxid and for any taxid that
|
||||||
|
is transferred to a new taxid. The **--update-taxid** option allows these
|
||||||
|
old taxids to be replaced with their new equivalent in the result of the
|
||||||
|
obitools command.
|
||||||
|
|
||||||
|
- The scoring system used by the `obipairing` command has been changed to be
|
||||||
|
more coherent. In the new version, the scores associated to a match and a
|
||||||
|
mismatch involving a nucleotide with a quality score of 0 are equal. Which
|
||||||
|
is normal as a zero quality score means a perfect indecision on the read
|
||||||
|
nucleotide, therefore there is no reason to penalize a match differently
|
||||||
|
from a mismatch (see
|
||||||
|
https://obitools4.metabarcoding.org/docs/commands/alignments/obipairing/exact-alignment/).
|
||||||
|
|
||||||
|
- In every *OBITools* command, the progress bar is automatically deactivated
|
||||||
|
when the standard error output is redirected.
|
||||||
|
|
||||||
|
- Because Genbank and ENA:EMBL contain very large sequences, while OBITools4
|
||||||
|
are optimized As Genbank and ENA:EMBL contain very large sequences, while
|
||||||
|
OBITools4 is optimized for short sequences, `obipcr` faces some problems
|
||||||
|
with excessive consumption of computer resources, especially memory. Several
|
||||||
|
improvements in the tuning of the default `obipcr` parameters and some new
|
||||||
|
features, currently only available for FASTA and FASTQ file readers, have
|
||||||
|
been implemented to limit the memory impact of `obipcr` without changing the
|
||||||
|
computational efficiency too much.
|
||||||
|
|
||||||
|
- Logging system and therefore format, have been homogenized.
|
||||||
|
|
||||||
## August 2nd, 2024. Release 4.3.0
|
## August 2nd, 2024. Release 4.3.0
|
||||||
|
|
||||||
### Change of git repositiory
|
### Change of git repository
|
||||||
|
|
||||||
- The OBITools4 git repository has been moved to the github repository.
|
- The OBITools4 git repository has been moved to the GitHub repository.
|
||||||
The new address is: https://github.com/metabarcoding/obitools4.
|
The new address is: https://github.com/metabarcoding/obitools4.
|
||||||
Take care for using the new install script for retrieving the new version.
|
Take care for using the new install script for retrieving the new version.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
curl -L https://raw.githubusercontent.com/metabarcoding/obitools4/master/install_obitools.sh \
|
curl -L https://metabarcoding.org/obitools4/install.sh \
|
||||||
| bash
|
| bash
|
||||||
```
|
```
|
||||||
|
|
||||||
or with options:
|
or with options:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
curl -L https://raw.githubusercontent.com/metabarcoding/obitools4/master/install_obitools.sh \
|
curl -L https://metabarcoding.org/obitools4/install.sh \
|
||||||
| bash -s -- --install-dir test_install --obitools-prefix k
|
| bash -s -- --install-dir test_install --obitools-prefix k
|
||||||
```
|
```
|
||||||
|
|
||||||
### CPU limitation
|
|
||||||
|
|
||||||
- By default, *OBITools4* tries to use all the computing power available on
|
|
||||||
your computer. In some circumstances this can be problematic (e.g. if you
|
|
||||||
are running on a computer cluster managed by your university). You can limit
|
|
||||||
the number of CPU cores used by *OBITools4* or by using the **--max-cpu**
|
|
||||||
option or by setting the **OBIMAXCPU** environment variable. Some strange
|
|
||||||
behaviour of *OBITools4* has been observed when users try to limit the
|
|
||||||
maximum number of usable CPU cores to one. This seems to be caused by the Go
|
|
||||||
language, and it is not obvious to get *OBITools4* to run correctly on a
|
|
||||||
single core in all circumstances. Therefore, if you ask to use a single
|
|
||||||
core, **OBITools4** will print a warning message and actually set this
|
|
||||||
parameter to two cores. If you really want a single core, you can use the
|
|
||||||
**--force-one-core** option. But be aware that this can lead to incorrect
|
|
||||||
calculations.
|
|
||||||
|
|
||||||
### New features
|
|
||||||
|
|
||||||
- The output of the obitools will evolve to produce results only in standard
|
- The output of the obitools will evolve to produce results only in standard
|
||||||
formats such as fasta and fastq. For non-sequential data, the output will be
|
formats such as fasta and fastq. For non-sequential data, the output will be
|
||||||
in CSV format, with the separator `,`, the decimal separator `.`, and a
|
in CSV format, with the separator `,`, the decimal separator `.`, and a
|
||||||
header line with the column names. It is more convenient to use the output
|
header line with the column names. It is more convenient to use the output
|
||||||
in other programs. For example, you can use the `csvtomd` command to
|
in other programs. For example, you can use the `csvtomd` command to
|
||||||
reformat the csv output into a markdown table. The first command to initiate
|
reformat the CSV output into a Markdown table. The first command to initiate
|
||||||
this change is `obicount`, which now produces a 3-line CSV output.
|
this change is `obicount`, which now produces a 3-line CSV output.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@@ -57,7 +196,7 @@
|
|||||||
database for `obitag` is to use `obipcr` on a local copy of Genbank or EMBL.
|
database for `obitag` is to use `obipcr` on a local copy of Genbank or EMBL.
|
||||||
However, these sequence databases are known to contain many taxonomic
|
However, these sequence databases are known to contain many taxonomic
|
||||||
errors, such as bacterial sequences annotated with the taxid of their host
|
errors, such as bacterial sequences annotated with the taxid of their host
|
||||||
species. obicleandb tries to detect these errors. To do this, it first keeps
|
species. `obicleandb` tries to detect these errors. To do this, it first keeps
|
||||||
only sequences annotated with the taxid to which a species, genus, and
|
only sequences annotated with the taxid to which a species, genus, and
|
||||||
family taxid can be assigned. Then, for each sequence, it compares the
|
family taxid can be assigned. Then, for each sequence, it compares the
|
||||||
distance of the sequence to the other sequences belonging to the same genus
|
distance of the sequence to the other sequences belonging to the same genus
|
||||||
@@ -68,7 +207,7 @@
|
|||||||
with the p-value of the Mann-Whitney U test in the **obicleandb_trusted**
|
with the p-value of the Mann-Whitney U test in the **obicleandb_trusted**
|
||||||
slot. Later, the distribution of this p-value can be analyzed to determine a
|
slot. Later, the distribution of this p-value can be analyzed to determine a
|
||||||
threshold. Empirically, a threshold of 0.05 is a good compromise and allows
|
threshold. Empirically, a threshold of 0.05 is a good compromise and allows
|
||||||
to filter out less than 1‰ of the sequences. These sequences can then be
|
filtering out less than 1‰ of the sequences. These sequences can then be
|
||||||
removed using `obigrep`.
|
removed using `obigrep`.
|
||||||
|
|
||||||
- Adds a new `obijoin` utility to join information contained in a sequence
|
- Adds a new `obijoin` utility to join information contained in a sequence
|
||||||
@@ -78,16 +217,16 @@
|
|||||||
|
|
||||||
- Adds a new tool `obidemerge` to demerge a `merge_xxx` slot by recreating the
|
- Adds a new tool `obidemerge` to demerge a `merge_xxx` slot by recreating the
|
||||||
multiple identical sequences having the slot `xxx` recreated with its initial
|
multiple identical sequences having the slot `xxx` recreated with its initial
|
||||||
value and the sequence count set to the number of occurences refered in the
|
value and the sequence count set to the number of occurrences referred in the
|
||||||
`merge_xxx` slot. During the operation, the `merge_xxx` slot is removed.
|
`merge_xxx` slot. During the operation, the `merge_xxx` slot is removed.
|
||||||
|
|
||||||
- Adds CSV as one of the input format for every obitools command. To encode
|
- Adds CSV as one of the input format for every obitools command. To encode
|
||||||
sequence the CSV file must includes a column named `sequence` and another
|
sequence the CSV file must include a column named `sequence` and another
|
||||||
column named `id`. An extra column named `qualities` can be added to specify
|
column named `id`. An extra column named `qualities` can be added to specify
|
||||||
the quality scores of the sequence following the same ascii encoding than the
|
the quality scores of the sequence following the same ASCII encoding than the
|
||||||
fastq format. All the other columns will be considered as annotations and will
|
fastq format. All the other columns will be considered as annotations and will
|
||||||
be interpreted as JSON objects encoding potentially for atomic values. If a
|
be interpreted as JSON objects encoding potentially for atomic values. If a
|
||||||
calumn value can not be decoded as JSON it will be considered as a string.
|
column value can not be decoded as JSON it will be considered as a string.
|
||||||
|
|
||||||
- A new option **--version** has been added to every obitools command. It will
|
- A new option **--version** has been added to every obitools command. It will
|
||||||
print the version of the command.
|
print the version of the command.
|
||||||
@@ -96,8 +235,8 @@
|
|||||||
quality scores from a BioSequence object.\
|
quality scores from a BioSequence object.\
|
||||||
|
|
||||||
- In `obimultuplex` the ngsfilter file describing the samples can be no provided
|
- In `obimultuplex` the ngsfilter file describing the samples can be no provided
|
||||||
not only using the classical nfsfilter format but also using the csv format.
|
not only using the classical ngsfilter format but also using the CSV format.
|
||||||
When using csv, the first line must contain the column names. 5 columns are
|
When using CSV, the first line must contain the column names. 5 columns are
|
||||||
expected:
|
expected:
|
||||||
|
|
||||||
- `experiment` the name of the experiment
|
- `experiment` the name of the experiment
|
||||||
@@ -113,43 +252,34 @@
|
|||||||
|
|
||||||
Supplementary columns are allowed. Their names and content will be used to
|
Supplementary columns are allowed. Their names and content will be used to
|
||||||
annotate the sequence corresponding to the sample, as the `key=value;` did
|
annotate the sequence corresponding to the sample, as the `key=value;` did
|
||||||
in the nfsfilter format.
|
in the ngsfilter format.
|
||||||
|
|
||||||
The CSV format used allows for comment lines starting with `#` character.
|
The CSV format used allows for comment lines starting with `#` character.
|
||||||
Special data lines starting with `@param` in the first column allow to
|
Special data lines starting with `@param` in the first column allow configuring the algorithm. The options **--template** provided an over
|
||||||
configure the algorithm. The options **--template** provided an over
|
commented example of the CSV format, including all the possible options.
|
||||||
commented example of the csv format, including all the possible options.
|
|
||||||
|
### CPU limitation
|
||||||
|
|
||||||
### Enhancement
|
- By default, *OBITools4* tries to use all the computing power available on
|
||||||
|
your computer. In some circumstances this can be problematic (e.g. if you
|
||||||
|
are running on a computer cluster managed by your university). You can limit
|
||||||
|
the number of CPU cores used by *OBITools4* or by using the **--max-cpu**
|
||||||
|
option or by setting the **OBIMAXCPU** environment variable. Some strange
|
||||||
|
behavior of *OBITools4* has been observed when users try to limit the
|
||||||
|
maximum number of usable CPU cores to one. This seems to be caused by the Go
|
||||||
|
language, and it is not obvious to get *OBITools4* to run correctly on a
|
||||||
|
single core in all circumstances. Therefore, if you ask to use a single
|
||||||
|
core, **OBITools4** will print a warning message and actually set this
|
||||||
|
parameter to two cores. If you really want a single core, you can use the
|
||||||
|
**--force-one-core** option. But be aware that this can lead to incorrect
|
||||||
|
calculations.
|
||||||
|
|
||||||
- In every *OBITools* command, the progress bar are automatically deactivated
|
|
||||||
when the standard error output is redirected.
|
|
||||||
- Because Genbank and ENA:EMBL contain very large sequences, while OBITools4
|
|
||||||
are optimized As Genbank and ENA:EMBL contain very large sequences, while
|
|
||||||
OBITools4 is optimised for short sequences, `obipcr` faces some problems
|
|
||||||
with excessive consumption of computer resources, especially memory. Several
|
|
||||||
improvements in the tuning of the default `obipcr` parameters and some new
|
|
||||||
features, currently only available for FASTA and FASTQ file readers, have
|
|
||||||
been implemented to limit the memory impact of `obipcr` without changing the
|
|
||||||
computational efficiency too much.
|
|
||||||
- Logging system and therefore format, have been homogenized.
|
|
||||||
|
|
||||||
### Bug
|
|
||||||
|
|
||||||
- In `obitag`, correct the wrong assignment of the **obitag_bestmatch**
|
|
||||||
attribute.
|
|
||||||
- In `obiclean`, the **--no-progress-bar** option disables all progress bars,
|
|
||||||
not just the data.
|
|
||||||
- Several fixes in reading FASTA and FASTQ files, including some code
|
|
||||||
simplification and and factorization.
|
|
||||||
- Fixed a bug in all obitools that caused the same file to be processed
|
|
||||||
multiple times. when specifying a directory name as input.
|
|
||||||
|
|
||||||
## April 2nd, 2024. Release 4.2.0
|
## April 2nd, 2024. Release 4.2.0
|
||||||
|
|
||||||
### New features
|
### New features
|
||||||
|
|
||||||
- A new OBITools named `obiscript` allows to process each sequence according
|
- A new OBITools named `obiscript` allows processing each sequence according
|
||||||
to a Lua script. This is an experimental tool. The **--template** option
|
to a Lua script. This is an experimental tool. The **--template** option
|
||||||
allows for generating an example script on the `stdout`.
|
allows for generating an example script on the `stdout`.
|
||||||
|
|
||||||
@@ -157,7 +287,7 @@
|
|||||||
|
|
||||||
- Two of the main class `obiseq.SeqWorker` and `obiseq.SeqWorker` have their
|
- Two of the main class `obiseq.SeqWorker` and `obiseq.SeqWorker` have their
|
||||||
declaration changed. Both now return two values a `obiseq.BioSequenceSlice`
|
declaration changed. Both now return two values a `obiseq.BioSequenceSlice`
|
||||||
and an `error`. This allow a worker to return potentially several sequences
|
and an `error`. This allows a worker to return potentially several sequences
|
||||||
as the result of the processing of a single sequence, or zero, which is
|
as the result of the processing of a single sequence, or zero, which is
|
||||||
equivalent to filter out the input sequence.
|
equivalent to filter out the input sequence.
|
||||||
|
|
||||||
@@ -165,12 +295,12 @@
|
|||||||
|
|
||||||
- In `obitag` if the reference database contains sequences annotated by taxid
|
- In `obitag` if the reference database contains sequences annotated by taxid
|
||||||
not referenced in the taxonomy, the corresponding sequences are discarded
|
not referenced in the taxonomy, the corresponding sequences are discarded
|
||||||
from the reference database and a warning indicating the sequence id and the
|
from the reference database and a warning indicating the sequence *id* and the
|
||||||
wrong taxid is emitted.
|
wrong taxid is emitted.
|
||||||
- The bug corrected in the parsing of EMBL and Genbank files as implemented in
|
- The bug corrected in the parsing of EMBL and Genbank files as implemented in
|
||||||
version 4.1.2 of OBITools4, potentially induced some reduction in the
|
version 4.1.2 of OBITools4, potentially induced some reduction in the
|
||||||
performance of the parsing. This should have been now fixed.
|
performance of the parsing. This should have been now fixed.
|
||||||
- In the same idea, parsing of genbank and EMBL files were reading and storing
|
- In the same idea, parsing of Genbank and EMBL files were reading and storing
|
||||||
in memory not only the sequence but also the annotations (features table).
|
in memory not only the sequence but also the annotations (features table).
|
||||||
Up to now none of the OBITools are using this information, but with large
|
Up to now none of the OBITools are using this information, but with large
|
||||||
complete genomes, it is occupying a lot of memory. To reduce this impact,
|
complete genomes, it is occupying a lot of memory. To reduce this impact,
|
||||||
@@ -209,7 +339,7 @@
|
|||||||
|
|
||||||
### New feature
|
### New feature
|
||||||
|
|
||||||
- In `obimatrix` a **--transpose** option allows to transpose the produced
|
- In `obimatrix` a **--transpose** option allows transposing the produced
|
||||||
matrix table in CSV format.
|
matrix table in CSV format.
|
||||||
- In `obitpairing` and `obipcrtag` two new options **--exact-mode** and
|
- In `obitpairing` and `obipcrtag` two new options **--exact-mode** and
|
||||||
**--fast-absolute** to control the heuristic used in the alignment
|
**--fast-absolute** to control the heuristic used in the alignment
|
||||||
@@ -217,7 +347,7 @@
|
|||||||
the exact algorithm at the cost of a speed. **--fast-absolute** change the
|
the exact algorithm at the cost of a speed. **--fast-absolute** change the
|
||||||
scoring schema of the heuristic.
|
scoring schema of the heuristic.
|
||||||
- In `obiannotate` adds the possibility to annotate the first match of a
|
- In `obiannotate` adds the possibility to annotate the first match of a
|
||||||
pattern using the same algorithm than the one used in `obipcr` and
|
pattern using the same algorithm as the one used in `obipcr` and
|
||||||
`obimultiplex`. For that four option were added :
|
`obimultiplex`. For that four option were added :
|
||||||
- **--pattern** : to specify the pattern. It can use IUPAC codes and
|
- **--pattern** : to specify the pattern. It can use IUPAC codes and
|
||||||
position with no error tolerated has to be followed by a `#` character.
|
position with no error tolerated has to be followed by a `#` character.
|
||||||
@@ -298,7 +428,7 @@
|
|||||||
|
|
||||||
### Bugs
|
### Bugs
|
||||||
|
|
||||||
- in the obitools language, the `composition` function now returns a map
|
- In the obitools language, the `composition` function now returns a map
|
||||||
indexed by lowercase string "a", "c", "g", "t" and "o" for other instead of
|
indexed by lowercase string "a", "c", "g", "t" and "o" for other instead of
|
||||||
being indexed by the ASCII codes of the corresponding letters.
|
being indexed by the ASCII codes of the corresponding letters.
|
||||||
- Correction of the reverse-complement operation. Every reverse complement of
|
- Correction of the reverse-complement operation. Every reverse complement of
|
||||||
@@ -311,18 +441,18 @@
|
|||||||
duplicating the quality values. This made `obimultiplex` to produce fastq
|
duplicating the quality values. This made `obimultiplex` to produce fastq
|
||||||
files with sequences having quality values duplicated.
|
files with sequences having quality values duplicated.
|
||||||
|
|
||||||
### Becareful
|
### Be careful
|
||||||
|
|
||||||
GO 1.21.0 is out, and it includes new functionalities which are used in the
|
GO 1.21.0 is out, and it includes new functionalities which are used in the
|
||||||
OBITools4 code. If you use the recommanded method for compiling OBITools on your
|
OBITools4 code. If you use the recommended method for compiling OBITools on your
|
||||||
computer, their is no problem, as the script always load the latest GO version.
|
computer, there is no problem, as the script always load the latest GO version.
|
||||||
If you rely on you personnal GO install, please think to update.
|
If you rely on your personal GO install, please think to update.
|
||||||
|
|
||||||
## August 29th, 2023. Release 4.0.5
|
## August 29th, 2023. Release 4.0.5
|
||||||
|
|
||||||
### Bugs
|
### Bugs
|
||||||
|
|
||||||
- Patch a bug in the `obiseq.BioSequence` constructor leading to a error on
|
- Patch a bug in the `obiseq.BioSequence` constructor leading to an error on
|
||||||
almost every obitools. The error message indicates : `fatal error: sync:
|
almost every obitools. The error message indicates : `fatal error: sync:
|
||||||
unlock of unlocked mutex` This bug was introduced in the release 4.0.4
|
unlock of unlocked mutex` This bug was introduced in the release 4.0.4
|
||||||
|
|
||||||
@@ -341,7 +471,7 @@ If you rely on you personnal GO install, please think to update.
|
|||||||
data structure to limit the number of alignments actually computed. This
|
data structure to limit the number of alignments actually computed. This
|
||||||
increase a bit the speed of both the software. `obirefidx` is nevertheless
|
increase a bit the speed of both the software. `obirefidx` is nevertheless
|
||||||
still too slow compared to my expectation.
|
still too slow compared to my expectation.
|
||||||
- Switch to a parallel version of the gzip library, allowing for high speed
|
- Switch to a parallel version of the GZIP library, allowing for high speed
|
||||||
compress and decompress operation on files.
|
compress and decompress operation on files.
|
||||||
|
|
||||||
### New feature
|
### New feature
|
||||||
@@ -385,12 +515,12 @@ If you rely on you personnal GO install, please think to update.
|
|||||||
--unidentified not_assigned.fastq
|
--unidentified not_assigned.fastq
|
||||||
```
|
```
|
||||||
|
|
||||||
the command produced four files : `tagged_library_R1.fastq` and
|
The command produced four files : `tagged_library_R1.fastq` and
|
||||||
`tagged_library_R2.fastq` containing the assigned reads and
|
`tagged_library_R2.fastq` containing the assigned reads and
|
||||||
`not_assigned_R1.fastq` and `not_assigned_R2.fastq` containing the
|
`not_assigned_R1.fastq` and `not_assigned_R2.fastq` containing the
|
||||||
unassignable reads.
|
unassignable reads.
|
||||||
|
|
||||||
the tagged library files can then be split using `obidistribute`:
|
The tagged library files can then be split using `obidistribute`:
|
||||||
|
|
||||||
```{bash}
|
```{bash}
|
||||||
mkdir pcr_reads
|
mkdir pcr_reads
|
||||||
@@ -400,9 +530,9 @@ If you rely on you personnal GO install, please think to update.
|
|||||||
|
|
||||||
- Adding of two options **--add-lca-in** and **--lca-error** to `obiannotate`.
|
- Adding of two options **--add-lca-in** and **--lca-error** to `obiannotate`.
|
||||||
These options aim to help during construction of reference database using
|
These options aim to help during construction of reference database using
|
||||||
`obipcr`. On obipcr output, it is commonly run obiuniq. To merge identical
|
`obipcr`. On `obipcr` output, it is commonly run `obiuniq`. To merge identical
|
||||||
sequences annotated with different taxids, it is now possible to use the
|
sequences annotated with different taxids, it is now possible to use the
|
||||||
following strategie :
|
following strategies :
|
||||||
|
|
||||||
```{bash}
|
```{bash}
|
||||||
obiuniq -m taxid myrefdb.obipcr.fasta \
|
obiuniq -m taxid myrefdb.obipcr.fasta \
|
||||||
@@ -433,7 +563,7 @@ If you rely on you personnal GO install, please think to update.
|
|||||||
- Correction of a bug in `obiconsensus` leading into the deletion of a base
|
- Correction of a bug in `obiconsensus` leading into the deletion of a base
|
||||||
close to the beginning of the consensus sequence.
|
close to the beginning of the consensus sequence.
|
||||||
|
|
||||||
## March 31th, 2023. Release 4.0.2
|
## March 31st, 2023. Release 4.0.2
|
||||||
|
|
||||||
### Compiler change
|
### Compiler change
|
||||||
|
|
||||||
@@ -444,15 +574,15 @@ If you rely on you personnal GO install, please think to update.
|
|||||||
- Add the possibility for looking pattern with indels. This has been added to
|
- Add the possibility for looking pattern with indels. This has been added to
|
||||||
`obimultiplex` through the **--with-indels** option.
|
`obimultiplex` through the **--with-indels** option.
|
||||||
- Every obitools command has a **--pprof** option making the command
|
- Every obitools command has a **--pprof** option making the command
|
||||||
publishing a profiling web site available at the address :
|
publishing a profiling website available at the address :
|
||||||
<http://localhost:8080/debug/pprof/>
|
<http://localhost:8080/debug/pprof/>
|
||||||
- A new `obiconsensus` command has been added. It is a prototype. It aims to
|
- A new `obiconsensus` command has been added. It is a prototype. It aims to
|
||||||
build a consensus sequence from a set of reads. The consensus is estimated
|
build a consensus sequence from a set of reads. The consensus is estimated
|
||||||
for all the sequences contained in the input file. If several input files,
|
for all the sequences contained in the input file. If several input files,
|
||||||
or a directory name are provided the result contains a consensus per file.
|
or a directory name are provided the result contains a consensus per file.
|
||||||
The id of the sequence is the name of the input file depleted of its
|
The *id* of the sequence is the name of the input file depleted of its
|
||||||
directory name and of all its extensions.
|
directory name and of all its extensions.
|
||||||
- In `obipcr` an experimental option **--fragmented** allows for spliting very
|
- In `obipcr` an experimental option **--fragmented** allows for splitting very
|
||||||
long query sequences into shorter fragments with an overlap between the two
|
long query sequences into shorter fragments with an overlap between the two
|
||||||
contiguous fragment insuring that no amplicons are missed despite the split.
|
contiguous fragment insuring that no amplicons are missed despite the split.
|
||||||
As a site effect some amplicon can be identified twice.
|
As a site effect some amplicon can be identified twice.
|
||||||
@@ -495,7 +625,7 @@ If you rely on you personnal GO install, please think to update.
|
|||||||
### Enhancement
|
### Enhancement
|
||||||
|
|
||||||
- *OBITools* are automatically processing all the sequences files contained in
|
- *OBITools* are automatically processing all the sequences files contained in
|
||||||
a directory and its sub-directory\
|
a directory and its subdirectory\
|
||||||
recursively if its name is provided as input. To process easily Genbank
|
recursively if its name is provided as input. To process easily Genbank
|
||||||
files, the corresponding filename extensions have been added. Today the
|
files, the corresponding filename extensions have been added. Today the
|
||||||
following extensions are recognized as sequence files : `.fasta`, `.fastq`,
|
following extensions are recognized as sequence files : `.fasta`, `.fastq`,
|
||||||
@@ -512,7 +642,7 @@ If you rely on you personnal GO install, please think to update.
|
|||||||
export OBICPUMAX=4
|
export OBICPUMAX=4
|
||||||
```
|
```
|
||||||
|
|
||||||
- Adds a new option --out\|-o allowing to specify the name of an outpout file.
|
- Adds a new option --out\|-o allowing to specify the name of an output file.
|
||||||
|
|
||||||
``` bash
|
``` bash
|
||||||
obiconvert -o xyz.fasta xxx.fastq
|
obiconvert -o xyz.fasta xxx.fastq
|
||||||
@@ -534,10 +664,10 @@ If you rely on you personnal GO install, please think to update.
|
|||||||
matched files remain consistent when processed.
|
matched files remain consistent when processed.
|
||||||
|
|
||||||
- Adding of the function `ifelse` to the expression language for computing
|
- Adding of the function `ifelse` to the expression language for computing
|
||||||
conditionnal values.
|
conditional values.
|
||||||
|
|
||||||
- Adding two function to the expression language related to sequence
|
- Adding two function to the expression language related to sequence
|
||||||
conposition : `composition` and `gcskew`. Both are taking a sequence as
|
composition : `composition` and `gcskew`. Both are taking a sequence as
|
||||||
single argument.
|
single argument.
|
||||||
|
|
||||||
## February 18th, 2023. Release 4.0.0
|
## February 18th, 2023. Release 4.0.0
|
||||||
@@ -545,8 +675,8 @@ If you rely on you personnal GO install, please think to update.
|
|||||||
It is the first version of the *OBITools* version 4. I decided to tag then
|
It is the first version of the *OBITools* version 4. I decided to tag then
|
||||||
following two weeks of intensive data analysis with them allowing to discover
|
following two weeks of intensive data analysis with them allowing to discover
|
||||||
many small bugs present in the previous non-official version. Obviously other
|
many small bugs present in the previous non-official version. Obviously other
|
||||||
bugs are certainly persent in the code, and you are welcome to use the git
|
bugs are certainly present in the code, and you are welcome to use the git
|
||||||
ticket system to mention them. But they seems to produce now reliable results.
|
ticket system to mention them. But they seem to produce now reliable results.
|
||||||
|
|
||||||
### Corrected bugs
|
### Corrected bugs
|
||||||
|
|
||||||
@@ -554,11 +684,11 @@ ticket system to mention them. But they seems to produce now reliable results.
|
|||||||
of sequences and to the production of incorrect file because of the last
|
of sequences and to the production of incorrect file because of the last
|
||||||
sequence record, sometime truncated in its middle. This was only occurring
|
sequence record, sometime truncated in its middle. This was only occurring
|
||||||
when more than a single CPU was used. It was affecting every obitools.
|
when more than a single CPU was used. It was affecting every obitools.
|
||||||
- The `obiparing` software had a bug in the right aligment procedure. This led
|
- The `obiparing` software had a bug in the right alignment procedure. This led
|
||||||
to the non alignment of very sort barcode during the paring of the forward
|
to the non-alignment of very sort barcode during the paring of the forward
|
||||||
and reverse reads.
|
and reverse reads.
|
||||||
- The `obipairing` tools had a non deterministic comportment when aligning a
|
- The `obipairing` tools had a non-deterministic comportment when aligning a
|
||||||
paor very low quality reads. This induced that the result of the same low
|
pair very low quality reads. This induced that the result of the same low
|
||||||
quality read pair was not the same from run to run.
|
quality read pair was not the same from run to run.
|
||||||
|
|
||||||
### New features
|
### New features
|
||||||
@@ -566,11 +696,10 @@ ticket system to mention them. But they seems to produce now reliable results.
|
|||||||
- Adding of a `--compress|-Z` option to every obitools allowing to produce
|
- Adding of a `--compress|-Z` option to every obitools allowing to produce
|
||||||
`gz` compressed output. OBITools were already able to deal with gziped input
|
`gz` compressed output. OBITools were already able to deal with gziped input
|
||||||
files transparently. They can now produce their results in the same format.
|
files transparently. They can now produce their results in the same format.
|
||||||
- Adding of a `--append|-A` option to the `obidistribute` tool. It allows to
|
- Adding of a `--append|-A` option to the `obidistribute` tool. It allows appending the result of an `obidistribute` execution to preexisting files. -
|
||||||
append the result of an `obidistribute` execution to preexisting files. -
|
|
||||||
Adding of a `--directory|-d` option to the `obidistribute` tool. It allows
|
Adding of a `--directory|-d` option to the `obidistribute` tool. It allows
|
||||||
to declare a secondary classification key over the one defined by the
|
declaring a secondary classification key over the one defined by the
|
||||||
'--category\|-c\` option. This extra key leads to produce directories in
|
`--category\|-c\` option. This extra key leads to produce directories in
|
||||||
which files produced according to the primary criterion are stored.
|
which files produced according to the primary criterion are stored.
|
||||||
- Adding of the functions `subspc`, `printf`, `int`, `numeric`, and `bool` to
|
- Adding of the functions `subspc`, `printf`, `int`, `numeric`, and `bool` to
|
||||||
the expression language.
|
the expression language.
|
||||||
213
blackboard/Prospective/kmer_index_design.md
Normal file
213
blackboard/Prospective/kmer_index_design.md
Normal file
@@ -0,0 +1,213 @@
|
|||||||
|
# Index de k-mers pour génomes de grande taille
|
||||||
|
|
||||||
|
## Contexte et objectifs
|
||||||
|
|
||||||
|
### Cas d'usage
|
||||||
|
|
||||||
|
- Indexation de k-mers longs (k=31) pour des génomes de grande taille (< 10 Go par génome)
|
||||||
|
- Nombre de génomes : plusieurs dizaines à quelques centaines
|
||||||
|
- Indexation en parallèle
|
||||||
|
- Stockage sur disque
|
||||||
|
- Possibilité d'ajouter des génomes, mais pas de modifier un génome existant
|
||||||
|
|
||||||
|
### Requêtes cibles
|
||||||
|
|
||||||
|
- **Présence/absence** d'un k-mer dans un génome
|
||||||
|
- **Intersection** entre génomes
|
||||||
|
- **Distances** : Jaccard (présence/absence) et potentiellement Bray-Curtis (comptage)
|
||||||
|
|
||||||
|
### Ressources disponibles
|
||||||
|
|
||||||
|
- 128 Go de RAM
|
||||||
|
- Stockage disque
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Estimation des volumes
|
||||||
|
|
||||||
|
### Par génome
|
||||||
|
|
||||||
|
- **10 Go de séquence** → ~10¹⁰ k-mers bruts (chevauchants)
|
||||||
|
- **Après déduplication** : typiquement 10-50% de k-mers uniques → **~1-5 × 10⁹ k-mers distincts**
|
||||||
|
|
||||||
|
### Espace théorique
|
||||||
|
|
||||||
|
- **k=31** → 62 bits → ~4.6 × 10¹⁸ k-mers possibles
|
||||||
|
- Table d'indexation directe impossible
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Métriques de distance
|
||||||
|
|
||||||
|
### Présence/absence (binaire)
|
||||||
|
|
||||||
|
- **Jaccard** : |A ∩ B| / |A ∪ B|
|
||||||
|
- **Sørensen-Dice** : 2|A ∩ B| / (|A| + |B|)
|
||||||
|
|
||||||
|
### Comptage (abondance)
|
||||||
|
|
||||||
|
- **Bray-Curtis** : 1 - (2 × Σ min(aᵢ, bᵢ)) / (Σ aᵢ + Σ bᵢ)
|
||||||
|
|
||||||
|
Note : Pour Bray-Curtis, le stockage des comptages est nécessaire, ce qui augmente significativement la taille de l'index.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Options d'indexation
|
||||||
|
|
||||||
|
### Option 1 : Bloom Filter par génome
|
||||||
|
|
||||||
|
**Principe** : Structure probabiliste pour test d'appartenance.
|
||||||
|
|
||||||
|
**Avantages :**
|
||||||
|
- Très compact : ~10 bits/élément pour FPR ~1%
|
||||||
|
- Construction rapide, streaming
|
||||||
|
- Facile à sérialiser/désérialiser
|
||||||
|
- Intersection et Jaccard estimables via formules analytiques
|
||||||
|
|
||||||
|
**Inconvénients :**
|
||||||
|
- Faux positifs (pas de faux négatifs)
|
||||||
|
- Distances approximatives
|
||||||
|
|
||||||
|
**Taille estimée** : 1-6 Go par génome (selon FPR cible)
|
||||||
|
|
||||||
|
#### Dimensionnement des Bloom filters
|
||||||
|
|
||||||
|
```
|
||||||
|
\mathrm{FPR} ;=; \left(1 - e^{-h n / m}\right)^h
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
| Bits/élément | FPR optimal | k (hash functions) |
|
||||||
|
|--------------|-------------|---------------------|
|
||||||
|
| 8 | ~2% | 5-6 |
|
||||||
|
| 10 | ~1% | 7 |
|
||||||
|
| 12 | ~0.3% | 8 |
|
||||||
|
| 16 | ~0.01% | 11 |
|
||||||
|
|
||||||
|
Formule du taux de faux positifs :
|
||||||
|
```
|
||||||
|
FPR ≈ (1 - e^(-kn/m))^k
|
||||||
|
```
|
||||||
|
Où n = nombre d'éléments, m = nombre de bits, k = nombre de hash functions.
|
||||||
|
|
||||||
|
### Option 2 : Ensemble trié de k-mers
|
||||||
|
|
||||||
|
**Principe** : Stocker les k-mers (uint64) triés, avec compression possible.
|
||||||
|
|
||||||
|
**Avantages :**
|
||||||
|
- Exact (pas de faux positifs)
|
||||||
|
- Intersection/union par merge sort O(n+m)
|
||||||
|
- Compression efficace (delta encoding sur k-mers triés)
|
||||||
|
|
||||||
|
**Inconvénients :**
|
||||||
|
- Plus volumineux : 8 octets/k-mer
|
||||||
|
- Construction plus lente (tri nécessaire)
|
||||||
|
|
||||||
|
**Taille estimée** : 8-40 Go par génome (non compressé)
|
||||||
|
|
||||||
|
### Option 3 : MPHF (Minimal Perfect Hash Function)
|
||||||
|
|
||||||
|
**Principe** : Fonction de hash parfaite minimale pour les k-mers présents.
|
||||||
|
|
||||||
|
**Avantages :**
|
||||||
|
- Très compact : ~3-4 bits/élément
|
||||||
|
- Lookup O(1)
|
||||||
|
- Exact pour les k-mers présents
|
||||||
|
|
||||||
|
**Inconvénients :**
|
||||||
|
- Construction coûteuse (plusieurs passes)
|
||||||
|
- Statique (pas d'ajout de k-mers après construction)
|
||||||
|
- Ne distingue pas "absent" vs "jamais vu" sans structure auxiliaire
|
||||||
|
|
||||||
|
### Option 4 : Hybride MPHF + Bloom filter
|
||||||
|
|
||||||
|
- MPHF pour mapping compact des k-mers présents
|
||||||
|
- Bloom filter pour pré-filtrage des absents
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Optimisation : Indexation de (k-2)-mers pour requêtes k-mers
|
||||||
|
|
||||||
|
### Principe
|
||||||
|
|
||||||
|
Au lieu d'indexer directement les 31-mers dans un Bloom filter, on indexe les 29-mers. Pour tester la présence d'un 31-mer, on vérifie que les **trois 29-mers** qu'il contient sont présents :
|
||||||
|
|
||||||
|
- positions 0-28
|
||||||
|
- positions 1-29
|
||||||
|
- positions 2-30
|
||||||
|
|
||||||
|
### Analyse probabiliste
|
||||||
|
|
||||||
|
Si le Bloom filter a un FPR de p pour un 29-mer individuel, le FPR effectif pour un 31-mer devient **p³** (les trois requêtes doivent toutes être des faux positifs).
|
||||||
|
|
||||||
|
| FPR 29-mer | FPR 31-mer effectif |
|
||||||
|
|------------|---------------------|
|
||||||
|
| 10% | 0.1% |
|
||||||
|
| 5% | 0.0125% |
|
||||||
|
| 1% | 0.0001% |
|
||||||
|
|
||||||
|
### Avantages
|
||||||
|
|
||||||
|
1. **Moins d'éléments à stocker** : il y a moins de 29-mers distincts que de 31-mers distincts dans un génome (deux 31-mers différents peuvent partager un même 29-mer)
|
||||||
|
|
||||||
|
2. **FPR drastiquement réduit** : FPR³ avec seulement 3 requêtes
|
||||||
|
|
||||||
|
3. **Index plus compact** : on peut utiliser moins de bits par élément (FPR plus élevé acceptable sur le 29-mer) tout en obtenant un FPR très bas sur le 31-mer
|
||||||
|
|
||||||
|
### Trade-off
|
||||||
|
|
||||||
|
Un Bloom filter à **5-6 bits/élément** pour les 29-mers donnerait un FPR effectif < 0.01% pour les 31-mers, soit environ **2× plus compact** que l'approche directe à qualité égale.
|
||||||
|
|
||||||
|
**Coût** : 3× plus de requêtes par lookup (mais les requêtes Bloom sont très rapides).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Accélération des calculs de distance : MinHash
|
||||||
|
|
||||||
|
### Principe
|
||||||
|
|
||||||
|
Pré-calculer une "signature" compacte (sketch) de chaque génome permettant d'estimer rapidement Jaccard sans charger les index complets.
|
||||||
|
|
||||||
|
### Avantages
|
||||||
|
|
||||||
|
- Matrice de distances entre 100+ génomes en quelques secondes
|
||||||
|
- Signature de taille fixe (ex: 1000-10000 hash values) quel que soit le génome
|
||||||
|
- Stockage minimal
|
||||||
|
|
||||||
|
### Utilisation
|
||||||
|
|
||||||
|
1. Construction : une passe sur les k-mers de chaque génome
|
||||||
|
2. Distance : comparaison des sketches en O(taille du sketch)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Architecture recommandée
|
||||||
|
|
||||||
|
### Pour présence/absence + Jaccard
|
||||||
|
|
||||||
|
1. **Index principal** : Bloom filter de (k-2)-mers avec l'optimisation décrite
|
||||||
|
- Compact (~3-5 Go par génome)
|
||||||
|
- FPR très bas pour les k-mers grâce aux requêtes triples
|
||||||
|
|
||||||
|
2. **Sketches MinHash** : pour calcul rapide des distances entre génomes
|
||||||
|
- Quelques Ko par génome
|
||||||
|
- Permet exploration rapide de la matrice de distances
|
||||||
|
|
||||||
|
### Pour comptage + Bray-Curtis
|
||||||
|
|
||||||
|
1. **Index principal** : k-mers triés + comptages
|
||||||
|
- uint64 (k-mer) + uint8/uint16 (count)
|
||||||
|
- Compression delta possible
|
||||||
|
- Plus volumineux mais exact
|
||||||
|
|
||||||
|
2. **Sketches** : variantes de MinHash pour données pondérées (ex: HyperMinHash)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Prochaines étapes
|
||||||
|
|
||||||
|
1. Implémenter un Bloom filter optimisé pour k-mers
|
||||||
|
2. Implémenter l'optimisation (k-2)-mer → k-mer
|
||||||
|
3. Implémenter MinHash pour les sketches
|
||||||
|
4. Définir le format de sérialisation sur disque
|
||||||
|
5. Benchmarker sur des génomes réels
|
||||||
@@ -3,13 +3,11 @@ package main
|
|||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
log "github.com/sirupsen/logrus"
|
|
||||||
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiannotate"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiannotate"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiutils"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
@@ -32,20 +30,25 @@ func main() {
|
|||||||
// trace.Start(ftrace)
|
// trace.Start(ftrace)
|
||||||
// defer trace.Stop()
|
// defer trace.Stop()
|
||||||
|
|
||||||
optionParser := obioptions.GenerateOptionParser(obiannotate.OptionSet)
|
optionParser := obioptions.GenerateOptionParser(
|
||||||
|
"obiannotate",
|
||||||
|
"edits the sequence annotations",
|
||||||
|
obiannotate.OptionSet,
|
||||||
|
)
|
||||||
|
|
||||||
_, args := optionParser(os.Args)
|
_, args := optionParser(os.Args)
|
||||||
|
|
||||||
sequences, err := obiconvert.CLIReadBioSequences(args...)
|
sequences, err := obiconvert.CLIReadBioSequences(args...)
|
||||||
|
obiconvert.OpenSequenceDataErrorMessage(args, err)
|
||||||
if err != nil {
|
|
||||||
log.Errorf("Cannot open file (%v)", err)
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
annotator := obiannotate.CLIAnnotationPipeline()
|
annotator := obiannotate.CLIAnnotationPipeline()
|
||||||
|
|
||||||
|
if obiannotate.CLIHasSetNumberFlag() {
|
||||||
|
sequences = sequences.NumberSequences(1, !obiconvert.CLINoInputOrder())
|
||||||
|
}
|
||||||
|
|
||||||
obiconvert.CLIWriteBioSequences(sequences.Pipe(annotator), true)
|
obiconvert.CLIWriteBioSequences(sequences.Pipe(annotator), true)
|
||||||
|
|
||||||
obiiter.WaitForLastPipe()
|
obiutils.WaitForLastPipe()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,31 +3,28 @@ package main
|
|||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
log "github.com/sirupsen/logrus"
|
|
||||||
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiclean"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiclean"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiutils"
|
||||||
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
optionParser := obioptions.GenerateOptionParser(obiclean.OptionSet)
|
optionParser := obioptions.GenerateOptionParser(
|
||||||
|
"obiclean",
|
||||||
|
"",
|
||||||
|
obiclean.OptionSet)
|
||||||
|
|
||||||
_, args := optionParser(os.Args)
|
_, args := optionParser(os.Args)
|
||||||
|
|
||||||
fs, err := obiconvert.CLIReadBioSequences(args...)
|
fs, err := obiconvert.CLIReadBioSequences(args...)
|
||||||
|
obiconvert.OpenSequenceDataErrorMessage(args, err)
|
||||||
if err != nil {
|
|
||||||
log.Errorf("Cannot open file (%v)", err)
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
cleaned := obiclean.CLIOBIClean(fs)
|
cleaned := obiclean.CLIOBIClean(fs)
|
||||||
|
|
||||||
obiconvert.CLIWriteBioSequences(cleaned, true)
|
obiconvert.CLIWriteBioSequences(cleaned, true)
|
||||||
|
|
||||||
obiiter.WaitForLastPipe()
|
obiutils.WaitForLastPipe()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,33 +3,31 @@ package main
|
|||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
log "github.com/sirupsen/logrus"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obidefault"
|
||||||
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obicleandb"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obicleandb"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiutils"
|
||||||
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
obioptions.SetBatchSize(10)
|
obidefault.SetBatchSize(10)
|
||||||
|
|
||||||
optionParser := obioptions.GenerateOptionParser(obicleandb.OptionSet)
|
optionParser := obioptions.GenerateOptionParser(
|
||||||
|
"obicleandb",
|
||||||
|
"clean-up reference databases",
|
||||||
|
obicleandb.OptionSet)
|
||||||
|
|
||||||
_, args := optionParser(os.Args)
|
_, args := optionParser(os.Args)
|
||||||
|
|
||||||
fs, err := obiconvert.CLIReadBioSequences(args...)
|
fs, err := obiconvert.CLIReadBioSequences(args...)
|
||||||
|
obiconvert.OpenSequenceDataErrorMessage(args, err)
|
||||||
if err != nil {
|
|
||||||
log.Errorf("Cannot open file (%v)", err)
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
cleaned := obicleandb.ICleanDB(fs)
|
cleaned := obicleandb.ICleanDB(fs)
|
||||||
|
|
||||||
toconsume, _ := obiconvert.CLIWriteBioSequences(cleaned, false)
|
toconsume, _ := obiconvert.CLIWriteBioSequences(cleaned, false)
|
||||||
toconsume.Consume()
|
toconsume.Consume()
|
||||||
|
|
||||||
obiiter.WaitForLastPipe()
|
obiutils.WaitForLastPipe()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,30 +3,27 @@ package main
|
|||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
log "github.com/sirupsen/logrus"
|
|
||||||
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiutils"
|
||||||
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
optionParser := obioptions.GenerateOptionParser(obiconvert.OptionSet)
|
optionParser := obioptions.GenerateOptionParser(
|
||||||
|
"obicomplement",
|
||||||
|
"reverse complement of sequences",
|
||||||
|
obiconvert.OptionSet(true))
|
||||||
|
|
||||||
_, args := optionParser(os.Args)
|
_, args := optionParser(os.Args)
|
||||||
|
|
||||||
fs, err := obiconvert.CLIReadBioSequences(args...)
|
fs, err := obiconvert.CLIReadBioSequences(args...)
|
||||||
|
obiconvert.OpenSequenceDataErrorMessage(args, err)
|
||||||
if err != nil {
|
|
||||||
log.Errorf("Cannot open file (%v)", err)
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
comp := fs.MakeIWorker(obiseq.ReverseComplementWorker(true), true)
|
comp := fs.MakeIWorker(obiseq.ReverseComplementWorker(true), true)
|
||||||
obiconvert.CLIWriteBioSequences(comp, true)
|
obiconvert.CLIWriteBioSequences(comp, true)
|
||||||
|
|
||||||
obiiter.WaitForLastPipe()
|
obiutils.WaitForLastPipe()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,31 +3,28 @@ package main
|
|||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
log "github.com/sirupsen/logrus"
|
|
||||||
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconsensus"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconsensus"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiutils"
|
||||||
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
optionParser := obioptions.GenerateOptionParser(obiconsensus.OptionSet)
|
optionParser := obioptions.GenerateOptionParser(
|
||||||
|
"obiconsensus",
|
||||||
|
"ONT reads denoising",
|
||||||
|
obiconsensus.OptionSet)
|
||||||
|
|
||||||
_, args := optionParser(os.Args)
|
_, args := optionParser(os.Args)
|
||||||
|
|
||||||
fs, err := obiconvert.CLIReadBioSequences(args...)
|
fs, err := obiconvert.CLIReadBioSequences(args...)
|
||||||
|
obiconvert.OpenSequenceDataErrorMessage(args, err)
|
||||||
if err != nil {
|
|
||||||
log.Errorf("Cannot open file (%v)", err)
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
cleaned := obiconsensus.CLIOBIMinion(fs)
|
cleaned := obiconsensus.CLIOBIMinion(fs)
|
||||||
|
|
||||||
obiconvert.CLIWriteBioSequences(cleaned, true)
|
obiconvert.CLIWriteBioSequences(cleaned, true)
|
||||||
|
|
||||||
obiiter.WaitForLastPipe()
|
obiutils.WaitForLastPipe()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,31 +3,29 @@ package main
|
|||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
log "github.com/sirupsen/logrus"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obidefault"
|
||||||
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiutils"
|
||||||
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
obioptions.SetStrictReadWorker(2)
|
obidefault.SetStrictReadWorker(2)
|
||||||
obioptions.SetStrictWriteWorker(2)
|
obidefault.SetStrictWriteWorker(2)
|
||||||
|
|
||||||
optionParser := obioptions.GenerateOptionParser(obiconvert.OptionSet)
|
optionParser := obioptions.GenerateOptionParser(
|
||||||
|
"obiconvert",
|
||||||
|
"convertion of sequence files to various formats",
|
||||||
|
obiconvert.OptionSet(true))
|
||||||
|
|
||||||
_, args := optionParser(os.Args)
|
_, args := optionParser(os.Args)
|
||||||
|
|
||||||
fs, err := obiconvert.CLIReadBioSequences(args...)
|
fs, err := obiconvert.CLIReadBioSequences(args...)
|
||||||
|
obiconvert.OpenSequenceDataErrorMessage(args, err)
|
||||||
if err != nil {
|
|
||||||
log.Errorf("Cannot open file (%v)", err)
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
obiconvert.CLIWriteBioSequences(fs, true)
|
obiconvert.CLIWriteBioSequences(fs, true)
|
||||||
|
|
||||||
obiiter.WaitForLastPipe()
|
obiutils.WaitForLastPipe()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,8 +4,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
log "github.com/sirupsen/logrus"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obidefault"
|
||||||
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obicount"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obicount"
|
||||||
|
|
||||||
@@ -29,23 +28,21 @@ func main() {
|
|||||||
// defer trace.Stop()
|
// defer trace.Stop()
|
||||||
|
|
||||||
optionParser := obioptions.GenerateOptionParser(
|
optionParser := obioptions.GenerateOptionParser(
|
||||||
|
"obicount",
|
||||||
|
"counts the sequences present in a file of sequences",
|
||||||
obiconvert.InputOptionSet,
|
obiconvert.InputOptionSet,
|
||||||
obicount.OptionSet,
|
obicount.OptionSet,
|
||||||
)
|
)
|
||||||
|
|
||||||
_, args := optionParser(os.Args)
|
_, args := optionParser(os.Args)
|
||||||
|
|
||||||
obioptions.SetStrictReadWorker(min(4, obioptions.CLIParallelWorkers()))
|
obidefault.SetStrictReadWorker(min(4, obidefault.ParallelWorkers()))
|
||||||
fs, err := obiconvert.CLIReadBioSequences(args...)
|
fs, err := obiconvert.CLIReadBioSequences(args...)
|
||||||
|
obiconvert.OpenSequenceDataErrorMessage(args, err)
|
||||||
if err != nil {
|
|
||||||
log.Errorf("Cannot open file (%v)", err)
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
nvariant, nread, nsymbol := fs.Count(true)
|
nvariant, nread, nsymbol := fs.Count(true)
|
||||||
|
|
||||||
fmt.Print("entites,n\n")
|
fmt.Print("entities,n\n")
|
||||||
|
|
||||||
if obicount.CLIIsPrintingVariantCount() {
|
if obicount.CLIIsPrintingVariantCount() {
|
||||||
fmt.Printf("variants,%d\n", nvariant)
|
fmt.Printf("variants,%d\n", nvariant)
|
||||||
|
|||||||
@@ -3,28 +3,25 @@ package main
|
|||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
log "github.com/sirupsen/logrus"
|
|
||||||
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obicsv"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obicsv"
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiutils"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
optionParser := obioptions.GenerateOptionParser(obicsv.OptionSet)
|
optionParser := obioptions.GenerateOptionParser(
|
||||||
|
"obicsv",
|
||||||
|
"converts sequence files to CSV format",
|
||||||
|
obicsv.OptionSet)
|
||||||
|
|
||||||
_, args := optionParser(os.Args)
|
_, args := optionParser(os.Args)
|
||||||
|
|
||||||
fs, err := obiconvert.CLIReadBioSequences(args...)
|
fs, err := obiconvert.CLIReadBioSequences(args...)
|
||||||
|
obiconvert.OpenSequenceDataErrorMessage(args, err)
|
||||||
|
|
||||||
if err != nil {
|
obicsv.CLIWriteSequenceCSV(fs, true)
|
||||||
log.Errorf("Cannot open file (%v)", err)
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
obicsv.CLIWriteCSV(fs, true)
|
obiutils.WaitForLastPipe()
|
||||||
|
|
||||||
obiiter.WaitForLastPipe()
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,34 +3,32 @@ package main
|
|||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
log "github.com/sirupsen/logrus"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obidefault"
|
||||||
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obidemerge"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obidemerge"
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiutils"
|
||||||
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
obioptions.SetStrictReadWorker(2)
|
obidefault.SetStrictReadWorker(2)
|
||||||
obioptions.SetStrictWriteWorker(2)
|
obidefault.SetStrictWriteWorker(2)
|
||||||
|
|
||||||
optionParser := obioptions.GenerateOptionParser(obidemerge.OptionSet)
|
optionParser := obioptions.GenerateOptionParser(
|
||||||
|
"obidemerge",
|
||||||
|
"",
|
||||||
|
obidemerge.OptionSet)
|
||||||
|
|
||||||
_, args := optionParser(os.Args)
|
_, args := optionParser(os.Args)
|
||||||
|
|
||||||
fs, err := obiconvert.CLIReadBioSequences(args...)
|
fs, err := obiconvert.CLIReadBioSequences(args...)
|
||||||
|
obiconvert.OpenSequenceDataErrorMessage(args, err)
|
||||||
if err != nil {
|
|
||||||
log.Errorf("Cannot open file (%v)", err)
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
demerged := obidemerge.CLIDemergeSequences(fs)
|
demerged := obidemerge.CLIDemergeSequences(fs)
|
||||||
|
|
||||||
obiconvert.CLIWriteBioSequences(demerged, true)
|
obiconvert.CLIWriteBioSequences(demerged, true)
|
||||||
|
|
||||||
obiiter.WaitForLastPipe()
|
obiutils.WaitForLastPipe()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,29 +3,26 @@ package main
|
|||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
log "github.com/sirupsen/logrus"
|
|
||||||
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obidistribute"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obidistribute"
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiutils"
|
||||||
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
optionParser := obioptions.GenerateOptionParser(obidistribute.OptionSet)
|
optionParser := obioptions.GenerateOptionParser(
|
||||||
|
"obidistribute",
|
||||||
|
"divided an input set of sequences into subsets",
|
||||||
|
obidistribute.OptionSet)
|
||||||
|
|
||||||
_, args := optionParser(os.Args)
|
_, args := optionParser(os.Args)
|
||||||
|
|
||||||
fs, err := obiconvert.CLIReadBioSequences(args...)
|
fs, err := obiconvert.CLIReadBioSequences(args...)
|
||||||
|
obiconvert.OpenSequenceDataErrorMessage(args, err)
|
||||||
if err != nil {
|
|
||||||
log.Errorf("Cannot open file (%v)", err)
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
obidistribute.CLIDistributeSequence(fs)
|
obidistribute.CLIDistributeSequence(fs)
|
||||||
|
|
||||||
obiiter.WaitForLastPipe()
|
obiutils.WaitForLastPipe()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,68 +0,0 @@
|
|||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obifind"
|
|
||||||
)
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
optionParser := obioptions.GenerateOptionParser(obifind.OptionSet)
|
|
||||||
|
|
||||||
_, args := optionParser(os.Args)
|
|
||||||
|
|
||||||
//prof, _ := os.Create("obifind.prof")
|
|
||||||
//pprof.StartCPUProfile(prof)
|
|
||||||
|
|
||||||
restrictions, err := obifind.ITaxonRestrictions()
|
|
||||||
if err != nil {
|
|
||||||
fmt.Printf("%+v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
switch {
|
|
||||||
case obifind.CLIRequestsPathForTaxid() >= 0:
|
|
||||||
taxonomy, err := obifind.CLILoadSelectedTaxonomy()
|
|
||||||
if err != nil {
|
|
||||||
fmt.Printf("%+v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
taxon, err := taxonomy.Taxon(obifind.CLIRequestsPathForTaxid())
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
fmt.Printf("%+v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
s, err := taxon.Path()
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
fmt.Printf("%+v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
obifind.TaxonWriter(s.Iterator(),
|
|
||||||
fmt.Sprintf("path:%d", taxon.Taxid()))
|
|
||||||
|
|
||||||
case len(args) == 0:
|
|
||||||
taxonomy, err := obifind.CLILoadSelectedTaxonomy()
|
|
||||||
if err != nil {
|
|
||||||
fmt.Printf("%+v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
obifind.TaxonWriter(restrictions(taxonomy.Iterator()), "")
|
|
||||||
|
|
||||||
default:
|
|
||||||
matcher, err := obifind.ITaxonNameMatcher()
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
fmt.Printf("%+v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, pattern := range args {
|
|
||||||
s := restrictions(matcher(pattern))
|
|
||||||
obifind.TaxonWriter(s, pattern)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//pprof.StopCPUProfile()
|
|
||||||
}
|
|
||||||
@@ -3,13 +3,11 @@ package main
|
|||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
log "github.com/sirupsen/logrus"
|
|
||||||
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obigrep"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obigrep"
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiutils"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
@@ -32,18 +30,18 @@ func main() {
|
|||||||
// trace.Start(ftrace)
|
// trace.Start(ftrace)
|
||||||
// defer trace.Stop()
|
// defer trace.Stop()
|
||||||
|
|
||||||
optionParser := obioptions.GenerateOptionParser(obigrep.OptionSet)
|
optionParser := obioptions.GenerateOptionParser(
|
||||||
|
"obigrep",
|
||||||
|
"select a subset of sequences on various criteria",
|
||||||
|
obigrep.OptionSet)
|
||||||
|
|
||||||
_, args := optionParser(os.Args)
|
_, args := optionParser(os.Args)
|
||||||
|
|
||||||
sequences, err := obiconvert.CLIReadBioSequences(args...)
|
sequences, err := obiconvert.CLIReadBioSequences(args...)
|
||||||
|
obiconvert.OpenSequenceDataErrorMessage(args, err)
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
log.Errorf("Cannot open file (%v)", err)
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
selected := obigrep.CLIFilterSequence(sequences)
|
selected := obigrep.CLIFilterSequence(sequences)
|
||||||
obiconvert.CLIWriteBioSequences(selected, true)
|
obiconvert.CLIWriteBioSequences(selected, true)
|
||||||
obiiter.WaitForLastPipe()
|
obiutils.WaitForLastPipe()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,34 +3,32 @@ package main
|
|||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
log "github.com/sirupsen/logrus"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obidefault"
|
||||||
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obijoin"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obijoin"
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiutils"
|
||||||
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
obioptions.SetStrictReadWorker(2)
|
obidefault.SetStrictReadWorker(2)
|
||||||
obioptions.SetStrictWriteWorker(2)
|
obidefault.SetStrictWriteWorker(2)
|
||||||
|
|
||||||
optionParser := obioptions.GenerateOptionParser(obijoin.OptionSet)
|
optionParser := obioptions.GenerateOptionParser(
|
||||||
|
"obijoin",
|
||||||
|
"merge annotations contained in a file to another file",
|
||||||
|
obijoin.OptionSet)
|
||||||
|
|
||||||
_, args := optionParser(os.Args)
|
_, args := optionParser(os.Args)
|
||||||
|
|
||||||
fs, err := obiconvert.CLIReadBioSequences(args...)
|
fs, err := obiconvert.CLIReadBioSequences(args...)
|
||||||
|
obiconvert.OpenSequenceDataErrorMessage(args, err)
|
||||||
if err != nil {
|
|
||||||
log.Errorf("Cannot open file (%v)", err)
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
joined := obijoin.CLIJoinSequences(fs)
|
joined := obijoin.CLIJoinSequences(fs)
|
||||||
|
|
||||||
obiconvert.CLIWriteBioSequences(joined, true)
|
obiconvert.CLIWriteBioSequences(joined, true)
|
||||||
|
|
||||||
obiiter.WaitForLastPipe()
|
obiutils.WaitForLastPipe()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
54
cmd/obitools/obikmermatch/main.go
Normal file
54
cmd/obitools/obikmermatch/main.go
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obikmersim"
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiutils"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
|
||||||
|
defer obiseq.LogBioSeqStatus()
|
||||||
|
|
||||||
|
// go tool pprof -http=":8000" ./obipairing ./cpu.pprof
|
||||||
|
// f, err := os.Create("cpu.pprof")
|
||||||
|
// if err != nil {
|
||||||
|
// log.Fatal(err)
|
||||||
|
// }
|
||||||
|
// pprof.StartCPUProfile(f)
|
||||||
|
// defer pprof.StopCPUProfile()
|
||||||
|
|
||||||
|
// go tool trace cpu.trace
|
||||||
|
// ftrace, err := os.Create("cpu.trace")
|
||||||
|
// if err != nil {
|
||||||
|
// log.Fatal(err)
|
||||||
|
// }
|
||||||
|
// trace.Start(ftrace)
|
||||||
|
// defer trace.Stop()
|
||||||
|
|
||||||
|
optionParser := obioptions.GenerateOptionParser(
|
||||||
|
"obikmermatch",
|
||||||
|
"",
|
||||||
|
obikmersim.MatchOptionSet)
|
||||||
|
|
||||||
|
_, args := optionParser(os.Args)
|
||||||
|
|
||||||
|
var err error
|
||||||
|
sequences := obiiter.NilIBioSequence
|
||||||
|
|
||||||
|
if !obikmersim.CLISelf() {
|
||||||
|
sequences, err = obiconvert.CLIReadBioSequences(args...)
|
||||||
|
}
|
||||||
|
|
||||||
|
obiconvert.OpenSequenceDataErrorMessage(args, err)
|
||||||
|
|
||||||
|
selected := obikmersim.CLIAlignSequences(sequences)
|
||||||
|
obiconvert.CLIWriteBioSequences(selected, true)
|
||||||
|
obiutils.WaitForLastPipe()
|
||||||
|
|
||||||
|
}
|
||||||
62
cmd/obitools/obikmersimcount/main.go
Normal file
62
cmd/obitools/obikmersimcount/main.go
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"log"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obikmersim"
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiutils"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
|
||||||
|
defer obiseq.LogBioSeqStatus()
|
||||||
|
|
||||||
|
// go tool pprof -http=":8000" ./obipairing ./cpu.pprof
|
||||||
|
// f, err := os.Create("cpu.pprof")
|
||||||
|
// if err != nil {
|
||||||
|
// log.Fatal(err)
|
||||||
|
// }
|
||||||
|
// pprof.StartCPUProfile(f)
|
||||||
|
// defer pprof.StopCPUProfile()
|
||||||
|
|
||||||
|
// go tool trace cpu.trace
|
||||||
|
// ftrace, err := os.Create("cpu.trace")
|
||||||
|
// if err != nil {
|
||||||
|
// log.Fatal(err)
|
||||||
|
// }
|
||||||
|
// trace.Start(ftrace)
|
||||||
|
// defer trace.Stop()
|
||||||
|
|
||||||
|
optionParser := obioptions.GenerateOptionParser(
|
||||||
|
"obikmersimcount",
|
||||||
|
"",
|
||||||
|
obikmersim.CountOptionSet)
|
||||||
|
|
||||||
|
_, args := optionParser(os.Args)
|
||||||
|
|
||||||
|
var err error
|
||||||
|
sequences := obiiter.NilIBioSequence
|
||||||
|
|
||||||
|
if !obikmersim.CLISelf() {
|
||||||
|
sequences, err = obiconvert.CLIReadBioSequences(args...)
|
||||||
|
}
|
||||||
|
|
||||||
|
obiconvert.OpenSequenceDataErrorMessage(args, err)
|
||||||
|
|
||||||
|
counted := obikmersim.CLILookForSharedKmers(sequences)
|
||||||
|
topull, err := obiconvert.CLIWriteBioSequences(counted, false)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
log.Panic(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
topull.Consume()
|
||||||
|
|
||||||
|
obiutils.WaitForLastPipe()
|
||||||
|
|
||||||
|
}
|
||||||
@@ -3,30 +3,27 @@ package main
|
|||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
log "github.com/sirupsen/logrus"
|
|
||||||
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obilandmark"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obilandmark"
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiutils"
|
||||||
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
optionParser := obioptions.GenerateOptionParser(obilandmark.OptionSet)
|
optionParser := obioptions.GenerateOptionParser(
|
||||||
|
"obilandmark",
|
||||||
|
"",
|
||||||
|
obilandmark.OptionSet)
|
||||||
|
|
||||||
_, args := optionParser(os.Args)
|
_, args := optionParser(os.Args)
|
||||||
|
|
||||||
fs, err := obiconvert.CLIReadBioSequences(args...)
|
fs, err := obiconvert.CLIReadBioSequences(args...)
|
||||||
|
obiconvert.OpenSequenceDataErrorMessage(args, err)
|
||||||
if err != nil {
|
|
||||||
log.Errorf("Cannot open file (%v)", err)
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
indexed := obilandmark.CLISelectLandmarkSequences(fs)
|
indexed := obilandmark.CLISelectLandmarkSequences(fs)
|
||||||
|
|
||||||
obiconvert.CLIWriteBioSequences(indexed, true)
|
obiconvert.CLIWriteBioSequences(indexed, true)
|
||||||
obiiter.WaitForLastPipe()
|
obiutils.WaitForLastPipe()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
47
cmd/obitools/obilowmask/main.go
Normal file
47
cmd/obitools/obilowmask/main.go
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obilowmask"
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiutils"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
|
||||||
|
defer obiseq.LogBioSeqStatus()
|
||||||
|
|
||||||
|
// go tool pprof -http=":8000" ./obipairing ./cpu.pprof
|
||||||
|
// f, err := os.Create("cpu.pprof")
|
||||||
|
// if err != nil {
|
||||||
|
// log.Fatal(err)
|
||||||
|
// }
|
||||||
|
// pprof.StartCPUProfile(f)
|
||||||
|
// defer pprof.StopCPUProfile()
|
||||||
|
|
||||||
|
// go tool trace cpu.trace
|
||||||
|
// ftrace, err := os.Create("cpu.trace")
|
||||||
|
// if err != nil {
|
||||||
|
// log.Fatal(err)
|
||||||
|
// }
|
||||||
|
// trace.Start(ftrace)
|
||||||
|
// defer trace.Stop()
|
||||||
|
|
||||||
|
optionParser := obioptions.GenerateOptionParser(
|
||||||
|
"obimicrosat",
|
||||||
|
"looks for microsatellites sequences in a sequence file",
|
||||||
|
obilowmask.OptionSet)
|
||||||
|
|
||||||
|
_, args := optionParser(os.Args)
|
||||||
|
|
||||||
|
sequences, err := obiconvert.CLIReadBioSequences(args...)
|
||||||
|
obiconvert.OpenSequenceDataErrorMessage(args, err)
|
||||||
|
|
||||||
|
selected := obilowmask.CLISequenceEntropyMasker(sequences)
|
||||||
|
obiconvert.CLIWriteBioSequences(selected, true)
|
||||||
|
obiutils.WaitForLastPipe()
|
||||||
|
|
||||||
|
}
|
||||||
@@ -4,8 +4,6 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
log "github.com/sirupsen/logrus"
|
|
||||||
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
||||||
@@ -33,17 +31,15 @@ func main() {
|
|||||||
// defer trace.Stop()
|
// defer trace.Stop()
|
||||||
|
|
||||||
optionParser := obioptions.GenerateOptionParser(
|
optionParser := obioptions.GenerateOptionParser(
|
||||||
|
"obimatrix",
|
||||||
|
"",
|
||||||
obimatrix.OptionSet,
|
obimatrix.OptionSet,
|
||||||
)
|
)
|
||||||
|
|
||||||
_, args := optionParser(os.Args)
|
_, args := optionParser(os.Args)
|
||||||
|
|
||||||
fs, err := obiconvert.CLIReadBioSequences(args...)
|
fs, err := obiconvert.CLIReadBioSequences(args...)
|
||||||
|
obiconvert.OpenSequenceDataErrorMessage(args, err)
|
||||||
if err != nil {
|
|
||||||
log.Errorf("Cannot open file (%v)", err)
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
matrix := obimatrix.IMatrix(fs)
|
matrix := obimatrix.IMatrix(fs)
|
||||||
|
|
||||||
|
|||||||
47
cmd/obitools/obimicrosat/main.go
Normal file
47
cmd/obitools/obimicrosat/main.go
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obimicrosat"
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiutils"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
|
||||||
|
defer obiseq.LogBioSeqStatus()
|
||||||
|
|
||||||
|
// go tool pprof -http=":8000" ./obipairing ./cpu.pprof
|
||||||
|
// f, err := os.Create("cpu.pprof")
|
||||||
|
// if err != nil {
|
||||||
|
// log.Fatal(err)
|
||||||
|
// }
|
||||||
|
// pprof.StartCPUProfile(f)
|
||||||
|
// defer pprof.StopCPUProfile()
|
||||||
|
|
||||||
|
// go tool trace cpu.trace
|
||||||
|
// ftrace, err := os.Create("cpu.trace")
|
||||||
|
// if err != nil {
|
||||||
|
// log.Fatal(err)
|
||||||
|
// }
|
||||||
|
// trace.Start(ftrace)
|
||||||
|
// defer trace.Stop()
|
||||||
|
|
||||||
|
optionParser := obioptions.GenerateOptionParser(
|
||||||
|
"obimicrosat",
|
||||||
|
"looks for microsatellites sequences in a sequence file",
|
||||||
|
obimicrosat.OptionSet)
|
||||||
|
|
||||||
|
_, args := optionParser(os.Args)
|
||||||
|
|
||||||
|
sequences, err := obiconvert.CLIReadBioSequences(args...)
|
||||||
|
obiconvert.OpenSequenceDataErrorMessage(args, err)
|
||||||
|
|
||||||
|
selected := obimicrosat.CLIAnnotateMicrosat(sequences)
|
||||||
|
obiconvert.CLIWriteBioSequences(selected, true)
|
||||||
|
obiutils.WaitForLastPipe()
|
||||||
|
|
||||||
|
}
|
||||||
@@ -6,10 +6,10 @@ import (
|
|||||||
|
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obimultiplex"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obimultiplex"
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiutils"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
@@ -28,7 +28,10 @@ func main() {
|
|||||||
// trace.Start(ftrace)
|
// trace.Start(ftrace)
|
||||||
// defer trace.Stop()
|
// defer trace.Stop()
|
||||||
|
|
||||||
optionParser := obioptions.GenerateOptionParser(obimultiplex.OptionSet)
|
optionParser := obioptions.GenerateOptionParser(
|
||||||
|
"obimultiplex",
|
||||||
|
"demultiplex amplicons",
|
||||||
|
obimultiplex.OptionSet)
|
||||||
|
|
||||||
_, args := optionParser(os.Args)
|
_, args := optionParser(os.Args)
|
||||||
|
|
||||||
@@ -43,14 +46,11 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sequences, err := obiconvert.CLIReadBioSequences(args...)
|
sequences, err := obiconvert.CLIReadBioSequences(args...)
|
||||||
|
obiconvert.OpenSequenceDataErrorMessage(args, err)
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
log.Errorf("Cannot open file (%v)", err)
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
amplicons, _ := obimultiplex.IExtractBarcode(sequences)
|
amplicons, _ := obimultiplex.IExtractBarcode(sequences)
|
||||||
obiconvert.CLIWriteBioSequences(amplicons, true)
|
obiconvert.CLIWriteBioSequences(amplicons, true)
|
||||||
amplicons.Wait()
|
amplicons.Wait()
|
||||||
obiiter.WaitForLastPipe()
|
obiutils.WaitForLastPipe()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,10 +5,11 @@ import (
|
|||||||
|
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obidefault"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obipairing"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obipairing"
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiutils"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
@@ -29,12 +30,15 @@ func main() {
|
|||||||
// trace.Start(ftrace)
|
// trace.Start(ftrace)
|
||||||
// defer trace.Stop()
|
// defer trace.Stop()
|
||||||
|
|
||||||
optionParser := obioptions.GenerateOptionParser(obipairing.OptionSet)
|
optionParser := obioptions.GenerateOptionParser(
|
||||||
|
"obipairing",
|
||||||
|
"align forward with reverse reads with paired reads",
|
||||||
|
obipairing.OptionSet)
|
||||||
|
|
||||||
optionParser(os.Args)
|
optionParser(os.Args)
|
||||||
|
|
||||||
obioptions.SetStrictReadWorker(2)
|
obidefault.SetStrictReadWorker(2)
|
||||||
obioptions.SetStrictWriteWorker(2)
|
obidefault.SetStrictWriteWorker(2)
|
||||||
pairs, err := obipairing.CLIPairedSequence()
|
pairs, err := obipairing.CLIPairedSequence()
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -51,10 +55,10 @@ func main() {
|
|||||||
obipairing.CLIFastMode(),
|
obipairing.CLIFastMode(),
|
||||||
obipairing.CLIFastRelativeScore(),
|
obipairing.CLIFastRelativeScore(),
|
||||||
obipairing.CLIWithStats(),
|
obipairing.CLIWithStats(),
|
||||||
obioptions.CLIParallelWorkers(),
|
obidefault.ParallelWorkers(),
|
||||||
)
|
)
|
||||||
|
|
||||||
obiconvert.CLIWriteBioSequences(paired, true)
|
obiconvert.CLIWriteBioSequences(paired, true)
|
||||||
|
|
||||||
obiiter.WaitForLastPipe()
|
obiutils.WaitForLastPipe()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,12 +3,11 @@ package main
|
|||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
log "github.com/sirupsen/logrus"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obidefault"
|
||||||
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obipcr"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obipcr"
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiutils"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
@@ -25,24 +24,23 @@ func main() {
|
|||||||
// trace.Start(ftrace)
|
// trace.Start(ftrace)
|
||||||
// defer trace.Stop()
|
// defer trace.Stop()
|
||||||
|
|
||||||
obioptions.SetWorkerPerCore(2)
|
obidefault.SetWorkerPerCore(2)
|
||||||
obioptions.SetReadWorkerPerCore(0.5)
|
obidefault.SetReadWorkerPerCore(0.5)
|
||||||
obioptions.SetParallelFilesRead(obioptions.CLIParallelWorkers() / 4)
|
obidefault.SetParallelFilesRead(obidefault.ParallelWorkers() / 4)
|
||||||
obioptions.SetBatchSize(10)
|
obidefault.SetBatchSize(10)
|
||||||
|
|
||||||
optionParser := obioptions.GenerateOptionParser(obipcr.OptionSet)
|
optionParser := obioptions.GenerateOptionParser(
|
||||||
|
"obipcr",
|
||||||
|
"simulates a PCR on a sequence files",
|
||||||
|
obipcr.OptionSet)
|
||||||
|
|
||||||
_, args := optionParser(os.Args)
|
_, args := optionParser(os.Args)
|
||||||
|
|
||||||
sequences, err := obiconvert.CLIReadBioSequences(args...)
|
sequences, err := obiconvert.CLIReadBioSequences(args...)
|
||||||
|
obiconvert.OpenSequenceDataErrorMessage(args, err)
|
||||||
if err != nil {
|
|
||||||
log.Errorf("Cannot open file (%v)", err)
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
amplicons, _ := obipcr.CLIPCR(sequences)
|
amplicons, _ := obipcr.CLIPCR(sequences)
|
||||||
obiconvert.CLIWriteBioSequences(amplicons, true)
|
obiconvert.CLIWriteBioSequences(amplicons, true)
|
||||||
obiiter.WaitForLastPipe()
|
obiutils.WaitForLastPipe()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,30 +3,27 @@ package main
|
|||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
log "github.com/sirupsen/logrus"
|
|
||||||
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obirefidx"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obirefidx"
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiutils"
|
||||||
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
optionParser := obioptions.GenerateOptionParser(obirefidx.OptionSet)
|
optionParser := obioptions.GenerateOptionParser(
|
||||||
|
"obireffamidx",
|
||||||
|
"",
|
||||||
|
obirefidx.OptionSet)
|
||||||
|
|
||||||
_, args := optionParser(os.Args)
|
_, args := optionParser(os.Args)
|
||||||
|
|
||||||
fs, err := obiconvert.CLIReadBioSequences(args...)
|
fs, err := obiconvert.CLIReadBioSequences(args...)
|
||||||
|
obiconvert.OpenSequenceDataErrorMessage(args, err)
|
||||||
if err != nil {
|
|
||||||
log.Errorf("Cannot open file (%v)", err)
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
indexed := obirefidx.IndexFamilyDB(fs)
|
indexed := obirefidx.IndexFamilyDB(fs)
|
||||||
|
|
||||||
obiconvert.CLIWriteBioSequences(indexed, true)
|
obiconvert.CLIWriteBioSequences(indexed, true)
|
||||||
obiiter.WaitForLastPipe()
|
obiutils.WaitForLastPipe()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,29 +3,27 @@ package main
|
|||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
log "github.com/sirupsen/logrus"
|
|
||||||
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obirefidx"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obirefidx"
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiutils"
|
||||||
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
optionParser := obioptions.GenerateOptionParser(obirefidx.OptionSet)
|
optionParser := obioptions.GenerateOptionParser(
|
||||||
|
"obirefidx",
|
||||||
|
"",
|
||||||
|
obirefidx.OptionSet)
|
||||||
|
|
||||||
_, args := optionParser(os.Args)
|
_, args := optionParser(os.Args)
|
||||||
|
|
||||||
fs, err := obiconvert.CLIReadBioSequences(args...)
|
fs, err := obiconvert.CLIReadBioSequences(args...)
|
||||||
|
obiconvert.OpenSequenceDataErrorMessage(args, err)
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
log.Errorf("Cannot open file (%v)", err)
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
indexed := obirefidx.IndexReferenceDB(fs)
|
indexed := obirefidx.IndexReferenceDB(fs)
|
||||||
|
|
||||||
obiconvert.CLIWriteBioSequences(indexed, true)
|
obiconvert.CLIWriteBioSequences(indexed, true)
|
||||||
obiiter.WaitForLastPipe()
|
obiutils.WaitForLastPipe()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,13 +4,11 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
log "github.com/sirupsen/logrus"
|
|
||||||
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiscript"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiscript"
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiutils"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
@@ -33,7 +31,10 @@ func main() {
|
|||||||
// trace.Start(ftrace)
|
// trace.Start(ftrace)
|
||||||
// defer trace.Stop()
|
// defer trace.Stop()
|
||||||
|
|
||||||
optionParser := obioptions.GenerateOptionParser(obiscript.OptionSet)
|
optionParser := obioptions.GenerateOptionParser(
|
||||||
|
"obiscript",
|
||||||
|
"executes a lua script on the input sequences",
|
||||||
|
obiscript.OptionSet)
|
||||||
|
|
||||||
_, args := optionParser(os.Args)
|
_, args := optionParser(os.Args)
|
||||||
|
|
||||||
@@ -43,15 +44,11 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sequences, err := obiconvert.CLIReadBioSequences(args...)
|
sequences, err := obiconvert.CLIReadBioSequences(args...)
|
||||||
|
obiconvert.OpenSequenceDataErrorMessage(args, err)
|
||||||
if err != nil {
|
|
||||||
log.Errorf("Cannot open file (%v)", err)
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
annotator := obiscript.CLIScriptPipeline()
|
annotator := obiscript.CLIScriptPipeline()
|
||||||
obiconvert.CLIWriteBioSequences(sequences.Pipe(annotator), true)
|
obiconvert.CLIWriteBioSequences(sequences.Pipe(annotator), true)
|
||||||
|
|
||||||
obiiter.WaitForLastPipe()
|
obiutils.WaitForLastPipe()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,13 +4,11 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
log "github.com/sirupsen/logrus"
|
|
||||||
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obisplit"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obisplit"
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiutils"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
@@ -33,7 +31,10 @@ func main() {
|
|||||||
// trace.Start(ftrace)
|
// trace.Start(ftrace)
|
||||||
// defer trace.Stop()
|
// defer trace.Stop()
|
||||||
|
|
||||||
optionParser := obioptions.GenerateOptionParser(obisplit.OptionSet)
|
optionParser := obioptions.GenerateOptionParser(
|
||||||
|
"obisplit",
|
||||||
|
"",
|
||||||
|
obisplit.OptionSet)
|
||||||
|
|
||||||
_, args := optionParser(os.Args)
|
_, args := optionParser(os.Args)
|
||||||
|
|
||||||
@@ -43,15 +44,11 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sequences, err := obiconvert.CLIReadBioSequences(args...)
|
sequences, err := obiconvert.CLIReadBioSequences(args...)
|
||||||
|
obiconvert.OpenSequenceDataErrorMessage(args, err)
|
||||||
if err != nil {
|
|
||||||
log.Errorf("Cannot open file (%v)", err)
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
annotator := obisplit.CLISlitPipeline()
|
annotator := obisplit.CLISlitPipeline()
|
||||||
obiconvert.CLIWriteBioSequences(sequences.Pipe(annotator), true)
|
obiconvert.CLIWriteBioSequences(sequences.Pipe(annotator), true)
|
||||||
|
|
||||||
obiiter.WaitForLastPipe()
|
obiutils.WaitForLastPipe()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
log "github.com/sirupsen/logrus"
|
|
||||||
"gopkg.in/yaml.v3"
|
"gopkg.in/yaml.v3"
|
||||||
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
||||||
@@ -34,16 +33,15 @@ func main() {
|
|||||||
// trace.Start(ftrace)
|
// trace.Start(ftrace)
|
||||||
// defer trace.Stop()
|
// defer trace.Stop()
|
||||||
|
|
||||||
optionParser := obioptions.GenerateOptionParser(obisummary.OptionSet)
|
optionParser := obioptions.GenerateOptionParser(
|
||||||
|
"obisummary",
|
||||||
|
"resume main information from a sequence file",
|
||||||
|
obisummary.OptionSet)
|
||||||
|
|
||||||
_, args := optionParser(os.Args)
|
_, args := optionParser(os.Args)
|
||||||
|
|
||||||
fs, err := obiconvert.CLIReadBioSequences(args...)
|
fs, err := obiconvert.CLIReadBioSequences(args...)
|
||||||
|
obiconvert.OpenSequenceDataErrorMessage(args, err)
|
||||||
if err != nil {
|
|
||||||
log.Errorf("Cannot open file (%v)", err)
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
summary := obisummary.ISummary(fs, obisummary.CLIMapSummary())
|
summary := obisummary.ISummary(fs, obisummary.CLIMapSummary())
|
||||||
|
|
||||||
|
|||||||
@@ -6,10 +6,13 @@ import (
|
|||||||
|
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obidefault"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitax"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obifind"
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obitag"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obitag"
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obitaxonomy"
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiutils"
|
||||||
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
||||||
)
|
)
|
||||||
@@ -32,39 +35,55 @@ func main() {
|
|||||||
// trace.Start(ftrace)
|
// trace.Start(ftrace)
|
||||||
// defer trace.Stop()
|
// defer trace.Stop()
|
||||||
|
|
||||||
obioptions.SetWorkerPerCore(2)
|
obidefault.SetWorkerPerCore(2)
|
||||||
obioptions.SetStrictReadWorker(1)
|
obidefault.SetStrictReadWorker(1)
|
||||||
obioptions.SetStrictWriteWorker(1)
|
obidefault.SetStrictWriteWorker(1)
|
||||||
obioptions.SetBatchSize(10)
|
obidefault.SetBatchSize(10)
|
||||||
|
|
||||||
optionParser := obioptions.GenerateOptionParser(obitag.OptionSet)
|
optionParser := obioptions.GenerateOptionParser(
|
||||||
|
"obitag",
|
||||||
|
"realizes taxonomic assignment",
|
||||||
|
obitag.OptionSet)
|
||||||
|
|
||||||
_, args := optionParser(os.Args)
|
_, args := optionParser(os.Args)
|
||||||
|
|
||||||
fs, err := obiconvert.CLIReadBioSequences(args...)
|
fs, err := obiconvert.CLIReadBioSequences(args...)
|
||||||
|
obiconvert.OpenSequenceDataErrorMessage(args, err)
|
||||||
|
|
||||||
if err != nil {
|
taxo := obitax.DefaultTaxonomy()
|
||||||
log.Errorf("Cannot open file (%v)", err)
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
taxo, error := obifind.CLILoadSelectedTaxonomy()
|
|
||||||
if error != nil {
|
|
||||||
log.Panicln(error)
|
|
||||||
}
|
|
||||||
|
|
||||||
references := obitag.CLIRefDB()
|
references := obitag.CLIRefDB()
|
||||||
|
|
||||||
|
if references == nil {
|
||||||
|
log.Panicln("No loaded reference database")
|
||||||
|
}
|
||||||
|
|
||||||
|
if taxo == nil {
|
||||||
|
taxo, err = references.ExtractTaxonomy(nil, obitaxonomy.CLINewickWithLeaves())
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
log.Fatalf("No taxonomy specified or extractable from reference database: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
taxo.SetAsDefault()
|
||||||
|
}
|
||||||
|
|
||||||
|
if taxo == nil {
|
||||||
|
log.Panicln("No loaded taxonomy")
|
||||||
|
}
|
||||||
|
|
||||||
var identified obiiter.IBioSequence
|
var identified obiiter.IBioSequence
|
||||||
|
|
||||||
|
fsrb := fs.Rebatch(obidefault.BatchSize())
|
||||||
|
|
||||||
if obitag.CLIGeometricMode() {
|
if obitag.CLIGeometricMode() {
|
||||||
identified = obitag.CLIGeomAssignTaxonomy(fs, references, taxo)
|
identified = obitag.CLIGeomAssignTaxonomy(fsrb, references, taxo)
|
||||||
} else {
|
} else {
|
||||||
identified = obitag.CLIAssignTaxonomy(fs, references, taxo)
|
identified = obitag.CLIAssignTaxonomy(fsrb, references, taxo)
|
||||||
}
|
}
|
||||||
|
|
||||||
obiconvert.CLIWriteBioSequences(identified, true)
|
obiconvert.CLIWriteBioSequences(identified, true)
|
||||||
obiiter.WaitForLastPipe()
|
obiutils.WaitForLastPipe()
|
||||||
|
|
||||||
obitag.CLISaveRefetenceDB(references)
|
obitag.CLISaveRefetenceDB(references)
|
||||||
|
|
||||||
|
|||||||
@@ -1,65 +0,0 @@
|
|||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
log "github.com/sirupsen/logrus"
|
|
||||||
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obifind"
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obitag"
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obitag2"
|
|
||||||
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
|
||||||
)
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
|
|
||||||
// go tool pprof -http=":8000" ./build/obitag ./cpu.pprof
|
|
||||||
// f, err := os.Create("cpu.pprof")
|
|
||||||
// if err != nil {
|
|
||||||
// log.Fatal(err)
|
|
||||||
// }
|
|
||||||
// pprof.StartCPUProfile(f)
|
|
||||||
// defer pprof.StopCPUProfile()
|
|
||||||
|
|
||||||
// go tool trace cpu.trace
|
|
||||||
// ftrace, err := os.Create("cpu.trace")
|
|
||||||
// if err != nil {
|
|
||||||
// log.Fatal(err)
|
|
||||||
// }
|
|
||||||
// trace.Start(ftrace)
|
|
||||||
// defer trace.Stop()
|
|
||||||
|
|
||||||
obioptions.SetWorkerPerCore(2)
|
|
||||||
obioptions.SetStrictReadWorker(1)
|
|
||||||
obioptions.SetStrictWriteWorker(1)
|
|
||||||
obioptions.SetBatchSize(10)
|
|
||||||
|
|
||||||
optionParser := obioptions.GenerateOptionParser(obitag.OptionSet)
|
|
||||||
|
|
||||||
_, args := optionParser(os.Args)
|
|
||||||
|
|
||||||
fs, err := obiconvert.CLIReadBioSequences(args...)
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
log.Errorf("Cannot open file (%v)", err)
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
taxo, error := obifind.CLILoadSelectedTaxonomy()
|
|
||||||
if error != nil {
|
|
||||||
log.Panicln(error)
|
|
||||||
}
|
|
||||||
|
|
||||||
references := obitag.CLIRefDB()
|
|
||||||
|
|
||||||
identified := obitag2.CLIAssignTaxonomy(fs, references, taxo)
|
|
||||||
|
|
||||||
obiconvert.CLIWriteBioSequences(identified, true)
|
|
||||||
obiiter.WaitForLastPipe()
|
|
||||||
|
|
||||||
fmt.Println("")
|
|
||||||
}
|
|
||||||
@@ -5,11 +5,12 @@ import (
|
|||||||
|
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obidefault"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obipairing"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obipairing"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obitagpcr"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obitagpcr"
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiutils"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
@@ -30,9 +31,12 @@ func main() {
|
|||||||
// trace.Start(ftrace)
|
// trace.Start(ftrace)
|
||||||
// defer trace.Stop()
|
// defer trace.Stop()
|
||||||
|
|
||||||
obioptions.SetWorkerPerCore(1)
|
obidefault.SetWorkerPerCore(1)
|
||||||
|
|
||||||
optionParser := obioptions.GenerateOptionParser(obitagpcr.OptionSet)
|
optionParser := obioptions.GenerateOptionParser(
|
||||||
|
"obitagpcr",
|
||||||
|
"split a paired raw read data set per sample",
|
||||||
|
obitagpcr.OptionSet)
|
||||||
|
|
||||||
optionParser(os.Args)
|
optionParser(os.Args)
|
||||||
pairs, err := obipairing.CLIPairedSequence()
|
pairs, err := obipairing.CLIPairedSequence()
|
||||||
@@ -54,5 +58,5 @@ func main() {
|
|||||||
|
|
||||||
obiconvert.CLIWriteBioSequences(paired, true)
|
obiconvert.CLIWriteBioSequences(paired, true)
|
||||||
|
|
||||||
obiiter.WaitForLastPipe()
|
obiutils.WaitForLastPipe()
|
||||||
}
|
}
|
||||||
|
|||||||
142
cmd/obitools/obitaxonomy/main.go
Normal file
142
cmd/obitools/obitaxonomy/main.go
Normal file
@@ -0,0 +1,142 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obidefault"
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiitercsv"
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitax"
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obicsv"
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obitaxonomy"
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiutils"
|
||||||
|
|
||||||
|
log "github.com/sirupsen/logrus"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
optionParser := obioptions.GenerateOptionParser(
|
||||||
|
"obitaxonomy",
|
||||||
|
"manipulates and queries taxonomy",
|
||||||
|
obitaxonomy.OptionSet)
|
||||||
|
|
||||||
|
_, args := optionParser(os.Args)
|
||||||
|
|
||||||
|
var iterator *obitax.ITaxon
|
||||||
|
|
||||||
|
if obitaxonomy.CLIDownloadNCBI() {
|
||||||
|
err := obitaxonomy.CLIDownloadNCBITaxdump()
|
||||||
|
if err != nil {
|
||||||
|
log.Errorf("Cannot download NCBI taxonomy: %s", err.Error())
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
os.Exit(0)
|
||||||
|
}
|
||||||
|
|
||||||
|
if !obidefault.HasSelectedTaxonomy() {
|
||||||
|
log.Fatal("you must indicate a taxonomy using the -t or --taxonomy option")
|
||||||
|
}
|
||||||
|
|
||||||
|
switch {
|
||||||
|
case obitaxonomy.CLIAskForRankList():
|
||||||
|
newIter := obiitercsv.NewICSVRecord()
|
||||||
|
newIter.Add(1)
|
||||||
|
newIter.AppendField("rank")
|
||||||
|
go func() {
|
||||||
|
ranks := obitax.DefaultTaxonomy().RankList()
|
||||||
|
data := make([]obiitercsv.CSVRecord, len(ranks))
|
||||||
|
|
||||||
|
for i, rank := range ranks {
|
||||||
|
record := make(obiitercsv.CSVRecord)
|
||||||
|
record["rank"] = rank
|
||||||
|
data[i] = record
|
||||||
|
}
|
||||||
|
newIter.Push(obiitercsv.MakeCSVRecordBatch(obitax.DefaultTaxonomy().Name(), 0, data))
|
||||||
|
newIter.Close()
|
||||||
|
newIter.Done()
|
||||||
|
}()
|
||||||
|
obicsv.CLICSVWriter(newIter, true)
|
||||||
|
obiutils.WaitForLastPipe()
|
||||||
|
os.Exit(0)
|
||||||
|
|
||||||
|
case obitaxonomy.CLIExtractTaxonomy():
|
||||||
|
iter, err := obiconvert.CLIReadBioSequences(args...)
|
||||||
|
iter = iter.NumberSequences(1, true)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
log.Fatalf("Cannot extract taxonomy: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
taxonomy, err := iter.ExtractTaxonomy(obitaxonomy.CLINewickWithLeaves())
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
log.Fatalf("Cannot extract taxonomy: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
taxonomy.SetAsDefault()
|
||||||
|
|
||||||
|
log.Infof("Number of extracted taxa: %d", taxonomy.Len())
|
||||||
|
iterator = taxonomy.AsTaxonSet().Sort().Iterator()
|
||||||
|
|
||||||
|
case obitaxonomy.CLIDumpSubtaxonomy():
|
||||||
|
iterator = obitaxonomy.CLISubTaxonomyIterator()
|
||||||
|
|
||||||
|
case obitaxonomy.CLIRequestsPathForTaxid() != "NA":
|
||||||
|
|
||||||
|
taxon, isAlias, err := obitax.DefaultTaxonomy().Taxon(obitaxonomy.CLIRequestsPathForTaxid())
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
log.Fatalf("Cannot identify the requested taxon: %s (%v)",
|
||||||
|
obitaxonomy.CLIRequestsPathForTaxid(), err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if isAlias {
|
||||||
|
if obidefault.FailOnTaxonomy() {
|
||||||
|
log.Fatalf("Taxon %s is an alias for %s", taxon.String(), taxon.Parent().String())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
s := taxon.Path()
|
||||||
|
|
||||||
|
if s == nil {
|
||||||
|
log.Fatalf("Cannot extract taxonomic path describing %s", taxon.String())
|
||||||
|
}
|
||||||
|
|
||||||
|
iterator = s.Iterator()
|
||||||
|
|
||||||
|
if obitaxonomy.CLIWithQuery() {
|
||||||
|
iterator = iterator.AddMetadata("query", taxon.String())
|
||||||
|
}
|
||||||
|
|
||||||
|
case len(args) == 0:
|
||||||
|
iterator = obitax.DefaultTaxonomy().Iterator()
|
||||||
|
default:
|
||||||
|
iters := make([]*obitax.ITaxon, len(args))
|
||||||
|
|
||||||
|
for i, pat := range args {
|
||||||
|
ii := obitax.DefaultTaxonomy().IFilterOnName(pat, obitaxonomy.CLIFixedPattern(), true)
|
||||||
|
if obitaxonomy.CLIWithQuery() {
|
||||||
|
ii = ii.AddMetadata("query", pat)
|
||||||
|
}
|
||||||
|
iters[i] = ii
|
||||||
|
}
|
||||||
|
|
||||||
|
iterator = iters[0]
|
||||||
|
|
||||||
|
if len(iters) > 1 {
|
||||||
|
iterator = iterator.Concat(iters[1:]...)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
iterator = obitaxonomy.CLITaxonRestrictions(iterator)
|
||||||
|
|
||||||
|
if obitaxonomy.CLIAsNewick() {
|
||||||
|
obitaxonomy.CLINewickWriter(iterator, true)
|
||||||
|
} else {
|
||||||
|
obitaxonomy.CLICSVTaxaWriter(iterator, true)
|
||||||
|
}
|
||||||
|
|
||||||
|
obiutils.WaitForLastPipe()
|
||||||
|
|
||||||
|
}
|
||||||
@@ -3,13 +3,12 @@ package main
|
|||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
log "github.com/sirupsen/logrus"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obidefault"
|
||||||
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiuniq"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiuniq"
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiutils"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
@@ -32,20 +31,21 @@ func main() {
|
|||||||
// trace.Start(ftrace)
|
// trace.Start(ftrace)
|
||||||
// defer trace.Stop()
|
// defer trace.Stop()
|
||||||
|
|
||||||
optionParser := obioptions.GenerateOptionParser(obiuniq.OptionSet)
|
obidefault.SetBatchSize(10)
|
||||||
|
obidefault.SetReadQualities(false)
|
||||||
|
optionParser := obioptions.GenerateOptionParser(
|
||||||
|
"obiuniq",
|
||||||
|
"dereplicate sequence data sets",
|
||||||
|
obiuniq.OptionSet)
|
||||||
|
|
||||||
_, args := optionParser(os.Args)
|
_, args := optionParser(os.Args)
|
||||||
|
|
||||||
sequences, err := obiconvert.CLIReadBioSequences(args...)
|
sequences, err := obiconvert.CLIReadBioSequences(args...)
|
||||||
|
obiconvert.OpenSequenceDataErrorMessage(args, err)
|
||||||
if err != nil {
|
|
||||||
log.Errorf("Cannot open file (%v)", err)
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
unique := obiuniq.CLIUnique(sequences)
|
unique := obiuniq.CLIUnique(sequences)
|
||||||
obiconvert.CLIWriteBioSequences(unique, true)
|
obiconvert.CLIWriteBioSequences(unique, true)
|
||||||
|
|
||||||
obiiter.WaitForLastPipe()
|
obiutils.WaitForLastPipe()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,36 +3,14 @@ package main
|
|||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
log "github.com/sirupsen/logrus"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiformats"
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiutils"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiiter"
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
|
||||||
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
optionParser := obioptions.GenerateOptionParser(obiconvert.OptionSet)
|
|
||||||
|
|
||||||
_, args := optionParser(os.Args)
|
obiformats.DetectTaxonomyFormat(os.Args[1])
|
||||||
|
println(obiutils.RemoveAllExt("toto/tutu/test.txt"))
|
||||||
fs, err := obiconvert.CLIReadBioSequences(args...)
|
println(obiutils.Basename("toto/tutu/test.txt"))
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
log.Errorf("Cannot open file (%v)", err)
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
frags := obiiter.IFragments(
|
|
||||||
1000,
|
|
||||||
100,
|
|
||||||
10,
|
|
||||||
100,
|
|
||||||
obioptions.CLIParallelWorkers(),
|
|
||||||
)
|
|
||||||
|
|
||||||
obiconvert.CLIWriteBioSequences(fs.Pipe(frags), true)
|
|
||||||
|
|
||||||
obiiter.WaitForLastPipe()
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
1
ecoprimers
Submodule
1
ecoprimers
Submodule
Submodule ecoprimers added at b7552200bd
23
git-hooks/pre-push
Executable file
23
git-hooks/pre-push
Executable file
@@ -0,0 +1,23 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
remote="$1"
|
||||||
|
#url="$2"
|
||||||
|
|
||||||
|
log() {
|
||||||
|
echo -e "[Pre-Push tests @ $(date)] $*" 1>&2
|
||||||
|
}
|
||||||
|
|
||||||
|
current_branch=$(git symbolic-ref --short head)
|
||||||
|
|
||||||
|
cmd="make githubtests"
|
||||||
|
|
||||||
|
if [[ $current_branch = "master" ]]; then
|
||||||
|
log "you are on $current_branch, running build test"
|
||||||
|
if ! eval "$cmd"; then
|
||||||
|
log "Pre-push tests failed $cmd"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
log "Tests are OK, ready to push on $remote"
|
||||||
|
exit 0
|
||||||
30
go.mod
30
go.mod
@@ -1,12 +1,16 @@
|
|||||||
module git.metabarcoding.org/obitools/obitools4/obitools4
|
module git.metabarcoding.org/obitools/obitools4/obitools4
|
||||||
|
|
||||||
go 1.22.1
|
go 1.23.4
|
||||||
|
|
||||||
|
toolchain go1.24.2
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/DavidGamba/go-getoptions v0.28.0
|
github.com/DavidGamba/go-getoptions v0.28.0
|
||||||
github.com/PaesslerAG/gval v1.2.2
|
github.com/PaesslerAG/gval v1.2.2
|
||||||
github.com/barkimedes/go-deepcopy v0.0.0-20220514131651-17c30cfc62df
|
github.com/barkimedes/go-deepcopy v0.0.0-20220514131651-17c30cfc62df
|
||||||
|
github.com/buger/jsonparser v1.1.1
|
||||||
github.com/chen3feng/stl4go v0.1.1
|
github.com/chen3feng/stl4go v0.1.1
|
||||||
|
github.com/dlclark/regexp2 v1.11.4
|
||||||
github.com/goccy/go-json v0.10.3
|
github.com/goccy/go-json v0.10.3
|
||||||
github.com/klauspost/pgzip v1.2.6
|
github.com/klauspost/pgzip v1.2.6
|
||||||
github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58
|
github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58
|
||||||
@@ -16,27 +20,23 @@ require (
|
|||||||
github.com/stretchr/testify v1.8.4
|
github.com/stretchr/testify v1.8.4
|
||||||
github.com/tevino/abool/v2 v2.1.0
|
github.com/tevino/abool/v2 v2.1.0
|
||||||
github.com/yuin/gopher-lua v1.1.1
|
github.com/yuin/gopher-lua v1.1.1
|
||||||
golang.org/x/exp v0.0.0-20231006140011-7918f672742d
|
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa
|
||||||
gonum.org/v1/gonum v0.14.0
|
gonum.org/v1/gonum v0.14.0
|
||||||
gopkg.in/yaml.v3 v3.0.1
|
gopkg.in/yaml.v3 v3.0.1
|
||||||
scientificgo.org/special v0.0.0
|
scientificgo.org/special v0.0.0
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/bytedance/sonic v1.11.9 // indirect
|
github.com/RoaringBitmap/roaring v1.9.4 // indirect
|
||||||
github.com/bytedance/sonic/loader v0.1.1 // indirect
|
github.com/bits-and-blooms/bitset v1.12.0 // indirect
|
||||||
github.com/cloudwego/base64x v0.1.4 // indirect
|
|
||||||
github.com/cloudwego/iasm v0.2.0 // indirect
|
|
||||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||||
github.com/goombaio/orderedmap v0.0.0-20180924084748-ba921b7e2419 // indirect
|
github.com/goombaio/orderedmap v0.0.0-20180924084748-ba921b7e2419 // indirect
|
||||||
github.com/klauspost/cpuid/v2 v2.0.9 // indirect
|
github.com/kr/pretty v0.3.1 // indirect
|
||||||
github.com/kr/pretty v0.3.0 // indirect
|
|
||||||
github.com/kr/text v0.2.0 // indirect
|
github.com/kr/text v0.2.0 // indirect
|
||||||
github.com/montanaflynn/stats v0.7.1 // indirect
|
github.com/mschoch/smat v0.2.0 // indirect
|
||||||
|
github.com/pelletier/go-toml/v2 v2.2.4 // indirect
|
||||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||||
github.com/rogpeppe/go-internal v1.6.1 // indirect
|
github.com/rogpeppe/go-internal v1.12.0 // indirect
|
||||||
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
|
|
||||||
golang.org/x/arch v0.0.0-20210923205945-b76863e36670 // indirect
|
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
@@ -49,8 +49,8 @@ require (
|
|||||||
github.com/rivo/uniseg v0.4.4 // indirect
|
github.com/rivo/uniseg v0.4.4 // indirect
|
||||||
github.com/shopspring/decimal v1.3.1 // indirect
|
github.com/shopspring/decimal v1.3.1 // indirect
|
||||||
github.com/ulikunitz/xz v0.5.11
|
github.com/ulikunitz/xz v0.5.11
|
||||||
golang.org/x/net v0.17.0 // indirect
|
golang.org/x/net v0.35.0 // indirect
|
||||||
golang.org/x/sys v0.17.0 // indirect
|
golang.org/x/sys v0.30.0 // indirect
|
||||||
golang.org/x/term v0.13.0 // indirect
|
golang.org/x/term v0.29.0 // indirect
|
||||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c
|
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c
|
||||||
)
|
)
|
||||||
|
|||||||
68
go.sum
68
go.sum
@@ -4,29 +4,27 @@ github.com/PaesslerAG/gval v1.2.2 h1:Y7iBzhgE09IGTt5QgGQ2IdaYYYOU134YGHBThD+wm9E
|
|||||||
github.com/PaesslerAG/gval v1.2.2/go.mod h1:XRFLwvmkTEdYziLdaCeCa5ImcGVrfQbeNUbVR+C6xac=
|
github.com/PaesslerAG/gval v1.2.2/go.mod h1:XRFLwvmkTEdYziLdaCeCa5ImcGVrfQbeNUbVR+C6xac=
|
||||||
github.com/PaesslerAG/jsonpath v0.1.0 h1:gADYeifvlqK3R3i2cR5B4DGgxLXIPb3TRTH1mGi0jPI=
|
github.com/PaesslerAG/jsonpath v0.1.0 h1:gADYeifvlqK3R3i2cR5B4DGgxLXIPb3TRTH1mGi0jPI=
|
||||||
github.com/PaesslerAG/jsonpath v0.1.0/go.mod h1:4BzmtoM/PI8fPO4aQGIusjGxGir2BzcV0grWtFzq1Y8=
|
github.com/PaesslerAG/jsonpath v0.1.0/go.mod h1:4BzmtoM/PI8fPO4aQGIusjGxGir2BzcV0grWtFzq1Y8=
|
||||||
|
github.com/RoaringBitmap/roaring v1.9.4 h1:yhEIoH4YezLYT04s1nHehNO64EKFTop/wBhxv2QzDdQ=
|
||||||
|
github.com/RoaringBitmap/roaring v1.9.4/go.mod h1:6AXUsoIEzDTFFQCe1RbGA6uFONMhvejWj5rqITANK90=
|
||||||
github.com/barkimedes/go-deepcopy v0.0.0-20220514131651-17c30cfc62df h1:GSoSVRLoBaFpOOds6QyY1L8AX7uoY+Ln3BHc22W40X0=
|
github.com/barkimedes/go-deepcopy v0.0.0-20220514131651-17c30cfc62df h1:GSoSVRLoBaFpOOds6QyY1L8AX7uoY+Ln3BHc22W40X0=
|
||||||
github.com/barkimedes/go-deepcopy v0.0.0-20220514131651-17c30cfc62df/go.mod h1:hiVxq5OP2bUGBRNS3Z/bt/reCLFNbdcST6gISi1fiOM=
|
github.com/barkimedes/go-deepcopy v0.0.0-20220514131651-17c30cfc62df/go.mod h1:hiVxq5OP2bUGBRNS3Z/bt/reCLFNbdcST6gISi1fiOM=
|
||||||
github.com/bytedance/sonic v1.11.9 h1:LFHENlIY/SLzDWverzdOvgMztTxcfcF+cqNsz9pK5zg=
|
github.com/bits-and-blooms/bitset v1.12.0 h1:U/q1fAF7xXRhFCrhROzIfffYnu+dlS38vCZtmFVPHmA=
|
||||||
github.com/bytedance/sonic v1.11.9/go.mod h1:LysEHSvpvDySVdC2f87zGWf6CIKJcAvqab1ZaiQtds4=
|
github.com/bits-and-blooms/bitset v1.12.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8=
|
||||||
github.com/bytedance/sonic/loader v0.1.1 h1:c+e5Pt1k/cy5wMveRDyk2X4B9hF4g7an8N3zCYjJFNM=
|
github.com/buger/jsonparser v1.1.1 h1:2PnMjfWD7wBILjqQbt530v576A/cAbQvEW9gGIpYMUs=
|
||||||
github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU=
|
github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0=
|
||||||
github.com/chen3feng/stl4go v0.1.1 h1:0L1+mDw7pomftKDruM23f1mA7miavOj6C6MZeadzN2Q=
|
github.com/chen3feng/stl4go v0.1.1 h1:0L1+mDw7pomftKDruM23f1mA7miavOj6C6MZeadzN2Q=
|
||||||
github.com/chen3feng/stl4go v0.1.1/go.mod h1:5ml3psLgETJjRJnMbPE+JiHLrCpt+Ajc2weeTECXzWU=
|
github.com/chen3feng/stl4go v0.1.1/go.mod h1:5ml3psLgETJjRJnMbPE+JiHLrCpt+Ajc2weeTECXzWU=
|
||||||
github.com/cloudwego/base64x v0.1.4 h1:jwCgWpFanWmN8xoIUHa2rtzmkd5J2plF/dnLS6Xd/0Y=
|
|
||||||
github.com/cloudwego/base64x v0.1.4/go.mod h1:0zlkT4Wn5C6NdauXdJRhSKRlJvmclQ1hhJgA0rcu/8w=
|
|
||||||
github.com/cloudwego/iasm v0.2.0 h1:1KNIy1I1H9hNNFEEH3DVnI4UujN+1zjpuk6gwHLTssg=
|
|
||||||
github.com/cloudwego/iasm v0.2.0/go.mod h1:8rXZaNYT2n95jn+zTI1sDr+IgcD2GVs0nlbbQPiEFhY=
|
|
||||||
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
||||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
|
github.com/dlclark/regexp2 v1.11.4 h1:rPYF9/LECdNymJufQKmri9gV604RvvABwgOA8un7yAo=
|
||||||
|
github.com/dlclark/regexp2 v1.11.4/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8=
|
||||||
github.com/dsnet/compress v0.0.1 h1:PlZu0n3Tuv04TzpfPbrnI0HW/YwodEXDS+oPKahKF0Q=
|
github.com/dsnet/compress v0.0.1 h1:PlZu0n3Tuv04TzpfPbrnI0HW/YwodEXDS+oPKahKF0Q=
|
||||||
github.com/dsnet/compress v0.0.1/go.mod h1:Aw8dCMJ7RioblQeTqt88akK31OvO8Dhf5JflhBbQEHo=
|
github.com/dsnet/compress v0.0.1/go.mod h1:Aw8dCMJ7RioblQeTqt88akK31OvO8Dhf5JflhBbQEHo=
|
||||||
github.com/dsnet/golib v0.0.0-20171103203638-1ea166775780/go.mod h1:Lj+Z9rebOhdfkVLjJ8T6VcRQv3SXugXy999NBtR9aFY=
|
github.com/dsnet/golib v0.0.0-20171103203638-1ea166775780/go.mod h1:Lj+Z9rebOhdfkVLjJ8T6VcRQv3SXugXy999NBtR9aFY=
|
||||||
github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0=
|
github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0=
|
||||||
github.com/gabriel-vasile/mimetype v1.4.3/go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk=
|
github.com/gabriel-vasile/mimetype v1.4.3/go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk=
|
||||||
github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU=
|
|
||||||
github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
|
|
||||||
github.com/goccy/go-json v0.10.3 h1:KZ5WoDbxAIgm2HNbYckL0se1fHD6rz5j4ywS6ebzDqA=
|
github.com/goccy/go-json v0.10.3 h1:KZ5WoDbxAIgm2HNbYckL0se1fHD6rz5j4ywS6ebzDqA=
|
||||||
github.com/goccy/go-json v0.10.3/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M=
|
github.com/goccy/go-json v0.10.3/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M=
|
||||||
github.com/goombaio/orderedmap v0.0.0-20180924084748-ba921b7e2419 h1:SajEQ6tktpF9SRIuzbiPOX9AEZZ53Bvw0k9Mzrts8Lg=
|
github.com/goombaio/orderedmap v0.0.0-20180924084748-ba921b7e2419 h1:SajEQ6tktpF9SRIuzbiPOX9AEZZ53Bvw0k9Mzrts8Lg=
|
||||||
@@ -37,17 +35,12 @@ github.com/k0kubun/go-ansi v0.0.0-20180517002512-3bf9e2903213/go.mod h1:vNUNkEQ1
|
|||||||
github.com/klauspost/compress v1.4.1/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A=
|
github.com/klauspost/compress v1.4.1/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A=
|
||||||
github.com/klauspost/compress v1.17.2 h1:RlWWUY/Dr4fL8qk9YG7DTZ7PDgME2V4csBXA8L/ixi4=
|
github.com/klauspost/compress v1.17.2 h1:RlWWUY/Dr4fL8qk9YG7DTZ7PDgME2V4csBXA8L/ixi4=
|
||||||
github.com/klauspost/compress v1.17.2/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE=
|
github.com/klauspost/compress v1.17.2/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE=
|
||||||
github.com/klauspost/cpuid v1.2.0 h1:NMpwD2G9JSFOE1/TJjGSo5zG7Yb2bTe7eq1jH+irmeE=
|
|
||||||
github.com/klauspost/cpuid v1.2.0/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek=
|
github.com/klauspost/cpuid v1.2.0/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek=
|
||||||
github.com/klauspost/cpuid/v2 v2.0.9 h1:lgaqFMSdTdQYdZ04uHyN2d/eKdOMyi2YLSvlQIBFYa4=
|
|
||||||
github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
|
|
||||||
github.com/klauspost/pgzip v1.2.6 h1:8RXeL5crjEUFnR2/Sn6GJNWtSQ3Dk8pq4CL3jvdDyjU=
|
github.com/klauspost/pgzip v1.2.6 h1:8RXeL5crjEUFnR2/Sn6GJNWtSQ3Dk8pq4CL3jvdDyjU=
|
||||||
github.com/klauspost/pgzip v1.2.6/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs=
|
github.com/klauspost/pgzip v1.2.6/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs=
|
||||||
github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M=
|
|
||||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
|
||||||
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
|
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
|
||||||
github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0=
|
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
|
||||||
github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk=
|
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
|
||||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||||
@@ -58,17 +51,21 @@ github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZ
|
|||||||
github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
|
github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
|
||||||
github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db h1:62I3jR2EmQ4l5rM/4FEfDWcRD+abF5XlKShorW5LRoQ=
|
github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db h1:62I3jR2EmQ4l5rM/4FEfDWcRD+abF5XlKShorW5LRoQ=
|
||||||
github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db/go.mod h1:l0dey0ia/Uv7NcFFVbCLtqEBQbrT4OCwCSKTEv6enCw=
|
github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db/go.mod h1:l0dey0ia/Uv7NcFFVbCLtqEBQbrT4OCwCSKTEv6enCw=
|
||||||
github.com/montanaflynn/stats v0.7.1 h1:etflOAAHORrCC44V+aR6Ftzort912ZU+YLiSTuV8eaE=
|
github.com/mschoch/smat v0.2.0 h1:8imxQsjDm8yFEAVBe7azKmKSgzSkZXDuKkSq9374khM=
|
||||||
github.com/montanaflynn/stats v0.7.1/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow=
|
github.com/mschoch/smat v0.2.0/go.mod h1:kc9mz7DoBKqDyiRL7VZN8KvXQMWeTaVnttLRXOlotKw=
|
||||||
github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 h1:onHthvaw9LFnH4t2DcNVpwGmV9E1BkGknEliJkfwQj0=
|
github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 h1:onHthvaw9LFnH4t2DcNVpwGmV9E1BkGknEliJkfwQj0=
|
||||||
github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58/go.mod h1:DXv8WO4yhMYhSNPKjeNKa5WY9YCIEBRbNzFFPJbWO6Y=
|
github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58/go.mod h1:DXv8WO4yhMYhSNPKjeNKa5WY9YCIEBRbNzFFPJbWO6Y=
|
||||||
|
github.com/pelletier/go-toml/v2 v2.2.4 h1:mye9XuhQ6gvn5h28+VilKrrPoQVanw5PMw/TB0t5Ec4=
|
||||||
|
github.com/pelletier/go-toml/v2 v2.2.4/go.mod h1:2gIqNv+qfxSVS7cM2xJQKtLSTLUE9V8t9Stt+h56mCY=
|
||||||
|
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
|
||||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
||||||
github.com/rivo/uniseg v0.4.4 h1:8TfxU8dW6PdqD27gjM8MVNuicgxIjxpm4K7x4jp8sis=
|
github.com/rivo/uniseg v0.4.4 h1:8TfxU8dW6PdqD27gjM8MVNuicgxIjxpm4K7x4jp8sis=
|
||||||
github.com/rivo/uniseg v0.4.4/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
|
github.com/rivo/uniseg v0.4.4/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
|
||||||
github.com/rogpeppe/go-internal v1.6.1 h1:/FiVV8dS/e+YqF2JvO3yXRFbBLTIuSDkuC7aBOAvL+k=
|
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
|
||||||
github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
|
github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8=
|
||||||
|
github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4=
|
||||||
github.com/rrethy/ahocorasick v1.0.0 h1:YKkCB+E5PXc0xmLfMrWbfNht8vG9Re97IHSWZk/Lk8E=
|
github.com/rrethy/ahocorasick v1.0.0 h1:YKkCB+E5PXc0xmLfMrWbfNht8vG9Re97IHSWZk/Lk8E=
|
||||||
github.com/rrethy/ahocorasick v1.0.0/go.mod h1:nq8oScE7Vy1rOppoQxpQiiDmPHuKCuk9rXrNcxUV3R0=
|
github.com/rrethy/ahocorasick v1.0.0/go.mod h1:nq8oScE7Vy1rOppoQxpQiiDmPHuKCuk9rXrNcxUV3R0=
|
||||||
github.com/schollz/progressbar/v3 v3.13.1 h1:o8rySDYiQ59Mwzy2FELeHY5ZARXZTVJC7iHD6PEFUiE=
|
github.com/schollz/progressbar/v3 v3.13.1 h1:o8rySDYiQ59Mwzy2FELeHY5ZARXZTVJC7iHD6PEFUiE=
|
||||||
@@ -78,50 +75,37 @@ github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFR
|
|||||||
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
|
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
|
||||||
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
|
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
|
||||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
|
||||||
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
|
||||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
|
||||||
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
|
||||||
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
|
||||||
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
|
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
|
||||||
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||||
github.com/tevino/abool/v2 v2.1.0 h1:7w+Vf9f/5gmKT4m4qkayb33/92M+Um45F2BkHOR+L/c=
|
github.com/tevino/abool/v2 v2.1.0 h1:7w+Vf9f/5gmKT4m4qkayb33/92M+Um45F2BkHOR+L/c=
|
||||||
github.com/tevino/abool/v2 v2.1.0/go.mod h1:+Lmlqk6bHDWHqN1cbxqhwEAwMPXgc8I1SDEamtseuXY=
|
github.com/tevino/abool/v2 v2.1.0/go.mod h1:+Lmlqk6bHDWHqN1cbxqhwEAwMPXgc8I1SDEamtseuXY=
|
||||||
github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI=
|
|
||||||
github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08=
|
|
||||||
github.com/ulikunitz/xz v0.5.6/go.mod h1:2bypXElzHzzJZwzH67Y6wb67pO62Rzfn7BSiF4ABRW8=
|
github.com/ulikunitz/xz v0.5.6/go.mod h1:2bypXElzHzzJZwzH67Y6wb67pO62Rzfn7BSiF4ABRW8=
|
||||||
github.com/ulikunitz/xz v0.5.11 h1:kpFauv27b6ynzBNT/Xy+1k+fK4WswhN/6PN5WhFAGw8=
|
github.com/ulikunitz/xz v0.5.11 h1:kpFauv27b6ynzBNT/Xy+1k+fK4WswhN/6PN5WhFAGw8=
|
||||||
github.com/ulikunitz/xz v0.5.11/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
|
github.com/ulikunitz/xz v0.5.11/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
|
||||||
github.com/yuin/gopher-lua v1.1.1 h1:kYKnWBjvbNP4XLT3+bPEwAXJx262OhaHDWDVOPjL46M=
|
github.com/yuin/gopher-lua v1.1.1 h1:kYKnWBjvbNP4XLT3+bPEwAXJx262OhaHDWDVOPjL46M=
|
||||||
github.com/yuin/gopher-lua v1.1.1/go.mod h1:GBR0iDaNXjAgGg9zfCvksxSRnQx76gclCIb7kdAd1Pw=
|
github.com/yuin/gopher-lua v1.1.1/go.mod h1:GBR0iDaNXjAgGg9zfCvksxSRnQx76gclCIb7kdAd1Pw=
|
||||||
golang.org/x/arch v0.0.0-20210923205945-b76863e36670 h1:18EFjUmQOcUvxNYSkA6jO9VAiXCnxFY6NyDX0bHDmkU=
|
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa h1:FRnLl4eNAQl8hwxVVC17teOw8kdjVDVAiFMtgUdTSRQ=
|
||||||
golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8=
|
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa/go.mod h1:zk2irFbV9DP96SEBUUAy67IdHUaZuSnrz1n472HUCLE=
|
||||||
golang.org/x/exp v0.0.0-20231006140011-7918f672742d h1:jtJma62tbqLibJ5sFQz8bKtEM8rJBtfilJ2qTU199MI=
|
golang.org/x/net v0.35.0 h1:T5GQRQb2y08kTAByq9L4/bz8cipCdA8FbRTXewonqY8=
|
||||||
golang.org/x/exp v0.0.0-20231006140011-7918f672742d/go.mod h1:ldy0pHrwJyGW56pPQzzkH36rKxoZW1tw7ZJpeKx+hdo=
|
golang.org/x/net v0.35.0/go.mod h1:EglIi67kWsHKlRzzVMUD93VMSWGFOMSZgxFjparz1Qk=
|
||||||
golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM=
|
|
||||||
golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE=
|
|
||||||
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y=
|
golang.org/x/sys v0.30.0 h1:QjkSwP/36a20jFYWkSue1YwXzLmsV5Gfq7Eiy72C1uc=
|
||||||
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||||
golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U=
|
golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U=
|
||||||
golang.org/x/term v0.13.0 h1:bb+I9cTfFazGW51MZqBVmZy7+JEJMouUHTUSKVQLBek=
|
golang.org/x/term v0.29.0 h1:L6pJp37ocefwRRtYPKSWOWzOtWSxVajvz2ldH/xi3iU=
|
||||||
golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U=
|
golang.org/x/term v0.29.0/go.mod h1:6bl4lRlvVuDgSf3179VpIxBF0o10JUpXWOnI7nErv7s=
|
||||||
gonum.org/v1/gonum v0.14.0 h1:2NiG67LD1tEH0D7kM+ps2V+fXmsAnpUeec7n8tcr4S0=
|
gonum.org/v1/gonum v0.14.0 h1:2NiG67LD1tEH0D7kM+ps2V+fXmsAnpUeec7n8tcr4S0=
|
||||||
gonum.org/v1/gonum v0.14.0/go.mod h1:AoWeoz0becf9QMWtE8iWXNXc27fK4fNeHNf/oMejGfU=
|
gonum.org/v1/gonum v0.14.0/go.mod h1:AoWeoz0becf9QMWtE8iWXNXc27fK4fNeHNf/oMejGfU=
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
|
||||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
||||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
|
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
|
||||||
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
|
|
||||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50=
|
|
||||||
rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4=
|
|
||||||
scientificgo.org/special v0.0.0 h1:P6WJkECo6tgtvZAEfNXl+KEB9ReAatjKAeX8U07mjSc=
|
scientificgo.org/special v0.0.0 h1:P6WJkECo6tgtvZAEfNXl+KEB9ReAatjKAeX8U07mjSc=
|
||||||
scientificgo.org/special v0.0.0/go.mod h1:LoGVh9tS431RLTJo7gFlYDKFWq44cEb7QqL+M0EKtZU=
|
scientificgo.org/special v0.0.0/go.mod h1:LoGVh9tS431RLTJo7gFlYDKFWq44cEb7QqL+M0EKtZU=
|
||||||
scientificgo.org/testutil v0.0.0 h1:y356DHRo0tAz9zIFmxlhZoKDlHPHaWW/DCm9k3PhIMA=
|
scientificgo.org/testutil v0.0.0 h1:y356DHRo0tAz9zIFmxlhZoKDlHPHaWW/DCm9k3PhIMA=
|
||||||
|
|||||||
11
go.work.sum
11
go.work.sum
@@ -2,7 +2,6 @@ git.sr.ht/~sbinet/gg v0.3.1 h1:LNhjNn8DerC8f9DHLz6lS0YYul/b602DUxDgGkd/Aik=
|
|||||||
git.sr.ht/~sbinet/gg v0.3.1/go.mod h1:KGYtlADtqsqANL9ueOFkWymvzUvLMQllU5Ixo+8v3pc=
|
git.sr.ht/~sbinet/gg v0.3.1/go.mod h1:KGYtlADtqsqANL9ueOFkWymvzUvLMQllU5Ixo+8v3pc=
|
||||||
github.com/ajstarks/svgo v0.0.0-20211024235047-1546f124cd8b h1:slYM766cy2nI3BwyRiyQj/Ud48djTMtMebDqepE95rw=
|
github.com/ajstarks/svgo v0.0.0-20211024235047-1546f124cd8b h1:slYM766cy2nI3BwyRiyQj/Ud48djTMtMebDqepE95rw=
|
||||||
github.com/ajstarks/svgo v0.0.0-20211024235047-1546f124cd8b/go.mod h1:1KcenG0jGWcpt8ov532z81sp/kMMUG485J2InIOyADM=
|
github.com/ajstarks/svgo v0.0.0-20211024235047-1546f124cd8b/go.mod h1:1KcenG0jGWcpt8ov532z81sp/kMMUG485J2InIOyADM=
|
||||||
github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0=
|
|
||||||
github.com/chzyer/logex v1.1.10 h1:Swpa1K6QvQznwJRcfTfQJmTE72DqScAa40E+fbHEXEE=
|
github.com/chzyer/logex v1.1.10 h1:Swpa1K6QvQznwJRcfTfQJmTE72DqScAa40E+fbHEXEE=
|
||||||
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
|
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
|
||||||
github.com/chzyer/logex v1.2.0 h1:+eqR0HfOetur4tgnC8ftU5imRnhi4te+BadWS95c5AM=
|
github.com/chzyer/logex v1.2.0 h1:+eqR0HfOetur4tgnC8ftU5imRnhi4te+BadWS95c5AM=
|
||||||
@@ -20,15 +19,20 @@ github.com/go-latex/latex v0.0.0-20230307184459-12ec69307ad9 h1:NxXI5pTAtpEaU49b
|
|||||||
github.com/go-latex/latex v0.0.0-20230307184459-12ec69307ad9/go.mod h1:gWuR/CrFDDeVRFQwHPvsv9soJVB/iqymhuZQuJ3a9OM=
|
github.com/go-latex/latex v0.0.0-20230307184459-12ec69307ad9/go.mod h1:gWuR/CrFDDeVRFQwHPvsv9soJVB/iqymhuZQuJ3a9OM=
|
||||||
github.com/go-pdf/fpdf v0.6.0 h1:MlgtGIfsdMEEQJr2le6b/HNr1ZlQwxyWr77r2aj2U/8=
|
github.com/go-pdf/fpdf v0.6.0 h1:MlgtGIfsdMEEQJr2le6b/HNr1ZlQwxyWr77r2aj2U/8=
|
||||||
github.com/go-pdf/fpdf v0.6.0/go.mod h1:HzcnA+A23uwogo0tp9yU+l3V+KXhiESpt1PMayhOh5M=
|
github.com/go-pdf/fpdf v0.6.0/go.mod h1:HzcnA+A23uwogo0tp9yU+l3V+KXhiESpt1PMayhOh5M=
|
||||||
|
github.com/go-quicktest/qt v1.101.0/go.mod h1:14Bz/f7NwaXPtdYEgzsx46kqSxVwTbzVZsDC26tQJow=
|
||||||
github.com/goccmack/gocc v0.0.0-20230228185258-2292f9e40198 h1:FSii2UQeSLngl3jFoR4tUKZLprO7qUlh/TKKticc0BM=
|
github.com/goccmack/gocc v0.0.0-20230228185258-2292f9e40198 h1:FSii2UQeSLngl3jFoR4tUKZLprO7qUlh/TKKticc0BM=
|
||||||
github.com/goccmack/gocc v0.0.0-20230228185258-2292f9e40198/go.mod h1:DTh/Y2+NbnOVVoypCCQrovMPDKUGp4yZpSbWg5D0XIM=
|
github.com/goccmack/gocc v0.0.0-20230228185258-2292f9e40198/go.mod h1:DTh/Y2+NbnOVVoypCCQrovMPDKUGp4yZpSbWg5D0XIM=
|
||||||
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 h1:DACJavvAHhabrF08vX0COfcOBJRhZ8lUbR+ZWIs0Y5g=
|
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 h1:DACJavvAHhabrF08vX0COfcOBJRhZ8lUbR+ZWIs0Y5g=
|
||||||
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k=
|
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k=
|
||||||
|
github.com/google/go-cmdtest v0.4.1-0.20220921163831-55ab3332a786/go.mod h1:apVn/GCasLZUVpAJ6oWAuyP7Ne7CEsQbTnc0plM3m+o=
|
||||||
github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg=
|
github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg=
|
||||||
github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||||
|
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
|
||||||
|
github.com/google/safehtml v0.1.0/go.mod h1:L4KWwDsUJdECRAEpZoBn3O64bQaywRscowZjJAzjHnU=
|
||||||
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
|
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
|
||||||
github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM=
|
github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM=
|
||||||
github.com/ianlancetaylor/demangle v0.0.0-20220319035150-800ac71e25c2 h1:rcanfLhLDA8nozr/K289V1zcntHr3V+SHlXwzz1ZI2g=
|
github.com/ianlancetaylor/demangle v0.0.0-20220319035150-800ac71e25c2 h1:rcanfLhLDA8nozr/K289V1zcntHr3V+SHlXwzz1ZI2g=
|
||||||
|
github.com/jba/templatecheck v0.7.1/go.mod h1:n1Etw+Rrw1mDDD8dDRsEKTwMZsJ98EkktgNJC6wLUGo=
|
||||||
github.com/k0kubun/go-ansi v0.0.0-20180517002512-3bf9e2903213 h1:qGQQKEcAR99REcMpsXCp3lJ03zYT1PkRd3kQGPn9GVg=
|
github.com/k0kubun/go-ansi v0.0.0-20180517002512-3bf9e2903213 h1:qGQQKEcAR99REcMpsXCp3lJ03zYT1PkRd3kQGPn9GVg=
|
||||||
github.com/klauspost/cpuid v1.2.0 h1:NMpwD2G9JSFOE1/TJjGSo5zG7Yb2bTe7eq1jH+irmeE=
|
github.com/klauspost/cpuid v1.2.0 h1:NMpwD2G9JSFOE1/TJjGSo5zG7Yb2bTe7eq1jH+irmeE=
|
||||||
github.com/kr/pty v1.1.1 h1:VkoXIwSboBpnk99O/KFauAEILuNHv5DVFKZMBN/gUgw=
|
github.com/kr/pty v1.1.1 h1:VkoXIwSboBpnk99O/KFauAEILuNHv5DVFKZMBN/gUgw=
|
||||||
@@ -39,17 +43,22 @@ github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4=
|
|||||||
github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c=
|
github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c=
|
||||||
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
||||||
github.com/yuin/goldmark v1.4.13 h1:fVcFKWvrslecOb/tg+Cc05dkeYx540o0FuFt3nUVDoE=
|
github.com/yuin/goldmark v1.4.13 h1:fVcFKWvrslecOb/tg+Cc05dkeYx540o0FuFt3nUVDoE=
|
||||||
|
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
|
||||||
golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc=
|
golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc=
|
||||||
golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4=
|
golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4=
|
||||||
|
golang.org/x/crypto v0.33.0/go.mod h1:bVdXmD7IV/4GdElGPozy6U7lWdRXA4qyRVGJV57uQ5M=
|
||||||
golang.org/x/image v0.6.0 h1:bR8b5okrPI3g/gyZakLZHeWxAR8Dn5CyxXv1hLH5g/4=
|
golang.org/x/image v0.6.0 h1:bR8b5okrPI3g/gyZakLZHeWxAR8Dn5CyxXv1hLH5g/4=
|
||||||
golang.org/x/image v0.6.0/go.mod h1:MXLdDR43H7cDJq5GEGXEVeeNhPgi+YYEQ2pC1byI1x0=
|
golang.org/x/image v0.6.0/go.mod h1:MXLdDR43H7cDJq5GEGXEVeeNhPgi+YYEQ2pC1byI1x0=
|
||||||
golang.org/x/mod v0.13.0 h1:I/DsJXRlw/8l/0c24sM9yb0T4z9liZTduXvdAWYiysY=
|
golang.org/x/mod v0.13.0 h1:I/DsJXRlw/8l/0c24sM9yb0T4z9liZTduXvdAWYiysY=
|
||||||
golang.org/x/mod v0.13.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
|
golang.org/x/mod v0.13.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
|
||||||
|
golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
|
||||||
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 h1:uVc8UZUe6tr40fFVnUP5Oj+veunVezqYl9z7DYw9xzw=
|
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 h1:uVc8UZUe6tr40fFVnUP5Oj+veunVezqYl9z7DYw9xzw=
|
||||||
golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k=
|
golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k=
|
||||||
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
|
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
|
||||||
|
golang.org/x/text v0.22.0/go.mod h1:YRoo4H8PVmsu+E3Ou7cqLVH8oXWIHVoX0jqUWALQhfY=
|
||||||
golang.org/x/tools v0.14.0 h1:jvNa2pY0M4r62jkRQ6RwEZZyPcymeL9XZMLBbV7U2nc=
|
golang.org/x/tools v0.14.0 h1:jvNa2pY0M4r62jkRQ6RwEZZyPcymeL9XZMLBbV7U2nc=
|
||||||
golang.org/x/tools v0.14.0/go.mod h1:uYBEerGOWcJyEORxN+Ek8+TT266gXkNlHdJBwexUsBg=
|
golang.org/x/tools v0.14.0/go.mod h1:uYBEerGOWcJyEORxN+Ek8+TT266gXkNlHdJBwexUsBg=
|
||||||
|
golang.org/x/tools v0.15.0/go.mod h1:hpksKq4dtpQWS1uQ61JkdqWM3LscIS6Slf+VVkm+wQk=
|
||||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7 h1:9zdDQZ7Thm29KFXgAX/+yaf3eVbP7djjWp/dXAppNCc=
|
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7 h1:9zdDQZ7Thm29KFXgAX/+yaf3eVbP7djjWp/dXAppNCc=
|
||||||
gonum.org/v1/plot v0.10.1 h1:dnifSs43YJuNMDzB7v8wV64O4ABBHReuAVAoBxqBqS4=
|
gonum.org/v1/plot v0.10.1 h1:dnifSs43YJuNMDzB7v8wV64O4ABBHReuAVAoBxqBqS4=
|
||||||
gonum.org/v1/plot v0.10.1/go.mod h1:VZW5OlhkL1mysU9vaqNHnsy86inf6Ot+jB3r+BczCEo=
|
gonum.org/v1/plot v0.10.1/go.mod h1:VZW5OlhkL1mysU9vaqNHnsy86inf6Ot+jB3r+BczCEo=
|
||||||
|
|||||||
@@ -59,6 +59,11 @@ if [[ ! "$WORK_DIR" || ! -d "$WORK_DIR" ]]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
mkdir -p "${WORK_DIR}/cache" \
|
||||||
|
|| (echo "Cannot create ${WORK_DIR}/cache directory" 1>&2
|
||||||
|
exit 1)
|
||||||
|
|
||||||
|
|
||||||
mkdir -p "${INSTALL_DIR}/bin" 2> /dev/null \
|
mkdir -p "${INSTALL_DIR}/bin" 2> /dev/null \
|
||||||
|| (echo "Please enter your password for installing obitools in ${INSTALL_DIR}" 1>&2
|
|| (echo "Please enter your password for installing obitools in ${INSTALL_DIR}" 1>&2
|
||||||
sudo mkdir -p "${INSTALL_DIR}/bin")
|
sudo mkdir -p "${INSTALL_DIR}/bin")
|
||||||
@@ -68,11 +73,11 @@ if [[ ! -d "${INSTALL_DIR}/bin" ]]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
INSTALL_DIR="$(cd $INSTALL_DIR && pwd)"
|
INSTALL_DIR="$(cd ${INSTALL_DIR} && pwd)"
|
||||||
|
|
||||||
echo WORK_DIR=$WORK_DIR 1>&2
|
echo "WORK_DIR=$WORK_DIR" 1>&2
|
||||||
echo INSTALL_DIR=$INSTALL_DIR 1>&2
|
echo "INSTALL_DIR=$INSTALL_DIR" 1>&2
|
||||||
echo OBITOOLS_PREFIX=$OBITOOLS_PREFIX 1>&2
|
echo "OBITOOLS_PREFIX=$OBITOOLS_PREFIX" 1>&2
|
||||||
|
|
||||||
pushd "$WORK_DIR"|| exit
|
pushd "$WORK_DIR"|| exit
|
||||||
|
|
||||||
@@ -105,6 +110,13 @@ curl "$GOURL" \
|
|||||||
|
|
||||||
PATH="$(pwd)/go/bin:$PATH"
|
PATH="$(pwd)/go/bin:$PATH"
|
||||||
export PATH
|
export PATH
|
||||||
|
GOPATH="$(pwd)/go"
|
||||||
|
export GOPATH
|
||||||
|
|
||||||
|
export GOCACHE="$(pwd)/cache"
|
||||||
|
echo "GOCACHE=$GOCACHE" 1>&2@
|
||||||
|
mkdir -p "$GOCACHE"
|
||||||
|
|
||||||
|
|
||||||
curl -L "$OBIURL4" > master.zip
|
curl -L "$OBIURL4" > master.zip
|
||||||
unzip master.zip
|
unzip master.zip
|
||||||
@@ -112,11 +124,12 @@ unzip master.zip
|
|||||||
echo "Install OBITOOLS from : $OBIURL4"
|
echo "Install OBITOOLS from : $OBIURL4"
|
||||||
|
|
||||||
cd obitools4-master || exit
|
cd obitools4-master || exit
|
||||||
|
mkdir vendor
|
||||||
|
|
||||||
if [[ -z "$OBITOOLS_PREFIX" ]] ; then
|
if [[ -z "$OBITOOLS_PREFIX" ]] ; then
|
||||||
make
|
make GOFLAGS="-buildvcs=false"
|
||||||
else
|
else
|
||||||
make OBITOOLS_PREFIX="${OBITOOLS_PREFIX}"
|
make GOFLAGS="-buildvcs=false" OBITOOLS_PREFIX="${OBITOOLS_PREFIX}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
(cp build/* "${INSTALL_DIR}/bin" 2> /dev/null) \
|
(cp build/* "${INSTALL_DIR}/bin" 2> /dev/null) \
|
||||||
@@ -125,5 +138,6 @@ fi
|
|||||||
|
|
||||||
popd || exit
|
popd || exit
|
||||||
|
|
||||||
|
chmod -R +w "$WORK_DIR"
|
||||||
rm -rf "$WORK_DIR"
|
rm -rf "$WORK_DIR"
|
||||||
|
|
||||||
|
|||||||
292
kmer_roaring_index/FREQUENCY_FILTER_FINAL.md
Normal file
292
kmer_roaring_index/FREQUENCY_FILTER_FINAL.md
Normal file
@@ -0,0 +1,292 @@
|
|||||||
|
# Filtre de Fréquence avec v Niveaux de Roaring Bitmaps
|
||||||
|
|
||||||
|
## Algorithme
|
||||||
|
|
||||||
|
```go
|
||||||
|
Pour chaque k-mer rencontré dans les données:
|
||||||
|
c = 0
|
||||||
|
tant que (k-mer ∈ index[c] ET c < v):
|
||||||
|
c++
|
||||||
|
|
||||||
|
si c < v:
|
||||||
|
index[c].insert(k-mer)
|
||||||
|
```
|
||||||
|
|
||||||
|
**Résultat** : `index[v-1]` contient les k-mers vus **≥ v fois**
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Exemple d'exécution (v=3)
|
||||||
|
|
||||||
|
```
|
||||||
|
Données:
|
||||||
|
Read1: kmer X
|
||||||
|
Read2: kmer X
|
||||||
|
Read3: kmer X (X vu 3 fois)
|
||||||
|
Read4: kmer Y
|
||||||
|
Read5: kmer Y (Y vu 2 fois)
|
||||||
|
Read6: kmer Z (Z vu 1 fois)
|
||||||
|
|
||||||
|
Exécution:
|
||||||
|
|
||||||
|
Read1 (X):
|
||||||
|
c=0: X ∉ index[0] → index[0].add(X)
|
||||||
|
État: index[0]={X}, index[1]={}, index[2]={}
|
||||||
|
|
||||||
|
Read2 (X):
|
||||||
|
c=0: X ∈ index[0] → c=1
|
||||||
|
c=1: X ∉ index[1] → index[1].add(X)
|
||||||
|
État: index[0]={X}, index[1]={X}, index[2]={}
|
||||||
|
|
||||||
|
Read3 (X):
|
||||||
|
c=0: X ∈ index[0] → c=1
|
||||||
|
c=1: X ∈ index[1] → c=2
|
||||||
|
c=2: X ∉ index[2] → index[2].add(X)
|
||||||
|
État: index[0]={X}, index[1]={X}, index[2]={X}
|
||||||
|
|
||||||
|
Read4 (Y):
|
||||||
|
c=0: Y ∉ index[0] → index[0].add(Y)
|
||||||
|
État: index[0]={X,Y}, index[1]={X}, index[2]={X}
|
||||||
|
|
||||||
|
Read5 (Y):
|
||||||
|
c=0: Y ∈ index[0] → c=1
|
||||||
|
c=1: Y ∉ index[1] → index[1].add(Y)
|
||||||
|
État: index[0]={X,Y}, index[1]={X,Y}, index[2]={X}
|
||||||
|
|
||||||
|
Read6 (Z):
|
||||||
|
c=0: Z ∉ index[0] → index[0].add(Z)
|
||||||
|
État: index[0]={X,Y,Z}, index[1]={X,Y}, index[2]={X}
|
||||||
|
|
||||||
|
Résultat final:
|
||||||
|
index[0] (freq≥1): {X, Y, Z}
|
||||||
|
index[1] (freq≥2): {X, Y}
|
||||||
|
index[2] (freq≥3): {X} ← K-mers filtrés ✓
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Utilisation
|
||||||
|
|
||||||
|
```go
|
||||||
|
// Créer le filtre
|
||||||
|
filter := obikmer.NewFrequencyFilter(31, 3) // k=31, minFreq=3
|
||||||
|
|
||||||
|
// Ajouter les séquences
|
||||||
|
for _, read := range reads {
|
||||||
|
filter.AddSequence(read)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Récupérer les k-mers filtrés (freq ≥ 3)
|
||||||
|
filtered := filter.GetFilteredSet("filtered")
|
||||||
|
fmt.Printf("K-mers de qualité: %d\n", filtered.Cardinality())
|
||||||
|
|
||||||
|
// Statistiques
|
||||||
|
stats := filter.Stats()
|
||||||
|
fmt.Println(stats.String())
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Performance
|
||||||
|
|
||||||
|
### Complexité
|
||||||
|
|
||||||
|
**Par k-mer** :
|
||||||
|
- Lookups : Moyenne ~v/2, pire cas v
|
||||||
|
- Insertions : 1 Add
|
||||||
|
- **Pas de Remove** ✅
|
||||||
|
|
||||||
|
**Total pour n k-mers** :
|
||||||
|
- Temps : O(n × v/2)
|
||||||
|
- Mémoire : O(unique_kmers × v × 2 bytes)
|
||||||
|
|
||||||
|
### Early exit pour distribution skewed
|
||||||
|
|
||||||
|
Avec distribution typique (séquençage) :
|
||||||
|
```
|
||||||
|
80% singletons → 1 lookup (early exit)
|
||||||
|
15% freq 2-3 → 2-3 lookups
|
||||||
|
5% freq ≥4 → jusqu'à v lookups
|
||||||
|
|
||||||
|
Moyenne réelle : ~2 lookups/kmer (au lieu de v/2)
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Mémoire
|
||||||
|
|
||||||
|
### Pour 10^8 k-mers uniques
|
||||||
|
|
||||||
|
| v (minFreq) | Nombre bitmaps | Mémoire | vs map simple |
|
||||||
|
|-------------|----------------|---------|---------------|
|
||||||
|
| v=2 | 2 | ~400 MB | 6x moins |
|
||||||
|
| v=3 | 3 | ~600 MB | 4x moins |
|
||||||
|
| v=5 | 5 | ~1 GB | 2.4x moins |
|
||||||
|
| v=10 | 10 | ~2 GB | 1.2x moins |
|
||||||
|
| v=20 | 20 | ~4 GB | ~égal |
|
||||||
|
|
||||||
|
**Note** : Avec distribution skewed (beaucoup de singletons), la mémoire réelle est bien plus faible car les niveaux hauts ont peu d'éléments.
|
||||||
|
|
||||||
|
### Exemple réaliste (séquençage)
|
||||||
|
|
||||||
|
Pour 10^8 k-mers totaux, v=3 :
|
||||||
|
```
|
||||||
|
Distribution:
|
||||||
|
80% singletons → 80M dans index[0]
|
||||||
|
15% freq 2-3 → 15M dans index[1]
|
||||||
|
5% freq ≥3 → 5M dans index[2]
|
||||||
|
|
||||||
|
Mémoire:
|
||||||
|
index[0]: 80M × 2 bytes = 160 MB
|
||||||
|
index[1]: 15M × 2 bytes = 30 MB
|
||||||
|
index[2]: 5M × 2 bytes = 10 MB
|
||||||
|
Total: ~200 MB ✅
|
||||||
|
|
||||||
|
vs map simple: 80M × 24 bytes = ~2 GB
|
||||||
|
Réduction: 10x
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Comparaison des approches
|
||||||
|
|
||||||
|
| Approche | Mémoire (10^8 kmers) | Passes | Lookups/kmer | Quand utiliser |
|
||||||
|
|----------|----------------------|--------|--------------|----------------|
|
||||||
|
| **v-Bitmaps** | **200-600 MB** | **1** | **~2 (avg)** | **Standard** ✅ |
|
||||||
|
| Map simple | 2.4 GB | 1 | 1 | Si RAM illimitée |
|
||||||
|
| Multi-pass | 400 MB | v | v | Si I/O pas cher |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Avantages de v-Bitmaps
|
||||||
|
|
||||||
|
✅ **Une seule passe** sur les données
|
||||||
|
✅ **Mémoire optimale** avec Roaring bitmaps
|
||||||
|
✅ **Pas de Remove** (seulement Contains + Add)
|
||||||
|
✅ **Early exit** efficace sur singletons
|
||||||
|
✅ **Scalable** jusqu'à v~10-20
|
||||||
|
✅ **Simple** à implémenter et comprendre
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Cas d'usage typiques
|
||||||
|
|
||||||
|
### 1. Éliminer erreurs de séquençage
|
||||||
|
|
||||||
|
```go
|
||||||
|
filter := obikmer.NewFrequencyFilter(31, 3)
|
||||||
|
|
||||||
|
// Traiter FASTQ
|
||||||
|
for read := range StreamFastq("sample.fastq") {
|
||||||
|
filter.AddSequence(read)
|
||||||
|
}
|
||||||
|
|
||||||
|
// K-mers de qualité (pas d'erreurs)
|
||||||
|
cleaned := filter.GetFilteredSet("cleaned")
|
||||||
|
```
|
||||||
|
|
||||||
|
**Résultat** : Élimine 70-80% des k-mers (erreurs)
|
||||||
|
|
||||||
|
### 2. Assemblage de génome
|
||||||
|
|
||||||
|
```go
|
||||||
|
filter := obikmer.NewFrequencyFilter(31, 2)
|
||||||
|
|
||||||
|
// Filtrer avant l'assemblage
|
||||||
|
for read := range reads {
|
||||||
|
filter.AddSequence(read)
|
||||||
|
}
|
||||||
|
|
||||||
|
solidKmers := filter.GetFilteredSet("solid")
|
||||||
|
// Utiliser solidKmers pour le graphe de Bruijn
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3. Comparaison de génomes
|
||||||
|
|
||||||
|
```go
|
||||||
|
collection := obikmer.NewKmerSetCollection(31)
|
||||||
|
|
||||||
|
for _, genome := range genomes {
|
||||||
|
filter := obikmer.NewFrequencyFilter(31, 3)
|
||||||
|
filter.AddSequences(genome.Reads)
|
||||||
|
|
||||||
|
cleaned := filter.GetFilteredSet(genome.ID)
|
||||||
|
collection.Add(cleaned)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Analyses comparatives sur k-mers de qualité
|
||||||
|
matrix := collection.ParallelPairwiseJaccard(8)
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Limites
|
||||||
|
|
||||||
|
**Pour v > 20** :
|
||||||
|
- Trop de lookups (v lookups/kmer)
|
||||||
|
- Mémoire importante (v × 200MB pour 10^8 kmers)
|
||||||
|
|
||||||
|
**Solutions alternatives pour v > 20** :
|
||||||
|
- Utiliser map simple (9 bytes/kmer) si RAM disponible
|
||||||
|
- Algorithme différent (sketch, probabiliste)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Optimisations possibles
|
||||||
|
|
||||||
|
### 1. Parallélisation
|
||||||
|
|
||||||
|
```go
|
||||||
|
// Traiter plusieurs fichiers en parallèle
|
||||||
|
filters := make([]*FrequencyFilter, numFiles)
|
||||||
|
|
||||||
|
var wg sync.WaitGroup
|
||||||
|
for i, file := range files {
|
||||||
|
wg.Add(1)
|
||||||
|
go func(idx int, f string) {
|
||||||
|
defer wg.Done()
|
||||||
|
filters[idx] = ProcessFile(f, k, minFreq)
|
||||||
|
}(i, file)
|
||||||
|
}
|
||||||
|
wg.Wait()
|
||||||
|
|
||||||
|
// Merger les résultats
|
||||||
|
merged := MergeFilters(filters)
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. Streaming avec seuil adaptatif
|
||||||
|
|
||||||
|
```go
|
||||||
|
// Commencer avec v=5, réduire progressivement
|
||||||
|
filter := obikmer.NewFrequencyFilter(31, 5)
|
||||||
|
|
||||||
|
// ... traitement ...
|
||||||
|
|
||||||
|
// Si trop de mémoire, réduire à v=3
|
||||||
|
if filter.MemoryUsage() > threshold {
|
||||||
|
filter = ConvertToLowerThreshold(filter, 3)
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Récapitulatif final
|
||||||
|
|
||||||
|
**Pour filtrer les k-mers par fréquence ≥ v :**
|
||||||
|
|
||||||
|
1. **Créer** : `filter := NewFrequencyFilter(k, v)`
|
||||||
|
2. **Traiter** : `filter.AddSequence(read)` pour chaque read
|
||||||
|
3. **Résultat** : `filtered := filter.GetFilteredSet(id)`
|
||||||
|
|
||||||
|
**Mémoire** : ~2v MB par million de k-mers uniques
|
||||||
|
**Temps** : Une seule passe, ~2 lookups/kmer en moyenne
|
||||||
|
**Optimal pour** : v ≤ 20, distribution skewed (séquençage)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Code fourni
|
||||||
|
|
||||||
|
1. **frequency_filter.go** - Implémentation complète
|
||||||
|
2. **examples_frequency_filter_final.go** - Exemples d'utilisation
|
||||||
|
|
||||||
|
**Tout est prêt à utiliser !** 🚀
|
||||||
320
kmer_roaring_index/examples_frequency_filter_final.go
Normal file
320
kmer_roaring_index/examples_frequency_filter_final.go
Normal file
@@ -0,0 +1,320 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"obikmer"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
// ==========================================
|
||||||
|
// EXEMPLE 1 : Utilisation basique
|
||||||
|
// ==========================================
|
||||||
|
fmt.Println("=== EXEMPLE 1 : Utilisation basique ===\n")
|
||||||
|
|
||||||
|
k := 31
|
||||||
|
minFreq := 3 // Garder les k-mers vus ≥3 fois
|
||||||
|
|
||||||
|
// Créer le filtre
|
||||||
|
filter := obikmer.NewFrequencyFilter(k, minFreq)
|
||||||
|
|
||||||
|
// Simuler des séquences avec différentes fréquences
|
||||||
|
sequences := [][]byte{
|
||||||
|
[]byte("ACGTACGTACGTACGTACGTACGTACGTACG"), // Kmer X
|
||||||
|
[]byte("ACGTACGTACGTACGTACGTACGTACGTACG"), // Kmer X (freq=2)
|
||||||
|
[]byte("ACGTACGTACGTACGTACGTACGTACGTACG"), // Kmer X (freq=3) ✓
|
||||||
|
[]byte("TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT"), // Kmer Y
|
||||||
|
[]byte("TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT"), // Kmer Y (freq=2) ✗
|
||||||
|
[]byte("GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG"), // Kmer Z (freq=1) ✗
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Printf("Traitement de %d séquences...\n", len(sequences))
|
||||||
|
for _, seq := range sequences {
|
||||||
|
filter.AddSequence(seq)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Récupérer les k-mers filtrés
|
||||||
|
filtered := filter.GetFilteredSet("filtered")
|
||||||
|
fmt.Printf("\nK-mers avec freq ≥ %d: %d\n", minFreq, filtered.Cardinality())
|
||||||
|
|
||||||
|
// Statistiques
|
||||||
|
stats := filter.Stats()
|
||||||
|
fmt.Println("\n" + stats.String())
|
||||||
|
|
||||||
|
// ==========================================
|
||||||
|
// EXEMPLE 2 : Vérifier les niveaux
|
||||||
|
// ==========================================
|
||||||
|
fmt.Println("\n=== EXEMPLE 2 : Inspection des niveaux ===\n")
|
||||||
|
|
||||||
|
// Vérifier chaque niveau
|
||||||
|
for level := 0; level < minFreq; level++ {
|
||||||
|
levelSet := filter.GetKmersAtLevel(level)
|
||||||
|
fmt.Printf("Niveau %d (freq≥%d): %d k-mers\n",
|
||||||
|
level+1, level+1, levelSet.Cardinality())
|
||||||
|
}
|
||||||
|
|
||||||
|
// ==========================================
|
||||||
|
// EXEMPLE 3 : Données réalistes
|
||||||
|
// ==========================================
|
||||||
|
fmt.Println("\n=== EXEMPLE 3 : Simulation données séquençage ===\n")
|
||||||
|
|
||||||
|
filter2 := obikmer.NewFrequencyFilter(31, 3)
|
||||||
|
|
||||||
|
// Simuler un dataset réaliste :
|
||||||
|
// - 1000 reads
|
||||||
|
// - 80% contiennent des erreurs (singletons)
|
||||||
|
// - 15% vrais k-mers à basse fréquence
|
||||||
|
// - 5% vrais k-mers à haute fréquence
|
||||||
|
|
||||||
|
// Vraie séquence répétée
|
||||||
|
trueSeq := []byte("ACGTACGTACGTACGTACGTACGTACGTACG")
|
||||||
|
for i := 0; i < 50; i++ {
|
||||||
|
filter2.AddSequence(trueSeq)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Séquence à fréquence moyenne
|
||||||
|
mediumSeq := []byte("CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC")
|
||||||
|
for i := 0; i < 5; i++ {
|
||||||
|
filter2.AddSequence(mediumSeq)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Erreurs de séquençage (singletons)
|
||||||
|
for i := 0; i < 100; i++ {
|
||||||
|
errorSeq := []byte(fmt.Sprintf("TTTTTTTTTTTTTTTTTTTTTTTTTTTT%03d", i))
|
||||||
|
filter2.AddSequence(errorSeq)
|
||||||
|
}
|
||||||
|
|
||||||
|
stats2 := filter2.Stats()
|
||||||
|
fmt.Println(stats2.String())
|
||||||
|
|
||||||
|
fmt.Println("Distribution attendue:")
|
||||||
|
fmt.Println(" - Beaucoup de singletons (erreurs)")
|
||||||
|
fmt.Println(" - Peu de k-mers à haute fréquence (signal)")
|
||||||
|
fmt.Println(" → Filtrage efficace !")
|
||||||
|
|
||||||
|
// ==========================================
|
||||||
|
// EXEMPLE 4 : Tester différents seuils
|
||||||
|
// ==========================================
|
||||||
|
fmt.Println("\n=== EXEMPLE 4 : Comparaison de seuils ===\n")
|
||||||
|
|
||||||
|
testSeqs := [][]byte{
|
||||||
|
[]byte("ACGTACGTACGTACGTACGTACGTACGTACG"),
|
||||||
|
[]byte("ACGTACGTACGTACGTACGTACGTACGTACG"),
|
||||||
|
[]byte("ACGTACGTACGTACGTACGTACGTACGTACG"),
|
||||||
|
[]byte("ACGTACGTACGTACGTACGTACGTACGTACG"),
|
||||||
|
[]byte("ACGTACGTACGTACGTACGTACGTACGTACG"), // freq=5
|
||||||
|
[]byte("TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT"),
|
||||||
|
[]byte("TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT"),
|
||||||
|
[]byte("TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT"), // freq=3
|
||||||
|
[]byte("GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG"), // freq=1
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, minFreq := range []int{2, 3, 5} {
|
||||||
|
f := obikmer.NewFrequencyFilter(31, minFreq)
|
||||||
|
f.AddSequences(testSeqs)
|
||||||
|
|
||||||
|
fmt.Printf("minFreq=%d: %d k-mers retenus (%.2f MB)\n",
|
||||||
|
minFreq,
|
||||||
|
f.Cardinality(),
|
||||||
|
float64(f.MemoryUsage())/1024/1024)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ==========================================
|
||||||
|
// EXEMPLE 5 : Comparaison mémoire
|
||||||
|
// ==========================================
|
||||||
|
fmt.Println("\n=== EXEMPLE 5 : Comparaison mémoire ===\n")
|
||||||
|
|
||||||
|
filter3 := obikmer.NewFrequencyFilter(31, 3)
|
||||||
|
|
||||||
|
// Simuler 10000 séquences
|
||||||
|
for i := 0; i < 10000; i++ {
|
||||||
|
seq := make([]byte, 100)
|
||||||
|
for j := range seq {
|
||||||
|
seq[j] = "ACGT"[(i+j)%4]
|
||||||
|
}
|
||||||
|
filter3.AddSequence(seq)
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Println(filter3.CompareWithSimpleMap())
|
||||||
|
|
||||||
|
// ==========================================
|
||||||
|
// EXEMPLE 6 : Workflow complet
|
||||||
|
// ==========================================
|
||||||
|
fmt.Println("\n=== EXEMPLE 6 : Workflow complet ===\n")
|
||||||
|
|
||||||
|
fmt.Println("1. Créer le filtre")
|
||||||
|
finalFilter := obikmer.NewFrequencyFilter(31, 3)
|
||||||
|
|
||||||
|
fmt.Println("2. Traiter les données (simulation)")
|
||||||
|
// En pratique : lire depuis FASTQ
|
||||||
|
// for read := range ReadFastq("data.fastq") {
|
||||||
|
// finalFilter.AddSequence(read)
|
||||||
|
// }
|
||||||
|
|
||||||
|
// Simulation
|
||||||
|
for i := 0; i < 1000; i++ {
|
||||||
|
seq := []byte("ACGTACGTACGTACGTACGTACGTACGTACG")
|
||||||
|
finalFilter.AddSequence(seq)
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Println("3. Récupérer les k-mers filtrés")
|
||||||
|
result := finalFilter.GetFilteredSet("final")
|
||||||
|
|
||||||
|
fmt.Println("4. Utiliser le résultat")
|
||||||
|
fmt.Printf(" K-mers de qualité: %d\n", result.Cardinality())
|
||||||
|
fmt.Printf(" Mémoire utilisée: %.2f MB\n", float64(finalFilter.MemoryUsage())/1024/1024)
|
||||||
|
|
||||||
|
fmt.Println("5. Sauvegarder (optionnel)")
|
||||||
|
// result.Save("filtered_kmers.bin")
|
||||||
|
|
||||||
|
// ==========================================
|
||||||
|
// EXEMPLE 7 : Vérification individuelle
|
||||||
|
// ==========================================
|
||||||
|
fmt.Println("\n=== EXEMPLE 7 : Vérification de k-mers spécifiques ===\n")
|
||||||
|
|
||||||
|
checkFilter := obikmer.NewFrequencyFilter(31, 3)
|
||||||
|
|
||||||
|
testSeq := []byte("ACGTACGTACGTACGTACGTACGTACGTACG")
|
||||||
|
for i := 0; i < 5; i++ {
|
||||||
|
checkFilter.AddSequence(testSeq)
|
||||||
|
}
|
||||||
|
|
||||||
|
var kmers []uint64
|
||||||
|
kmers = obikmer.EncodeKmers(testSeq, 31, &kmers)
|
||||||
|
|
||||||
|
if len(kmers) > 0 {
|
||||||
|
testKmer := kmers[0]
|
||||||
|
|
||||||
|
fmt.Printf("K-mer test: 0x%016X\n", testKmer)
|
||||||
|
fmt.Printf(" Présent dans filtre: %v\n", checkFilter.Contains(testKmer))
|
||||||
|
fmt.Printf(" Fréquence approx: %d\n", checkFilter.GetFrequency(testKmer))
|
||||||
|
}
|
||||||
|
|
||||||
|
// ==========================================
|
||||||
|
// EXEMPLE 8 : Intégration avec collection
|
||||||
|
// ==========================================
|
||||||
|
fmt.Println("\n=== EXEMPLE 8 : Intégration avec KmerSetCollection ===\n")
|
||||||
|
|
||||||
|
// Créer une collection de génomes filtrés
|
||||||
|
collection := obikmer.NewKmerSetCollection(31)
|
||||||
|
|
||||||
|
genomes := map[string][][]byte{
|
||||||
|
"Genome1": {
|
||||||
|
[]byte("ACGTACGTACGTACGTACGTACGTACGTACG"),
|
||||||
|
[]byte("ACGTACGTACGTACGTACGTACGTACGTACG"),
|
||||||
|
[]byte("ACGTACGTACGTACGTACGTACGTACGTACG"),
|
||||||
|
[]byte("TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT"), // Erreur
|
||||||
|
},
|
||||||
|
"Genome2": {
|
||||||
|
[]byte("ACGTACGTACGTACGTACGTACGTACGTACG"),
|
||||||
|
[]byte("ACGTACGTACGTACGTACGTACGTACGTACG"),
|
||||||
|
[]byte("ACGTACGTACGTACGTACGTACGTACGTACG"),
|
||||||
|
[]byte("GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG"), // Erreur
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
for id, sequences := range genomes {
|
||||||
|
// Filtrer chaque génome
|
||||||
|
genomeFilter := obikmer.NewFrequencyFilter(31, 3)
|
||||||
|
genomeFilter.AddSequences(sequences)
|
||||||
|
|
||||||
|
// Ajouter à la collection
|
||||||
|
filteredSet := genomeFilter.GetFilteredSet(id)
|
||||||
|
collection.Add(filteredSet)
|
||||||
|
|
||||||
|
fmt.Printf("%s: %d k-mers de qualité\n", id, filteredSet.Cardinality())
|
||||||
|
}
|
||||||
|
|
||||||
|
// Analyser la collection
|
||||||
|
fmt.Println("\nAnalyse comparative:")
|
||||||
|
collectionStats := collection.ComputeStats()
|
||||||
|
fmt.Printf(" Core genome: %d k-mers\n", collectionStats.CoreSize)
|
||||||
|
fmt.Printf(" Pan genome: %d k-mers\n", collectionStats.PanGenomeSize)
|
||||||
|
|
||||||
|
// ==========================================
|
||||||
|
// RÉSUMÉ
|
||||||
|
// ==========================================
|
||||||
|
fmt.Println("\n=== RÉSUMÉ ===\n")
|
||||||
|
fmt.Println("Le FrequencyFilter permet de:")
|
||||||
|
fmt.Println(" ✓ Filtrer les k-mers par fréquence minimale")
|
||||||
|
fmt.Println(" ✓ Utiliser une mémoire optimale avec Roaring bitmaps")
|
||||||
|
fmt.Println(" ✓ Une seule passe sur les données")
|
||||||
|
fmt.Println(" ✓ Éliminer efficacement les erreurs de séquençage")
|
||||||
|
fmt.Println("")
|
||||||
|
fmt.Println("Workflow typique:")
|
||||||
|
fmt.Println(" 1. filter := NewFrequencyFilter(k, minFreq)")
|
||||||
|
fmt.Println(" 2. for each sequence: filter.AddSequence(seq)")
|
||||||
|
fmt.Println(" 3. filtered := filter.GetFilteredSet(id)")
|
||||||
|
fmt.Println(" 4. Utiliser filtered dans vos analyses")
|
||||||
|
}
|
||||||
|
|
||||||
|
// ==================================
|
||||||
|
// FONCTION HELPER POUR BENCHMARKS
|
||||||
|
// ==================================
|
||||||
|
|
||||||
|
func BenchmarkFrequencyFilter() {
|
||||||
|
k := 31
|
||||||
|
minFreq := 3
|
||||||
|
|
||||||
|
// Test avec différentes tailles
|
||||||
|
sizes := []int{1000, 10000, 100000}
|
||||||
|
|
||||||
|
fmt.Println("\n=== BENCHMARK ===\n")
|
||||||
|
|
||||||
|
for _, size := range sizes {
|
||||||
|
filter := obikmer.NewFrequencyFilter(k, minFreq)
|
||||||
|
|
||||||
|
// Générer des séquences
|
||||||
|
for i := 0; i < size; i++ {
|
||||||
|
seq := make([]byte, 100)
|
||||||
|
for j := range seq {
|
||||||
|
seq[j] = "ACGT"[(i+j)%4]
|
||||||
|
}
|
||||||
|
filter.AddSequence(seq)
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Printf("Size=%d reads:\n", size)
|
||||||
|
fmt.Printf(" Filtered k-mers: %d\n", filter.Cardinality())
|
||||||
|
fmt.Printf(" Memory: %.2f MB\n", float64(filter.MemoryUsage())/1024/1024)
|
||||||
|
fmt.Println()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ==================================
|
||||||
|
// FONCTION POUR DONNÉES RÉELLES
|
||||||
|
// ==================================
|
||||||
|
|
||||||
|
func ProcessRealData() {
|
||||||
|
// Exemple pour traiter de vraies données FASTQ
|
||||||
|
|
||||||
|
k := 31
|
||||||
|
minFreq := 3
|
||||||
|
|
||||||
|
filter := obikmer.NewFrequencyFilter(k, minFreq)
|
||||||
|
|
||||||
|
// Pseudo-code pour lire un FASTQ
|
||||||
|
/*
|
||||||
|
fastqFile := "sample.fastq"
|
||||||
|
reader := NewFastqReader(fastqFile)
|
||||||
|
|
||||||
|
for reader.HasNext() {
|
||||||
|
read := reader.Next()
|
||||||
|
filter.AddSequence(read.Sequence)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Récupérer le résultat
|
||||||
|
filtered := filter.GetFilteredSet("sample_filtered")
|
||||||
|
filtered.Save("sample_filtered_kmers.bin")
|
||||||
|
|
||||||
|
// Stats
|
||||||
|
stats := filter.Stats()
|
||||||
|
fmt.Println(stats.String())
|
||||||
|
*/
|
||||||
|
|
||||||
|
fmt.Println("Workflow pour données réelles:")
|
||||||
|
fmt.Println(" 1. Créer le filtre avec minFreq approprié (2-5 typique)")
|
||||||
|
fmt.Println(" 2. Stream les reads depuis FASTQ")
|
||||||
|
fmt.Println(" 3. Récupérer les k-mers filtrés")
|
||||||
|
fmt.Println(" 4. Utiliser pour assemblage/comparaison/etc.")
|
||||||
|
|
||||||
|
_ = filter // unused
|
||||||
|
}
|
||||||
109
obitests/obitools/obiannotate/test.sh
Executable file
109
obitests/obitools/obiannotate/test.sh
Executable file
@@ -0,0 +1,109 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#
|
||||||
|
# Here give the name of the test serie
|
||||||
|
#
|
||||||
|
|
||||||
|
TEST_NAME=obiannotate
|
||||||
|
CMD=obiannotate
|
||||||
|
|
||||||
|
######
|
||||||
|
#
|
||||||
|
# Some variable and function definitions: please don't change them
|
||||||
|
#
|
||||||
|
######
|
||||||
|
TEST_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
|
||||||
|
OBITOOLS_DIR="${TEST_DIR/obitest*/}build"
|
||||||
|
export PATH="${OBITOOLS_DIR}:${PATH}"
|
||||||
|
|
||||||
|
MCMD="$(echo "${CMD:0:4}" | tr '[:lower:]' '[:upper:]')$(echo "${CMD:4}" | tr '[:upper:]' '[:lower:]')"
|
||||||
|
|
||||||
|
TMPDIR="$(mktemp -d)"
|
||||||
|
ntest=0
|
||||||
|
success=0
|
||||||
|
failed=0
|
||||||
|
|
||||||
|
cleanup() {
|
||||||
|
echo "========================================" 1>&2
|
||||||
|
echo "## Results of the $TEST_NAME tests:" 1>&2
|
||||||
|
|
||||||
|
echo 1>&2
|
||||||
|
echo "- $ntest tests run" 1>&2
|
||||||
|
echo "- $success successfully completed" 1>&2
|
||||||
|
echo "- $failed failed tests" 1>&2
|
||||||
|
echo 1>&2
|
||||||
|
echo "Cleaning up the temporary directory..." 1>&2
|
||||||
|
echo 1>&2
|
||||||
|
echo "========================================" 1>&2
|
||||||
|
|
||||||
|
rm -rf "$TMPDIR" # Suppress the temporary directory
|
||||||
|
|
||||||
|
if [ $failed -gt 0 ]; then
|
||||||
|
log "$TEST_NAME tests failed"
|
||||||
|
log
|
||||||
|
log
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
log
|
||||||
|
log
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
log() {
|
||||||
|
echo -e "[$TEST_NAME @ $(date)] $*" 1>&2
|
||||||
|
}
|
||||||
|
|
||||||
|
log "Testing $TEST_NAME..."
|
||||||
|
log "Test directory is $TEST_DIR"
|
||||||
|
log "obitools directory is $OBITOOLS_DIR"
|
||||||
|
log "Temporary directory is $TMPDIR"
|
||||||
|
log "files: $(find $TEST_DIR | awk -F'/' '{print $NF}' | tail -n +2)"
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
####
|
||||||
|
#### Below are the tests
|
||||||
|
####
|
||||||
|
#### Before each test :
|
||||||
|
#### - increment the variable ntest
|
||||||
|
####
|
||||||
|
#### Run the command as the condition of an if / then /else
|
||||||
|
#### - The command must return 0 on success
|
||||||
|
#### - The command must return an exit code different from 0 on failure
|
||||||
|
#### - The datafiles are stored in the same directory than the test script
|
||||||
|
#### - The test script directory is stored in the TEST_DIR variable
|
||||||
|
#### - If result files have to be produced they must be stored
|
||||||
|
#### in the temporary directory (TMPDIR variable)
|
||||||
|
####
|
||||||
|
#### then clause is executed on success of the command
|
||||||
|
#### - Write a success message using the log function
|
||||||
|
#### - increment the variable success
|
||||||
|
####
|
||||||
|
#### else clause is executed on failure of the command
|
||||||
|
#### - Write a failure message using the log function
|
||||||
|
#### - increment the variable failed
|
||||||
|
####
|
||||||
|
######################################################################
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
((ntest++))
|
||||||
|
if $CMD -h > "${TMPDIR}/help.txt" 2>&1
|
||||||
|
then
|
||||||
|
log "$MCMD: printing help OK"
|
||||||
|
((success++))
|
||||||
|
else
|
||||||
|
log "$MCMD: printing help failed"
|
||||||
|
((failed++))
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
#########################################
|
||||||
|
#
|
||||||
|
# At the end of the tests
|
||||||
|
# the cleanup function is called
|
||||||
|
#
|
||||||
|
#########################################
|
||||||
|
|
||||||
|
cleanup
|
||||||
109
obitests/obitools/obiclean/test.sh
Executable file
109
obitests/obitools/obiclean/test.sh
Executable file
@@ -0,0 +1,109 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#
|
||||||
|
# Here give the name of the test serie
|
||||||
|
#
|
||||||
|
|
||||||
|
TEST_NAME=obiclean
|
||||||
|
CMD=obiclean
|
||||||
|
|
||||||
|
######
|
||||||
|
#
|
||||||
|
# Some variable and function definitions: please don't change them
|
||||||
|
#
|
||||||
|
######
|
||||||
|
TEST_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
|
||||||
|
OBITOOLS_DIR="${TEST_DIR/obitest*/}build"
|
||||||
|
export PATH="${OBITOOLS_DIR}:${PATH}"
|
||||||
|
|
||||||
|
MCMD="$(echo "${CMD:0:4}" | tr '[:lower:]' '[:upper:]')$(echo "${CMD:4}" | tr '[:upper:]' '[:lower:]')"
|
||||||
|
|
||||||
|
TMPDIR="$(mktemp -d)"
|
||||||
|
ntest=0
|
||||||
|
success=0
|
||||||
|
failed=0
|
||||||
|
|
||||||
|
cleanup() {
|
||||||
|
echo "========================================" 1>&2
|
||||||
|
echo "## Results of the $TEST_NAME tests:" 1>&2
|
||||||
|
|
||||||
|
echo 1>&2
|
||||||
|
echo "- $ntest tests run" 1>&2
|
||||||
|
echo "- $success successfully completed" 1>&2
|
||||||
|
echo "- $failed failed tests" 1>&2
|
||||||
|
echo 1>&2
|
||||||
|
echo "Cleaning up the temporary directory..." 1>&2
|
||||||
|
echo 1>&2
|
||||||
|
echo "========================================" 1>&2
|
||||||
|
|
||||||
|
rm -rf "$TMPDIR" # Suppress the temporary directory
|
||||||
|
|
||||||
|
if [ $failed -gt 0 ]; then
|
||||||
|
log "$TEST_NAME tests failed"
|
||||||
|
log
|
||||||
|
log
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
log
|
||||||
|
log
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
log() {
|
||||||
|
echo -e "[$TEST_NAME @ $(date)] $*" 1>&2
|
||||||
|
}
|
||||||
|
|
||||||
|
log "Testing $TEST_NAME..."
|
||||||
|
log "Test directory is $TEST_DIR"
|
||||||
|
log "obitools directory is $OBITOOLS_DIR"
|
||||||
|
log "Temporary directory is $TMPDIR"
|
||||||
|
log "files: $(find $TEST_DIR | awk -F'/' '{print $NF}' | tail -n +2)"
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
####
|
||||||
|
#### Below are the tests
|
||||||
|
####
|
||||||
|
#### Before each test :
|
||||||
|
#### - increment the variable ntest
|
||||||
|
####
|
||||||
|
#### Run the command as the condition of an if / then /else
|
||||||
|
#### - The command must return 0 on success
|
||||||
|
#### - The command must return an exit code different from 0 on failure
|
||||||
|
#### - The datafiles are stored in the same directory than the test script
|
||||||
|
#### - The test script directory is stored in the TEST_DIR variable
|
||||||
|
#### - If result files have to be produced they must be stored
|
||||||
|
#### in the temporary directory (TMPDIR variable)
|
||||||
|
####
|
||||||
|
#### then clause is executed on success of the command
|
||||||
|
#### - Write a success message using the log function
|
||||||
|
#### - increment the variable success
|
||||||
|
####
|
||||||
|
#### else clause is executed on failure of the command
|
||||||
|
#### - Write a failure message using the log function
|
||||||
|
#### - increment the variable failed
|
||||||
|
####
|
||||||
|
######################################################################
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
((ntest++))
|
||||||
|
if $CMD -h > "${TMPDIR}/help.txt" 2>&1
|
||||||
|
then
|
||||||
|
log "$MCMD: printing help OK"
|
||||||
|
((success++))
|
||||||
|
else
|
||||||
|
log "$MCMD: printing help failed"
|
||||||
|
((failed++))
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
#########################################
|
||||||
|
#
|
||||||
|
# At the end of the tests
|
||||||
|
# the cleanup function is called
|
||||||
|
#
|
||||||
|
#########################################
|
||||||
|
|
||||||
|
cleanup
|
||||||
109
obitests/obitools/obicleandb/test.sh
Executable file
109
obitests/obitools/obicleandb/test.sh
Executable file
@@ -0,0 +1,109 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#
|
||||||
|
# Here give the name of the test serie
|
||||||
|
#
|
||||||
|
|
||||||
|
TEST_NAME=obicleandb
|
||||||
|
CMD=obicleandb
|
||||||
|
|
||||||
|
######
|
||||||
|
#
|
||||||
|
# Some variable and function definitions: please don't change them
|
||||||
|
#
|
||||||
|
######
|
||||||
|
TEST_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
|
||||||
|
OBITOOLS_DIR="${TEST_DIR/obitest*/}build"
|
||||||
|
export PATH="${OBITOOLS_DIR}:${PATH}"
|
||||||
|
|
||||||
|
MCMD="$(echo "${CMD:0:4}" | tr '[:lower:]' '[:upper:]')$(echo "${CMD:4}" | tr '[:upper:]' '[:lower:]')"
|
||||||
|
|
||||||
|
TMPDIR="$(mktemp -d)"
|
||||||
|
ntest=0
|
||||||
|
success=0
|
||||||
|
failed=0
|
||||||
|
|
||||||
|
cleanup() {
|
||||||
|
echo "========================================" 1>&2
|
||||||
|
echo "## Results of the $TEST_NAME tests:" 1>&2
|
||||||
|
|
||||||
|
echo 1>&2
|
||||||
|
echo "- $ntest tests run" 1>&2
|
||||||
|
echo "- $success successfully completed" 1>&2
|
||||||
|
echo "- $failed failed tests" 1>&2
|
||||||
|
echo 1>&2
|
||||||
|
echo "Cleaning up the temporary directory..." 1>&2
|
||||||
|
echo 1>&2
|
||||||
|
echo "========================================" 1>&2
|
||||||
|
|
||||||
|
rm -rf "$TMPDIR" # Suppress the temporary directory
|
||||||
|
|
||||||
|
if [ $failed -gt 0 ]; then
|
||||||
|
log "$TEST_NAME tests failed"
|
||||||
|
log
|
||||||
|
log
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
log
|
||||||
|
log
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
log() {
|
||||||
|
echo -e "[$TEST_NAME @ $(date)] $*" 1>&2
|
||||||
|
}
|
||||||
|
|
||||||
|
log "Testing $TEST_NAME..."
|
||||||
|
log "Test directory is $TEST_DIR"
|
||||||
|
log "obitools directory is $OBITOOLS_DIR"
|
||||||
|
log "Temporary directory is $TMPDIR"
|
||||||
|
log "files: $(find $TEST_DIR | awk -F'/' '{print $NF}' | tail -n +2)"
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
####
|
||||||
|
#### Below are the tests
|
||||||
|
####
|
||||||
|
#### Before each test :
|
||||||
|
#### - increment the variable ntest
|
||||||
|
####
|
||||||
|
#### Run the command as the condition of an if / then /else
|
||||||
|
#### - The command must return 0 on success
|
||||||
|
#### - The command must return an exit code different from 0 on failure
|
||||||
|
#### - The datafiles are stored in the same directory than the test script
|
||||||
|
#### - The test script directory is stored in the TEST_DIR variable
|
||||||
|
#### - If result files have to be produced they must be stored
|
||||||
|
#### in the temporary directory (TMPDIR variable)
|
||||||
|
####
|
||||||
|
#### then clause is executed on success of the command
|
||||||
|
#### - Write a success message using the log function
|
||||||
|
#### - increment the variable success
|
||||||
|
####
|
||||||
|
#### else clause is executed on failure of the command
|
||||||
|
#### - Write a failure message using the log function
|
||||||
|
#### - increment the variable failed
|
||||||
|
####
|
||||||
|
######################################################################
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
((ntest++))
|
||||||
|
if $CMD -h > "${TMPDIR}/help.txt" 2>&1
|
||||||
|
then
|
||||||
|
log "$MCMD: printing help OK"
|
||||||
|
((success++))
|
||||||
|
else
|
||||||
|
log "$MCMD: printing help failed"
|
||||||
|
((failed++))
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
#########################################
|
||||||
|
#
|
||||||
|
# At the end of the tests
|
||||||
|
# the cleanup function is called
|
||||||
|
#
|
||||||
|
#########################################
|
||||||
|
|
||||||
|
cleanup
|
||||||
109
obitests/obitools/obicomplement/test.sh
Executable file
109
obitests/obitools/obicomplement/test.sh
Executable file
@@ -0,0 +1,109 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#
|
||||||
|
# Here give the name of the test serie
|
||||||
|
#
|
||||||
|
|
||||||
|
TEST_NAME=obicomplement
|
||||||
|
CMD=obicomplement
|
||||||
|
|
||||||
|
######
|
||||||
|
#
|
||||||
|
# Some variable and function definitions: please don't change them
|
||||||
|
#
|
||||||
|
######
|
||||||
|
TEST_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
|
||||||
|
OBITOOLS_DIR="${TEST_DIR/obitest*/}build"
|
||||||
|
export PATH="${OBITOOLS_DIR}:${PATH}"
|
||||||
|
|
||||||
|
MCMD="$(echo "${CMD:0:4}" | tr '[:lower:]' '[:upper:]')$(echo "${CMD:4}" | tr '[:upper:]' '[:lower:]')"
|
||||||
|
|
||||||
|
TMPDIR="$(mktemp -d)"
|
||||||
|
ntest=0
|
||||||
|
success=0
|
||||||
|
failed=0
|
||||||
|
|
||||||
|
cleanup() {
|
||||||
|
echo "========================================" 1>&2
|
||||||
|
echo "## Results of the $TEST_NAME tests:" 1>&2
|
||||||
|
|
||||||
|
echo 1>&2
|
||||||
|
echo "- $ntest tests run" 1>&2
|
||||||
|
echo "- $success successfully completed" 1>&2
|
||||||
|
echo "- $failed failed tests" 1>&2
|
||||||
|
echo 1>&2
|
||||||
|
echo "Cleaning up the temporary directory..." 1>&2
|
||||||
|
echo 1>&2
|
||||||
|
echo "========================================" 1>&2
|
||||||
|
|
||||||
|
rm -rf "$TMPDIR" # Suppress the temporary directory
|
||||||
|
|
||||||
|
if [ $failed -gt 0 ]; then
|
||||||
|
log "$TEST_NAME tests failed"
|
||||||
|
log
|
||||||
|
log
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
log
|
||||||
|
log
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
log() {
|
||||||
|
echo -e "[$TEST_NAME @ $(date)] $*" 1>&2
|
||||||
|
}
|
||||||
|
|
||||||
|
log "Testing $TEST_NAME..."
|
||||||
|
log "Test directory is $TEST_DIR"
|
||||||
|
log "obitools directory is $OBITOOLS_DIR"
|
||||||
|
log "Temporary directory is $TMPDIR"
|
||||||
|
log "files: $(find $TEST_DIR | awk -F'/' '{print $NF}' | tail -n +2)"
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
####
|
||||||
|
#### Below are the tests
|
||||||
|
####
|
||||||
|
#### Before each test :
|
||||||
|
#### - increment the variable ntest
|
||||||
|
####
|
||||||
|
#### Run the command as the condition of an if / then /else
|
||||||
|
#### - The command must return 0 on success
|
||||||
|
#### - The command must return an exit code different from 0 on failure
|
||||||
|
#### - The datafiles are stored in the same directory than the test script
|
||||||
|
#### - The test script directory is stored in the TEST_DIR variable
|
||||||
|
#### - If result files have to be produced they must be stored
|
||||||
|
#### in the temporary directory (TMPDIR variable)
|
||||||
|
####
|
||||||
|
#### then clause is executed on success of the command
|
||||||
|
#### - Write a success message using the log function
|
||||||
|
#### - increment the variable success
|
||||||
|
####
|
||||||
|
#### else clause is executed on failure of the command
|
||||||
|
#### - Write a failure message using the log function
|
||||||
|
#### - increment the variable failed
|
||||||
|
####
|
||||||
|
######################################################################
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
((ntest++))
|
||||||
|
if $CMD -h > "${TMPDIR}/help.txt" 2>&1
|
||||||
|
then
|
||||||
|
log "$MCMD: printing help OK"
|
||||||
|
((success++))
|
||||||
|
else
|
||||||
|
log "$MCMD: printing help failed"
|
||||||
|
((failed++))
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
#########################################
|
||||||
|
#
|
||||||
|
# At the end of the tests
|
||||||
|
# the cleanup function is called
|
||||||
|
#
|
||||||
|
#########################################
|
||||||
|
|
||||||
|
cleanup
|
||||||
109
obitests/obitools/obiconsensus/test.sh
Executable file
109
obitests/obitools/obiconsensus/test.sh
Executable file
@@ -0,0 +1,109 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#
|
||||||
|
# Here give the name of the test serie
|
||||||
|
#
|
||||||
|
|
||||||
|
TEST_NAME=obiconsensus
|
||||||
|
CMD=obiconsensus
|
||||||
|
|
||||||
|
######
|
||||||
|
#
|
||||||
|
# Some variable and function definitions: please don't change them
|
||||||
|
#
|
||||||
|
######
|
||||||
|
TEST_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
|
||||||
|
OBITOOLS_DIR="${TEST_DIR/obitest*/}build"
|
||||||
|
export PATH="${OBITOOLS_DIR}:${PATH}"
|
||||||
|
|
||||||
|
MCMD="$(echo "${CMD:0:4}" | tr '[:lower:]' '[:upper:]')$(echo "${CMD:4}" | tr '[:upper:]' '[:lower:]')"
|
||||||
|
|
||||||
|
TMPDIR="$(mktemp -d)"
|
||||||
|
ntest=0
|
||||||
|
success=0
|
||||||
|
failed=0
|
||||||
|
|
||||||
|
cleanup() {
|
||||||
|
echo "========================================" 1>&2
|
||||||
|
echo "## Results of the $TEST_NAME tests:" 1>&2
|
||||||
|
|
||||||
|
echo 1>&2
|
||||||
|
echo "- $ntest tests run" 1>&2
|
||||||
|
echo "- $success successfully completed" 1>&2
|
||||||
|
echo "- $failed failed tests" 1>&2
|
||||||
|
echo 1>&2
|
||||||
|
echo "Cleaning up the temporary directory..." 1>&2
|
||||||
|
echo 1>&2
|
||||||
|
echo "========================================" 1>&2
|
||||||
|
|
||||||
|
rm -rf "$TMPDIR" # Suppress the temporary directory
|
||||||
|
|
||||||
|
if [ $failed -gt 0 ]; then
|
||||||
|
log "$TEST_NAME tests failed"
|
||||||
|
log
|
||||||
|
log
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
log
|
||||||
|
log
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
log() {
|
||||||
|
echo -e "[$TEST_NAME @ $(date)] $*" 1>&2
|
||||||
|
}
|
||||||
|
|
||||||
|
log "Testing $TEST_NAME..."
|
||||||
|
log "Test directory is $TEST_DIR"
|
||||||
|
log "obitools directory is $OBITOOLS_DIR"
|
||||||
|
log "Temporary directory is $TMPDIR"
|
||||||
|
log "files: $(find $TEST_DIR | awk -F'/' '{print $NF}' | tail -n +2)"
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
####
|
||||||
|
#### Below are the tests
|
||||||
|
####
|
||||||
|
#### Before each test :
|
||||||
|
#### - increment the variable ntest
|
||||||
|
####
|
||||||
|
#### Run the command as the condition of an if / then /else
|
||||||
|
#### - The command must return 0 on success
|
||||||
|
#### - The command must return an exit code different from 0 on failure
|
||||||
|
#### - The datafiles are stored in the same directory than the test script
|
||||||
|
#### - The test script directory is stored in the TEST_DIR variable
|
||||||
|
#### - If result files have to be produced they must be stored
|
||||||
|
#### in the temporary directory (TMPDIR variable)
|
||||||
|
####
|
||||||
|
#### then clause is executed on success of the command
|
||||||
|
#### - Write a success message using the log function
|
||||||
|
#### - increment the variable success
|
||||||
|
####
|
||||||
|
#### else clause is executed on failure of the command
|
||||||
|
#### - Write a failure message using the log function
|
||||||
|
#### - increment the variable failed
|
||||||
|
####
|
||||||
|
######################################################################
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
((ntest++))
|
||||||
|
if $CMD -h > "${TMPDIR}/help.txt" 2>&1
|
||||||
|
then
|
||||||
|
log "$MCMD: printing help OK"
|
||||||
|
((success++))
|
||||||
|
else
|
||||||
|
log "$MCMD: printing help failed"
|
||||||
|
((failed++))
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
#########################################
|
||||||
|
#
|
||||||
|
# At the end of the tests
|
||||||
|
# the cleanup function is called
|
||||||
|
#
|
||||||
|
#########################################
|
||||||
|
|
||||||
|
cleanup
|
||||||
BIN
obitests/obitools/obiconvert/gbpln1088.4Mb.fasta.gz
Normal file
BIN
obitests/obitools/obiconvert/gbpln1088.4Mb.fasta.gz
Normal file
Binary file not shown.
144
obitests/obitools/obiconvert/test.sh
Executable file
144
obitests/obitools/obiconvert/test.sh
Executable file
@@ -0,0 +1,144 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#
|
||||||
|
# Here give the name of the test serie
|
||||||
|
#
|
||||||
|
|
||||||
|
TEST_NAME=obiconvert
|
||||||
|
CMD=obiconvert
|
||||||
|
|
||||||
|
######
|
||||||
|
#
|
||||||
|
# Some variable and function definitions: please don't change them
|
||||||
|
#
|
||||||
|
######
|
||||||
|
TEST_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
|
||||||
|
|
||||||
|
if [ -z "$TEST_DIR" ] ; then
|
||||||
|
TEST_DIR="."
|
||||||
|
fi
|
||||||
|
|
||||||
|
OBITOOLS_DIR="${TEST_DIR/obitest*/}build"
|
||||||
|
export PATH="${OBITOOLS_DIR}:${PATH}"
|
||||||
|
|
||||||
|
MCMD="$(echo "${CMD:0:4}" | tr '[:lower:]' '[:upper:]')$(echo "${CMD:4}" | tr '[:upper:]' '[:lower:]')"
|
||||||
|
|
||||||
|
TMPDIR="$(mktemp -d)"
|
||||||
|
ntest=0
|
||||||
|
success=0
|
||||||
|
failed=0
|
||||||
|
|
||||||
|
cleanup() {
|
||||||
|
echo "========================================" 1>&2
|
||||||
|
echo "## Results of the $TEST_NAME tests:" 1>&2
|
||||||
|
|
||||||
|
echo 1>&2
|
||||||
|
echo "- $ntest tests run" 1>&2
|
||||||
|
echo "- $success successfully completed" 1>&2
|
||||||
|
echo "- $failed failed tests" 1>&2
|
||||||
|
echo 1>&2
|
||||||
|
echo "Cleaning up the temporary directory..." 1>&2
|
||||||
|
echo 1>&2
|
||||||
|
echo "========================================" 1>&2
|
||||||
|
|
||||||
|
rm -rf "$TMPDIR" # Suppress the temporary directory
|
||||||
|
|
||||||
|
if [ $failed -gt 0 ]; then
|
||||||
|
log "$TEST_NAME tests failed"
|
||||||
|
log
|
||||||
|
log
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
log
|
||||||
|
log
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
log() {
|
||||||
|
echo -e "[$TEST_NAME @ $(date)] $*" 1>&2
|
||||||
|
}
|
||||||
|
|
||||||
|
log "Testing $TEST_NAME..."
|
||||||
|
log "Test directory is $TEST_DIR"
|
||||||
|
log "obitools directory is $OBITOOLS_DIR"
|
||||||
|
log "Temporary directory is $TMPDIR"
|
||||||
|
log "files: $(find $TEST_DIR | awk -F'/' '{print $NF}' | tail -n +2)"
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
####
|
||||||
|
#### Below are the tests
|
||||||
|
####
|
||||||
|
#### Before each test :
|
||||||
|
#### - increment the variable ntest
|
||||||
|
####
|
||||||
|
#### Run the command as the condition of an if / then /else
|
||||||
|
#### - The command must return 0 on success
|
||||||
|
#### - The command must return an exit code different from 0 on failure
|
||||||
|
#### - The datafiles are stored in the same directory than the test script
|
||||||
|
#### - The test script directory is stored in the TEST_DIR variable
|
||||||
|
#### - If result files have to be produced they must be stored
|
||||||
|
#### in the temporary directory (TMPDIR variable)
|
||||||
|
####
|
||||||
|
#### then clause is executed on success of the command
|
||||||
|
#### - Write a success message using the log function
|
||||||
|
#### - increment the variable success
|
||||||
|
####
|
||||||
|
#### else clause is executed on failure of the command
|
||||||
|
#### - Write a failure message using the log function
|
||||||
|
#### - increment the variable failed
|
||||||
|
####
|
||||||
|
######################################################################
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
((ntest++))
|
||||||
|
if $CMD -h > "${TMPDIR}/help.txt" 2>&1
|
||||||
|
then
|
||||||
|
log "$MCMD: printing help OK"
|
||||||
|
((success++))
|
||||||
|
else
|
||||||
|
log "$MCMD: printing help failed"
|
||||||
|
((failed++))
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
((ntest++))
|
||||||
|
if obiconvert -Z "${TEST_DIR}/gbpln1088.4Mb.fasta.gz" \
|
||||||
|
> "${TMPDIR}/xxx.fasta.gz" && \
|
||||||
|
zdiff "${TEST_DIR}/gbpln1088.4Mb.fasta.gz" \
|
||||||
|
"${TMPDIR}/xxx.fasta.gz"
|
||||||
|
then
|
||||||
|
log "$MCMD: converting large fasta file to fasta OK"
|
||||||
|
((success++))
|
||||||
|
else
|
||||||
|
log "$MCMD: converting large fasta file to fasta failed"
|
||||||
|
((failed++))
|
||||||
|
fi
|
||||||
|
|
||||||
|
((ntest++))
|
||||||
|
if obiconvert -Z --fastq-output \
|
||||||
|
"${TEST_DIR}/gbpln1088.4Mb.fasta.gz" \
|
||||||
|
> "${TMPDIR}/xxx.fastq.gz" && \
|
||||||
|
obiconvert -Z --fasta-output \
|
||||||
|
"${TMPDIR}/xxx.fastq.gz" \
|
||||||
|
> "${TMPDIR}/yyy.fasta.gz" && \
|
||||||
|
zdiff "${TEST_DIR}/gbpln1088.4Mb.fasta.gz" \
|
||||||
|
"${TMPDIR}/yyy.fasta.gz"
|
||||||
|
then
|
||||||
|
log "$MCMD: converting large file between fasta and fastq OK"
|
||||||
|
((success++))
|
||||||
|
else
|
||||||
|
log "$MCMD: converting large file between fasta and fastq failed"
|
||||||
|
((failed++))
|
||||||
|
fi
|
||||||
|
|
||||||
|
#########################################
|
||||||
|
#
|
||||||
|
# At the end of the tests
|
||||||
|
# the cleanup function is called
|
||||||
|
#
|
||||||
|
#########################################
|
||||||
|
|
||||||
|
cleanup
|
||||||
163
obitests/obitools/obicount/test.sh
Executable file
163
obitests/obitools/obicount/test.sh
Executable file
@@ -0,0 +1,163 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#
|
||||||
|
# Here give the name of the test serie
|
||||||
|
#
|
||||||
|
|
||||||
|
TEST_NAME=obicount
|
||||||
|
CMD=obicount
|
||||||
|
|
||||||
|
######
|
||||||
|
#
|
||||||
|
# Some variable and function definitions: please don't change them
|
||||||
|
#
|
||||||
|
######
|
||||||
|
TEST_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
|
||||||
|
OBITOOLS_DIR="${TEST_DIR/obitest*/}build"
|
||||||
|
export PATH="${OBITOOLS_DIR}:${PATH}"
|
||||||
|
|
||||||
|
MCMD="$(echo "${CMD:0:4}" | tr '[:lower:]' '[:upper:]')$(echo "${CMD:4}" | tr '[:upper:]' '[:lower:]')"
|
||||||
|
|
||||||
|
TMPDIR="$(mktemp -d)"
|
||||||
|
ntest=0
|
||||||
|
success=0
|
||||||
|
failed=0
|
||||||
|
|
||||||
|
cleanup() {
|
||||||
|
echo "========================================" 1>&2
|
||||||
|
echo "## Results of the $TEST_NAME tests:" 1>&2
|
||||||
|
|
||||||
|
echo 1>&2
|
||||||
|
echo "- $ntest tests run" 1>&2
|
||||||
|
echo "- $success successfully completed" 1>&2
|
||||||
|
echo "- $failed failed tests" 1>&2
|
||||||
|
echo 1>&2
|
||||||
|
echo "Cleaning up the temporary directory..." 1>&2
|
||||||
|
echo 1>&2
|
||||||
|
echo "========================================" 1>&2
|
||||||
|
|
||||||
|
rm -rf "$TMPDIR" # Suppress the temporary directory
|
||||||
|
|
||||||
|
if [ $failed -gt 0 ]; then
|
||||||
|
log "$TEST_NAME tests failed"
|
||||||
|
log
|
||||||
|
log
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
log
|
||||||
|
log
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
log() {
|
||||||
|
echo -e "[$TEST_NAME @ $(date)] $*" 1>&2
|
||||||
|
}
|
||||||
|
|
||||||
|
log "Testing $TEST_NAME..."
|
||||||
|
log "Test directory is $TEST_DIR"
|
||||||
|
log "obitools directory is $OBITOOLS_DIR"
|
||||||
|
log "Temporary directory is $TMPDIR"
|
||||||
|
log "files: $(find $TEST_DIR | awk -F'/' '{print $NF}' | tail -n +2)"
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
####
|
||||||
|
#### Below are the tests
|
||||||
|
####
|
||||||
|
#### Before each test :
|
||||||
|
#### - increment the variable ntest
|
||||||
|
####
|
||||||
|
#### Run the command as the condition of an if / then /else
|
||||||
|
#### - The command must return 0 on success
|
||||||
|
#### - The command must return an exit code different from 0 on failure
|
||||||
|
#### - The datafiles are stored in the same directory than the test script
|
||||||
|
#### - The test script directory is stored in the TEST_DIR variable
|
||||||
|
#### - If result files have to be produced they must be stored
|
||||||
|
#### in the temporary directory (TMPDIR variable)
|
||||||
|
####
|
||||||
|
#### then clause is executed on success of the command
|
||||||
|
#### - Write a success message using the log function
|
||||||
|
#### - increment the variable success
|
||||||
|
####
|
||||||
|
#### else clause is executed on failure of the command
|
||||||
|
#### - Write a failure message using the log function
|
||||||
|
#### - increment the variable failed
|
||||||
|
####
|
||||||
|
######################################################################
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
((ntest++))
|
||||||
|
if $CMD -h > "${TMPDIR}/help.txt" 2>&1
|
||||||
|
then
|
||||||
|
log "$MCMD: printing help OK"
|
||||||
|
((success++))
|
||||||
|
else
|
||||||
|
log "$MCMD: printing help failed"
|
||||||
|
((failed++))
|
||||||
|
fi
|
||||||
|
|
||||||
|
((ntest++))
|
||||||
|
if obicount "${TEST_DIR}/wolf_F.fasta.gz" \
|
||||||
|
> "${TMPDIR}/wolf_F.fasta_count.csv"
|
||||||
|
then
|
||||||
|
log "OBICount: fasta reading OK"
|
||||||
|
((success++))
|
||||||
|
else
|
||||||
|
log "OBICount: fasta reading failed"
|
||||||
|
((failed++))
|
||||||
|
fi
|
||||||
|
|
||||||
|
((ntest++))
|
||||||
|
if obicount "${TEST_DIR}/wolf_F.fastq.gz" \
|
||||||
|
> "${TMPDIR}/wolf_F.fastq_count.csv"
|
||||||
|
then
|
||||||
|
log "OBICount: fastq reading OK"
|
||||||
|
((success++))
|
||||||
|
else
|
||||||
|
log "OBICount: fastq reading failed"
|
||||||
|
((failed++))
|
||||||
|
fi
|
||||||
|
|
||||||
|
((ntest++))
|
||||||
|
if obicount "${TEST_DIR}/wolf_F.csv.gz" \
|
||||||
|
> "${TMPDIR}/wolf_F.csv_count.csv"
|
||||||
|
then
|
||||||
|
log "OBICount: csv reading OK"
|
||||||
|
((success++))
|
||||||
|
else
|
||||||
|
log "OBICount: csv reading failed"
|
||||||
|
((failed++))
|
||||||
|
fi
|
||||||
|
|
||||||
|
((ntest++))
|
||||||
|
if diff "${TMPDIR}/wolf_F.fasta_count.csv" \
|
||||||
|
"${TMPDIR}/wolf_F.fastq_count.csv" > /dev/null
|
||||||
|
then
|
||||||
|
log "OBICount: counting on fasta and fastq are identical OK"
|
||||||
|
((success++))
|
||||||
|
else
|
||||||
|
log "OBICount: counting on fasta and fastq are different failed"
|
||||||
|
((failed++))
|
||||||
|
fi
|
||||||
|
|
||||||
|
((ntest++))
|
||||||
|
if diff "${TMPDIR}/wolf_F.fasta_count.csv" \
|
||||||
|
"${TMPDIR}/wolf_F.csv_count.csv" > /dev/null
|
||||||
|
then
|
||||||
|
log "OBICount: counting on fasta and csv are identical OK"
|
||||||
|
((success++))
|
||||||
|
else
|
||||||
|
log "OBICount: counting on fasta and csv are different failed"
|
||||||
|
((failed++))
|
||||||
|
fi
|
||||||
|
|
||||||
|
#########################################
|
||||||
|
#
|
||||||
|
# At the end of the tests
|
||||||
|
# the cleanup function is called
|
||||||
|
#
|
||||||
|
#########################################
|
||||||
|
|
||||||
|
cleanup
|
||||||
BIN
obitests/obitools/obicount/wolf_F.csv.gz
Normal file
BIN
obitests/obitools/obicount/wolf_F.csv.gz
Normal file
Binary file not shown.
BIN
obitests/obitools/obicount/wolf_F.fasta.gz
Normal file
BIN
obitests/obitools/obicount/wolf_F.fasta.gz
Normal file
Binary file not shown.
BIN
obitests/obitools/obicount/wolf_F.fastq.gz
Normal file
BIN
obitests/obitools/obicount/wolf_F.fastq.gz
Normal file
Binary file not shown.
109
obitests/obitools/obicsv/test.sh
Executable file
109
obitests/obitools/obicsv/test.sh
Executable file
@@ -0,0 +1,109 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#
|
||||||
|
# Here give the name of the test serie
|
||||||
|
#
|
||||||
|
|
||||||
|
TEST_NAME=obicsv
|
||||||
|
CMD=obicsv
|
||||||
|
|
||||||
|
######
|
||||||
|
#
|
||||||
|
# Some variable and function definitions: please don't change them
|
||||||
|
#
|
||||||
|
######
|
||||||
|
TEST_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
|
||||||
|
OBITOOLS_DIR="${TEST_DIR/obitest*/}build"
|
||||||
|
export PATH="${OBITOOLS_DIR}:${PATH}"
|
||||||
|
|
||||||
|
MCMD="$(echo "${CMD:0:4}" | tr '[:lower:]' '[:upper:]')$(echo "${CMD:4}" | tr '[:upper:]' '[:lower:]')"
|
||||||
|
|
||||||
|
TMPDIR="$(mktemp -d)"
|
||||||
|
ntest=0
|
||||||
|
success=0
|
||||||
|
failed=0
|
||||||
|
|
||||||
|
cleanup() {
|
||||||
|
echo "========================================" 1>&2
|
||||||
|
echo "## Results of the $TEST_NAME tests:" 1>&2
|
||||||
|
|
||||||
|
echo 1>&2
|
||||||
|
echo "- $ntest tests run" 1>&2
|
||||||
|
echo "- $success successfully completed" 1>&2
|
||||||
|
echo "- $failed failed tests" 1>&2
|
||||||
|
echo 1>&2
|
||||||
|
echo "Cleaning up the temporary directory..." 1>&2
|
||||||
|
echo 1>&2
|
||||||
|
echo "========================================" 1>&2
|
||||||
|
|
||||||
|
rm -rf "$TMPDIR" # Suppress the temporary directory
|
||||||
|
|
||||||
|
if [ $failed -gt 0 ]; then
|
||||||
|
log "$TEST_NAME tests failed"
|
||||||
|
log
|
||||||
|
log
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
log
|
||||||
|
log
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
log() {
|
||||||
|
echo -e "[$TEST_NAME @ $(date)] $*" 1>&2
|
||||||
|
}
|
||||||
|
|
||||||
|
log "Testing $TEST_NAME..."
|
||||||
|
log "Test directory is $TEST_DIR"
|
||||||
|
log "obitools directory is $OBITOOLS_DIR"
|
||||||
|
log "Temporary directory is $TMPDIR"
|
||||||
|
log "files: $(find $TEST_DIR | awk -F'/' '{print $NF}' | tail -n +2)"
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
####
|
||||||
|
#### Below are the tests
|
||||||
|
####
|
||||||
|
#### Before each test :
|
||||||
|
#### - increment the variable ntest
|
||||||
|
####
|
||||||
|
#### Run the command as the condition of an if / then /else
|
||||||
|
#### - The command must return 0 on success
|
||||||
|
#### - The command must return an exit code different from 0 on failure
|
||||||
|
#### - The datafiles are stored in the same directory than the test script
|
||||||
|
#### - The test script directory is stored in the TEST_DIR variable
|
||||||
|
#### - If result files have to be produced they must be stored
|
||||||
|
#### in the temporary directory (TMPDIR variable)
|
||||||
|
####
|
||||||
|
#### then clause is executed on success of the command
|
||||||
|
#### - Write a success message using the log function
|
||||||
|
#### - increment the variable success
|
||||||
|
####
|
||||||
|
#### else clause is executed on failure of the command
|
||||||
|
#### - Write a failure message using the log function
|
||||||
|
#### - increment the variable failed
|
||||||
|
####
|
||||||
|
######################################################################
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
((ntest++))
|
||||||
|
if $CMD -h > "${TMPDIR}/help.txt" 2>&1
|
||||||
|
then
|
||||||
|
log "$MCMD: printing help OK"
|
||||||
|
((success++))
|
||||||
|
else
|
||||||
|
log "$MCMD: printing help failed"
|
||||||
|
((failed++))
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
#########################################
|
||||||
|
#
|
||||||
|
# At the end of the tests
|
||||||
|
# the cleanup function is called
|
||||||
|
#
|
||||||
|
#########################################
|
||||||
|
|
||||||
|
cleanup
|
||||||
109
obitests/obitools/obidemerge/test.sh
Executable file
109
obitests/obitools/obidemerge/test.sh
Executable file
@@ -0,0 +1,109 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#
|
||||||
|
# Here give the name of the test serie
|
||||||
|
#
|
||||||
|
|
||||||
|
TEST_NAME=obidemerge
|
||||||
|
CMD=obidemerge
|
||||||
|
|
||||||
|
######
|
||||||
|
#
|
||||||
|
# Some variable and function definitions: please don't change them
|
||||||
|
#
|
||||||
|
######
|
||||||
|
TEST_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
|
||||||
|
OBITOOLS_DIR="${TEST_DIR/obitest*/}build"
|
||||||
|
export PATH="${OBITOOLS_DIR}:${PATH}"
|
||||||
|
|
||||||
|
MCMD="$(echo "${CMD:0:4}" | tr '[:lower:]' '[:upper:]')$(echo "${CMD:4}" | tr '[:upper:]' '[:lower:]')"
|
||||||
|
|
||||||
|
TMPDIR="$(mktemp -d)"
|
||||||
|
ntest=0
|
||||||
|
success=0
|
||||||
|
failed=0
|
||||||
|
|
||||||
|
cleanup() {
|
||||||
|
echo "========================================" 1>&2
|
||||||
|
echo "## Results of the $TEST_NAME tests:" 1>&2
|
||||||
|
|
||||||
|
echo 1>&2
|
||||||
|
echo "- $ntest tests run" 1>&2
|
||||||
|
echo "- $success successfully completed" 1>&2
|
||||||
|
echo "- $failed failed tests" 1>&2
|
||||||
|
echo 1>&2
|
||||||
|
echo "Cleaning up the temporary directory..." 1>&2
|
||||||
|
echo 1>&2
|
||||||
|
echo "========================================" 1>&2
|
||||||
|
|
||||||
|
rm -rf "$TMPDIR" # Suppress the temporary directory
|
||||||
|
|
||||||
|
if [ $failed -gt 0 ]; then
|
||||||
|
log "$TEST_NAME tests failed"
|
||||||
|
log
|
||||||
|
log
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
log
|
||||||
|
log
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
log() {
|
||||||
|
echo -e "[$TEST_NAME @ $(date)] $*" 1>&2
|
||||||
|
}
|
||||||
|
|
||||||
|
log "Testing $TEST_NAME..."
|
||||||
|
log "Test directory is $TEST_DIR"
|
||||||
|
log "obitools directory is $OBITOOLS_DIR"
|
||||||
|
log "Temporary directory is $TMPDIR"
|
||||||
|
log "files: $(find $TEST_DIR | awk -F'/' '{print $NF}' | tail -n +2)"
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
####
|
||||||
|
#### Below are the tests
|
||||||
|
####
|
||||||
|
#### Before each test :
|
||||||
|
#### - increment the variable ntest
|
||||||
|
####
|
||||||
|
#### Run the command as the condition of an if / then /else
|
||||||
|
#### - The command must return 0 on success
|
||||||
|
#### - The command must return an exit code different from 0 on failure
|
||||||
|
#### - The datafiles are stored in the same directory than the test script
|
||||||
|
#### - The test script directory is stored in the TEST_DIR variable
|
||||||
|
#### - If result files have to be produced they must be stored
|
||||||
|
#### in the temporary directory (TMPDIR variable)
|
||||||
|
####
|
||||||
|
#### then clause is executed on success of the command
|
||||||
|
#### - Write a success message using the log function
|
||||||
|
#### - increment the variable success
|
||||||
|
####
|
||||||
|
#### else clause is executed on failure of the command
|
||||||
|
#### - Write a failure message using the log function
|
||||||
|
#### - increment the variable failed
|
||||||
|
####
|
||||||
|
######################################################################
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
((ntest++))
|
||||||
|
if $CMD -h > "${TMPDIR}/help.txt" 2>&1
|
||||||
|
then
|
||||||
|
log "$MCMD: printing help OK"
|
||||||
|
((success++))
|
||||||
|
else
|
||||||
|
log "$MCMD: printing help failed"
|
||||||
|
((failed++))
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
#########################################
|
||||||
|
#
|
||||||
|
# At the end of the tests
|
||||||
|
# the cleanup function is called
|
||||||
|
#
|
||||||
|
#########################################
|
||||||
|
|
||||||
|
cleanup
|
||||||
109
obitests/obitools/obidistribute/test.sh
Executable file
109
obitests/obitools/obidistribute/test.sh
Executable file
@@ -0,0 +1,109 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#
|
||||||
|
# Here give the name of the test serie
|
||||||
|
#
|
||||||
|
|
||||||
|
TEST_NAME=obidistribute
|
||||||
|
CMD=obidistribute
|
||||||
|
|
||||||
|
######
|
||||||
|
#
|
||||||
|
# Some variable and function definitions: please don't change them
|
||||||
|
#
|
||||||
|
######
|
||||||
|
TEST_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
|
||||||
|
OBITOOLS_DIR="${TEST_DIR/obitest*/}build"
|
||||||
|
export PATH="${OBITOOLS_DIR}:${PATH}"
|
||||||
|
|
||||||
|
MCMD="$(echo "${CMD:0:4}" | tr '[:lower:]' '[:upper:]')$(echo "${CMD:4}" | tr '[:upper:]' '[:lower:]')"
|
||||||
|
|
||||||
|
TMPDIR="$(mktemp -d)"
|
||||||
|
ntest=0
|
||||||
|
success=0
|
||||||
|
failed=0
|
||||||
|
|
||||||
|
cleanup() {
|
||||||
|
echo "========================================" 1>&2
|
||||||
|
echo "## Results of the $TEST_NAME tests:" 1>&2
|
||||||
|
|
||||||
|
echo 1>&2
|
||||||
|
echo "- $ntest tests run" 1>&2
|
||||||
|
echo "- $success successfully completed" 1>&2
|
||||||
|
echo "- $failed failed tests" 1>&2
|
||||||
|
echo 1>&2
|
||||||
|
echo "Cleaning up the temporary directory..." 1>&2
|
||||||
|
echo 1>&2
|
||||||
|
echo "========================================" 1>&2
|
||||||
|
|
||||||
|
rm -rf "$TMPDIR" # Suppress the temporary directory
|
||||||
|
|
||||||
|
if [ $failed -gt 0 ]; then
|
||||||
|
log "$TEST_NAME tests failed"
|
||||||
|
log
|
||||||
|
log
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
log
|
||||||
|
log
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
log() {
|
||||||
|
echo -e "[$TEST_NAME @ $(date)] $*" 1>&2
|
||||||
|
}
|
||||||
|
|
||||||
|
log "Testing $TEST_NAME..."
|
||||||
|
log "Test directory is $TEST_DIR"
|
||||||
|
log "obitools directory is $OBITOOLS_DIR"
|
||||||
|
log "Temporary directory is $TMPDIR"
|
||||||
|
log "files: $(find $TEST_DIR | awk -F'/' '{print $NF}' | tail -n +2)"
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
####
|
||||||
|
#### Below are the tests
|
||||||
|
####
|
||||||
|
#### Before each test :
|
||||||
|
#### - increment the variable ntest
|
||||||
|
####
|
||||||
|
#### Run the command as the condition of an if / then /else
|
||||||
|
#### - The command must return 0 on success
|
||||||
|
#### - The command must return an exit code different from 0 on failure
|
||||||
|
#### - The datafiles are stored in the same directory than the test script
|
||||||
|
#### - The test script directory is stored in the TEST_DIR variable
|
||||||
|
#### - If result files have to be produced they must be stored
|
||||||
|
#### in the temporary directory (TMPDIR variable)
|
||||||
|
####
|
||||||
|
#### then clause is executed on success of the command
|
||||||
|
#### - Write a success message using the log function
|
||||||
|
#### - increment the variable success
|
||||||
|
####
|
||||||
|
#### else clause is executed on failure of the command
|
||||||
|
#### - Write a failure message using the log function
|
||||||
|
#### - increment the variable failed
|
||||||
|
####
|
||||||
|
######################################################################
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
((ntest++))
|
||||||
|
if $CMD -h > "${TMPDIR}/help.txt" 2>&1
|
||||||
|
then
|
||||||
|
log "$MCMD: printing help OK"
|
||||||
|
((success++))
|
||||||
|
else
|
||||||
|
log "$MCMD: printing help failed"
|
||||||
|
((failed++))
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
#########################################
|
||||||
|
#
|
||||||
|
# At the end of the tests
|
||||||
|
# the cleanup function is called
|
||||||
|
#
|
||||||
|
#########################################
|
||||||
|
|
||||||
|
cleanup
|
||||||
109
obitests/obitools/obigrep/test.sh
Executable file
109
obitests/obitools/obigrep/test.sh
Executable file
@@ -0,0 +1,109 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#
|
||||||
|
# Here give the name of the test serie
|
||||||
|
#
|
||||||
|
|
||||||
|
TEST_NAME=obigrep
|
||||||
|
CMD=obigrep
|
||||||
|
|
||||||
|
######
|
||||||
|
#
|
||||||
|
# Some variable and function definitions: please don't change them
|
||||||
|
#
|
||||||
|
######
|
||||||
|
TEST_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
|
||||||
|
OBITOOLS_DIR="${TEST_DIR/obitest*/}build"
|
||||||
|
export PATH="${OBITOOLS_DIR}:${PATH}"
|
||||||
|
|
||||||
|
MCMD="$(echo "${CMD:0:4}" | tr '[:lower:]' '[:upper:]')$(echo "${CMD:4}" | tr '[:upper:]' '[:lower:]')"
|
||||||
|
|
||||||
|
TMPDIR="$(mktemp -d)"
|
||||||
|
ntest=0
|
||||||
|
success=0
|
||||||
|
failed=0
|
||||||
|
|
||||||
|
cleanup() {
|
||||||
|
echo "========================================" 1>&2
|
||||||
|
echo "## Results of the $TEST_NAME tests:" 1>&2
|
||||||
|
|
||||||
|
echo 1>&2
|
||||||
|
echo "- $ntest tests run" 1>&2
|
||||||
|
echo "- $success successfully completed" 1>&2
|
||||||
|
echo "- $failed failed tests" 1>&2
|
||||||
|
echo 1>&2
|
||||||
|
echo "Cleaning up the temporary directory..." 1>&2
|
||||||
|
echo 1>&2
|
||||||
|
echo "========================================" 1>&2
|
||||||
|
|
||||||
|
rm -rf "$TMPDIR" # Suppress the temporary directory
|
||||||
|
|
||||||
|
if [ $failed -gt 0 ]; then
|
||||||
|
log "$TEST_NAME tests failed"
|
||||||
|
log
|
||||||
|
log
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
log
|
||||||
|
log
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
log() {
|
||||||
|
echo -e "[$TEST_NAME @ $(date)] $*" 1>&2
|
||||||
|
}
|
||||||
|
|
||||||
|
log "Testing $TEST_NAME..."
|
||||||
|
log "Test directory is $TEST_DIR"
|
||||||
|
log "obitools directory is $OBITOOLS_DIR"
|
||||||
|
log "Temporary directory is $TMPDIR"
|
||||||
|
log "files: $(find $TEST_DIR | awk -F'/' '{print $NF}' | tail -n +2)"
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
####
|
||||||
|
#### Below are the tests
|
||||||
|
####
|
||||||
|
#### Before each test :
|
||||||
|
#### - increment the variable ntest
|
||||||
|
####
|
||||||
|
#### Run the command as the condition of an if / then /else
|
||||||
|
#### - The command must return 0 on success
|
||||||
|
#### - The command must return an exit code different from 0 on failure
|
||||||
|
#### - The datafiles are stored in the same directory than the test script
|
||||||
|
#### - The test script directory is stored in the TEST_DIR variable
|
||||||
|
#### - If result files have to be produced they must be stored
|
||||||
|
#### in the temporary directory (TMPDIR variable)
|
||||||
|
####
|
||||||
|
#### then clause is executed on success of the command
|
||||||
|
#### - Write a success message using the log function
|
||||||
|
#### - increment the variable success
|
||||||
|
####
|
||||||
|
#### else clause is executed on failure of the command
|
||||||
|
#### - Write a failure message using the log function
|
||||||
|
#### - increment the variable failed
|
||||||
|
####
|
||||||
|
######################################################################
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
((ntest++))
|
||||||
|
if $CMD -h > "${TMPDIR}/help.txt" 2>&1
|
||||||
|
then
|
||||||
|
log "$MCMD: printing help OK"
|
||||||
|
((success++))
|
||||||
|
else
|
||||||
|
log "$MCMD: printing help failed"
|
||||||
|
((failed++))
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
#########################################
|
||||||
|
#
|
||||||
|
# At the end of the tests
|
||||||
|
# the cleanup function is called
|
||||||
|
#
|
||||||
|
#########################################
|
||||||
|
|
||||||
|
cleanup
|
||||||
109
obitests/obitools/obijoin/test.sh
Executable file
109
obitests/obitools/obijoin/test.sh
Executable file
@@ -0,0 +1,109 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#
|
||||||
|
# Here give the name of the test serie
|
||||||
|
#
|
||||||
|
|
||||||
|
TEST_NAME=obijoin
|
||||||
|
CMD=obijoin
|
||||||
|
|
||||||
|
######
|
||||||
|
#
|
||||||
|
# Some variable and function definitions: please don't change them
|
||||||
|
#
|
||||||
|
######
|
||||||
|
TEST_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
|
||||||
|
OBITOOLS_DIR="${TEST_DIR/obitest*/}build"
|
||||||
|
export PATH="${OBITOOLS_DIR}:${PATH}"
|
||||||
|
|
||||||
|
MCMD="$(echo "${CMD:0:4}" | tr '[:lower:]' '[:upper:]')$(echo "${CMD:4}" | tr '[:upper:]' '[:lower:]')"
|
||||||
|
|
||||||
|
TMPDIR="$(mktemp -d)"
|
||||||
|
ntest=0
|
||||||
|
success=0
|
||||||
|
failed=0
|
||||||
|
|
||||||
|
cleanup() {
|
||||||
|
echo "========================================" 1>&2
|
||||||
|
echo "## Results of the $TEST_NAME tests:" 1>&2
|
||||||
|
|
||||||
|
echo 1>&2
|
||||||
|
echo "- $ntest tests run" 1>&2
|
||||||
|
echo "- $success successfully completed" 1>&2
|
||||||
|
echo "- $failed failed tests" 1>&2
|
||||||
|
echo 1>&2
|
||||||
|
echo "Cleaning up the temporary directory..." 1>&2
|
||||||
|
echo 1>&2
|
||||||
|
echo "========================================" 1>&2
|
||||||
|
|
||||||
|
rm -rf "$TMPDIR" # Suppress the temporary directory
|
||||||
|
|
||||||
|
if [ $failed -gt 0 ]; then
|
||||||
|
log "$TEST_NAME tests failed"
|
||||||
|
log
|
||||||
|
log
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
log
|
||||||
|
log
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
log() {
|
||||||
|
echo -e "[$TEST_NAME @ $(date)] $*" 1>&2
|
||||||
|
}
|
||||||
|
|
||||||
|
log "Testing $TEST_NAME..."
|
||||||
|
log "Test directory is $TEST_DIR"
|
||||||
|
log "obitools directory is $OBITOOLS_DIR"
|
||||||
|
log "Temporary directory is $TMPDIR"
|
||||||
|
log "files: $(find $TEST_DIR | awk -F'/' '{print $NF}' | tail -n +2)"
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
####
|
||||||
|
#### Below are the tests
|
||||||
|
####
|
||||||
|
#### Before each test :
|
||||||
|
#### - increment the variable ntest
|
||||||
|
####
|
||||||
|
#### Run the command as the condition of an if / then /else
|
||||||
|
#### - The command must return 0 on success
|
||||||
|
#### - The command must return an exit code different from 0 on failure
|
||||||
|
#### - The datafiles are stored in the same directory than the test script
|
||||||
|
#### - The test script directory is stored in the TEST_DIR variable
|
||||||
|
#### - If result files have to be produced they must be stored
|
||||||
|
#### in the temporary directory (TMPDIR variable)
|
||||||
|
####
|
||||||
|
#### then clause is executed on success of the command
|
||||||
|
#### - Write a success message using the log function
|
||||||
|
#### - increment the variable success
|
||||||
|
####
|
||||||
|
#### else clause is executed on failure of the command
|
||||||
|
#### - Write a failure message using the log function
|
||||||
|
#### - increment the variable failed
|
||||||
|
####
|
||||||
|
######################################################################
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
((ntest++))
|
||||||
|
if $CMD -h > "${TMPDIR}/help.txt" 2>&1
|
||||||
|
then
|
||||||
|
log "$MCMD: printing help OK"
|
||||||
|
((success++))
|
||||||
|
else
|
||||||
|
log "$MCMD: printing help failed"
|
||||||
|
((failed++))
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
#########################################
|
||||||
|
#
|
||||||
|
# At the end of the tests
|
||||||
|
# the cleanup function is called
|
||||||
|
#
|
||||||
|
#########################################
|
||||||
|
|
||||||
|
cleanup
|
||||||
109
obitests/obitools/obikmermatch/test.sh
Executable file
109
obitests/obitools/obikmermatch/test.sh
Executable file
@@ -0,0 +1,109 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#
|
||||||
|
# Here give the name of the test serie
|
||||||
|
#
|
||||||
|
|
||||||
|
TEST_NAME=obikmermatch
|
||||||
|
CMD=obikmermatch
|
||||||
|
|
||||||
|
######
|
||||||
|
#
|
||||||
|
# Some variable and function definitions: please don't change them
|
||||||
|
#
|
||||||
|
######
|
||||||
|
TEST_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
|
||||||
|
OBITOOLS_DIR="${TEST_DIR/obitest*/}build"
|
||||||
|
export PATH="${OBITOOLS_DIR}:${PATH}"
|
||||||
|
|
||||||
|
MCMD="$(echo "${CMD:0:4}" | tr '[:lower:]' '[:upper:]')$(echo "${CMD:4}" | tr '[:upper:]' '[:lower:]')"
|
||||||
|
|
||||||
|
TMPDIR="$(mktemp -d)"
|
||||||
|
ntest=0
|
||||||
|
success=0
|
||||||
|
failed=0
|
||||||
|
|
||||||
|
cleanup() {
|
||||||
|
echo "========================================" 1>&2
|
||||||
|
echo "## Results of the $TEST_NAME tests:" 1>&2
|
||||||
|
|
||||||
|
echo 1>&2
|
||||||
|
echo "- $ntest tests run" 1>&2
|
||||||
|
echo "- $success successfully completed" 1>&2
|
||||||
|
echo "- $failed failed tests" 1>&2
|
||||||
|
echo 1>&2
|
||||||
|
echo "Cleaning up the temporary directory..." 1>&2
|
||||||
|
echo 1>&2
|
||||||
|
echo "========================================" 1>&2
|
||||||
|
|
||||||
|
rm -rf "$TMPDIR" # Suppress the temporary directory
|
||||||
|
|
||||||
|
if [ $failed -gt 0 ]; then
|
||||||
|
log "$TEST_NAME tests failed"
|
||||||
|
log
|
||||||
|
log
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
log
|
||||||
|
log
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
log() {
|
||||||
|
echo -e "[$TEST_NAME @ $(date)] $*" 1>&2
|
||||||
|
}
|
||||||
|
|
||||||
|
log "Testing $TEST_NAME..."
|
||||||
|
log "Test directory is $TEST_DIR"
|
||||||
|
log "obitools directory is $OBITOOLS_DIR"
|
||||||
|
log "Temporary directory is $TMPDIR"
|
||||||
|
log "files: $(find $TEST_DIR | awk -F'/' '{print $NF}' | tail -n +2)"
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
####
|
||||||
|
#### Below are the tests
|
||||||
|
####
|
||||||
|
#### Before each test :
|
||||||
|
#### - increment the variable ntest
|
||||||
|
####
|
||||||
|
#### Run the command as the condition of an if / then /else
|
||||||
|
#### - The command must return 0 on success
|
||||||
|
#### - The command must return an exit code different from 0 on failure
|
||||||
|
#### - The datafiles are stored in the same directory than the test script
|
||||||
|
#### - The test script directory is stored in the TEST_DIR variable
|
||||||
|
#### - If result files have to be produced they must be stored
|
||||||
|
#### in the temporary directory (TMPDIR variable)
|
||||||
|
####
|
||||||
|
#### then clause is executed on success of the command
|
||||||
|
#### - Write a success message using the log function
|
||||||
|
#### - increment the variable success
|
||||||
|
####
|
||||||
|
#### else clause is executed on failure of the command
|
||||||
|
#### - Write a failure message using the log function
|
||||||
|
#### - increment the variable failed
|
||||||
|
####
|
||||||
|
######################################################################
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
((ntest++))
|
||||||
|
if $CMD -h > "${TMPDIR}/help.txt" 2>&1
|
||||||
|
then
|
||||||
|
log "$MCMD: printing help OK"
|
||||||
|
((success++))
|
||||||
|
else
|
||||||
|
log "$MCMD: printing help failed"
|
||||||
|
((failed++))
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
#########################################
|
||||||
|
#
|
||||||
|
# At the end of the tests
|
||||||
|
# the cleanup function is called
|
||||||
|
#
|
||||||
|
#########################################
|
||||||
|
|
||||||
|
cleanup
|
||||||
109
obitests/obitools/obikmersimcount/test.sh
Executable file
109
obitests/obitools/obikmersimcount/test.sh
Executable file
@@ -0,0 +1,109 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#
|
||||||
|
# Here give the name of the test serie
|
||||||
|
#
|
||||||
|
|
||||||
|
TEST_NAME=obikmersimcount
|
||||||
|
CMD=obikmersimcount
|
||||||
|
|
||||||
|
######
|
||||||
|
#
|
||||||
|
# Some variable and function definitions: please don't change them
|
||||||
|
#
|
||||||
|
######
|
||||||
|
TEST_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
|
||||||
|
OBITOOLS_DIR="${TEST_DIR/obitest*/}build"
|
||||||
|
export PATH="${OBITOOLS_DIR}:${PATH}"
|
||||||
|
|
||||||
|
MCMD="$(echo "${CMD:0:4}" | tr '[:lower:]' '[:upper:]')$(echo "${CMD:4}" | tr '[:upper:]' '[:lower:]')"
|
||||||
|
|
||||||
|
TMPDIR="$(mktemp -d)"
|
||||||
|
ntest=0
|
||||||
|
success=0
|
||||||
|
failed=0
|
||||||
|
|
||||||
|
cleanup() {
|
||||||
|
echo "========================================" 1>&2
|
||||||
|
echo "## Results of the $TEST_NAME tests:" 1>&2
|
||||||
|
|
||||||
|
echo 1>&2
|
||||||
|
echo "- $ntest tests run" 1>&2
|
||||||
|
echo "- $success successfully completed" 1>&2
|
||||||
|
echo "- $failed failed tests" 1>&2
|
||||||
|
echo 1>&2
|
||||||
|
echo "Cleaning up the temporary directory..." 1>&2
|
||||||
|
echo 1>&2
|
||||||
|
echo "========================================" 1>&2
|
||||||
|
|
||||||
|
rm -rf "$TMPDIR" # Suppress the temporary directory
|
||||||
|
|
||||||
|
if [ $failed -gt 0 ]; then
|
||||||
|
log "$TEST_NAME tests failed"
|
||||||
|
log
|
||||||
|
log
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
log
|
||||||
|
log
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
log() {
|
||||||
|
echo -e "[$TEST_NAME @ $(date)] $*" 1>&2
|
||||||
|
}
|
||||||
|
|
||||||
|
log "Testing $TEST_NAME..."
|
||||||
|
log "Test directory is $TEST_DIR"
|
||||||
|
log "obitools directory is $OBITOOLS_DIR"
|
||||||
|
log "Temporary directory is $TMPDIR"
|
||||||
|
log "files: $(find $TEST_DIR | awk -F'/' '{print $NF}' | tail -n +2)"
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
####
|
||||||
|
#### Below are the tests
|
||||||
|
####
|
||||||
|
#### Before each test :
|
||||||
|
#### - increment the variable ntest
|
||||||
|
####
|
||||||
|
#### Run the command as the condition of an if / then /else
|
||||||
|
#### - The command must return 0 on success
|
||||||
|
#### - The command must return an exit code different from 0 on failure
|
||||||
|
#### - The datafiles are stored in the same directory than the test script
|
||||||
|
#### - The test script directory is stored in the TEST_DIR variable
|
||||||
|
#### - If result files have to be produced they must be stored
|
||||||
|
#### in the temporary directory (TMPDIR variable)
|
||||||
|
####
|
||||||
|
#### then clause is executed on success of the command
|
||||||
|
#### - Write a success message using the log function
|
||||||
|
#### - increment the variable success
|
||||||
|
####
|
||||||
|
#### else clause is executed on failure of the command
|
||||||
|
#### - Write a failure message using the log function
|
||||||
|
#### - increment the variable failed
|
||||||
|
####
|
||||||
|
######################################################################
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
((ntest++))
|
||||||
|
if $CMD -h > "${TMPDIR}/help.txt" 2>&1
|
||||||
|
then
|
||||||
|
log "$MCMD: printing help OK"
|
||||||
|
((success++))
|
||||||
|
else
|
||||||
|
log "$MCMD: printing help failed"
|
||||||
|
((failed++))
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
#########################################
|
||||||
|
#
|
||||||
|
# At the end of the tests
|
||||||
|
# the cleanup function is called
|
||||||
|
#
|
||||||
|
#########################################
|
||||||
|
|
||||||
|
cleanup
|
||||||
109
obitests/obitools/obilandmark/test.sh
Executable file
109
obitests/obitools/obilandmark/test.sh
Executable file
@@ -0,0 +1,109 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#
|
||||||
|
# Here give the name of the test serie
|
||||||
|
#
|
||||||
|
|
||||||
|
TEST_NAME=obilandmark
|
||||||
|
CMD=obilandmark
|
||||||
|
|
||||||
|
######
|
||||||
|
#
|
||||||
|
# Some variable and function definitions: please don't change them
|
||||||
|
#
|
||||||
|
######
|
||||||
|
TEST_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
|
||||||
|
OBITOOLS_DIR="${TEST_DIR/obitest*/}build"
|
||||||
|
export PATH="${OBITOOLS_DIR}:${PATH}"
|
||||||
|
|
||||||
|
MCMD="$(echo "${CMD:0:4}" | tr '[:lower:]' '[:upper:]')$(echo "${CMD:4}" | tr '[:upper:]' '[:lower:]')"
|
||||||
|
|
||||||
|
TMPDIR="$(mktemp -d)"
|
||||||
|
ntest=0
|
||||||
|
success=0
|
||||||
|
failed=0
|
||||||
|
|
||||||
|
cleanup() {
|
||||||
|
echo "========================================" 1>&2
|
||||||
|
echo "## Results of the $TEST_NAME tests:" 1>&2
|
||||||
|
|
||||||
|
echo 1>&2
|
||||||
|
echo "- $ntest tests run" 1>&2
|
||||||
|
echo "- $success successfully completed" 1>&2
|
||||||
|
echo "- $failed failed tests" 1>&2
|
||||||
|
echo 1>&2
|
||||||
|
echo "Cleaning up the temporary directory..." 1>&2
|
||||||
|
echo 1>&2
|
||||||
|
echo "========================================" 1>&2
|
||||||
|
|
||||||
|
rm -rf "$TMPDIR" # Suppress the temporary directory
|
||||||
|
|
||||||
|
if [ $failed -gt 0 ]; then
|
||||||
|
log "$TEST_NAME tests failed"
|
||||||
|
log
|
||||||
|
log
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
log
|
||||||
|
log
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
log() {
|
||||||
|
echo -e "[$TEST_NAME @ $(date)] $*" 1>&2
|
||||||
|
}
|
||||||
|
|
||||||
|
log "Testing $TEST_NAME..."
|
||||||
|
log "Test directory is $TEST_DIR"
|
||||||
|
log "obitools directory is $OBITOOLS_DIR"
|
||||||
|
log "Temporary directory is $TMPDIR"
|
||||||
|
log "files: $(find $TEST_DIR | awk -F'/' '{print $NF}' | tail -n +2)"
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
####
|
||||||
|
#### Below are the tests
|
||||||
|
####
|
||||||
|
#### Before each test :
|
||||||
|
#### - increment the variable ntest
|
||||||
|
####
|
||||||
|
#### Run the command as the condition of an if / then /else
|
||||||
|
#### - The command must return 0 on success
|
||||||
|
#### - The command must return an exit code different from 0 on failure
|
||||||
|
#### - The datafiles are stored in the same directory than the test script
|
||||||
|
#### - The test script directory is stored in the TEST_DIR variable
|
||||||
|
#### - If result files have to be produced they must be stored
|
||||||
|
#### in the temporary directory (TMPDIR variable)
|
||||||
|
####
|
||||||
|
#### then clause is executed on success of the command
|
||||||
|
#### - Write a success message using the log function
|
||||||
|
#### - increment the variable success
|
||||||
|
####
|
||||||
|
#### else clause is executed on failure of the command
|
||||||
|
#### - Write a failure message using the log function
|
||||||
|
#### - increment the variable failed
|
||||||
|
####
|
||||||
|
######################################################################
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
((ntest++))
|
||||||
|
if $CMD -h > "${TMPDIR}/help.txt" 2>&1
|
||||||
|
then
|
||||||
|
log "$MCMD: printing help OK"
|
||||||
|
((success++))
|
||||||
|
else
|
||||||
|
log "$MCMD: printing help failed"
|
||||||
|
((failed++))
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
#########################################
|
||||||
|
#
|
||||||
|
# At the end of the tests
|
||||||
|
# the cleanup function is called
|
||||||
|
#
|
||||||
|
#########################################
|
||||||
|
|
||||||
|
cleanup
|
||||||
109
obitests/obitools/obimatrix/test.sh
Executable file
109
obitests/obitools/obimatrix/test.sh
Executable file
@@ -0,0 +1,109 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#
|
||||||
|
# Here give the name of the test serie
|
||||||
|
#
|
||||||
|
|
||||||
|
TEST_NAME=obimatrix
|
||||||
|
CMD=obimatrix
|
||||||
|
|
||||||
|
######
|
||||||
|
#
|
||||||
|
# Some variable and function definitions: please don't change them
|
||||||
|
#
|
||||||
|
######
|
||||||
|
TEST_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
|
||||||
|
OBITOOLS_DIR="${TEST_DIR/obitest*/}build"
|
||||||
|
export PATH="${OBITOOLS_DIR}:${PATH}"
|
||||||
|
|
||||||
|
MCMD="$(echo "${CMD:0:4}" | tr '[:lower:]' '[:upper:]')$(echo "${CMD:4}" | tr '[:upper:]' '[:lower:]')"
|
||||||
|
|
||||||
|
TMPDIR="$(mktemp -d)"
|
||||||
|
ntest=0
|
||||||
|
success=0
|
||||||
|
failed=0
|
||||||
|
|
||||||
|
cleanup() {
|
||||||
|
echo "========================================" 1>&2
|
||||||
|
echo "## Results of the $TEST_NAME tests:" 1>&2
|
||||||
|
|
||||||
|
echo 1>&2
|
||||||
|
echo "- $ntest tests run" 1>&2
|
||||||
|
echo "- $success successfully completed" 1>&2
|
||||||
|
echo "- $failed failed tests" 1>&2
|
||||||
|
echo 1>&2
|
||||||
|
echo "Cleaning up the temporary directory..." 1>&2
|
||||||
|
echo 1>&2
|
||||||
|
echo "========================================" 1>&2
|
||||||
|
|
||||||
|
rm -rf "$TMPDIR" # Suppress the temporary directory
|
||||||
|
|
||||||
|
if [ $failed -gt 0 ]; then
|
||||||
|
log "$TEST_NAME tests failed"
|
||||||
|
log
|
||||||
|
log
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
log
|
||||||
|
log
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
log() {
|
||||||
|
echo -e "[$TEST_NAME @ $(date)] $*" 1>&2
|
||||||
|
}
|
||||||
|
|
||||||
|
log "Testing $TEST_NAME..."
|
||||||
|
log "Test directory is $TEST_DIR"
|
||||||
|
log "obitools directory is $OBITOOLS_DIR"
|
||||||
|
log "Temporary directory is $TMPDIR"
|
||||||
|
log "files: $(find $TEST_DIR | awk -F'/' '{print $NF}' | tail -n +2)"
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
####
|
||||||
|
#### Below are the tests
|
||||||
|
####
|
||||||
|
#### Before each test :
|
||||||
|
#### - increment the variable ntest
|
||||||
|
####
|
||||||
|
#### Run the command as the condition of an if / then /else
|
||||||
|
#### - The command must return 0 on success
|
||||||
|
#### - The command must return an exit code different from 0 on failure
|
||||||
|
#### - The datafiles are stored in the same directory than the test script
|
||||||
|
#### - The test script directory is stored in the TEST_DIR variable
|
||||||
|
#### - If result files have to be produced they must be stored
|
||||||
|
#### in the temporary directory (TMPDIR variable)
|
||||||
|
####
|
||||||
|
#### then clause is executed on success of the command
|
||||||
|
#### - Write a success message using the log function
|
||||||
|
#### - increment the variable success
|
||||||
|
####
|
||||||
|
#### else clause is executed on failure of the command
|
||||||
|
#### - Write a failure message using the log function
|
||||||
|
#### - increment the variable failed
|
||||||
|
####
|
||||||
|
######################################################################
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
((ntest++))
|
||||||
|
if $CMD -h > "${TMPDIR}/help.txt" 2>&1
|
||||||
|
then
|
||||||
|
log "$MCMD: printing help OK"
|
||||||
|
((success++))
|
||||||
|
else
|
||||||
|
log "$MCMD: printing help failed"
|
||||||
|
((failed++))
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
#########################################
|
||||||
|
#
|
||||||
|
# At the end of the tests
|
||||||
|
# the cleanup function is called
|
||||||
|
#
|
||||||
|
#########################################
|
||||||
|
|
||||||
|
cleanup
|
||||||
109
obitests/obitools/obimicrosat/test.sh
Executable file
109
obitests/obitools/obimicrosat/test.sh
Executable file
@@ -0,0 +1,109 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#
|
||||||
|
# Here give the name of the test serie
|
||||||
|
#
|
||||||
|
|
||||||
|
TEST_NAME=obimicrosat
|
||||||
|
CMD=obimicrosat
|
||||||
|
|
||||||
|
######
|
||||||
|
#
|
||||||
|
# Some variable and function definitions: please don't change them
|
||||||
|
#
|
||||||
|
######
|
||||||
|
TEST_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
|
||||||
|
OBITOOLS_DIR="${TEST_DIR/obitest*/}build"
|
||||||
|
export PATH="${OBITOOLS_DIR}:${PATH}"
|
||||||
|
|
||||||
|
MCMD="$(echo "${CMD:0:4}" | tr '[:lower:]' '[:upper:]')$(echo "${CMD:4}" | tr '[:upper:]' '[:lower:]')"
|
||||||
|
|
||||||
|
TMPDIR="$(mktemp -d)"
|
||||||
|
ntest=0
|
||||||
|
success=0
|
||||||
|
failed=0
|
||||||
|
|
||||||
|
cleanup() {
|
||||||
|
echo "========================================" 1>&2
|
||||||
|
echo "## Results of the $TEST_NAME tests:" 1>&2
|
||||||
|
|
||||||
|
echo 1>&2
|
||||||
|
echo "- $ntest tests run" 1>&2
|
||||||
|
echo "- $success successfully completed" 1>&2
|
||||||
|
echo "- $failed failed tests" 1>&2
|
||||||
|
echo 1>&2
|
||||||
|
echo "Cleaning up the temporary directory..." 1>&2
|
||||||
|
echo 1>&2
|
||||||
|
echo "========================================" 1>&2
|
||||||
|
|
||||||
|
rm -rf "$TMPDIR" # Suppress the temporary directory
|
||||||
|
|
||||||
|
if [ $failed -gt 0 ]; then
|
||||||
|
log "$TEST_NAME tests failed"
|
||||||
|
log
|
||||||
|
log
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
log
|
||||||
|
log
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
log() {
|
||||||
|
echo -e "[$TEST_NAME @ $(date)] $*" 1>&2
|
||||||
|
}
|
||||||
|
|
||||||
|
log "Testing $TEST_NAME..."
|
||||||
|
log "Test directory is $TEST_DIR"
|
||||||
|
log "obitools directory is $OBITOOLS_DIR"
|
||||||
|
log "Temporary directory is $TMPDIR"
|
||||||
|
log "files: $(find $TEST_DIR | awk -F'/' '{print $NF}' | tail -n +2)"
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
####
|
||||||
|
#### Below are the tests
|
||||||
|
####
|
||||||
|
#### Before each test :
|
||||||
|
#### - increment the variable ntest
|
||||||
|
####
|
||||||
|
#### Run the command as the condition of an if / then /else
|
||||||
|
#### - The command must return 0 on success
|
||||||
|
#### - The command must return an exit code different from 0 on failure
|
||||||
|
#### - The datafiles are stored in the same directory than the test script
|
||||||
|
#### - The test script directory is stored in the TEST_DIR variable
|
||||||
|
#### - If result files have to be produced they must be stored
|
||||||
|
#### in the temporary directory (TMPDIR variable)
|
||||||
|
####
|
||||||
|
#### then clause is executed on success of the command
|
||||||
|
#### - Write a success message using the log function
|
||||||
|
#### - increment the variable success
|
||||||
|
####
|
||||||
|
#### else clause is executed on failure of the command
|
||||||
|
#### - Write a failure message using the log function
|
||||||
|
#### - increment the variable failed
|
||||||
|
####
|
||||||
|
######################################################################
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
((ntest++))
|
||||||
|
if $CMD -h > "${TMPDIR}/help.txt" 2>&1
|
||||||
|
then
|
||||||
|
log "$MCMD: printing help OK"
|
||||||
|
((success++))
|
||||||
|
else
|
||||||
|
log "$MCMD: printing help failed"
|
||||||
|
((failed++))
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
#########################################
|
||||||
|
#
|
||||||
|
# At the end of the tests
|
||||||
|
# the cleanup function is called
|
||||||
|
#
|
||||||
|
#########################################
|
||||||
|
|
||||||
|
cleanup
|
||||||
109
obitests/obitools/obimultiplex/test.sh
Executable file
109
obitests/obitools/obimultiplex/test.sh
Executable file
@@ -0,0 +1,109 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#
|
||||||
|
# Here give the name of the test serie
|
||||||
|
#
|
||||||
|
|
||||||
|
TEST_NAME=obimultiplex
|
||||||
|
CMD=obimultiplex
|
||||||
|
|
||||||
|
######
|
||||||
|
#
|
||||||
|
# Some variable and function definitions: please don't change them
|
||||||
|
#
|
||||||
|
######
|
||||||
|
TEST_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
|
||||||
|
OBITOOLS_DIR="${TEST_DIR/obitest*/}build"
|
||||||
|
export PATH="${OBITOOLS_DIR}:${PATH}"
|
||||||
|
|
||||||
|
MCMD="$(echo "${CMD:0:4}" | tr '[:lower:]' '[:upper:]')$(echo "${CMD:4}" | tr '[:upper:]' '[:lower:]')"
|
||||||
|
|
||||||
|
TMPDIR="$(mktemp -d)"
|
||||||
|
ntest=0
|
||||||
|
success=0
|
||||||
|
failed=0
|
||||||
|
|
||||||
|
cleanup() {
|
||||||
|
echo "========================================" 1>&2
|
||||||
|
echo "## Results of the $TEST_NAME tests:" 1>&2
|
||||||
|
|
||||||
|
echo 1>&2
|
||||||
|
echo "- $ntest tests run" 1>&2
|
||||||
|
echo "- $success successfully completed" 1>&2
|
||||||
|
echo "- $failed failed tests" 1>&2
|
||||||
|
echo 1>&2
|
||||||
|
echo "Cleaning up the temporary directory..." 1>&2
|
||||||
|
echo 1>&2
|
||||||
|
echo "========================================" 1>&2
|
||||||
|
|
||||||
|
rm -rf "$TMPDIR" # Suppress the temporary directory
|
||||||
|
|
||||||
|
if [ $failed -gt 0 ]; then
|
||||||
|
log "$TEST_NAME tests failed"
|
||||||
|
log
|
||||||
|
log
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
log
|
||||||
|
log
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
log() {
|
||||||
|
echo -e "[$TEST_NAME @ $(date)] $*" 1>&2
|
||||||
|
}
|
||||||
|
|
||||||
|
log "Testing $TEST_NAME..."
|
||||||
|
log "Test directory is $TEST_DIR"
|
||||||
|
log "obitools directory is $OBITOOLS_DIR"
|
||||||
|
log "Temporary directory is $TMPDIR"
|
||||||
|
log "files: $(find $TEST_DIR | awk -F'/' '{print $NF}' | tail -n +2)"
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
####
|
||||||
|
#### Below are the tests
|
||||||
|
####
|
||||||
|
#### Before each test :
|
||||||
|
#### - increment the variable ntest
|
||||||
|
####
|
||||||
|
#### Run the command as the condition of an if / then /else
|
||||||
|
#### - The command must return 0 on success
|
||||||
|
#### - The command must return an exit code different from 0 on failure
|
||||||
|
#### - The datafiles are stored in the same directory than the test script
|
||||||
|
#### - The test script directory is stored in the TEST_DIR variable
|
||||||
|
#### - If result files have to be produced they must be stored
|
||||||
|
#### in the temporary directory (TMPDIR variable)
|
||||||
|
####
|
||||||
|
#### then clause is executed on success of the command
|
||||||
|
#### - Write a success message using the log function
|
||||||
|
#### - increment the variable success
|
||||||
|
####
|
||||||
|
#### else clause is executed on failure of the command
|
||||||
|
#### - Write a failure message using the log function
|
||||||
|
#### - increment the variable failed
|
||||||
|
####
|
||||||
|
######################################################################
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
((ntest++))
|
||||||
|
if $CMD -h > "${TMPDIR}/help.txt" 2>&1
|
||||||
|
then
|
||||||
|
log "$MCMD: printing help OK"
|
||||||
|
((success++))
|
||||||
|
else
|
||||||
|
log "$MCMD: printing help failed"
|
||||||
|
((failed++))
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
#########################################
|
||||||
|
#
|
||||||
|
# At the end of the tests
|
||||||
|
# the cleanup function is called
|
||||||
|
#
|
||||||
|
#########################################
|
||||||
|
|
||||||
|
cleanup
|
||||||
150
obitests/obitools/obipairing/test.sh
Executable file
150
obitests/obitools/obipairing/test.sh
Executable file
@@ -0,0 +1,150 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#
|
||||||
|
# Here give the name of the test serie
|
||||||
|
#
|
||||||
|
|
||||||
|
TEST_NAME=obipairing
|
||||||
|
CMD=obipairing
|
||||||
|
|
||||||
|
######
|
||||||
|
#
|
||||||
|
# Some variable and function definitions: please don't change them
|
||||||
|
#
|
||||||
|
######
|
||||||
|
TEST_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
|
||||||
|
OBITOOLS_DIR="${TEST_DIR/obitest*/}build"
|
||||||
|
export PATH="${OBITOOLS_DIR}:${PATH}"
|
||||||
|
|
||||||
|
MCMD="$(echo "${CMD:0:4}" | tr '[:lower:]' '[:upper:]')$(echo "${CMD:4}" | tr '[:upper:]' '[:lower:]')"
|
||||||
|
|
||||||
|
TMPDIR="$(mktemp -d)"
|
||||||
|
ntest=0
|
||||||
|
success=0
|
||||||
|
failed=0
|
||||||
|
|
||||||
|
cleanup() {
|
||||||
|
echo "========================================" 1>&2
|
||||||
|
echo "## Results of the $TEST_NAME tests:" 1>&2
|
||||||
|
|
||||||
|
echo 1>&2
|
||||||
|
echo "- $ntest tests run" 1>&2
|
||||||
|
echo "- $success successfully completed" 1>&2
|
||||||
|
echo "- $failed failed tests" 1>&2
|
||||||
|
echo 1>&2
|
||||||
|
echo "Cleaning up the temporary directory..." 1>&2
|
||||||
|
echo 1>&2
|
||||||
|
echo "========================================" 1>&2
|
||||||
|
|
||||||
|
rm -rf "$TMPDIR" # Suppress the temporary directory
|
||||||
|
|
||||||
|
if [ $failed -gt 0 ]; then
|
||||||
|
log "$TEST_NAME tests failed"
|
||||||
|
log
|
||||||
|
log
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
log
|
||||||
|
log
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
log() {
|
||||||
|
echo -e "[$TEST_NAME @ $(date)] $*" 1>&2
|
||||||
|
}
|
||||||
|
|
||||||
|
log "Testing $TEST_NAME..."
|
||||||
|
log "Test directory is $TEST_DIR"
|
||||||
|
log "obitools directory is $OBITOOLS_DIR"
|
||||||
|
log "Temporary directory is $TMPDIR"
|
||||||
|
log "files: $(find $TEST_DIR | awk -F'/' '{print $NF}' | tail -n +2)"
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
####
|
||||||
|
#### Below are the tests
|
||||||
|
####
|
||||||
|
#### Before each test :
|
||||||
|
#### - increment the variable ntest
|
||||||
|
####
|
||||||
|
#### Run the command as the condition of an if / then /else
|
||||||
|
#### - The command must return 0 on success
|
||||||
|
#### - The command must return an exit code different from 0 on failure
|
||||||
|
#### - The datafiles are stored in the same directory than the test script
|
||||||
|
#### - The test script directory is stored in the TEST_DIR variable
|
||||||
|
#### - If result files have to be produced they must be stored
|
||||||
|
#### in the temporary directory (TMPDIR variable)
|
||||||
|
####
|
||||||
|
#### then clause is executed on success of the command
|
||||||
|
#### - Write a success message using the log function
|
||||||
|
#### - increment the variable success
|
||||||
|
####
|
||||||
|
#### else clause is executed on failure of the command
|
||||||
|
#### - Write a failure message using the log function
|
||||||
|
#### - increment the variable failed
|
||||||
|
####
|
||||||
|
######################################################################
|
||||||
|
|
||||||
|
((ntest++))
|
||||||
|
if $CMD -h > "${TMPDIR}/help.txt" 2>&1
|
||||||
|
then
|
||||||
|
log "$MCMD: printing help OK"
|
||||||
|
((success++))
|
||||||
|
else
|
||||||
|
log "$MCMD: printing help failed"
|
||||||
|
((failed++))
|
||||||
|
fi
|
||||||
|
|
||||||
|
((ntest++))
|
||||||
|
if obipairing -F "${TEST_DIR}/wolf_F.fastq.gz" \
|
||||||
|
-R "${TEST_DIR}/wolf_R.fastq.gz" \
|
||||||
|
| obidistribute -Z -c mode \
|
||||||
|
-p "${TMPDIR}/wolf_paired_%s.fastq.gz"
|
||||||
|
then
|
||||||
|
log "OBIPairing: sequence pairing OK"
|
||||||
|
((success++))
|
||||||
|
else
|
||||||
|
log "OBIPairing: sequence pairing failed"
|
||||||
|
((failed++))
|
||||||
|
fi
|
||||||
|
|
||||||
|
((ntest++))
|
||||||
|
if obicsv -Z -s -i \
|
||||||
|
-k ali_dir -k ali_length -k pairing_fast_count \
|
||||||
|
-k pairing_fast_overlap -k pairing_fast_score \
|
||||||
|
-k score -k score_norm -k seq_a_single \
|
||||||
|
-k seq_b_single -k seq_ab_match \
|
||||||
|
"${TMPDIR}/wolf_paired_alignment.fastq.gz" \
|
||||||
|
> "${TMPDIR}/wolf_paired_alignment.csv.gz" \
|
||||||
|
&& zdiff -c "${TEST_DIR}/wolf_paired_alignment.csv.gz" \
|
||||||
|
"${TMPDIR}/wolf_paired_alignment.csv.gz"
|
||||||
|
then
|
||||||
|
log "OBIPairing: check aligned sequences OK"
|
||||||
|
((success++))
|
||||||
|
else
|
||||||
|
log "OBIPairing: check aligned sequences failed"
|
||||||
|
((failed++))
|
||||||
|
fi
|
||||||
|
|
||||||
|
((ntest++))
|
||||||
|
if obicsv -Z -s -i \
|
||||||
|
"${TMPDIR}/wolf_paired_join.fastq.gz" \
|
||||||
|
> "${TMPDIR}/wolf_paired_join.csv.gz" \
|
||||||
|
&& zdiff -c "${TEST_DIR}/wolf_paired_join.csv.gz" \
|
||||||
|
"${TMPDIR}/wolf_paired_join.csv.gz"
|
||||||
|
then
|
||||||
|
log "OBIPairing: check joined sequences OK"
|
||||||
|
((success++))
|
||||||
|
else
|
||||||
|
log "OBIPairing: check joined sequences failed"
|
||||||
|
((failed++))
|
||||||
|
fi
|
||||||
|
|
||||||
|
#########################################
|
||||||
|
#
|
||||||
|
# At the end of the tests
|
||||||
|
# the cleanup function is called
|
||||||
|
#
|
||||||
|
#########################################
|
||||||
|
|
||||||
|
cleanup
|
||||||
BIN
obitests/obitools/obipairing/wolf_F.fastq.gz
Normal file
BIN
obitests/obitools/obipairing/wolf_F.fastq.gz
Normal file
Binary file not shown.
BIN
obitests/obitools/obipairing/wolf_R.fastq.gz
Normal file
BIN
obitests/obitools/obipairing/wolf_R.fastq.gz
Normal file
Binary file not shown.
BIN
obitests/obitools/obipairing/wolf_paired_alignment.csv.gz
Normal file
BIN
obitests/obitools/obipairing/wolf_paired_alignment.csv.gz
Normal file
Binary file not shown.
BIN
obitests/obitools/obipairing/wolf_paired_join.csv.gz
Normal file
BIN
obitests/obitools/obipairing/wolf_paired_join.csv.gz
Normal file
Binary file not shown.
109
obitests/obitools/obipcr/test.sh
Executable file
109
obitests/obitools/obipcr/test.sh
Executable file
@@ -0,0 +1,109 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#
|
||||||
|
# Here give the name of the test serie
|
||||||
|
#
|
||||||
|
|
||||||
|
TEST_NAME=obipcr
|
||||||
|
CMD=obipcr
|
||||||
|
|
||||||
|
######
|
||||||
|
#
|
||||||
|
# Some variable and function definitions: please don't change them
|
||||||
|
#
|
||||||
|
######
|
||||||
|
TEST_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
|
||||||
|
OBITOOLS_DIR="${TEST_DIR/obitest*/}build"
|
||||||
|
export PATH="${OBITOOLS_DIR}:${PATH}"
|
||||||
|
|
||||||
|
MCMD="$(echo "${CMD:0:4}" | tr '[:lower:]' '[:upper:]')$(echo "${CMD:4}" | tr '[:upper:]' '[:lower:]')"
|
||||||
|
|
||||||
|
TMPDIR="$(mktemp -d)"
|
||||||
|
ntest=0
|
||||||
|
success=0
|
||||||
|
failed=0
|
||||||
|
|
||||||
|
cleanup() {
|
||||||
|
echo "========================================" 1>&2
|
||||||
|
echo "## Results of the $TEST_NAME tests:" 1>&2
|
||||||
|
|
||||||
|
echo 1>&2
|
||||||
|
echo "- $ntest tests run" 1>&2
|
||||||
|
echo "- $success successfully completed" 1>&2
|
||||||
|
echo "- $failed failed tests" 1>&2
|
||||||
|
echo 1>&2
|
||||||
|
echo "Cleaning up the temporary directory..." 1>&2
|
||||||
|
echo 1>&2
|
||||||
|
echo "========================================" 1>&2
|
||||||
|
|
||||||
|
rm -rf "$TMPDIR" # Suppress the temporary directory
|
||||||
|
|
||||||
|
if [ $failed -gt 0 ]; then
|
||||||
|
log "$TEST_NAME tests failed"
|
||||||
|
log
|
||||||
|
log
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
log
|
||||||
|
log
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
log() {
|
||||||
|
echo -e "[$TEST_NAME @ $(date)] $*" 1>&2
|
||||||
|
}
|
||||||
|
|
||||||
|
log "Testing $TEST_NAME..."
|
||||||
|
log "Test directory is $TEST_DIR"
|
||||||
|
log "obitools directory is $OBITOOLS_DIR"
|
||||||
|
log "Temporary directory is $TMPDIR"
|
||||||
|
log "files: $(find $TEST_DIR | awk -F'/' '{print $NF}' | tail -n +2)"
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
####
|
||||||
|
#### Below are the tests
|
||||||
|
####
|
||||||
|
#### Before each test :
|
||||||
|
#### - increment the variable ntest
|
||||||
|
####
|
||||||
|
#### Run the command as the condition of an if / then /else
|
||||||
|
#### - The command must return 0 on success
|
||||||
|
#### - The command must return an exit code different from 0 on failure
|
||||||
|
#### - The datafiles are stored in the same directory than the test script
|
||||||
|
#### - The test script directory is stored in the TEST_DIR variable
|
||||||
|
#### - If result files have to be produced they must be stored
|
||||||
|
#### in the temporary directory (TMPDIR variable)
|
||||||
|
####
|
||||||
|
#### then clause is executed on success of the command
|
||||||
|
#### - Write a success message using the log function
|
||||||
|
#### - increment the variable success
|
||||||
|
####
|
||||||
|
#### else clause is executed on failure of the command
|
||||||
|
#### - Write a failure message using the log function
|
||||||
|
#### - increment the variable failed
|
||||||
|
####
|
||||||
|
######################################################################
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
((ntest++))
|
||||||
|
if $CMD -h > "${TMPDIR}/help.txt" 2>&1
|
||||||
|
then
|
||||||
|
log "$MCMD: printing help OK"
|
||||||
|
((success++))
|
||||||
|
else
|
||||||
|
log "$MCMD: printing help failed"
|
||||||
|
((failed++))
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
#########################################
|
||||||
|
#
|
||||||
|
# At the end of the tests
|
||||||
|
# the cleanup function is called
|
||||||
|
#
|
||||||
|
#########################################
|
||||||
|
|
||||||
|
cleanup
|
||||||
109
obitests/obitools/obirefidx/test.sh
Executable file
109
obitests/obitools/obirefidx/test.sh
Executable file
@@ -0,0 +1,109 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#
|
||||||
|
# Here give the name of the test serie
|
||||||
|
#
|
||||||
|
|
||||||
|
TEST_NAME=obirefidx
|
||||||
|
CMD=obirefidx
|
||||||
|
|
||||||
|
######
|
||||||
|
#
|
||||||
|
# Some variable and function definitions: please don't change them
|
||||||
|
#
|
||||||
|
######
|
||||||
|
TEST_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
|
||||||
|
OBITOOLS_DIR="${TEST_DIR/obitest*/}build"
|
||||||
|
export PATH="${OBITOOLS_DIR}:${PATH}"
|
||||||
|
|
||||||
|
MCMD="$(echo "${CMD:0:4}" | tr '[:lower:]' '[:upper:]')$(echo "${CMD:4}" | tr '[:upper:]' '[:lower:]')"
|
||||||
|
|
||||||
|
TMPDIR="$(mktemp -d)"
|
||||||
|
ntest=0
|
||||||
|
success=0
|
||||||
|
failed=0
|
||||||
|
|
||||||
|
cleanup() {
|
||||||
|
echo "========================================" 1>&2
|
||||||
|
echo "## Results of the $TEST_NAME tests:" 1>&2
|
||||||
|
|
||||||
|
echo 1>&2
|
||||||
|
echo "- $ntest tests run" 1>&2
|
||||||
|
echo "- $success successfully completed" 1>&2
|
||||||
|
echo "- $failed failed tests" 1>&2
|
||||||
|
echo 1>&2
|
||||||
|
echo "Cleaning up the temporary directory..." 1>&2
|
||||||
|
echo 1>&2
|
||||||
|
echo "========================================" 1>&2
|
||||||
|
|
||||||
|
rm -rf "$TMPDIR" # Suppress the temporary directory
|
||||||
|
|
||||||
|
if [ $failed -gt 0 ]; then
|
||||||
|
log "$TEST_NAME tests failed"
|
||||||
|
log
|
||||||
|
log
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
log
|
||||||
|
log
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
log() {
|
||||||
|
echo -e "[$TEST_NAME @ $(date)] $*" 1>&2
|
||||||
|
}
|
||||||
|
|
||||||
|
log "Testing $TEST_NAME..."
|
||||||
|
log "Test directory is $TEST_DIR"
|
||||||
|
log "obitools directory is $OBITOOLS_DIR"
|
||||||
|
log "Temporary directory is $TMPDIR"
|
||||||
|
log "files: $(find $TEST_DIR | awk -F'/' '{print $NF}' | tail -n +2)"
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
####
|
||||||
|
#### Below are the tests
|
||||||
|
####
|
||||||
|
#### Before each test :
|
||||||
|
#### - increment the variable ntest
|
||||||
|
####
|
||||||
|
#### Run the command as the condition of an if / then /else
|
||||||
|
#### - The command must return 0 on success
|
||||||
|
#### - The command must return an exit code different from 0 on failure
|
||||||
|
#### - The datafiles are stored in the same directory than the test script
|
||||||
|
#### - The test script directory is stored in the TEST_DIR variable
|
||||||
|
#### - If result files have to be produced they must be stored
|
||||||
|
#### in the temporary directory (TMPDIR variable)
|
||||||
|
####
|
||||||
|
#### then clause is executed on success of the command
|
||||||
|
#### - Write a success message using the log function
|
||||||
|
#### - increment the variable success
|
||||||
|
####
|
||||||
|
#### else clause is executed on failure of the command
|
||||||
|
#### - Write a failure message using the log function
|
||||||
|
#### - increment the variable failed
|
||||||
|
####
|
||||||
|
######################################################################
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
((ntest++))
|
||||||
|
if $CMD -h > "${TMPDIR}/help.txt" 2>&1
|
||||||
|
then
|
||||||
|
log "$MCMD: printing help OK"
|
||||||
|
((success++))
|
||||||
|
else
|
||||||
|
log "$MCMD: printing help failed"
|
||||||
|
((failed++))
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
#########################################
|
||||||
|
#
|
||||||
|
# At the end of the tests
|
||||||
|
# the cleanup function is called
|
||||||
|
#
|
||||||
|
#########################################
|
||||||
|
|
||||||
|
cleanup
|
||||||
109
obitests/obitools/obiscript/test.sh
Executable file
109
obitests/obitools/obiscript/test.sh
Executable file
@@ -0,0 +1,109 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#
|
||||||
|
# Here give the name of the test serie
|
||||||
|
#
|
||||||
|
|
||||||
|
TEST_NAME=obiscript
|
||||||
|
CMD=obiscript
|
||||||
|
|
||||||
|
######
|
||||||
|
#
|
||||||
|
# Some variable and function definitions: please don't change them
|
||||||
|
#
|
||||||
|
######
|
||||||
|
TEST_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
|
||||||
|
OBITOOLS_DIR="${TEST_DIR/obitest*/}build"
|
||||||
|
export PATH="${OBITOOLS_DIR}:${PATH}"
|
||||||
|
|
||||||
|
MCMD="$(echo "${CMD:0:4}" | tr '[:lower:]' '[:upper:]')$(echo "${CMD:4}" | tr '[:upper:]' '[:lower:]')"
|
||||||
|
|
||||||
|
TMPDIR="$(mktemp -d)"
|
||||||
|
ntest=0
|
||||||
|
success=0
|
||||||
|
failed=0
|
||||||
|
|
||||||
|
cleanup() {
|
||||||
|
echo "========================================" 1>&2
|
||||||
|
echo "## Results of the $TEST_NAME tests:" 1>&2
|
||||||
|
|
||||||
|
echo 1>&2
|
||||||
|
echo "- $ntest tests run" 1>&2
|
||||||
|
echo "- $success successfully completed" 1>&2
|
||||||
|
echo "- $failed failed tests" 1>&2
|
||||||
|
echo 1>&2
|
||||||
|
echo "Cleaning up the temporary directory..." 1>&2
|
||||||
|
echo 1>&2
|
||||||
|
echo "========================================" 1>&2
|
||||||
|
|
||||||
|
rm -rf "$TMPDIR" # Suppress the temporary directory
|
||||||
|
|
||||||
|
if [ $failed -gt 0 ]; then
|
||||||
|
log "$TEST_NAME tests failed"
|
||||||
|
log
|
||||||
|
log
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
log
|
||||||
|
log
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
log() {
|
||||||
|
echo -e "[$TEST_NAME @ $(date)] $*" 1>&2
|
||||||
|
}
|
||||||
|
|
||||||
|
log "Testing $TEST_NAME..."
|
||||||
|
log "Test directory is $TEST_DIR"
|
||||||
|
log "obitools directory is $OBITOOLS_DIR"
|
||||||
|
log "Temporary directory is $TMPDIR"
|
||||||
|
log "files: $(find $TEST_DIR | awk -F'/' '{print $NF}' | tail -n +2)"
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
####
|
||||||
|
#### Below are the tests
|
||||||
|
####
|
||||||
|
#### Before each test :
|
||||||
|
#### - increment the variable ntest
|
||||||
|
####
|
||||||
|
#### Run the command as the condition of an if / then /else
|
||||||
|
#### - The command must return 0 on success
|
||||||
|
#### - The command must return an exit code different from 0 on failure
|
||||||
|
#### - The datafiles are stored in the same directory than the test script
|
||||||
|
#### - The test script directory is stored in the TEST_DIR variable
|
||||||
|
#### - If result files have to be produced they must be stored
|
||||||
|
#### in the temporary directory (TMPDIR variable)
|
||||||
|
####
|
||||||
|
#### then clause is executed on success of the command
|
||||||
|
#### - Write a success message using the log function
|
||||||
|
#### - increment the variable success
|
||||||
|
####
|
||||||
|
#### else clause is executed on failure of the command
|
||||||
|
#### - Write a failure message using the log function
|
||||||
|
#### - increment the variable failed
|
||||||
|
####
|
||||||
|
######################################################################
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
((ntest++))
|
||||||
|
if $CMD -h > "${TMPDIR}/help.txt" 2>&1
|
||||||
|
then
|
||||||
|
log "$MCMD: printing help OK"
|
||||||
|
((success++))
|
||||||
|
else
|
||||||
|
log "$MCMD: printing help failed"
|
||||||
|
((failed++))
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
#########################################
|
||||||
|
#
|
||||||
|
# At the end of the tests
|
||||||
|
# the cleanup function is called
|
||||||
|
#
|
||||||
|
#########################################
|
||||||
|
|
||||||
|
cleanup
|
||||||
109
obitests/obitools/obisplit/test.sh
Executable file
109
obitests/obitools/obisplit/test.sh
Executable file
@@ -0,0 +1,109 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#
|
||||||
|
# Here give the name of the test serie
|
||||||
|
#
|
||||||
|
|
||||||
|
TEST_NAME=obisplit
|
||||||
|
CMD=obisplit
|
||||||
|
|
||||||
|
######
|
||||||
|
#
|
||||||
|
# Some variable and function definitions: please don't change them
|
||||||
|
#
|
||||||
|
######
|
||||||
|
TEST_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
|
||||||
|
OBITOOLS_DIR="${TEST_DIR/obitest*/}build"
|
||||||
|
export PATH="${OBITOOLS_DIR}:${PATH}"
|
||||||
|
|
||||||
|
MCMD="$(echo "${CMD:0:4}" | tr '[:lower:]' '[:upper:]')$(echo "${CMD:4}" | tr '[:upper:]' '[:lower:]')"
|
||||||
|
|
||||||
|
TMPDIR="$(mktemp -d)"
|
||||||
|
ntest=0
|
||||||
|
success=0
|
||||||
|
failed=0
|
||||||
|
|
||||||
|
cleanup() {
|
||||||
|
echo "========================================" 1>&2
|
||||||
|
echo "## Results of the $TEST_NAME tests:" 1>&2
|
||||||
|
|
||||||
|
echo 1>&2
|
||||||
|
echo "- $ntest tests run" 1>&2
|
||||||
|
echo "- $success successfully completed" 1>&2
|
||||||
|
echo "- $failed failed tests" 1>&2
|
||||||
|
echo 1>&2
|
||||||
|
echo "Cleaning up the temporary directory..." 1>&2
|
||||||
|
echo 1>&2
|
||||||
|
echo "========================================" 1>&2
|
||||||
|
|
||||||
|
rm -rf "$TMPDIR" # Suppress the temporary directory
|
||||||
|
|
||||||
|
if [ $failed -gt 0 ]; then
|
||||||
|
log "$TEST_NAME tests failed"
|
||||||
|
log
|
||||||
|
log
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
log
|
||||||
|
log
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
log() {
|
||||||
|
echo -e "[$TEST_NAME @ $(date)] $*" 1>&2
|
||||||
|
}
|
||||||
|
|
||||||
|
log "Testing $TEST_NAME..."
|
||||||
|
log "Test directory is $TEST_DIR"
|
||||||
|
log "obitools directory is $OBITOOLS_DIR"
|
||||||
|
log "Temporary directory is $TMPDIR"
|
||||||
|
log "files: $(find $TEST_DIR | awk -F'/' '{print $NF}' | tail -n +2)"
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
####
|
||||||
|
#### Below are the tests
|
||||||
|
####
|
||||||
|
#### Before each test :
|
||||||
|
#### - increment the variable ntest
|
||||||
|
####
|
||||||
|
#### Run the command as the condition of an if / then /else
|
||||||
|
#### - The command must return 0 on success
|
||||||
|
#### - The command must return an exit code different from 0 on failure
|
||||||
|
#### - The datafiles are stored in the same directory than the test script
|
||||||
|
#### - The test script directory is stored in the TEST_DIR variable
|
||||||
|
#### - If result files have to be produced they must be stored
|
||||||
|
#### in the temporary directory (TMPDIR variable)
|
||||||
|
####
|
||||||
|
#### then clause is executed on success of the command
|
||||||
|
#### - Write a success message using the log function
|
||||||
|
#### - increment the variable success
|
||||||
|
####
|
||||||
|
#### else clause is executed on failure of the command
|
||||||
|
#### - Write a failure message using the log function
|
||||||
|
#### - increment the variable failed
|
||||||
|
####
|
||||||
|
######################################################################
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
((ntest++))
|
||||||
|
if $CMD -h > "${TMPDIR}/help.txt" 2>&1
|
||||||
|
then
|
||||||
|
log "$MCMD: printing help OK"
|
||||||
|
((success++))
|
||||||
|
else
|
||||||
|
log "$MCMD: printing help failed"
|
||||||
|
((failed++))
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
#########################################
|
||||||
|
#
|
||||||
|
# At the end of the tests
|
||||||
|
# the cleanup function is called
|
||||||
|
#
|
||||||
|
#########################################
|
||||||
|
|
||||||
|
cleanup
|
||||||
9
obitests/obitools/obisummary/some_uniq_seq.fasta
Normal file
9
obitests/obitools/obisummary/some_uniq_seq.fasta
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
>Seq_1 {"count":2,"merged_sample":{"15a_F730814":1,"29a_F260619":1}}
|
||||||
|
ttagccctaaacacaagtaattaatataacaaaattattcgccagagtactaccggcaat
|
||||||
|
agctyaaaactcaaaggacttggcggtgctttataccctt
|
||||||
|
>Seq_2 {"count":22,"merged_sample":{"15a_F730814":12,"29a_F260619":10}}
|
||||||
|
ttagccctaaacacaagtaattaatataacaaaattattcgccagagtactaccggcaat
|
||||||
|
atcttaaaactcaaaggacttggcggtgctttataccctt
|
||||||
|
>Seq_3 {"count":22,"merged_sample":{"15a_F730814":15,"29a_F260619":7}}
|
||||||
|
ttagccctaaacacaagtaattaatataacaaaattattcgccagagtactaccggcgat
|
||||||
|
agcttaaaactcaaaggacttggcggtgctttataccctt
|
||||||
35
obitests/obitools/obisummary/some_uniq_seq.json
Normal file
35
obitests/obitools/obisummary/some_uniq_seq.json
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
{
|
||||||
|
"annotations": {
|
||||||
|
"keys": {
|
||||||
|
"map": {
|
||||||
|
"merged_sample": 3
|
||||||
|
},
|
||||||
|
"scalar": {
|
||||||
|
"count": 3
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"map_attributes": 1,
|
||||||
|
"scalar_attributes": 1,
|
||||||
|
"vector_attributes": 0
|
||||||
|
},
|
||||||
|
"count": {
|
||||||
|
"reads": 46,
|
||||||
|
"total_length": 300,
|
||||||
|
"variants": 3
|
||||||
|
},
|
||||||
|
"samples": {
|
||||||
|
"sample_count": 2,
|
||||||
|
"sample_stats": {
|
||||||
|
"15a_F730814": {
|
||||||
|
"reads": 28,
|
||||||
|
"singletons": 1,
|
||||||
|
"variants": 3
|
||||||
|
},
|
||||||
|
"29a_F260619": {
|
||||||
|
"reads": 18,
|
||||||
|
"singletons": 1,
|
||||||
|
"variants": 3
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
25
obitests/obitools/obisummary/some_uniq_seq.yaml
Normal file
25
obitests/obitools/obisummary/some_uniq_seq.yaml
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
annotations:
|
||||||
|
keys:
|
||||||
|
map:
|
||||||
|
merged_sample: 3
|
||||||
|
scalar:
|
||||||
|
count: 3
|
||||||
|
map_attributes: 1
|
||||||
|
scalar_attributes: 1
|
||||||
|
vector_attributes: 0
|
||||||
|
count:
|
||||||
|
reads: 46
|
||||||
|
total_length: 300
|
||||||
|
variants: 3
|
||||||
|
samples:
|
||||||
|
sample_count: 2
|
||||||
|
sample_stats:
|
||||||
|
15a_F730814:
|
||||||
|
reads: 28
|
||||||
|
singletons: 1
|
||||||
|
variants: 3
|
||||||
|
29a_F260619:
|
||||||
|
reads: 18
|
||||||
|
singletons: 1
|
||||||
|
variants: 3
|
||||||
|
|
||||||
152
obitests/obitools/obisummary/test.sh
Executable file
152
obitests/obitools/obisummary/test.sh
Executable file
@@ -0,0 +1,152 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#
|
||||||
|
# Here give the name of the test serie
|
||||||
|
#
|
||||||
|
|
||||||
|
TEST_NAME=obisummary
|
||||||
|
CMD=obisummary
|
||||||
|
|
||||||
|
######
|
||||||
|
#
|
||||||
|
# Some variable and function definitions: please don't change them
|
||||||
|
#
|
||||||
|
######
|
||||||
|
TEST_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
|
||||||
|
OBITOOLS_DIR="${TEST_DIR/obitest*/}build"
|
||||||
|
export PATH="${OBITOOLS_DIR}:${PATH}"
|
||||||
|
|
||||||
|
MCMD="$(echo "${CMD:0:4}" | tr '[:lower:]' '[:upper:]')$(echo "${CMD:4}" | tr '[:upper:]' '[:lower:]')"
|
||||||
|
|
||||||
|
TMPDIR="$(mktemp -d)"
|
||||||
|
ntest=0
|
||||||
|
success=0
|
||||||
|
failed=0
|
||||||
|
|
||||||
|
cleanup() {
|
||||||
|
echo "========================================" 1>&2
|
||||||
|
echo "## Results of the $TEST_NAME tests:" 1>&2
|
||||||
|
|
||||||
|
echo 1>&2
|
||||||
|
echo "- $ntest tests run" 1>&2
|
||||||
|
echo "- $success successfully completed" 1>&2
|
||||||
|
echo "- $failed failed tests" 1>&2
|
||||||
|
echo 1>&2
|
||||||
|
echo "Cleaning up the temporary directory..." 1>&2
|
||||||
|
echo 1>&2
|
||||||
|
echo "========================================" 1>&2
|
||||||
|
|
||||||
|
rm -rf "$TMPDIR" # Suppress the temporary directory
|
||||||
|
|
||||||
|
if [ $failed -gt 0 ]; then
|
||||||
|
log "$TEST_NAME tests failed"
|
||||||
|
log
|
||||||
|
log
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
log
|
||||||
|
log
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
log() {
|
||||||
|
echo -e "[$TEST_NAME @ $(date)] $*" 1>&2
|
||||||
|
}
|
||||||
|
|
||||||
|
log "Testing $TEST_NAME..."
|
||||||
|
log "Test directory is $TEST_DIR"
|
||||||
|
log "obitools directory is $OBITOOLS_DIR"
|
||||||
|
log "Temporary directory is $TMPDIR"
|
||||||
|
log "files: $(find $TEST_DIR | awk -F'/' '{print $NF}' | tail -n +2)"
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
####
|
||||||
|
#### Below are the tests
|
||||||
|
####
|
||||||
|
#### Before each test :
|
||||||
|
#### - increment the variable ntest
|
||||||
|
####
|
||||||
|
#### Run the command as the condition of an if / then /else
|
||||||
|
#### - The command must return 0 on success
|
||||||
|
#### - The command must return an exit code different from 0 on failure
|
||||||
|
#### - The datafiles are stored in the same directory than the test script
|
||||||
|
#### - The test script directory is stored in the TEST_DIR variable
|
||||||
|
#### - If result files have to be produced they must be stored
|
||||||
|
#### in the temporary directory (TMPDIR variable)
|
||||||
|
####
|
||||||
|
#### then clause is executed on success of the command
|
||||||
|
#### - Write a success message using the log function
|
||||||
|
#### - increment the variable success
|
||||||
|
####
|
||||||
|
#### else clause is executed on failure of the command
|
||||||
|
#### - Write a failure message using the log function
|
||||||
|
#### - increment the variable failed
|
||||||
|
####
|
||||||
|
######################################################################
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
((ntest++))
|
||||||
|
if $CMD -h > "${TMPDIR}/help.txt" 2>&1
|
||||||
|
then
|
||||||
|
log "$MCMD: printing help OK"
|
||||||
|
((success++))
|
||||||
|
else
|
||||||
|
log "$MCMD: printing help failed"
|
||||||
|
((failed++))
|
||||||
|
fi
|
||||||
|
|
||||||
|
((ntest++))
|
||||||
|
if obisummary "${TEST_DIR}/some_uniq_seq.fasta" \
|
||||||
|
> "${TMPDIR}/some_uniq_seq.json"
|
||||||
|
then
|
||||||
|
log "$MCMD: formating json execution OK"
|
||||||
|
((success++))
|
||||||
|
else
|
||||||
|
log "$MCMD: formating json execution failed"
|
||||||
|
((failed++))
|
||||||
|
fi
|
||||||
|
|
||||||
|
((ntest++))
|
||||||
|
if diff "${TEST_DIR}/some_uniq_seq.json" \
|
||||||
|
"${TMPDIR}/some_uniq_seq.json" > /dev/null
|
||||||
|
then
|
||||||
|
log "$MCMD: formating json OK"
|
||||||
|
((success++))
|
||||||
|
else
|
||||||
|
log "$MCMD: formating json failed"
|
||||||
|
((failed++))
|
||||||
|
fi
|
||||||
|
|
||||||
|
((ntest++))
|
||||||
|
if obisummary --yaml "${TEST_DIR}/some_uniq_seq.fasta" \
|
||||||
|
> "${TMPDIR}/some_uniq_seq.yaml"
|
||||||
|
then
|
||||||
|
log "$MCMD: formating yaml execution OK"
|
||||||
|
((success++))
|
||||||
|
else
|
||||||
|
log "$MCMD: formating yaml execution failed"
|
||||||
|
((failed++))
|
||||||
|
fi
|
||||||
|
|
||||||
|
((ntest++))
|
||||||
|
if diff "${TEST_DIR}/some_uniq_seq.yaml" \
|
||||||
|
"${TMPDIR}/some_uniq_seq.yaml" > /dev/null
|
||||||
|
then
|
||||||
|
log "$MCMD: formating yaml OK"
|
||||||
|
((success++))
|
||||||
|
else
|
||||||
|
log "$MCMD: formating yaml failed"
|
||||||
|
((failed++))
|
||||||
|
fi
|
||||||
|
|
||||||
|
#########################################
|
||||||
|
#
|
||||||
|
# At the end of the tests
|
||||||
|
# the cleanup function is called
|
||||||
|
#
|
||||||
|
#########################################
|
||||||
|
|
||||||
|
cleanup
|
||||||
109
obitests/obitools/obitag/test.sh
Executable file
109
obitests/obitools/obitag/test.sh
Executable file
@@ -0,0 +1,109 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#
|
||||||
|
# Here give the name of the test serie
|
||||||
|
#
|
||||||
|
|
||||||
|
TEST_NAME=obitag
|
||||||
|
CMD=obitag
|
||||||
|
|
||||||
|
######
|
||||||
|
#
|
||||||
|
# Some variable and function definitions: please don't change them
|
||||||
|
#
|
||||||
|
######
|
||||||
|
TEST_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
|
||||||
|
OBITOOLS_DIR="${TEST_DIR/obitest*/}build"
|
||||||
|
export PATH="${OBITOOLS_DIR}:${PATH}"
|
||||||
|
|
||||||
|
MCMD="$(echo "${CMD:0:4}" | tr '[:lower:]' '[:upper:]')$(echo "${CMD:4}" | tr '[:upper:]' '[:lower:]')"
|
||||||
|
|
||||||
|
TMPDIR="$(mktemp -d)"
|
||||||
|
ntest=0
|
||||||
|
success=0
|
||||||
|
failed=0
|
||||||
|
|
||||||
|
cleanup() {
|
||||||
|
echo "========================================" 1>&2
|
||||||
|
echo "## Results of the $TEST_NAME tests:" 1>&2
|
||||||
|
|
||||||
|
echo 1>&2
|
||||||
|
echo "- $ntest tests run" 1>&2
|
||||||
|
echo "- $success successfully completed" 1>&2
|
||||||
|
echo "- $failed failed tests" 1>&2
|
||||||
|
echo 1>&2
|
||||||
|
echo "Cleaning up the temporary directory..." 1>&2
|
||||||
|
echo 1>&2
|
||||||
|
echo "========================================" 1>&2
|
||||||
|
|
||||||
|
rm -rf "$TMPDIR" # Suppress the temporary directory
|
||||||
|
|
||||||
|
if [ $failed -gt 0 ]; then
|
||||||
|
log "$TEST_NAME tests failed"
|
||||||
|
log
|
||||||
|
log
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
log
|
||||||
|
log
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
log() {
|
||||||
|
echo -e "[$TEST_NAME @ $(date)] $*" 1>&2
|
||||||
|
}
|
||||||
|
|
||||||
|
log "Testing $TEST_NAME..."
|
||||||
|
log "Test directory is $TEST_DIR"
|
||||||
|
log "obitools directory is $OBITOOLS_DIR"
|
||||||
|
log "Temporary directory is $TMPDIR"
|
||||||
|
log "files: $(find $TEST_DIR | awk -F'/' '{print $NF}' | tail -n +2)"
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
####
|
||||||
|
#### Below are the tests
|
||||||
|
####
|
||||||
|
#### Before each test :
|
||||||
|
#### - increment the variable ntest
|
||||||
|
####
|
||||||
|
#### Run the command as the condition of an if / then /else
|
||||||
|
#### - The command must return 0 on success
|
||||||
|
#### - The command must return an exit code different from 0 on failure
|
||||||
|
#### - The datafiles are stored in the same directory than the test script
|
||||||
|
#### - The test script directory is stored in the TEST_DIR variable
|
||||||
|
#### - If result files have to be produced they must be stored
|
||||||
|
#### in the temporary directory (TMPDIR variable)
|
||||||
|
####
|
||||||
|
#### then clause is executed on success of the command
|
||||||
|
#### - Write a success message using the log function
|
||||||
|
#### - increment the variable success
|
||||||
|
####
|
||||||
|
#### else clause is executed on failure of the command
|
||||||
|
#### - Write a failure message using the log function
|
||||||
|
#### - increment the variable failed
|
||||||
|
####
|
||||||
|
######################################################################
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
((ntest++))
|
||||||
|
if $CMD -h > "${TMPDIR}/help.txt" 2>&1
|
||||||
|
then
|
||||||
|
log "$MCMD: printing help OK"
|
||||||
|
((success++))
|
||||||
|
else
|
||||||
|
log "$MCMD: printing help failed"
|
||||||
|
((failed++))
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
#########################################
|
||||||
|
#
|
||||||
|
# At the end of the tests
|
||||||
|
# the cleanup function is called
|
||||||
|
#
|
||||||
|
#########################################
|
||||||
|
|
||||||
|
cleanup
|
||||||
109
obitests/obitools/obitagpcr/test.sh
Executable file
109
obitests/obitools/obitagpcr/test.sh
Executable file
@@ -0,0 +1,109 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#
|
||||||
|
# Here give the name of the test serie
|
||||||
|
#
|
||||||
|
|
||||||
|
TEST_NAME=obipcr
|
||||||
|
CMD=obipcr
|
||||||
|
|
||||||
|
######
|
||||||
|
#
|
||||||
|
# Some variable and function definitions: please don't change them
|
||||||
|
#
|
||||||
|
######
|
||||||
|
TEST_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
|
||||||
|
OBITOOLS_DIR="${TEST_DIR/obitest*/}build"
|
||||||
|
export PATH="${OBITOOLS_DIR}:${PATH}"
|
||||||
|
|
||||||
|
MCMD="$(echo "${CMD:0:4}" | tr '[:lower:]' '[:upper:]')$(echo "${CMD:4}" | tr '[:upper:]' '[:lower:]')"
|
||||||
|
|
||||||
|
TMPDIR="$(mktemp -d)"
|
||||||
|
ntest=0
|
||||||
|
success=0
|
||||||
|
failed=0
|
||||||
|
|
||||||
|
cleanup() {
|
||||||
|
echo "========================================" 1>&2
|
||||||
|
echo "## Results of the $TEST_NAME tests:" 1>&2
|
||||||
|
|
||||||
|
echo 1>&2
|
||||||
|
echo "- $ntest tests run" 1>&2
|
||||||
|
echo "- $success successfully completed" 1>&2
|
||||||
|
echo "- $failed failed tests" 1>&2
|
||||||
|
echo 1>&2
|
||||||
|
echo "Cleaning up the temporary directory..." 1>&2
|
||||||
|
echo 1>&2
|
||||||
|
echo "========================================" 1>&2
|
||||||
|
|
||||||
|
rm -rf "$TMPDIR" # Suppress the temporary directory
|
||||||
|
|
||||||
|
if [ $failed -gt 0 ]; then
|
||||||
|
log "$TEST_NAME tests failed"
|
||||||
|
log
|
||||||
|
log
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
log
|
||||||
|
log
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
log() {
|
||||||
|
echo -e "[$TEST_NAME @ $(date)] $*" 1>&2
|
||||||
|
}
|
||||||
|
|
||||||
|
log "Testing $TEST_NAME..."
|
||||||
|
log "Test directory is $TEST_DIR"
|
||||||
|
log "obitools directory is $OBITOOLS_DIR"
|
||||||
|
log "Temporary directory is $TMPDIR"
|
||||||
|
log "files: $(find $TEST_DIR | awk -F'/' '{print $NF}' | tail -n +2)"
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
####
|
||||||
|
#### Below are the tests
|
||||||
|
####
|
||||||
|
#### Before each test :
|
||||||
|
#### - increment the variable ntest
|
||||||
|
####
|
||||||
|
#### Run the command as the condition of an if / then /else
|
||||||
|
#### - The command must return 0 on success
|
||||||
|
#### - The command must return an exit code different from 0 on failure
|
||||||
|
#### - The datafiles are stored in the same directory than the test script
|
||||||
|
#### - The test script directory is stored in the TEST_DIR variable
|
||||||
|
#### - If result files have to be produced they must be stored
|
||||||
|
#### in the temporary directory (TMPDIR variable)
|
||||||
|
####
|
||||||
|
#### then clause is executed on success of the command
|
||||||
|
#### - Write a success message using the log function
|
||||||
|
#### - increment the variable success
|
||||||
|
####
|
||||||
|
#### else clause is executed on failure of the command
|
||||||
|
#### - Write a failure message using the log function
|
||||||
|
#### - increment the variable failed
|
||||||
|
####
|
||||||
|
######################################################################
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
((ntest++))
|
||||||
|
if $CMD -h > "${TMPDIR}/help.txt" 2>&1
|
||||||
|
then
|
||||||
|
log "$MCMD: printing help OK"
|
||||||
|
((success++))
|
||||||
|
else
|
||||||
|
log "$MCMD: printing help failed"
|
||||||
|
((failed++))
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
#########################################
|
||||||
|
#
|
||||||
|
# At the end of the tests
|
||||||
|
# the cleanup function is called
|
||||||
|
#
|
||||||
|
#########################################
|
||||||
|
|
||||||
|
cleanup
|
||||||
109
obitests/obitools/obitaxonomy/test.sh
Executable file
109
obitests/obitools/obitaxonomy/test.sh
Executable file
@@ -0,0 +1,109 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#
|
||||||
|
# Here give the name of the test serie
|
||||||
|
#
|
||||||
|
|
||||||
|
TEST_NAME=obitaxonomy
|
||||||
|
CMD=obitaxonomy
|
||||||
|
|
||||||
|
######
|
||||||
|
#
|
||||||
|
# Some variable and function definitions: please don't change them
|
||||||
|
#
|
||||||
|
######
|
||||||
|
TEST_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
|
||||||
|
OBITOOLS_DIR="${TEST_DIR/obitest*/}build"
|
||||||
|
export PATH="${OBITOOLS_DIR}:${PATH}"
|
||||||
|
|
||||||
|
MCMD="$(echo "${CMD:0:4}" | tr '[:lower:]' '[:upper:]')$(echo "${CMD:4}" | tr '[:upper:]' '[:lower:]')"
|
||||||
|
|
||||||
|
TMPDIR="$(mktemp -d)"
|
||||||
|
ntest=0
|
||||||
|
success=0
|
||||||
|
failed=0
|
||||||
|
|
||||||
|
cleanup() {
|
||||||
|
echo "========================================" 1>&2
|
||||||
|
echo "## Results of the $TEST_NAME tests:" 1>&2
|
||||||
|
|
||||||
|
echo 1>&2
|
||||||
|
echo "- $ntest tests run" 1>&2
|
||||||
|
echo "- $success successfully completed" 1>&2
|
||||||
|
echo "- $failed failed tests" 1>&2
|
||||||
|
echo 1>&2
|
||||||
|
echo "Cleaning up the temporary directory..." 1>&2
|
||||||
|
echo 1>&2
|
||||||
|
echo "========================================" 1>&2
|
||||||
|
|
||||||
|
rm -rf "$TMPDIR" # Suppress the temporary directory
|
||||||
|
|
||||||
|
if [ $failed -gt 0 ]; then
|
||||||
|
log "$TEST_NAME tests failed"
|
||||||
|
log
|
||||||
|
log
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
log
|
||||||
|
log
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
log() {
|
||||||
|
echo -e "[$TEST_NAME @ $(date)] $*" 1>&2
|
||||||
|
}
|
||||||
|
|
||||||
|
log "Testing $TEST_NAME..."
|
||||||
|
log "Test directory is $TEST_DIR"
|
||||||
|
log "obitools directory is $OBITOOLS_DIR"
|
||||||
|
log "Temporary directory is $TMPDIR"
|
||||||
|
log "files: $(find $TEST_DIR | awk -F'/' '{print $NF}' | tail -n +2)"
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
####
|
||||||
|
#### Below are the tests
|
||||||
|
####
|
||||||
|
#### Before each test :
|
||||||
|
#### - increment the variable ntest
|
||||||
|
####
|
||||||
|
#### Run the command as the condition of an if / then /else
|
||||||
|
#### - The command must return 0 on success
|
||||||
|
#### - The command must return an exit code different from 0 on failure
|
||||||
|
#### - The datafiles are stored in the same directory than the test script
|
||||||
|
#### - The test script directory is stored in the TEST_DIR variable
|
||||||
|
#### - If result files have to be produced they must be stored
|
||||||
|
#### in the temporary directory (TMPDIR variable)
|
||||||
|
####
|
||||||
|
#### then clause is executed on success of the command
|
||||||
|
#### - Write a success message using the log function
|
||||||
|
#### - increment the variable success
|
||||||
|
####
|
||||||
|
#### else clause is executed on failure of the command
|
||||||
|
#### - Write a failure message using the log function
|
||||||
|
#### - increment the variable failed
|
||||||
|
####
|
||||||
|
######################################################################
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
((ntest++))
|
||||||
|
if $CMD -h > "${TMPDIR}/help.txt" 2>&1
|
||||||
|
then
|
||||||
|
log "$MCMD: printing help OK"
|
||||||
|
((success++))
|
||||||
|
else
|
||||||
|
log "$MCMD: printing help failed"
|
||||||
|
((failed++))
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
#########################################
|
||||||
|
#
|
||||||
|
# At the end of the tests
|
||||||
|
# the cleanup function is called
|
||||||
|
#
|
||||||
|
#########################################
|
||||||
|
|
||||||
|
cleanup
|
||||||
205
obitests/obitools/obiuniq/test.sh
Executable file
205
obitests/obitools/obiuniq/test.sh
Executable file
@@ -0,0 +1,205 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#
|
||||||
|
# Here give the name of the test serie
|
||||||
|
#
|
||||||
|
|
||||||
|
TEST_NAME=obiuniq
|
||||||
|
CMD=obiuniq
|
||||||
|
|
||||||
|
######
|
||||||
|
#
|
||||||
|
# Some variable and function definitions: please don't change them
|
||||||
|
#
|
||||||
|
######
|
||||||
|
TEST_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
|
||||||
|
OBITOOLS_DIR="${TEST_DIR/obitest*/}build"
|
||||||
|
export PATH="${OBITOOLS_DIR}:${PATH}"
|
||||||
|
|
||||||
|
MCMD="$(echo "${CMD:0:4}" | tr '[:lower:]' '[:upper:]')$(echo "${CMD:4}" | tr '[:upper:]' '[:lower:]')"
|
||||||
|
|
||||||
|
TMPDIR="$(mktemp -d)"
|
||||||
|
ntest=0
|
||||||
|
success=0
|
||||||
|
failed=0
|
||||||
|
|
||||||
|
cleanup() {
|
||||||
|
echo "========================================" 1>&2
|
||||||
|
echo "## Results of the $TEST_NAME tests:" 1>&2
|
||||||
|
|
||||||
|
echo 1>&2
|
||||||
|
echo "- $ntest tests run" 1>&2
|
||||||
|
echo "- $success successfully completed" 1>&2
|
||||||
|
echo "- $failed failed tests" 1>&2
|
||||||
|
echo 1>&2
|
||||||
|
echo "Cleaning up the temporary directory..." 1>&2
|
||||||
|
echo 1>&2
|
||||||
|
echo "========================================" 1>&2
|
||||||
|
|
||||||
|
rm -rf "$TMPDIR" # Suppress the temporary directory
|
||||||
|
|
||||||
|
if [ $failed -gt 0 ]; then
|
||||||
|
log "$TEST_NAME tests failed"
|
||||||
|
log
|
||||||
|
log
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
log
|
||||||
|
log
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
log() {
|
||||||
|
echo -e "[$TEST_NAME @ $(date)] $*" 1>&2
|
||||||
|
}
|
||||||
|
|
||||||
|
log "Testing $TEST_NAME..."
|
||||||
|
log "Test directory is $TEST_DIR"
|
||||||
|
log "obitools directory is $OBITOOLS_DIR"
|
||||||
|
log "Temporary directory is $TMPDIR"
|
||||||
|
log "files: $(find $TEST_DIR | awk -F'/' '{print $NF}' | tail -n +2)"
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
####
|
||||||
|
#### Below are the tests
|
||||||
|
####
|
||||||
|
#### Before each test :
|
||||||
|
#### - increment the variable ntest
|
||||||
|
####
|
||||||
|
#### Run the command as the condition of an if / then /else
|
||||||
|
#### - The command must return 0 on success
|
||||||
|
#### - The command must return an exit code different from 0 on failure
|
||||||
|
#### - The datafiles are stored in the same directory than the test script
|
||||||
|
#### - The test script directory is stored in the TEST_DIR variable
|
||||||
|
#### - If result files have to be produced they must be stored
|
||||||
|
#### in the temporary directory (TMPDIR variable)
|
||||||
|
####
|
||||||
|
#### then clause is executed on success of the command
|
||||||
|
#### - Write a success message using the log function
|
||||||
|
#### - increment the variable success
|
||||||
|
####
|
||||||
|
#### else clause is executed on failure of the command
|
||||||
|
#### - Write a failure message using the log function
|
||||||
|
#### - increment the variable failed
|
||||||
|
####
|
||||||
|
######################################################################
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
((ntest++))
|
||||||
|
if $CMD -h > "${TMPDIR}/help.txt" 2>&1
|
||||||
|
then
|
||||||
|
log "$MCMD: printing help OK"
|
||||||
|
((success++))
|
||||||
|
else
|
||||||
|
log "$MCMD: printing help failed"
|
||||||
|
((failed++))
|
||||||
|
fi
|
||||||
|
|
||||||
|
((ntest++))
|
||||||
|
if obiuniq "${TEST_DIR}/touniq.fasta" \
|
||||||
|
> "${TMPDIR}/touniq_u.fasta"
|
||||||
|
then
|
||||||
|
log "OBIUniq simple: running OK"
|
||||||
|
((success++))
|
||||||
|
else
|
||||||
|
log "OBIUniq simple: running failed"
|
||||||
|
((failed++))
|
||||||
|
fi
|
||||||
|
|
||||||
|
obicsv -s --auto ${TEST_DIR}/touniq_u.fasta \
|
||||||
|
| tail -n +2 \
|
||||||
|
| sort \
|
||||||
|
> "${TMPDIR}/touniq_u_ref.csv"
|
||||||
|
|
||||||
|
obicsv -s --auto ${TMPDIR}/touniq_u.fasta \
|
||||||
|
| tail -n +2 \
|
||||||
|
| sort \
|
||||||
|
> "${TMPDIR}/touniq_u.csv"
|
||||||
|
|
||||||
|
((ntest++))
|
||||||
|
if diff "${TMPDIR}/touniq_u_ref.csv" \
|
||||||
|
"${TMPDIR}/touniq_u.csv" > /dev/null
|
||||||
|
then
|
||||||
|
log "OBIUniq simple: result OK"
|
||||||
|
((success++))
|
||||||
|
else
|
||||||
|
log "OBIUniq simple: result failed"
|
||||||
|
((failed++))
|
||||||
|
fi
|
||||||
|
|
||||||
|
((ntest++))
|
||||||
|
if obiuniq -c a "${TEST_DIR}/touniq.fasta" \
|
||||||
|
> "${TMPDIR}/touniq_u_a.fasta"
|
||||||
|
then
|
||||||
|
log "OBIUniq one category: running OK"
|
||||||
|
((success++))
|
||||||
|
else
|
||||||
|
log "OBIUniq one category: running failed"
|
||||||
|
((failed++))
|
||||||
|
fi
|
||||||
|
|
||||||
|
obicsv -s --auto ${TEST_DIR}/touniq_u_a.fasta \
|
||||||
|
| tail -n +2 \
|
||||||
|
| sort \
|
||||||
|
> "${TMPDIR}/touniq_u_a_ref.csv"
|
||||||
|
|
||||||
|
obicsv -s --auto ${TMPDIR}/touniq_u_a.fasta \
|
||||||
|
| tail -n +2 \
|
||||||
|
| sort \
|
||||||
|
> "${TMPDIR}/touniq_u_a.csv"
|
||||||
|
|
||||||
|
|
||||||
|
((ntest++))
|
||||||
|
if diff "${TMPDIR}/touniq_u_a_ref.csv" \
|
||||||
|
"${TMPDIR}/touniq_u_a.csv" > /dev/null
|
||||||
|
then
|
||||||
|
log "OBIUniq one category: result OK"
|
||||||
|
((success++))
|
||||||
|
else
|
||||||
|
log "OBIUniq one category: result failed"
|
||||||
|
((failed++))
|
||||||
|
fi
|
||||||
|
|
||||||
|
((ntest++))
|
||||||
|
if obiuniq -c a -c b "${TEST_DIR}/touniq.fasta" \
|
||||||
|
> "${TMPDIR}/touniq_u_a_b.fasta"
|
||||||
|
then
|
||||||
|
log "OBIUniq two categories: running OK"
|
||||||
|
((success++))
|
||||||
|
else
|
||||||
|
log "OBIUniq two categories: running failed"
|
||||||
|
((failed++))
|
||||||
|
fi
|
||||||
|
|
||||||
|
obicsv -s --auto ${TEST_DIR}/touniq_u_a_b.fasta \
|
||||||
|
| tail -n +2 \
|
||||||
|
| sort \
|
||||||
|
> "${TMPDIR}/touniq_u_a_b_ref.csv"
|
||||||
|
|
||||||
|
obicsv -s --auto ${TMPDIR}/touniq_u_a_b.fasta \
|
||||||
|
| tail -n +2 \
|
||||||
|
| sort \
|
||||||
|
> "${TMPDIR}/touniq_u_a_b.csv"
|
||||||
|
|
||||||
|
((ntest++))
|
||||||
|
if diff "${TMPDIR}/touniq_u_a_b_ref.csv" \
|
||||||
|
"${TMPDIR}/touniq_u_a_b.csv" > /dev/null
|
||||||
|
then
|
||||||
|
log "OBIUniq two categories: result OK"
|
||||||
|
((success++))
|
||||||
|
else
|
||||||
|
log "OBIUniq two categories: result failed"
|
||||||
|
((failed++))
|
||||||
|
fi
|
||||||
|
|
||||||
|
#########################################
|
||||||
|
#
|
||||||
|
# At the end of the tests
|
||||||
|
# the cleanup function is called
|
||||||
|
#
|
||||||
|
#########################################
|
||||||
|
|
||||||
|
cleanup
|
||||||
16
obitests/obitools/obiuniq/touniq.fasta
Normal file
16
obitests/obitools/obiuniq/touniq.fasta
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
>seq1 {"a":2, "b":4,"c":5}
|
||||||
|
aaacccgggttt
|
||||||
|
>seq2 {"a":3, "b":4,"c":5}
|
||||||
|
aaacccgggttt
|
||||||
|
>seq3 {"a":3, "b":5,"c":5}
|
||||||
|
aaacccgggttt
|
||||||
|
>seq4 {"a":3, "b":5,"c":6}
|
||||||
|
aaacccgggttt
|
||||||
|
>seq5 {"a":2, "b":4,"c":5}
|
||||||
|
aaacccgggtttca
|
||||||
|
>seq6 {"a":3, "b":4,"c":5}
|
||||||
|
aaacccgggtttca
|
||||||
|
>seq7 {"a":3, "b":5,"c":5}
|
||||||
|
aaacccgggtttca
|
||||||
|
>seq8 {"a":3, "b":5,"c":6}
|
||||||
|
aaacccgggtttca
|
||||||
4
obitests/obitools/obiuniq/touniq_u.fasta
Normal file
4
obitests/obitools/obiuniq/touniq_u.fasta
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
>seq5 {"count":4}
|
||||||
|
aaacccgggtttca
|
||||||
|
>seq1 {"count":4}
|
||||||
|
aaacccgggttt
|
||||||
8
obitests/obitools/obiuniq/touniq_u_a.fasta
Normal file
8
obitests/obitools/obiuniq/touniq_u_a.fasta
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
>seq5 {"a":2,"b":4,"c":5,"count":1}
|
||||||
|
aaacccgggtttca
|
||||||
|
>seq6 {"a":3,"count":3}
|
||||||
|
aaacccgggtttca
|
||||||
|
>seq1 {"a":2,"b":4,"c":5,"count":1}
|
||||||
|
aaacccgggttt
|
||||||
|
>seq2 {"a":3,"count":3}
|
||||||
|
aaacccgggttt
|
||||||
12
obitests/obitools/obiuniq/touniq_u_a_b.fasta
Normal file
12
obitests/obitools/obiuniq/touniq_u_a_b.fasta
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
>seq5 {"a":2,"b":4,"c":5,"count":1}
|
||||||
|
aaacccgggtttca
|
||||||
|
>seq6 {"a":3,"b":4,"c":5,"count":1}
|
||||||
|
aaacccgggtttca
|
||||||
|
>seq7 {"a":3,"b":5,"count":2}
|
||||||
|
aaacccgggtttca
|
||||||
|
>seq1 {"a":2,"b":4,"c":5,"count":1}
|
||||||
|
aaacccgggttt
|
||||||
|
>seq2 {"a":3,"b":4,"c":5,"count":1}
|
||||||
|
aaacccgggttt
|
||||||
|
>seq3 {"a":3,"b":5,"count":2}
|
||||||
|
aaacccgggttt
|
||||||
@@ -10,6 +10,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiutils"
|
||||||
)
|
)
|
||||||
|
|
||||||
// // A pool of byte slices.
|
// // A pool of byte slices.
|
||||||
@@ -158,12 +159,30 @@ func BuildQualityConsensus(seqA, seqB *obiseq.BioSequence, path []int, statOnMis
|
|||||||
|
|
||||||
match := 0
|
match := 0
|
||||||
|
|
||||||
|
left := obiutils.Abs(path[0])
|
||||||
|
right := 0
|
||||||
|
if path[len(path)-1] == 0 {
|
||||||
|
right = path[len(path)-2]
|
||||||
|
}
|
||||||
|
|
||||||
|
right = obiutils.Abs(right)
|
||||||
|
|
||||||
|
right = len(*bufferQA) - right
|
||||||
|
|
||||||
|
// obilog.Warnf("BuildQualityConsensus: left = %d right = %d\n", left, right)
|
||||||
|
|
||||||
for i, qA = range *bufferQA {
|
for i, qA = range *bufferQA {
|
||||||
nA := (*bufferSA)[i]
|
nA := (*bufferSA)[i]
|
||||||
nB := (*bufferSB)[i]
|
nB := (*bufferSB)[i]
|
||||||
qB = (*bufferQB)[i]
|
qB = (*bufferQB)[i]
|
||||||
|
|
||||||
if statOnMismatch && nA != nB && nA != ' ' && nB != ' ' {
|
if statOnMismatch && i >= left && i < right && nA != nB {
|
||||||
|
if nA == ' ' {
|
||||||
|
nA = '-'
|
||||||
|
}
|
||||||
|
if nB == ' ' {
|
||||||
|
nB = '-'
|
||||||
|
}
|
||||||
mismatches[strings.ToUpper(fmt.Sprintf("(%c:%02d)->(%c:%02d)", nA, qA, nB, qB))] = i + 1
|
mismatches[strings.ToUpper(fmt.Sprintf("(%c:%02d)->(%c:%02d)", nA, qA, nB, qB))] = i + 1
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -183,13 +202,12 @@ func BuildQualityConsensus(seqA, seqB *obiseq.BioSequence, path []int, statOnMis
|
|||||||
|
|
||||||
q := qA + qB
|
q := qA + qB
|
||||||
|
|
||||||
if qA > 0 && qB > 0 {
|
if nA != nB {
|
||||||
if nA != nB {
|
q = qM - byte(math.Log10(1-math.Pow(10, -float64(qm)/40))*10+0.5)
|
||||||
q = qM - byte(math.Log10(1-math.Pow(10, -float64(qm)/30))*10+0.5)
|
}
|
||||||
}
|
|
||||||
if nA == nB {
|
if nA == nB {
|
||||||
match++
|
match++
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if q > 90 {
|
if q > 90 {
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ func _Backtracking(pathMatrix []int, lseqA, lseqB int, path *[]int) []int {
|
|||||||
cp := cap(*path)
|
cp := cap(*path)
|
||||||
(*path) = slices.Grow((*path), needed)
|
(*path) = slices.Grow((*path), needed)
|
||||||
if cp < cap(*path) {
|
if cp < cap(*path) {
|
||||||
log.Infof("Resized path from %d to %d\n", cp, cap(*path))
|
log.Debugf("Resized path from %d to %d\n", cp, cap(*path))
|
||||||
}
|
}
|
||||||
p := cap(*path)
|
p := cap(*path)
|
||||||
*path = (*path)[:p]
|
*path = (*path)[:p]
|
||||||
|
|||||||
@@ -74,6 +74,30 @@ func _Logaddexp(a, b float64) float64 {
|
|||||||
return b + math.Log1p(math.Exp(a-b))
|
return b + math.Log1p(math.Exp(a-b))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func _Log1mexp(a float64) float64 {
|
||||||
|
if a > 0 {
|
||||||
|
log.Panic("Log1mexp: a > 0")
|
||||||
|
}
|
||||||
|
|
||||||
|
if a == 0 {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
return (math.Log(-math.Expm1(a)))
|
||||||
|
}
|
||||||
|
|
||||||
|
func _Logdiffexp(a, b float64) float64 {
|
||||||
|
if a < b {
|
||||||
|
log.Panic("Log1mexp: a < b")
|
||||||
|
}
|
||||||
|
|
||||||
|
if a == b {
|
||||||
|
return math.Inf(-1)
|
||||||
|
}
|
||||||
|
|
||||||
|
return a + _Log1mexp(b-a)
|
||||||
|
}
|
||||||
|
|
||||||
// _MatchScoreRatio calculates the match score ratio between two bytes.
|
// _MatchScoreRatio calculates the match score ratio between two bytes.
|
||||||
//
|
//
|
||||||
// Parameters:
|
// Parameters:
|
||||||
@@ -83,25 +107,25 @@ func _Logaddexp(a, b float64) float64 {
|
|||||||
// Returns:
|
// Returns:
|
||||||
// - float64: the match score ratio when a match is observed
|
// - float64: the match score ratio when a match is observed
|
||||||
// - float64: the match score ratio when a mismatch is observed
|
// - float64: the match score ratio when a mismatch is observed
|
||||||
func _MatchScoreRatio(a, b byte) (float64, float64) {
|
func _MatchScoreRatio(QF, QR byte) (float64, float64) {
|
||||||
|
|
||||||
l2 := math.Log(2)
|
|
||||||
l3 := math.Log(3)
|
l3 := math.Log(3)
|
||||||
|
l4 := math.Log(4)
|
||||||
l10 := math.Log(10)
|
l10 := math.Log(10)
|
||||||
lalea := math.Log(4) // 1 /(change of the random model)
|
qF := -float64(QF) / 10 * l10
|
||||||
lE1 := -float64(a)/10*l10 - l3 // log proba of sequencing error on A/3
|
qR := -float64(QR) / 10 * l10
|
||||||
lE2 := -float64(b)/10*l10 - l3 // log proba of sequencing error on B/3
|
term1 := _Logaddexp(qF, qR)
|
||||||
lO1 := math.Log1p(-math.Exp(lE1 + l3)) // log proba no being an error on A
|
term2 := _Logdiffexp(term1, qF+qR)
|
||||||
lO2 := math.Log1p(-math.Exp(lE2 + l3)) // log proba no being an error on B
|
|
||||||
lO1O2 := lO1 + lO2
|
|
||||||
lE1E2 := lE1 + lE2
|
|
||||||
lO1E2 := lO1 + lE2
|
|
||||||
lO2E1 := lO2 + lE1
|
|
||||||
|
|
||||||
MM := _Logaddexp(lO1O2, lE1E2+l3) // Proba match when match observed
|
// obilog.Warnf("MatchScoreRatio: %v, %v , %v, %v", QF, QR, term1, term2)
|
||||||
Mm := _Logaddexp(_Logaddexp(lO1E2, lO2E1), lE1E2+l2) // Proba match when mismatch observed
|
|
||||||
|
|
||||||
return MM + lalea, Mm + lalea
|
match_logp := _Log1mexp(term2 + l3 - l4)
|
||||||
|
match_score := match_logp - _Log1mexp(match_logp)
|
||||||
|
|
||||||
|
mismatch_logp := term2 - l4
|
||||||
|
mismatch_score := mismatch_logp - _Log1mexp(mismatch_logp)
|
||||||
|
|
||||||
|
return match_score, mismatch_score
|
||||||
}
|
}
|
||||||
|
|
||||||
func _InitNucPartMatch() {
|
func _InitNucPartMatch() {
|
||||||
|
|||||||
@@ -21,15 +21,15 @@ func encodeValues(score, length int, out bool) uint64 {
|
|||||||
return fo
|
return fo
|
||||||
}
|
}
|
||||||
|
|
||||||
func _isout(value uint64) bool {
|
// func _isout(value uint64) bool {
|
||||||
const outmask = uint64(1) << dwsize
|
// const outmask = uint64(1) << dwsize
|
||||||
return (value & outmask) == 0
|
// return (value & outmask) == 0
|
||||||
}
|
// }
|
||||||
|
|
||||||
func _lpath(value uint64) int {
|
// func _lpath(value uint64) int {
|
||||||
const mask = uint64(1<<wsize) - 1
|
// const mask = uint64(1<<wsize) - 1
|
||||||
return int(((value + 1) ^ mask) & mask)
|
// return int(((value + 1) ^ mask) & mask)
|
||||||
}
|
// }
|
||||||
|
|
||||||
func decodeValues(value uint64) (int, int, bool) {
|
func decodeValues(value uint64) (int, int, bool) {
|
||||||
const mask = uint64(1<<wsize) - 1
|
const mask = uint64(1<<wsize) - 1
|
||||||
@@ -57,4 +57,3 @@ func _setout(value uint64) uint64 {
|
|||||||
var _empty = encodeValues(0, 0, false)
|
var _empty = encodeValues(0, 0, false)
|
||||||
var _out = encodeValues(0, 30000, true)
|
var _out = encodeValues(0, 30000, true)
|
||||||
var _notavail = encodeValues(0, 30000, false)
|
var _notavail = encodeValues(0, 30000, false)
|
||||||
|
|
||||||
|
|||||||
@@ -4,33 +4,6 @@ import (
|
|||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _iupac = [26]byte{
|
|
||||||
// a b c d e f
|
|
||||||
1, 14, 2, 13, 0, 0,
|
|
||||||
// g h i j k l
|
|
||||||
4, 11, 0, 0, 12, 0,
|
|
||||||
// m n o p q r
|
|
||||||
3, 15, 0, 0, 0, 5,
|
|
||||||
// s t u v w x
|
|
||||||
6, 8, 8, 13, 9, 0,
|
|
||||||
// y z
|
|
||||||
10, 0,
|
|
||||||
}
|
|
||||||
|
|
||||||
func _samenuc(a, b byte) bool {
|
|
||||||
if (a >= 'A') && (a <= 'Z') {
|
|
||||||
a |= 32
|
|
||||||
}
|
|
||||||
if (b >= 'A') && (b <= 'Z') {
|
|
||||||
b |= 32
|
|
||||||
}
|
|
||||||
|
|
||||||
if (a >= 'a') && (a <= 'z') && (b >= 'a') && (b <= 'z') {
|
|
||||||
return (_iupac[a-'a'] & _iupac[b-'a']) > 0
|
|
||||||
}
|
|
||||||
return a == b
|
|
||||||
}
|
|
||||||
|
|
||||||
// FastLCSEGFScoreByte calculates the score of the Longest Common Subsequence (LCS) between two byte slices.
|
// FastLCSEGFScoreByte calculates the score of the Longest Common Subsequence (LCS) between two byte slices.
|
||||||
//
|
//
|
||||||
// The score is calculated using the following scoring matrix:
|
// The score is calculated using the following scoring matrix:
|
||||||
@@ -165,7 +138,7 @@ func FastLCSEGFScoreByte(bA, bB []byte, maxError int, endgapfree bool, buffer *[
|
|||||||
default:
|
default:
|
||||||
// We are in the middle of the matrix
|
// We are in the middle of the matrix
|
||||||
Sdiag = _incpath(previous[x])
|
Sdiag = _incpath(previous[x])
|
||||||
if _samenuc(bA[j-1], bB[i-1]) {
|
if obiseq.SameIUPACNuc(bA[j-1], bB[i-1]) {
|
||||||
Sdiag = _incscore(Sdiag)
|
Sdiag = _incscore(Sdiag)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -265,7 +238,7 @@ func FastLCSEGFScoreByte(bA, bB []byte, maxError int, endgapfree bool, buffer *[
|
|||||||
Sleft = _notavail
|
Sleft = _notavail
|
||||||
default:
|
default:
|
||||||
Sdiag = _incpath(previous[x])
|
Sdiag = _incpath(previous[x])
|
||||||
if _samenuc(bA[j-1], bB[i-1]) {
|
if obiseq.SameIUPACNuc(bA[j-1], bB[i-1]) {
|
||||||
Sdiag = _incscore(Sdiag)
|
Sdiag = _incscore(Sdiag)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,38 +1,86 @@
|
|||||||
package obialign
|
package obialign
|
||||||
|
|
||||||
|
import (
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
||||||
|
log "github.com/sirupsen/logrus"
|
||||||
|
)
|
||||||
|
|
||||||
|
// buffIndex converts a pair of coordinates (i, j) into a linear index in a matrix
|
||||||
|
// of size width x width. The coordinates are (-1)-indexed, and the linear index
|
||||||
|
// is 0-indexed as well. The function first adds 1 to both coordinates to make
|
||||||
|
// sure the (-1,-1) coordinate is at position 0 in the matrix, and then computes
|
||||||
|
// the linear index by multiplying the first coordinate by the width and adding
|
||||||
|
// the second coordinate.
|
||||||
func buffIndex(i, j, width int) int {
|
func buffIndex(i, j, width int) int {
|
||||||
return (i+1)*width + (j + 1)
|
return (i+1)*width + (j + 1)
|
||||||
}
|
}
|
||||||
func LocatePattern(pattern, sequence []byte) (int, int, int) {
|
|
||||||
|
// LocatePattern is a function to locate a pattern in a sequence.
|
||||||
|
//
|
||||||
|
// It uses a dynamic programming approach to build a matrix of scores.
|
||||||
|
// The score at each cell is the maximum of the score of the cell
|
||||||
|
// above it (representing a deletion), the score of the cell to its
|
||||||
|
// left (representing an insertion), and the score of the cell
|
||||||
|
// diagonally above it (representing a match).
|
||||||
|
//
|
||||||
|
// The score of a match is 0 if the two characters are the same,
|
||||||
|
// and -1 if they are different.
|
||||||
|
//
|
||||||
|
// The function returns the start and end positions of the best
|
||||||
|
// match, as well as the number of errors in the best match.
|
||||||
|
func LocatePattern(id string, pattern, sequence []byte) (int, int, int) {
|
||||||
|
|
||||||
|
if len(pattern) >= len(sequence) {
|
||||||
|
log.Panicf("Sequence %s:Pattern %s must be shorter than sequence %s", id, pattern, sequence)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Pattern spreads over the columns
|
||||||
|
// Sequence spreads over the rows
|
||||||
width := len(pattern) + 1
|
width := len(pattern) + 1
|
||||||
buffsize := (len(pattern) + 1) * (len(sequence) + 1)
|
buffsize := (len(pattern) + 1) * (len(sequence) + 1)
|
||||||
buffer := make([]int, buffsize)
|
buffer := make([]int, buffsize)
|
||||||
|
|
||||||
|
// The path matrix keeps track of the best path through the matrix
|
||||||
|
// 0 : indicate the diagonal path
|
||||||
|
// 1 : indicate the up path
|
||||||
|
// -1 : indicate the left path
|
||||||
path := make([]int, buffsize)
|
path := make([]int, buffsize)
|
||||||
|
|
||||||
|
// Initialize the first row of the matrix
|
||||||
for j := 0; j < len(pattern); j++ {
|
for j := 0; j < len(pattern); j++ {
|
||||||
idx := buffIndex(-1, j, width)
|
idx := buffIndex(-1, j, width)
|
||||||
buffer[idx] = -j - 1
|
buffer[idx] = -j - 1
|
||||||
path[idx] = -1
|
path[idx] = -1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Initialize the first column of the matrix
|
||||||
|
// Alignment is endgap free so first column = 0
|
||||||
|
// to allow primer to shift freely along the sequence
|
||||||
for i := -1; i < len(sequence); i++ {
|
for i := -1; i < len(sequence); i++ {
|
||||||
idx := buffIndex(i, -1, width)
|
idx := buffIndex(i, -1, width)
|
||||||
buffer[idx] = 0
|
buffer[idx] = 0
|
||||||
path[idx] = +1
|
path[idx] = +1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Fills the matrix except the last column
|
||||||
|
// where gaps must be free too.
|
||||||
path[0] = 0
|
path[0] = 0
|
||||||
jmax := len(pattern) - 1
|
jmax := len(pattern) - 1
|
||||||
for i := 0; i < len(sequence); i++ {
|
for i := 0; i < len(sequence); i++ {
|
||||||
for j := 0; j < jmax; j++ {
|
for j := 0; j < jmax; j++ {
|
||||||
|
|
||||||
|
// Mismatch score = -1
|
||||||
|
// Match score = 0
|
||||||
match := -1
|
match := -1
|
||||||
if _samenuc(pattern[j], sequence[i]) {
|
if obiseq.SameIUPACNuc(pattern[j], sequence[i]) {
|
||||||
match = 0
|
match = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
idx := buffIndex(i, j, width)
|
idx := buffIndex(i, j, width)
|
||||||
|
|
||||||
diag := buffer[buffIndex(i-1, j-1, width)] + match
|
diag := buffer[buffIndex(i-1, j-1, width)] + match
|
||||||
|
|
||||||
|
// Each gap cost -1
|
||||||
left := buffer[buffIndex(i, j-1, width)] - 1
|
left := buffer[buffIndex(i, j-1, width)] - 1
|
||||||
up := buffer[buffIndex(i-1, j, width)] - 1
|
up := buffer[buffIndex(i-1, j, width)] - 1
|
||||||
|
|
||||||
@@ -51,11 +99,14 @@ func LocatePattern(pattern, sequence []byte) (int, int, int) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Fills the last column considering the free up gap
|
||||||
for i := 0; i < len(sequence); i++ {
|
for i := 0; i < len(sequence); i++ {
|
||||||
idx := buffIndex(i, jmax, width)
|
idx := buffIndex(i, jmax, width)
|
||||||
|
|
||||||
|
// Mismatch score = -1
|
||||||
|
// Match score = 0
|
||||||
match := -1
|
match := -1
|
||||||
if _samenuc(pattern[jmax], sequence[i]) {
|
if obiseq.SameIUPACNuc(pattern[jmax], sequence[i]) {
|
||||||
match = 0
|
match = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,6 +116,7 @@ func LocatePattern(pattern, sequence []byte) (int, int, int) {
|
|||||||
|
|
||||||
score := max(diag, up, left)
|
score := max(diag, up, left)
|
||||||
buffer[idx] = score
|
buffer[idx] = score
|
||||||
|
|
||||||
switch {
|
switch {
|
||||||
case score == left:
|
case score == left:
|
||||||
path[idx] = -1
|
path[idx] = -1
|
||||||
@@ -75,11 +127,13 @@ func LocatePattern(pattern, sequence []byte) (int, int, int) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Bactracking of the aligment
|
||||||
|
|
||||||
i := len(sequence) - 1
|
i := len(sequence) - 1
|
||||||
j := jmax
|
j := jmax
|
||||||
end := -1
|
end := -1
|
||||||
lali := 0
|
lali := 0
|
||||||
for i > -1 && j > 0 {
|
for j > 0 { // C'était i > -1 && j > 0
|
||||||
lali++
|
lali++
|
||||||
switch path[buffIndex(i, j, width)] {
|
switch path[buffIndex(i, j, width)] {
|
||||||
case 0:
|
case 0:
|
||||||
@@ -100,5 +154,9 @@ func LocatePattern(pattern, sequence []byte) (int, int, int) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// obilog.Warnf("from : %d to: %d error: %d match: %v",
|
||||||
|
// i, end+1, -buffer[buffIndex(len(sequence)-1, len(pattern)-1, width)],
|
||||||
|
// string(sequence[i:(end+1)]))
|
||||||
return i, end + 1, -buffer[buffIndex(len(sequence)-1, len(pattern)-1, width)]
|
return i, end + 1, -buffer[buffIndex(len(sequence)-1, len(pattern)-1, width)]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package obialign
|
package obialign
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"log"
|
||||||
|
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obikmer"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obikmer"
|
||||||
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
||||||
)
|
)
|
||||||
@@ -313,6 +315,105 @@ func _FillMatrixPeRightAlign(seqA, qualA, seqB, qualB []byte, gap, scale float64
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Gaps at the beginning and at the end of seqA are free
|
||||||
|
// With seqA spanning over lines and seqB over columns
|
||||||
|
//
|
||||||
|
// SeqA must be the longer sequence. If that constraint is not
|
||||||
|
// respected, the function will panic.
|
||||||
|
//
|
||||||
|
// TO BE FINISHED
|
||||||
|
// - First column gap = 0
|
||||||
|
// - Last column gaps = 0
|
||||||
|
//
|
||||||
|
// Paths are encoded :
|
||||||
|
// - 0 : for diagonal
|
||||||
|
// - -1 : for top
|
||||||
|
// - +1 : for left
|
||||||
|
func _FillMatrixPeCenterAlign(seqA, qualA, seqB, qualB []byte, gap, scale float64,
|
||||||
|
scoreMatrix, pathMatrix *[]int) int {
|
||||||
|
|
||||||
|
la := len(seqA)
|
||||||
|
lb := len(seqB)
|
||||||
|
|
||||||
|
if len(seqA) < len(seqB) {
|
||||||
|
log.Panicf("len(seqA) < len(seqB) : %d < %d", len(seqA), len(seqB))
|
||||||
|
}
|
||||||
|
|
||||||
|
// The actual gap score is the gap score times the mismatch between
|
||||||
|
// two bases with a score of 40
|
||||||
|
gapPenalty := int(scale*gap*float64(_NucScorePartMatchMismatch[40][40]) + 0.5)
|
||||||
|
|
||||||
|
needed := (la + 1) * (lb + 1)
|
||||||
|
|
||||||
|
if needed > cap(*scoreMatrix) {
|
||||||
|
*scoreMatrix = make([]int, needed)
|
||||||
|
}
|
||||||
|
|
||||||
|
if needed > cap(*pathMatrix) {
|
||||||
|
*pathMatrix = make([]int, needed)
|
||||||
|
}
|
||||||
|
|
||||||
|
*scoreMatrix = (*scoreMatrix)[:needed]
|
||||||
|
*pathMatrix = (*pathMatrix)[:needed]
|
||||||
|
|
||||||
|
// Sets the first position of the matrix with 0 score
|
||||||
|
_SetMatrices(scoreMatrix, pathMatrix, la, -1, -1, 0, 0)
|
||||||
|
|
||||||
|
// Fills the first column with score 0
|
||||||
|
for i := 0; i < la; i++ {
|
||||||
|
_SetMatrices(scoreMatrix, pathMatrix, la, i, -1, 0, -1)
|
||||||
|
}
|
||||||
|
|
||||||
|
// la1 := la - 1 // Except the last line (gaps are free on it)
|
||||||
|
lb1 := lb - 1 // Except the last column (gaps are free on it)
|
||||||
|
|
||||||
|
for j := 0; j < lb1; j++ {
|
||||||
|
|
||||||
|
// Fill the first line with scores corresponding to a set of gaps
|
||||||
|
_SetMatrices(scoreMatrix, pathMatrix, la, -1, j, (j+1)*gapPenalty, 1)
|
||||||
|
|
||||||
|
for i := 0; i < la; i++ {
|
||||||
|
left, diag, top := _GetMatrixFrom(scoreMatrix, la, i, j)
|
||||||
|
// log.Infof("LA: i : %d j : %d left : %d diag : %d top : %d\n", i, j, left, diag, top)
|
||||||
|
|
||||||
|
diag += _PairingScorePeAlign(seqA[i], qualA[i], seqB[j], qualB[j], scale)
|
||||||
|
left += gapPenalty
|
||||||
|
top += gapPenalty
|
||||||
|
|
||||||
|
switch {
|
||||||
|
case diag >= left && diag >= top:
|
||||||
|
_SetMatrices(scoreMatrix, pathMatrix, la, i, j, diag, 0)
|
||||||
|
case left >= diag && left >= top:
|
||||||
|
_SetMatrices(scoreMatrix, pathMatrix, la, i, j, left, +1)
|
||||||
|
default:
|
||||||
|
_SetMatrices(scoreMatrix, pathMatrix, la, i, j, top, -1)
|
||||||
|
}
|
||||||
|
// log.Infof("LA: i : %d j : %d left : %d diag : %d top : %d [%d]\n", i, j, left, diag, top, _GetMatrix(scoreMatrix, la, i, j))
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
for i := 0; i < la; i++ {
|
||||||
|
left, diag, top := _GetMatrixFrom(scoreMatrix, la, i, lb1)
|
||||||
|
// log.Infof("LA: i : %d j : %d left : %d diag : %d top : %d\n", i, j, left, diag, top)
|
||||||
|
|
||||||
|
diag += _PairingScorePeAlign(seqA[i], qualA[i], seqB[lb1], qualB[lb1], scale)
|
||||||
|
left += gapPenalty
|
||||||
|
|
||||||
|
switch {
|
||||||
|
case diag >= left && diag >= top:
|
||||||
|
_SetMatrices(scoreMatrix, pathMatrix, la, i, lb1, diag, 0)
|
||||||
|
case left >= diag && left >= top:
|
||||||
|
_SetMatrices(scoreMatrix, pathMatrix, la, i, lb1, left, +1)
|
||||||
|
default:
|
||||||
|
_SetMatrices(scoreMatrix, pathMatrix, la, i, lb1, top, -1)
|
||||||
|
}
|
||||||
|
// log.Infof("LA: i : %d j : %d left : %d diag : %d top : %d [%d]\n", i, j, left, diag, top, _GetMatrix(scoreMatrix, la, i, j))
|
||||||
|
}
|
||||||
|
|
||||||
|
return _GetMatrix(scoreMatrix, la, la-1, lb1)
|
||||||
|
}
|
||||||
|
|
||||||
func PELeftAlign(seqA, seqB *obiseq.BioSequence, gap, scale float64,
|
func PELeftAlign(seqA, seqB *obiseq.BioSequence, gap, scale float64,
|
||||||
arena PEAlignArena) (int, []int) {
|
arena PEAlignArena) (int, []int) {
|
||||||
|
|
||||||
@@ -359,9 +460,33 @@ func PERightAlign(seqA, seqB *obiseq.BioSequence, gap, scale float64,
|
|||||||
return score, path
|
return score, path
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func PECenterAlign(seqA, seqB *obiseq.BioSequence, gap, scale float64,
|
||||||
|
arena PEAlignArena) (int, []int) {
|
||||||
|
|
||||||
|
if !_InitializedDnaScore {
|
||||||
|
_InitDNAScoreMatrix()
|
||||||
|
}
|
||||||
|
|
||||||
|
if arena.pointer == nil {
|
||||||
|
arena = MakePEAlignArena(seqA.Len(), seqB.Len())
|
||||||
|
}
|
||||||
|
|
||||||
|
score := _FillMatrixPeCenterAlign(seqA.Sequence(), seqA.Qualities(),
|
||||||
|
seqB.Sequence(), seqB.Qualities(), gap, scale,
|
||||||
|
&arena.pointer.scoreMatrix,
|
||||||
|
&arena.pointer.pathMatrix)
|
||||||
|
|
||||||
|
path := _Backtracking(arena.pointer.pathMatrix,
|
||||||
|
seqA.Len(), seqB.Len(),
|
||||||
|
&arena.pointer.path)
|
||||||
|
|
||||||
|
return score, path
|
||||||
|
}
|
||||||
|
|
||||||
func PEAlign(seqA, seqB *obiseq.BioSequence,
|
func PEAlign(seqA, seqB *obiseq.BioSequence,
|
||||||
gap, scale float64, fastAlign bool, delta int, fastScoreRel bool,
|
gap, scale float64, fastAlign bool, delta int, fastScoreRel bool,
|
||||||
arena PEAlignArena, shift_buff *map[int]int) (int, []int, int, int, float64) {
|
arena PEAlignArena, shift_buff *map[int]int) (bool, int, []int, int, int, float64) {
|
||||||
|
var isLeftAlign bool
|
||||||
var score, shift int
|
var score, shift int
|
||||||
var startA, startB int
|
var startA, startB int
|
||||||
var partLen, over int
|
var partLen, over int
|
||||||
@@ -412,6 +537,7 @@ func PEAlign(seqA, seqB *obiseq.BioSequence,
|
|||||||
rawSeqB = seqB.Sequence()[0:partLen]
|
rawSeqB = seqB.Sequence()[0:partLen]
|
||||||
qualSeqB = seqB.Qualities()[0:partLen]
|
qualSeqB = seqB.Qualities()[0:partLen]
|
||||||
extra3 = seqB.Len() - partLen
|
extra3 = seqB.Len() - partLen
|
||||||
|
isLeftAlign = true
|
||||||
score = _FillMatrixPeLeftAlign(
|
score = _FillMatrixPeLeftAlign(
|
||||||
rawSeqA, qualSeqA, rawSeqB, qualSeqB, gap, scale,
|
rawSeqA, qualSeqA, rawSeqB, qualSeqB, gap, scale,
|
||||||
&arena.pointer.scoreMatrix,
|
&arena.pointer.scoreMatrix,
|
||||||
@@ -433,7 +559,7 @@ func PEAlign(seqA, seqB *obiseq.BioSequence,
|
|||||||
rawSeqA = seqA.Sequence()[:partLen]
|
rawSeqA = seqA.Sequence()[:partLen]
|
||||||
qualSeqA = seqA.Qualities()[:partLen]
|
qualSeqA = seqA.Qualities()[:partLen]
|
||||||
extra3 = partLen - seqA.Len()
|
extra3 = partLen - seqA.Len()
|
||||||
|
isLeftAlign = false
|
||||||
score = _FillMatrixPeRightAlign(
|
score = _FillMatrixPeRightAlign(
|
||||||
rawSeqA, qualSeqA, rawSeqB, qualSeqB, gap, scale,
|
rawSeqA, qualSeqA, rawSeqB, qualSeqB, gap, scale,
|
||||||
&arena.pointer.scoreMatrix,
|
&arena.pointer.scoreMatrix,
|
||||||
@@ -457,6 +583,7 @@ func PEAlign(seqA, seqB *obiseq.BioSequence,
|
|||||||
qualSeqB = seqB.Qualities()[0:partLen]
|
qualSeqB = seqB.Qualities()[0:partLen]
|
||||||
extra3 = seqB.Len() - partLen
|
extra3 = seqB.Len() - partLen
|
||||||
score = 0
|
score = 0
|
||||||
|
isLeftAlign = true
|
||||||
} else {
|
} else {
|
||||||
startA = 0
|
startA = 0
|
||||||
startB = -shift
|
startB = -shift
|
||||||
@@ -465,6 +592,7 @@ func PEAlign(seqA, seqB *obiseq.BioSequence,
|
|||||||
partLen = len(qualSeqB)
|
partLen = len(qualSeqB)
|
||||||
extra3 = partLen - seqA.Len()
|
extra3 = partLen - seqA.Len()
|
||||||
qualSeqA = seqA.Qualities()[:partLen]
|
qualSeqA = seqA.Qualities()[:partLen]
|
||||||
|
isLeftAlign = false
|
||||||
}
|
}
|
||||||
score = 0
|
score = 0
|
||||||
for i, qualA := range qualSeqA {
|
for i, qualA := range qualSeqA {
|
||||||
@@ -497,10 +625,14 @@ func PEAlign(seqA, seqB *obiseq.BioSequence,
|
|||||||
&arena.pointer.scoreMatrix,
|
&arena.pointer.scoreMatrix,
|
||||||
&arena.pointer.pathMatrix)
|
&arena.pointer.pathMatrix)
|
||||||
|
|
||||||
|
score = scoreR
|
||||||
|
|
||||||
path = _Backtracking(arena.pointer.pathMatrix,
|
path = _Backtracking(arena.pointer.pathMatrix,
|
||||||
len(rawSeqA), len(rawSeqB),
|
len(rawSeqA), len(rawSeqB),
|
||||||
&(arena.pointer.path))
|
&(arena.pointer.path))
|
||||||
|
|
||||||
|
isLeftAlign = false
|
||||||
|
|
||||||
scoreL := _FillMatrixPeLeftAlign(
|
scoreL := _FillMatrixPeLeftAlign(
|
||||||
rawSeqA, qualSeqA, rawSeqB, qualSeqB, gap, scale,
|
rawSeqA, qualSeqA, rawSeqB, qualSeqB, gap, scale,
|
||||||
&arena.pointer.scoreMatrix,
|
&arena.pointer.scoreMatrix,
|
||||||
@@ -510,9 +642,11 @@ func PEAlign(seqA, seqB *obiseq.BioSequence,
|
|||||||
path = _Backtracking(arena.pointer.pathMatrix,
|
path = _Backtracking(arena.pointer.pathMatrix,
|
||||||
len(rawSeqA), len(rawSeqB),
|
len(rawSeqA), len(rawSeqB),
|
||||||
&(arena.pointer.path))
|
&(arena.pointer.path))
|
||||||
|
isLeftAlign = true
|
||||||
|
score = scoreL
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return score, path, fastCount, over, fastScore
|
return isLeftAlign, score, path, fastCount, over, fastScore
|
||||||
}
|
}
|
||||||
|
|||||||
154
pkg/obialign/readalign.go
Normal file
154
pkg/obialign/readalign.go
Normal file
@@ -0,0 +1,154 @@
|
|||||||
|
package obialign
|
||||||
|
|
||||||
|
import (
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obikmer"
|
||||||
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
|
||||||
|
)
|
||||||
|
|
||||||
|
func ReadAlign(seqA, seqB *obiseq.BioSequence,
|
||||||
|
gap, scale float64, delta int, fastScoreRel bool,
|
||||||
|
arena PEAlignArena, shift_buff *map[int]int) (int, []int, int, int, float64, bool) {
|
||||||
|
var score, shift int
|
||||||
|
var startA, startB int
|
||||||
|
var partLen, over int
|
||||||
|
var rawSeqA, qualSeqA []byte
|
||||||
|
var rawSeqB, qualSeqB []byte
|
||||||
|
var extra5, extra3 int
|
||||||
|
|
||||||
|
var path []int
|
||||||
|
|
||||||
|
if !_InitializedDnaScore {
|
||||||
|
_InitDNAScoreMatrix()
|
||||||
|
}
|
||||||
|
|
||||||
|
fastCount := -1
|
||||||
|
fastScore := -1.0
|
||||||
|
|
||||||
|
directAlignment := true
|
||||||
|
|
||||||
|
index := obikmer.Index4mer(seqA,
|
||||||
|
&arena.pointer.fastIndex,
|
||||||
|
&arena.pointer.fastBuffer)
|
||||||
|
|
||||||
|
shift, fastCount, fastScore = obikmer.FastShiftFourMer(index, shift_buff, seqA.Len(), seqB, fastScoreRel, nil)
|
||||||
|
|
||||||
|
seqBR := seqB.ReverseComplement(false)
|
||||||
|
shiftR, fastCountR, fastScoreR := obikmer.FastShiftFourMer(index, shift_buff, seqA.Len(), seqBR, fastScoreRel, nil)
|
||||||
|
|
||||||
|
if fastCount < fastCountR {
|
||||||
|
shift = shiftR
|
||||||
|
fastCount = fastCountR
|
||||||
|
fastScore = fastScoreR
|
||||||
|
seqB = seqBR
|
||||||
|
directAlignment = false
|
||||||
|
}
|
||||||
|
|
||||||
|
// Compute the overlapping region length
|
||||||
|
switch {
|
||||||
|
case shift > 0:
|
||||||
|
over = seqA.Len() - shift
|
||||||
|
case shift < 0:
|
||||||
|
over = seqB.Len() + shift
|
||||||
|
default:
|
||||||
|
over = min(seqA.Len(), seqB.Len())
|
||||||
|
}
|
||||||
|
|
||||||
|
// obilog.Warnf("fw/fw: %v shift=%d fastCount=%d/over=%d fastScore=%f",
|
||||||
|
// directAlignment, shift, fastCount, over, fastScore)
|
||||||
|
|
||||||
|
// obilog.Warnf(("seqA: %s\nseqB: %s\n"), seqA.String(), seqB.String())
|
||||||
|
|
||||||
|
// At least one mismatch exists in the overlaping region
|
||||||
|
if fastCount+3 < over {
|
||||||
|
|
||||||
|
if shift > 0 || (shift == 0 && seqB.Len() >= seqA.Len()) {
|
||||||
|
startA = shift - delta
|
||||||
|
if startA < 0 {
|
||||||
|
startA = 0
|
||||||
|
}
|
||||||
|
extra5 = -startA
|
||||||
|
startB = 0
|
||||||
|
|
||||||
|
rawSeqA = seqA.Sequence()[startA:]
|
||||||
|
qualSeqA = seqA.Qualities()[startA:]
|
||||||
|
partLen = len(rawSeqA)
|
||||||
|
if partLen > seqB.Len() {
|
||||||
|
partLen = seqB.Len()
|
||||||
|
}
|
||||||
|
rawSeqB = seqB.Sequence()[0:partLen]
|
||||||
|
qualSeqB = seqB.Qualities()[0:partLen]
|
||||||
|
extra3 = seqB.Len() - partLen
|
||||||
|
score = _FillMatrixPeLeftAlign(
|
||||||
|
rawSeqA, qualSeqA, rawSeqB, qualSeqB, gap, scale,
|
||||||
|
&arena.pointer.scoreMatrix,
|
||||||
|
&arena.pointer.pathMatrix)
|
||||||
|
} else {
|
||||||
|
|
||||||
|
startA = 0
|
||||||
|
startB = -shift - delta
|
||||||
|
if startB < 0 {
|
||||||
|
startB = 0
|
||||||
|
}
|
||||||
|
extra5 = startB
|
||||||
|
rawSeqB = seqB.Sequence()[startB:]
|
||||||
|
qualSeqB = seqB.Qualities()[startB:]
|
||||||
|
partLen = len(rawSeqB)
|
||||||
|
if partLen > seqA.Len() {
|
||||||
|
partLen = seqA.Len()
|
||||||
|
}
|
||||||
|
rawSeqA = seqA.Sequence()[:partLen]
|
||||||
|
qualSeqA = seqA.Qualities()[:partLen]
|
||||||
|
extra3 = partLen - seqA.Len()
|
||||||
|
|
||||||
|
score = _FillMatrixPeRightAlign(
|
||||||
|
rawSeqA, qualSeqA, rawSeqB, qualSeqB, gap, scale,
|
||||||
|
&arena.pointer.scoreMatrix,
|
||||||
|
&arena.pointer.pathMatrix)
|
||||||
|
}
|
||||||
|
|
||||||
|
path = _Backtracking(arena.pointer.pathMatrix,
|
||||||
|
len(rawSeqA), len(rawSeqB),
|
||||||
|
&arena.pointer.path)
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
// Both overlaping regions are identicals
|
||||||
|
|
||||||
|
if shift > 0 || (shift == 0 && seqB.Len() >= seqA.Len()) {
|
||||||
|
startA = shift
|
||||||
|
startB = 0
|
||||||
|
extra5 = -startA
|
||||||
|
qualSeqA = seqA.Qualities()[startA:]
|
||||||
|
partLen = len(qualSeqA)
|
||||||
|
qualSeqB = seqB.Qualities()[0:partLen]
|
||||||
|
extra3 = seqB.Len() - partLen
|
||||||
|
score = 0
|
||||||
|
} else {
|
||||||
|
startA = 0
|
||||||
|
startB = -shift
|
||||||
|
extra5 = startB
|
||||||
|
qualSeqB = seqB.Qualities()[startB:]
|
||||||
|
partLen = len(qualSeqB)
|
||||||
|
extra3 = partLen - seqA.Len()
|
||||||
|
qualSeqA = seqA.Qualities()[:partLen]
|
||||||
|
}
|
||||||
|
|
||||||
|
score = 0
|
||||||
|
for i, qualA := range qualSeqA {
|
||||||
|
qualB := qualSeqB[i]
|
||||||
|
score += _NucScorePartMatchMatch[qualA][qualB]
|
||||||
|
}
|
||||||
|
|
||||||
|
path = arena.pointer.path[:0]
|
||||||
|
path = append(path, 0, partLen)
|
||||||
|
}
|
||||||
|
|
||||||
|
path[0] += extra5
|
||||||
|
if path[len(path)-1] == 0 {
|
||||||
|
path[len(path)-2] += extra3
|
||||||
|
} else {
|
||||||
|
path = append(path, extra3, 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
return score, path, fastCount, over, fastScore, directAlignment
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user