diff --git a/README.md b/README.md index 69558e1..c0c0b83 100644 --- a/README.md +++ b/README.md @@ -10,65 +10,72 @@ ### A fast and space-efficient pre-filter for estimating the quantification of very large collections of nucleotide sequences Needle is a tool for semi-quantitative analysis of very large collections of nucleotide sequences. -Needle stores its data in multiple interleaved Bloom filter, a fast and space efficient probabilistic data structure and uses a windowing scheme (also called minimisers) to reduce the amount of data to store. How many interleaved Bloom filter are used is defined by the user. Each interleaved Bloom filter has a so called expression threshold and stores minimisers with an occurrence greater than or equal to its own expression threshold and smaller than the next biggest expression threshold (if there is no bigger expression threshold, all greater than or equal to the threshold are stored). These expression thresholds are then used during the query (called estimate) to approximate the expression values of given transcripts. -## Citation +Needle stores its data in multiple Interleaved Bloom Filter (IBF), a fast and space efficient probabilistic data structure and uses a windowing scheme (also called minimisers) to reduce the amount of data to store. How many Interleaved Bloom Filter are used is defined by the user. + +Each IBF has a so-called expression threshold and stores minimisers with an occurrence greater than or equal to its own expression threshold and smaller than the next biggest expression threshold (if there is no bigger expression threshold, all greater than or equal to the threshold are stored). These expression thresholds are then used during the query (called estimate) to approximate the expression values of given transcripts. -Please cite: +## Citation -Mitra Darvish, Enrico Seiler, Svenja Mehringer, René Rahn, Knut Reinert, Needle: a fast and space-efficient prefilter for estimating the quantification of very large collections of expression experiments, Bioinformatics, Volume 38, Issue 17, 1 September 2022, Pages 4100–4108, https://doi.org/10.1093/bioinformatics/btac492 +In your academic works (also comparisons and pipelines) please cite: + * *Needle: a fast and space-efficient prefilter for estimating the quantification of very large collections of expression experiments*; + Mitra Darvish, Enrico Seiler, Svenja Mehringer, René Rahn, and Knut Reinert; Bioinformatics, Volume 38, Issue 17, 1 September 2022, Pages 4100–4108. + doi: https://doi.org/10.1093/bioinformatics/btac492 -## Download, Install & Build +## Download and Installation -
Prerequisites (click to expand) +### From Source -* CMake >= 3.10 -* GCC 10, 11 or 12 (most recent minor version) +**Prerequisites**: +* CMake >= 3.25 +* GCC >= 12 +* LLVM Clang >= 17 +* Intel oneAPI DPC++/C++ Compiler >= 2024.2 (older versions may work, but are not tested) * git -Refer to the [Seqan3 Setup Tutorial](https://docs.seqan.de/seqan/3-master-user/setup.html) for more in depth +Refer to the [Seqan3 Setup Tutorial](https://docs.seqan.de/seqan3/main_user/setup.html) for more in depth information. -
- -### Install with [bioconda](https://bioconda.github.io/recipes/needle/README.html) (Linux) - -```bash -conda install -c bioconda -c conda-forge needle -``` - -### Install via github Needle can be built by following these commands: -``` -git clone --recurse-submodules https://github.com/seqan/needle.git +```bash +git clone https://github.com/seqan/needle.git mkdir build-needle && cd build-needle -cmake ../needle +cmake ../needle -DCMAKE_BUILD_TYPE=Release make ``` -Run test to check, if Needle is working as intended. All tests should pass. +Run tests to check if Needle is working as intended. All tests should pass. +```bash +make check ``` -make test + +### Install with [bioconda](https://bioconda.github.io/recipes/needle/README.html) (Linux) + +```bash +conda install -c bioconda -c conda-forge needle ``` -If you are interested in building the documentation, just use the command: `make doc` +## Usage + +### Build a Needle index +To build a Needle index, several sequence files have to be given. All sequence file formats supported by SeqAn3 are accepted as an input (fasta, fastq, embl,... and their compressed forms). + +The flag `--paired` in the example below indicates that the given sequence files are paired-end experiments. Furthermore, the false positive rate has to be specified with the parameter `f`. -## Build an Needle index -In order to build a Needle index a number of sequence files have to be given. All sequence file formats supported by seqan3 are accepted as an input (fasta, fastq, embl,... and their compressed forms). The flag `--paired` in the example below indicates that the given sequence files are paired-end experiments. Furthermore, the false positive rate has to be specified with the parameter `f`. Use -h/--help for more information and to see further parameters. The flag `-c` can be used to build a compressed Needle index. The following example creates a compressed Needle index for two paired-end experiments for the expression thresholds 4 and 32. -``` +```bash ./bin/needle ibf ../needle/test/data/exp_*.fasta --paired -e 16 -e 32 -f 0.3 -c -o example ``` -Although, this works. It is recommended to calculate the minimisers beforehand by using the option `minimisers`. It calculates the minimisers of given experiments and stores their hash values and their occurrences in a binary file named ".minimiser". +Even though this works, it is recommended to calculate the minimisers beforehand by using the option `minimisers`. It calculates the minimisers of given experiments and stores their hash values and their occurrences in a binary file named ".minimiser". The following command calculates the minimisers in the two experiments. -``` +```bash ./bin/needle minimiser ../needle/test/data/exp_*.fasta --paired ``` @@ -81,53 +88,67 @@ A minimiser file is a binary file containing the following data: - shape (uint64_t), if flag is false - all minimiser hashes (uint64_t) with their occurrences (uint16_t) -Based on the minimiser files the Needle index can be computed by using the following command: -``` +Based on the minimiser files, the Needle index can be computed by using the following command: +```bash ./bin/needle ibfmin exp*.minimiser -e 16 -e 32 -f 0.3 -c -o example ``` -## Estimate -To estimate the expression value of one transcript a sequence file has to be given. Use the parameter "-i" to define where the Needle index can be found (should be equal with "-o" in the previous commands). +### Estimate +To estimate the expression value of one transcript, a sequence file has to be given + +Use the parameter "-i" to define where the Needle index can be found (should be equal with "-o" in the previous commands). + Use -h/--help for more information and to see further parameters. + The following example searches for one gene, which is expressed in the first experiment with expression 6 and in the second with expression 37. Therefore, it should be found only in the second experiment but not the first when using expression levels of 16 and 32. -``` +```bash ./bin/needle estimate ../needle/test/data/gene.fasta -i example ``` The created file "expressions.out" (if you prefer a different name, use "-o") should contain the following: -``` +```text GeneA 0 32 ``` -## Insert into an existing Needle index -It is possible to insert new sequence files into an uncompressed Needle index. Similar to the build step this can be done by either using the sequence files as input directly or the minimiser files outputed by `needle minimiser`. Most options are the same as the ones from the build step, however as the Needle index already exist, neither the false positive rate nor the number of hash functions can be changed. It is necessary to specify `i` to the directory, where the existing Needle index can be found. +### Insert into an existing Needle index +It is possible to insert new sequence files into an uncompressed Needle index. + +Similar to the build step, this can be done by either using the sequence files as input directly or the minimiser files outputted by `needle minimiser`. + +Most options are the same as the ones from the build step, however as the Needle index already exists, neither the false positive rate nor the number of hash functions can be changed. + +It is necessary to specify `i` to the directory, where the existing Needle index can be found. The following example inserts into the Needle index build above for two paired-end experiments. -``` -./bin/needle ibf ../needle/test/data/exp_0*.fasta --paired -e 16 -e 32 -f 0.3 -c -o example // Create Index -./bin/needle insert ../needle/test/data/exp_1*.fasta --paired -i example // Insert into created index +```bash +# Create Index +./bin/needle ibf ../needle/test/data/exp_0*.fasta --paired -e 16 -e 32 -f 0.3 -c -o example +# Insert into created index +./bin/needle insert ../needle/test/data/exp_1*.fasta --paired -i example ``` -Based on minimiser files an insertion to the Needle index can be achieved by using the following command: -``` -./bin/needle ibf ../needle/test/data/exp_0*.fasta --paired -e 16 -e 32 -f 0.3 -c -o example // Create Index -./bin/needle insertmin exp*.minimiser -i example // Insert into created index +Based on minimiser files, an insertion to the Needle index can be achieved by using the following command: +```bash +# Create Index +./bin/needle ibf ../needle/test/data/exp_0*.fasta --paired -e 16 -e 32 -f 0.3 -c -o example +# Insert into created index +./bin/needle insertmin exp*.minimiser -i example ``` The insert methods based on minimiser or on sequence files is independent of the way the index was created. -## Delete experiments from an existing Needle index -It is possible to delete sequence files from an uncompressed Needle index by specifiying the position of the experiment, which should be deleted. -These deleted experiments won't change the size of the index as the space is kept for later insertions. -``` -./bin/needle ibf ../needle/test/data/exp_*.fasta --paired -e 16 -e 32 -f 0.3 -c -o example // Create Index -./bin/needle delete -i example 0 // Delete first experiment exp_0 (with position 0) from index -`` - +### Delete experiments from an existing Needle index +It is possible to delete sequence files from an uncompressed Needle index by specifying the position of the experiment, which should be deleted. +These deleted experiments won't change the size of the index, as the space is kept for later insertions. +```bash +# Create Index +./bin/needle ibf ../needle/test/data/exp_*.fasta --paired -e 16 -e 32 -f 0.3 -c -o example +# Delete first experiment exp_0 (with position 0) from index +./bin/needle delete -i example 0 +``` ## Note - -This app was created with the [seqan3 app-template](https://github.com/seqan/app-template). +This app was created with the [SeqAn app-template](https://github.com/seqan/app-template). diff --git a/cmake/test/config.cmake b/cmake/test/config.cmake index f411a7d..c29ac3f 100644 --- a/cmake/test/config.cmake +++ b/cmake/test/config.cmake @@ -13,7 +13,7 @@ enable_testing () file (MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/output) add_definitions (-DOUTPUTDIR=\"${CMAKE_CURRENT_BINARY_DIR}/output/\") add_definitions (-DDATADIR=\"${CMAKE_CURRENT_BINARY_DIR}/data/\") -add_definitions (-DBINDIR=\"${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/\") +add_definitions (-DBINDIR=\"${CMAKE_BINARY_DIR}/bin/\") add_definitions (-DAPPNAME=\"${PROJECT_NAME}\") # Add the test interface library. diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b9357d1..071777e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -9,3 +9,4 @@ target_include_directories ("${PROJECT_NAME}_lib" PUBLIC ../include) add_executable ("${PROJECT_NAME}" main.cpp) target_link_libraries ("${PROJECT_NAME}" PRIVATE "${PROJECT_NAME}_lib") +set_target_properties ("${PROJECT_NAME}" PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")