Loading...
Searching...
No Matches
ibf.hpp
Go to the documentation of this file.
// SPDX-FileCopyrightText: 2006-2024 Knut Reinert & Freie Universität Berlin
// SPDX-FileCopyrightText: 2016-2024 Knut Reinert & MPI für molekulare Genetik
// SPDX-License-Identifier: BSD-3-Clause
#pragma once
#include <filesystem>
#include <iostream>
#include <math.h>
#include <numeric>
#include <string>
#include <seqan3/alphabet/container/concatenated_sequences.hpp>
#include <seqan3/alphabet/nucleotide/dna4.hpp>
#include "shared.hpp"
struct minimiser_arguments
{
std::filesystem::path
include_file; // Needs to be defined when only minimisers appearing in this file should be stored
std::filesystem::path
exclude_file; // Needs to be defined when minimisers appearing in this file should NOT be stored
std::vector<int> samples{}; // Can be used to indicate that sequence files belong to the same experiment
bool paired = false; // If true, than experiments are seen as paired-end experiments
bool experiment_names = false; // Flag, if names of experiment should be stored in a txt file
bool ram_friendly = false;
};
struct RandomGenerator
{
int maxi;
RandomGenerator(int max) : maxi(max)
{}
int operator()()
{
return rand() % maxi;
}
};
void count(min_arguments const & args,
std::vector<std::filesystem::path> sequence_files,
std::filesystem::path include_file,
std::filesystem::path genome_file,
bool paired);
void count_genome(min_arguments const & args, std::filesystem::path include_file, std::filesystem::path exclude_file);
void read_binary(std::filesystem::path filename, robin_hood::unordered_node_map<uint64_t, uint16_t> & hash_table);
void read_binary_start(min_arguments & args,
std::filesystem::path filename,
uint64_t & num_of_minimisers,
uint8_t & cutoff);
std::vector<uint16_t> ibf(std::vector<std::filesystem::path> const & sequence_files,
estimate_ibf_arguments & ibf_args,
minimiser_arguments & minimiser_args,
std::vector<double> & fpr,
std::vector<uint8_t> & cutoffs,
std::filesystem::path const expression_by_genome_file = "",
size_t num_hash = 1);
std::vector<uint16_t> ibf(std::vector<std::filesystem::path> const & minimiser_files,
estimate_ibf_arguments & ibf_args,
std::vector<double> & fpr,
std::filesystem::path const expression_by_genome_file = "",
size_t num_hash = 1);
void minimiser(std::vector<std::filesystem::path> const & sequence_files,
min_arguments const & args,
minimiser_arguments & minimiser_args,
std::vector<uint8_t> & cutoffs);
std::vector<uint16_t> insert(std::vector<std::filesystem::path> const & sequence_files,
estimate_ibf_arguments & ibf_args,
minimiser_arguments & minimiser_args,
std::vector<uint8_t> & cutoffs,
std::filesystem::path const expression_by_genome_file,
std::filesystem::path path_in,
bool samplewise);
std::vector<uint16_t> insert(std::vector<std::filesystem::path> const & minimiser_files,
estimate_ibf_arguments & ibf_args,
std::filesystem::path const expression_by_genome_file,
std::filesystem::path path_in,
bool samplewise);
void delete_bin(std::vector<uint64_t> const & delete_files,
estimate_ibf_arguments & ibf_args,
std::filesystem::path path_in,
bool samplewise);
count_genome
void count_genome(min_arguments const &args, std::filesystem::path include_file, std::filesystem::path exclude_file)
Creates a set of minimizers to ignore, which should be used as an input to count.
Definition ibf.cpp:385
minimiser
void minimiser(std::vector< std::filesystem::path > const &sequence_files, min_arguments const &args, minimiser_arguments &minimiser_args, std::vector< uint8_t > &cutoffs)
Create minimiser and header files.
Definition ibf.cpp:1625
count
void count(min_arguments const &args, std::vector< std::filesystem::path > sequence_files, std::filesystem::path include_file, std::filesystem::path genome_file, bool paired)
Get the concrete expression values (= median of all counts of one transcript) for given experiments....
Definition ibf.cpp:427
delete_bin
void delete_bin(std::vector< uint64_t > const &delete_files, estimate_ibf_arguments &ibf_args, std::filesystem::path path_in, bool samplewise)
Delete bins from ibfs.
Definition ibf.cpp:1489
insert
std::vector< uint16_t > insert(std::vector< std::filesystem::path > const &sequence_files, estimate_ibf_arguments &ibf_args, minimiser_arguments &minimiser_args, std::vector< uint8_t > &cutoffs, std::filesystem::path const expression_by_genome_file, std::filesystem::path path_in, bool samplewise)
Insert into IBFs.
Definition ibf.cpp:1435
read_binary
void read_binary(std::filesystem::path filename, robin_hood::unordered_node_map< uint64_t, uint16_t > &hash_table)
Reads a binary file that needle minimiser creates.
Definition ibf.cpp:491
ibf
std::vector< uint16_t > ibf(std::vector< std::filesystem::path > const &sequence_files, estimate_ibf_arguments &ibf_args, minimiser_arguments &minimiser_args, std::vector< double > &fpr, std::vector< uint8_t > &cutoffs, std::filesystem::path const expression_by_genome_file="", size_t num_hash=1)
Creates IBFs.
Definition ibf.cpp:1025
read_binary_start
void read_binary_start(min_arguments &args, std::filesystem::path filename, uint64_t &num_of_minimisers, uint8_t &cutoff)
Reads the beginning of a binary file that needle minimiser creates.
Definition ibf.cpp:522
shared.hpp
RandomGenerator::maxi
int maxi
Definition ibf.hpp:33
RandomGenerator::RandomGenerator
RandomGenerator(int max)
Definition ibf.hpp:34
RandomGenerator::operator()
int operator()()
Definition ibf.hpp:37
estimate_ibf_arguments
arguments used for estimate, ibf, ibfmin
Definition shared.hpp:39
min_arguments
arguments used for estimate, ibf, minimiser
Definition shared.hpp:30
minimiser_arguments
Definition ibf.hpp:19
minimiser_arguments::paired
bool paired
Definition ibf.hpp:25
minimiser_arguments::include_file
std::filesystem::path include_file
Definition ibf.hpp:21
minimiser_arguments::ram_friendly
bool ram_friendly
Definition ibf.hpp:27
minimiser_arguments::samples
std::vector< int > samples
Definition ibf.hpp:24
minimiser_arguments::exclude_file
std::filesystem::path exclude_file
Definition ibf.hpp:23
minimiser_arguments::experiment_names
bool experiment_names
Definition ibf.hpp:26