[med-svn] [Git][med-team/andi][upstream] New upstream version 1.15

Andreas Tille (@tille) gitlab at salsa.debian.org
Tue Nov 10 21:10:04 GMT 2026



Andreas Tille pushed to branch upstream at Debian Med / andi


Commits:
2d2acd5e by Andreas Tille at 2026-11-10T22:05:45+01:00
New upstream version 1.15
- - - - -


20 changed files:

- − .travis.yml
- README.md
- andi-manual.pdf
- configure.ac
- docs/andi.1.in
- docs/manual/andi-manual.tex
- scripts/_andi
- src/andi.c
- src/dist_hack.h
- src/esa.c
- src/global.h
- src/io.c
- src/io.h
- src/model.c
- src/model.h
- src/process.c
- test/test_esa.c
- test/test_fasta.cxx
- test/test_process.c
- test/test_seq.c


Changes:

=====================================
.travis.yml deleted
=====================================
@@ -1,43 +0,0 @@
-language: cpp
-compiler:
-  - gcc
-  - clang
-arch:
-  - amd64
-  - ppc64le
-sudo: false
-addons:
-  apt:
-    sources:
-      - deadsnakes
-      - ubuntu-toolchain-r-test
-    packages:
-      - cmake
-      - libglib2.0-dev
-      - libgsl0-dev
-
-install:
-  - export LIBDIVDIR="$HOME/libdivsufsort"
-  - pip install --user cpp-coveralls
-  - wget https://github.com/y-256/libdivsufsort/archive/master.tar.gz
-  - tar -xzvf master.tar.gz
-  - cd libdivsufsort-master && mkdir build && cd build
-  - cmake -DCMAKE_BUILD_TYPE="Release" -DCMAKE_INSTALL_PREFIX="$LIBDIVDIR" ..
-  - make && make install
-
-script:
-- CONFIGURE_FLAGS=""
-- export LD_LIBRARY_PATH="$LIBDIVDIR:$LIBDIVDIR/lib"
-- export LIBRARY_PATH="$LIBDIVDIR:$LIBRARY_PATH"
-- cd $TRAVIS_BUILD_DIR
-- autoreconf -fvi -Im4
-- export MYFLAGS="-fprofile-arcs -ftest-coverage -I$LIBDIVDIR/include"
-- if [ "${CC}" = "clang" ]; then export CONFIGURE_FLAGS="--disable-openmp"; fi
-- ./configure $CONFIGURE_FLAGS --enable-unit-tests LDFLAGS="-L$LIBDIVDIR/lib" CFLAGS="$MYFLAGS" CXXFLAGS="$MYFLAGS"
-- make
-- make check || cat ./test-suite.log || exit 1
-- export MYFLAGS="-I$LIBDIVDIR/include"
-- ./configure $CONFIGURE_FLAGS --enable-unit-tests LDFLAGS="-L$LIBDIVDIR/lib" CFLAGS="$MYFLAGS" CXXFLAGS="$MYFLAGS"
-- make distcheck DISTCHECK_CONFIGURE_FLAGS="LDFLAGS=\"-L$LIBDIVDIR/lib\" CFLAGS=\"-I$LIBDIVDIR/include\" CXXFLAGS=\"-I$LIBDIVDIR/include\" $CONFIGURE_FLAGS"
-after_success:
-- if [ "$CXX" = "g++" ]; then coveralls --exclude libdivsufsort-master -E '^andi-.*' --exclude libs --exclude test --gcov `which gcov-4.8` --gcov-options '\-lp'; fi


=====================================
README.md
=====================================
@@ -1,5 +1,3 @@
-[![Build Status](https://travis-ci.org/EvolBioInf/andi.svg?branch=master)](https://travis-ci.org/EvolBioInf/andi) [![Coverage Status](https://coveralls.io/repos/EvolBioInf/andi/badge.svg?branch=master)](https://coveralls.io/r/EvolBioInf/andi?branch=master)
-
 # About
 
 This is the `andi` program for estimating the evolutionary distance between closely related genomes. These distances can be used to rapidly infer phylogenies for big sets of genomes. Because `andi` does not compute full alignments, it is so efficient that it scales even up to thousands of bacterial genomes.
@@ -68,7 +66,7 @@ The release of this software is accompanied by a paper from [Haubold et al.](htt
 
 ## License
 
-Copyright © 2014 - 2021 Fabian Klötzl  
+Copyright © 2014 - 2026 Fabian Klötzl  
 License GPLv3+: GNU GPL version 3 or later.
 
 This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. The full license text is available at <http://gnu.org/licenses/gpl.html>.


=====================================
andi-manual.pdf
=====================================
Binary files a/andi-manual.pdf and b/andi-manual.pdf differ


=====================================
configure.ac
=====================================
@@ -1,4 +1,4 @@
-AC_INIT([andi], [0.14])
+AC_INIT([andi], [1.15])
 AM_INIT_AUTOMAKE([-Wall foreign])
 
 AC_CONFIG_MACRO_DIR([m4])


=====================================
docs/andi.1.in
=====================================
@@ -1,4 +1,4 @@
-.TH ANDI "1" "2020-01-09" "@VERSION@" "andi manual"
+.TH ANDI "1" "2026-01-16" "@VERSION@" "andi manual"
 .SH NAME
 andi \- estimates evolutionary distances
 .SH SYNOPSIS
@@ -23,7 +23,7 @@ Use this mode if each of your \fIFASTA\fR files represents one assembly with num
 In multithreaded mode, \fBandi\fR requires memory linear to the amount of threads. The low memory mode changes this to a constant demand independent from the used number of threads. Unfortunately, this comes at a significant runtime cost.
 .TP
 \fB\-m\fR \fIMODEL\fR, \fB\-\-model\fR=\fIMODEL\fR
-Set the nucleotide evolution model to one of 'Raw', 'JC', 'Kimura', or 'LogDet'. By default the Jukes-Cantor correction is used.
+Set the nucleotide evolution model to one of 'Raw', 'JC', 'Kimura', 'LogDet' or 'ANI'. By default the Jukes-Cantor correction is used.
 .TP
 \fB\-p\fR \fIFLOAT\fR
 Significance of an anchor; default: 0.025.
@@ -48,7 +48,7 @@ Prints the synopsis and an explanation of available options.
 \fB\-\-version\fR
 Outputs version information and acknowledgments.
 .SH COPYRIGHT
-Copyright \(co 2014 - 2021 Fabian Klötzl
+Copyright \(co 2014 - 2026 Fabian Klötzl
 License GPLv3+: GNU GPL version 3 or later.
 .br
 This is free software: you are free to change and redistribute it.


=====================================
docs/manual/andi-manual.tex
=====================================
@@ -152,7 +152,7 @@ Once you have downloaded the package, unzip it and change into the newly created
 Now \andi should be ready for use. Try invoking the help.
 
 \begin{lstlisting}
-~/andi-0.14 %  ~/andi
+~/andi-0.15 %  ~/andi
 Usage: andi [OPTIONS...] FILES...
 	FILES... can be any sequence of FASTA files.
 	Use '-' as file name to read from stdin.
@@ -161,7 +161,7 @@ Options:
       --file-of-filenames=FILE  Read additional filenames from FILE; one per line
   -j, --join           Treat all sequences from one file as a single genome
   -l, --low-memory     Use less memory at the cost of speed
-  -m, --model=MODEL    Pick an evolutionary model of 'Raw', 'JC', 'Kimura', 'LogDet'; default: JC
+  -m, --model=MODEL    Pick an evolutionary model of 'Raw', 'JC', 'Kimura', 'LogDet', 'ANI'; default: JC
   -p FLOAT             Significance of an anchor; default: 0.025
       --progress=WHEN  Print a progress bar 'always', 'never', or 'auto'; default: auto
   -t, --threads=INT    Set the number of threads; by default, all processors are used
@@ -276,9 +276,9 @@ S2        0.0995 0.0000
 ./andi ../test/1M.1.fasta -t 2  0,67s user 0,03s system 195% cpu 0,362 total
 \end{lstlisting}
 
-In the above examples the runtime dropped from \SI{0.613}{\second}, to \SI{0.362}{\second} using two threads. Giving \andi more threads than input genomes leads to no further speed improvement. \, The other important option is \lstinline$--join$ (see Section~\ref{sec:join}).
+In the above examples the runtime dropped from \SI{0.613}{\second}, to \SI{0.362}{\second} using two threads. Giving \andi more threads than input genomes leads to no further speed improvement. \, The other important option is \lstinline$--join$ (Section~\ref{sec:join}).
 
-By default, the distances computed by \andi are \emph{Jukes-Cantor} corrected \cite{jukescantor}. Other evolutionary models are also implemented (Kimura \cite{kimura}, LogDet \cite{logdet}, raw). The \lstinline$--model$ parameter can be used to switch between them.
+By default, the distances computed by \andi are \emph{Jukes-Cantor} corrected \cite{jukescantor}. Other evolutionary models are also implemented (Kimura \cite{kimura}, LogDet \cite{logdet}, raw and ANI). The \lstinline$--model$ parameter can be used to switch between them.
 
 Since version 0.9.4 \andi includes a bootstrapping method. It can be activated via the \lstinline$--bootstrap$ or \lstinline$-b$ switch. This option takes a numeric argument representing the number of matrices to create. The output can then be piped into \algo{phylip}. For more information on computing support values from distance matrices see \cite{afra}.
 


=====================================
scripts/_andi
=====================================
@@ -26,6 +26,7 @@ args+=(
 		JC\:Jukes\-Cantor\ corrected
 		Kimura\:Kimura\-two\-parameter
 		LogDet\:Logarithmic\ determinant
+		ANI\:Average\ Nucleotide\ Interchange
 	))'
 	"($info)-p+[Significance of an anchor; default\: 0.025]:float:"
 	"($info)--progress=[Show progress bar]:when:(always auto never)"


=====================================
src/andi.c
=====================================
@@ -207,9 +207,11 @@ int main(int argc, char *argv[]) {
 					MODEL = M_KIMURA;
 				} else if (strcasecmp(optarg, "LOGDET") == 0) {
 					MODEL = M_LOGDET;
+				} else if (strcasecmp(optarg, "ANI") == 0) {
+					MODEL = M_ANI;
 				} else {
 					soft_errx("Ignoring argument for --model. Expected Raw, "
-							  "JC, Kimura or LogDet");
+							  "JC, Kimura, LogDet or ANI");
 				}
 				break;
 			}
@@ -346,7 +348,7 @@ void usage(int status) {
 		"genome\n"
 		"  -l, --low-memory     Use less memory at the cost of speed\n"
 		"  -m, --model=MODEL    Pick an evolutionary model of 'Raw', 'JC', "
-		"'Kimura', 'LogDet'; default: JC\n"
+		"'Kimura', 'LogDet', 'ANI'; default: JC\n"
 		"  -p FLOAT             Significance of an anchor; default: 0.025\n"
 		"      --progress=WHEN  Print a progress bar 'always', 'never', or "
 		"'auto'; default: auto\n"
@@ -372,7 +374,7 @@ void usage(int status) {
 void version(void) {
 	const char str[] = {
 		"andi " VERSION "\n"
-		"Copyright (C) 2014 - 2020 Fabian Klötzl\n"
+		"Copyright (C) 2014 - 2026 Fabian Klötzl\n"
 		"License GPLv3+: GNU GPL version 3 or later "
 		"<http://gnu.org/licenses/gpl.html>\n"
 		"This is free software: you are free to change and redistribute it.\n"


=====================================
src/dist_hack.h
=====================================
@@ -42,7 +42,7 @@ void NAME(struct model *M, const seq_t *sequences, size_t n) {
 				(size_t)0, n * n - n);
 	}
 
-	//#pragma
+	// #pragma
 	P_OUTER
 	for (i = 0; i < n; i++) {
 		seq_subject subject;


=====================================
src/esa.c
=====================================
@@ -58,7 +58,7 @@ ssize_t char2code(const char c) {
 }
 
 #define R(CLD, i) ((CLD)[(i)])
-#define L(CLD, i) ((CLD)[(i)-1])
+#define L(CLD, i) ((CLD)[(i) - 1])
 
 /** @brief Fills the LCP-Interval cache.
  *


=====================================
src/global.h
=====================================
@@ -47,7 +47,7 @@ extern gsl_rng *RNG;
  */
 extern int MODEL;
 
-enum { M_RAW, M_JC, M_KIMURA, M_LOGDET };
+enum { M_RAW, M_JC, M_KIMURA, M_LOGDET, M_ANI };
 
 /**
  * This enum contains the available flags. Please note that all


=====================================
src/io.c
=====================================
@@ -251,7 +251,7 @@ void print_distances(const struct model *D, const seq_t *sequences, size_t n,
 	double *DD = malloc(n * n * sizeof(*DD));
 	CHECK_MALLOC(DD);
 
-#define DD(X, Y) (DD[(X)*n + (Y)])
+#define DD(X, Y) (DD[(X) * n + (Y)])
 
 	typedef double(estimate_fn)(const model *);
 	estimate_fn *estimate;
@@ -264,6 +264,7 @@ void print_distances(const struct model *D, const seq_t *sequences, size_t n,
 		case M_JC: estimate = &estimate_JC; break;
 		case M_KIMURA: estimate = &estimate_KIMURA; break;
 		case M_LOGDET: estimate = &estimate_LOGDET; break;
+		case M_ANI: estimate = &estimate_ANI; break;
 	}
 
 	for (i = 0; i < n; i++) {


=====================================
src/io.h
=====================================
@@ -14,8 +14,8 @@
 /**
  * This is a neat hack for dealing with matrices.
  */
-#define D(X, Y) (D[(X)*n + (Y)])
-#define M(X, Y) (M[(X)*n + (Y)])
+#define D(X, Y) (D[(X) * n + (Y)])
+#define M(X, Y) (M[(X) * n + (Y)])
 
 void read_fasta(const char *, dsa_t *dsa);
 void read_fasta_join(const char *, dsa_t *dsa);


=====================================
src/model.c
=====================================
@@ -197,6 +197,17 @@ double estimate_LOGDET(const model *MM) {
 	return dist <= 0.0 ? 0.0 : dist;
 }
 
+/**
+ * @brief Compute the average nucleotide interchange.
+ *
+ * @param MM - The mutation matrix.
+ * @returns The percent ANI.
+ */
+double estimate_ANI(const model *MM) {
+	double dist = estimate_RAW(MM);
+	return (1.0 - dist) * 100;
+}
+
 /** @brief Bootstrap a mutation matrix.
  *
  * The classical bootstrapping process, as described by Felsenstein, resamples


=====================================
src/model.h
=====================================
@@ -64,4 +64,5 @@ double estimate_RAW(const model *);
 double estimate_JC(const model *);
 double estimate_KIMURA(const model *);
 double estimate_LOGDET(const model *);
+double estimate_ANI(const model *);
 model model_bootstrap(model);


=====================================
src/process.c
=====================================
@@ -113,7 +113,7 @@ static inline bool lucky_anchor(const struct context *ctx,
 static inline bool anchor(const struct context *ctx,
 						  const struct anchor *last_match,
 						  struct anchor *this_match) {
-
+	(void)last_match;
 	lcp_inter_t inter = get_match_cached(ctx->C, ctx->query + this_match->pos_Q,
 										 ctx->query_length - this_match->pos_Q);
 
@@ -270,7 +270,7 @@ void calculate_distances(seq_t *sequences, size_t n) {
 }
 
 /** Yet another hack. */
-#define B(X, Y) (B[(X)*n + (Y)])
+#define B(X, Y) (B[(X) * n + (Y)])
 
 /** @brief Computes a bootstrap from _pairwise_ alignments.
  *


=====================================
test/test_esa.c
=====================================
@@ -1,6 +1,6 @@
 #include "esa.h"
-#include <glib.h>
 #include "global.h"
+#include <glib.h>
 #include <stdio.h>
 #include <string.h>
 
@@ -10,8 +10,8 @@ double ANCHOR_P_VALUE = 0.025;
 
 extern const int CACHE_LENGTH;
 
-char code3char( ssize_t code){
-	switch( code & 0x7){
+char code3char(ssize_t code) {
+	switch (code & 0x7) {
 		case 0: return 'A';
 		case 1: return 'C';
 		case 2: return 'G';
@@ -29,26 +29,26 @@ typedef struct {
 	seq_subject subject;
 } esa_fixture;
 
-void assert_equal_lcp( const lcp_inter_t *a, const lcp_inter_t *b){
-	g_assert_cmpint( a->i, ==, b->i);
-	g_assert_cmpint( a->j, ==, b->j);
-	g_assert_cmpint( a->l, ==, b->l);
+void assert_equal_lcp(const lcp_inter_t *a, const lcp_inter_t *b) {
+	g_assert_cmpint(a->i, ==, b->i);
+	g_assert_cmpint(a->j, ==, b->j);
+	g_assert_cmpint(a->l, ==, b->l);
 }
 
-void assert_equal_cache_nocache( const esa_s *C, const char *str, size_t qlen){
+void assert_equal_cache_nocache(const esa_s *C, const char *str, size_t qlen) {
 	lcp_inter_t a = get_match_cached(C, str, qlen);
 	lcp_inter_t b = get_match(C, str, qlen);
-	assert_equal_lcp( &a, &b);
+	assert_equal_lcp(&a, &b);
 	g_assert(strncmp(str, C->S + C->SA[a.i], a.l) == 0);
-	g_assert( str[a.l] != C->S[ a.l + C->SA[a.i]] || str[a.l] == '\0');
+	g_assert(str[a.l] != C->S[a.l + C->SA[a.i]] || str[a.l] == '\0');
 }
 
-void setup( esa_fixture *ef, gconstpointer test_data){
-	ef->C = malloc( sizeof(esa_s));
-	ef->S = malloc( sizeof(seq_t));
+void setup(esa_fixture *ef, gconstpointer test_data) {
+	ef->C = malloc(sizeof(esa_s));
+	ef->S = malloc(sizeof(seq_t));
 
-	g_assert( ef->C != NULL);
-	g_assert( ef->S != NULL);
+	g_assert(ef->C != NULL);
+	g_assert(ef->S != NULL);
 
 	const char *seq = {
 		"TACGAGCACTGGTGGAATTGATGTC"
@@ -58,22 +58,22 @@ void setup( esa_fixture *ef, gconstpointer test_data){
 		"TACGTGCACTGGTGGGATTGATGTC"
 		"TAGTATTATATGGCGCACCAGGATG"
 		"ATAGTAGTAGCAGTTTGCTTATCCC"
-		"ATCGCGTGTTTGCGGATGACCGAGA"
+		"ATCGCGTGTTTGCGGATGACCGAGA" // format hack
 	};
 
-	g_assert( seq_init( ef->S, seq, "S0" ) == 0);
-	seq_subject_init( &ef->subject, ef->S);
-	g_assert( ef->subject.RS != NULL);
-	int check = esa_init( ef->C, &ef->subject);
-	g_assert( check == 0);
+	g_assert(seq_init(ef->S, seq, "S0") == 0);
+	seq_subject_init(&ef->subject, ef->S);
+	g_assert(ef->subject.RS != NULL);
+	int check = esa_init(ef->C, &ef->subject);
+	g_assert(check == 0);
 }
 
-void setup2( esa_fixture *ef, gconstpointer test_data){
-	ef->C = malloc( sizeof(esa_s));
-	ef->S = malloc( sizeof(seq_t));
+void setup2(esa_fixture *ef, gconstpointer test_data) {
+	ef->C = malloc(sizeof(esa_s));
+	ef->S = malloc(sizeof(seq_t));
 
-	g_assert( ef->C != NULL);
-	g_assert( ef->S != NULL);
+	g_assert(ef->C != NULL);
+	g_assert(ef->S != NULL);
 
 	const char *seq = {
 		"TACGAGCACTGGTGGAATTGATGTC"
@@ -84,17 +84,17 @@ void setup2( esa_fixture *ef, gconstpointer test_data){
 		"TACGTGCACTGGTGGGATTGATGTC"
 		"TAGTATTATATGGCGCACCAGGATG"
 		"ATAGTAGTAGCAGTTTGCTTATCCC"
-		"ATCGCGTGTTTGCGGATGACCGAGA"
+		"ATCGCGTGTTTGCGGATGACCGAGA" // format hack
 	};
 
-	g_assert( seq_init( ef->S, seq, "S0" ) == 0);
-	seq_subject_init( &ef->subject, ef->S);
-	g_assert( ef->subject.RS != NULL);
-	int check = esa_init( ef->C, &ef->subject);
-	g_assert( check == 0);
+	g_assert(seq_init(ef->S, seq, "S0") == 0);
+	seq_subject_init(&ef->subject, ef->S);
+	g_assert(ef->subject.RS != NULL);
+	int check = esa_init(ef->C, &ef->subject);
+	g_assert(check == 0);
 }
 
-void teardown( esa_fixture *ef, gconstpointer test_data){
+void teardown(esa_fixture *ef, gconstpointer test_data) {
 	esa_free(ef->C);
 	free(ef->C);
 	seq_free(ef->S);
@@ -104,103 +104,103 @@ void teardown( esa_fixture *ef, gconstpointer test_data){
 
 extern int count;
 
-void basic( esa_fixture *ef, gconstpointer test_data){
+void basic(esa_fixture *ef, gconstpointer test_data) {
 	esa_s *C = ef->C;
-	g_assert( C->SA);
+	g_assert(C->SA);
 
 	lcp_inter_t a = get_match_cached(C, "AAGACTGG", 8);
 	lcp_inter_t b = get_match(C, "AAGACTGG", 8);
-	assert_equal_lcp( &a, &b);
-	g_assert(strncmp("AAGACTGG",C->S + C->SA[a.i], 8) == 0);
+	assert_equal_lcp(&a, &b);
+	g_assert(strncmp("AAGACTGG", C->S + C->SA[a.i], 8) == 0);
 
 	a = get_match_cached(C, "AATTAAAA", 8);
 	b = get_match(C, "AATTAAAA", 8);
-	assert_equal_lcp( &a, &b);
-	g_assert(strncmp("AATTAAAA",C->S + C->SA[a.i], a.l) == 0);
+	assert_equal_lcp(&a, &b);
+	g_assert(strncmp("AATTAAAA", C->S + C->SA[a.i], a.l) == 0);
 
 	a = get_match_cached(C, "ACCGAGAA", 8);
 	b = get_match(C, "ACCGAGAA", 8);
-	assert_equal_lcp( &a, &b);
-	g_assert(strncmp("ACCGAGAA",C->S + C->SA[a.i], a.l) == 0);
+	assert_equal_lcp(&a, &b);
+	g_assert(strncmp("ACCGAGAA", C->S + C->SA[a.i], a.l) == 0);
 
 	a = get_match_cached(C, "AAAAAAAAAAAA", 12);
 	b = get_match(C, "AAAAAAAAAAAA", 12);
-	assert_equal_lcp( &a, &b);
-	g_assert(strncmp("AAAAAAAAAAAA",C->S + C->SA[a.i], a.l) == 0);
+	assert_equal_lcp(&a, &b);
+	g_assert(strncmp("AAAAAAAAAAAA", C->S + C->SA[a.i], a.l) == 0);
 
-	//g_assert_cmpint(count, >=, 1 << (2*8));
+	// g_assert_cmpint(count, >=, 1 << (2*8));
 }
 
-void normq_cached( esa_fixture *ef, gconstpointer test_data){
+void normq_cached(esa_fixture *ef, gconstpointer test_data) {
 	esa_s *C = ef->C;
-	g_assert( C->SA);
+	g_assert(C->SA);
 	lcp_inter_t a, b;
 
 	a = get_match_cached(C, "A", 1);
 	b = get_match(C, "A", 1);
-	assert_equal_lcp( &a, &b);
+	assert_equal_lcp(&a, &b);
 
 	a = get_match_cached(C, "C", 1);
 	b = get_match(C, "C", 1);
-	assert_equal_lcp( &a, &b);
+	assert_equal_lcp(&a, &b);
 
 	a = get_match_cached(C, "CT", 2);
 	b = get_match(C, "CT", 2);
-	assert_equal_lcp( &a, &b);
+	assert_equal_lcp(&a, &b);
 
 	a = get_match_cached(C, "AAGACTGG", 8);
 	b = get_match(C, "AAGACTGG", 8);
-	assert_equal_lcp( &a, &b);
-	
+	assert_equal_lcp(&a, &b);
+
 	a = get_match_cached(C, "AATTAAAA", 8);
 	b = get_match(C, "AATTAAAA", 8);
-	assert_equal_lcp( &a, &b);
+	assert_equal_lcp(&a, &b);
 
 	a = get_match_cached(C, "ACCGAGAA", 8);
 	b = get_match(C, "ACCGAGAA", 8);
-	assert_equal_lcp( &a, &b);
+	assert_equal_lcp(&a, &b);
 
 	a = get_match_cached(C, "AAAAAAAAAAAA", 12);
 	b = get_match(C, "AAAAAAAAAAAA", 12);
-	assert_equal_lcp( &a, &b);
+	assert_equal_lcp(&a, &b);
 
 	a = get_match_cached(C, "!AAAAAAAAAAAA", 12);
 	b = get_match(C, "!AAAAAAAAAAAA", 12);
-	assert_equal_lcp( &a, &b);
+	assert_equal_lcp(&a, &b);
 }
 
 size_t MAX_DEPTH = 11;
 
-void prefix_dfs( esa_s *C, char *str, size_t depth);
+void prefix_dfs(esa_s *C, char *str, size_t depth);
 
-void prefix( esa_fixture *ef, gconstpointer test_data){
+void prefix(esa_fixture *ef, gconstpointer test_data) {
 	esa_s *C = ef->C;
-	char str[MAX_DEPTH+1];
+	char str[MAX_DEPTH + 1];
 	str[MAX_DEPTH] = '\0';
-	prefix_dfs( C, str, 0);
+	prefix_dfs(C, str, 0);
 }
 
-void prefix_dfs( esa_s *C, char *str, size_t depth){
-	if( depth < MAX_DEPTH){
-		for( int code = 0; code < 4; ++code){
+void prefix_dfs(esa_s *C, char *str, size_t depth) {
+	if (depth < MAX_DEPTH) {
+		for (int code = 0; code < 4; ++code) {
 			str[depth] = code2char(code);
-			prefix_dfs( C, str, depth + 1);
+			prefix_dfs(C, str, depth + 1);
 		}
 	} else {
 		assert_equal_cache_nocache(C, str, depth);
 	}
 }
 
-int main(int argc, char *argv[])
-{
-	g_test_init( &argc, &argv, NULL);
+int main(int argc, char *argv[]) {
+	g_test_init(&argc, &argv, NULL);
 	g_test_add("/esa/basic", esa_fixture, NULL, setup, basic, teardown);
-	g_test_add("/esa/sample cache", esa_fixture, NULL, setup, normq_cached, teardown);
-	g_test_add("/esa/sample cache 2", esa_fixture, NULL, setup2, normq_cached, teardown);
+	g_test_add("/esa/sample cache", esa_fixture, NULL, setup, normq_cached,
+			   teardown);
+	g_test_add("/esa/sample cache 2", esa_fixture, NULL, setup2, normq_cached,
+			   teardown);
 	g_test_add("/esa/full cache", esa_fixture, NULL, setup, prefix, teardown);
-	g_test_add("/esa/full cache 2", esa_fixture, NULL, setup2, prefix, teardown);
+	g_test_add("/esa/full cache 2", esa_fixture, NULL, setup2, prefix,
+			   teardown);
 
-	
 	return g_test_run();
 }
-


=====================================
test/test_fasta.cxx
=====================================
@@ -2,18 +2,18 @@
  * This program can create genome sequences with a specific distance.
  */
 
+#include <functional>
+#include <getopt.h>
 #include <iostream>
 #include <random>
-#include <functional>
 #include <string>
-#include <getopt.h>
 
 using namespace std;
 
 void usage();
-void print_seq( unsigned, unsigned, int, int, double);
+void print_seq(unsigned, unsigned, int, int, double);
 
-int main(int argc, char *argv[]){
+int main(int argc, char *argv[]) {
 
 	random_device rd{};
 	auto seed = rd();
@@ -24,16 +24,15 @@ int main(int argc, char *argv[]){
 	auto seqs = vector<double>{0};
 
 	int check;
-	while((check = getopt(argc, argv, "s:l:L:d:r")) != -1){
-		switch(check) {
-			case 's':
-				{
-					seed = static_cast<unsigned int>(stol(optarg));
-					if( seed == 0){
-						seed = rd();
-					}
-					break;
+	while ((check = getopt(argc, argv, "s:l:L:d:r")) != -1) {
+		switch (check) {
+			case 's': {
+				seed = static_cast<unsigned int>(stol(optarg));
+				if (seed == 0) {
+					seed = rd();
 				}
+				break;
+			}
 			case 'l': length = stoi(optarg); break;
 			case 'L': line_length = stoi(optarg); break;
 			case 'd': seqs.push_back(stod(optarg)); break;
@@ -43,50 +42,50 @@ int main(int argc, char *argv[]){
 		}
 	}
 
-	if( seqs.size() < 2){
+	if (seqs.size() < 2) {
 		seqs.push_back(0.1);
 	}
 
-	if( !raw){
-		for(auto& dist : seqs) {
+	if (!raw) {
+		for (auto &dist : seqs) {
 			auto d = dist;
-			auto p = 0.75 - 0.75 * exp(-(4.0/3.0) * d);
+			auto p = 0.75 - 0.75 * exp(-(4.0 / 3.0) * d);
 			dist = p;
 		}
 	}
 
 	auto base_seed = seed;
 
-	for( int i=0; i< seqs.size(); i++){
+	for (auto i = 0u; i < seqs.size(); i++) {
 		cout << ">S" << i << " (base_seed: " << base_seed << ")" << endl;
-		print_seq( base_seed, seed++, length, line_length, seqs[i]);
+		print_seq(base_seed, seed++, length, line_length, seqs[i]);
 	}
 
 	return 0;
 }
 
-
 static auto ACGT = "ACGT";
 static auto NO_A = "CGT";
 static auto NO_C = "AGT";
 static auto NO_G = "ACT";
 static auto NO_T = "ACG";
 
-void print_seq( unsigned base_seed, unsigned mut_seed, int length, int line_length, double divergence){
-	char line[line_length+1];
+void print_seq(unsigned base_seed, unsigned mut_seed, int length,
+			   int line_length, double divergence) {
+	char line[line_length + 1];
 	line[line_length] = '\0';
 
 	auto base_rand = default_random_engine{base_seed};
-	auto base_dist = uniform_int_distribution<int>{0,3};
-	auto base_acgt = [&]{return ACGT[base_dist(base_rand)];};
+	auto base_dist = uniform_int_distribution<int>{0, 3};
+	auto base_acgt = [&] { return ACGT[base_dist(base_rand)]; };
 
 	auto mut_rand = default_random_engine{mut_seed};
-	auto mut_dist = uniform_real_distribution<double>{0,1};
-	auto mut = bind( mut_dist, mut_rand);
-	auto mut_acgt = uniform_int_distribution<int>{0,2};
-	auto mutate = [&](char c){
+	auto mut_dist = uniform_real_distribution<double>{0, 1};
+	auto mut = bind(mut_dist, mut_rand);
+	auto mut_acgt = uniform_int_distribution<int>{0, 2};
+	auto mutate = [&](char c) {
 		int idx = mut_acgt(mut_rand);
-		switch(c){
+		switch (c) {
 			case 'A': return NO_A[idx];
 			case 'C': return NO_C[idx];
 			case 'G': return NO_G[idx];
@@ -98,13 +97,13 @@ void print_seq( unsigned base_seed, unsigned mut_seed, int length, int line_leng
 	double nucleotides = (double)length;
 	double mutations = nucleotides * divergence;
 
-	for(int i= length, j; i > 0; i -= j){
+	for (int i = length, j; i > 0; i -= j) {
 		j = min(line_length, i);
 
-		for(auto k=0; k<j; k++){
+		for (auto k = 0; k < j; k++) {
 			char c = base_acgt();
 
-			if( mut() < mutations / nucleotides ){
+			if (mut() < mutations / nucleotides) {
 				c = mutate(c);
 				mutations--;
 			}
@@ -118,9 +117,8 @@ void print_seq( unsigned base_seed, unsigned mut_seed, int length, int line_leng
 	}
 }
 
-void usage(){
-	const static char *str = {
-		"usage: test_fasta [-l length] [-d dist...] [-L line length] [-s seed] [-r raw]\n"
-	};
+void usage() {
+	const static char *str = {"usage: test_fasta [-l length] [-d dist...] [-L "
+							  "line length] [-s seed] [-r raw]\n"};
 	cerr << str;
 }


=====================================
test/test_process.c
=====================================
@@ -20,9 +20,12 @@ void test_shustring_cum_prob() {
 
 	size_t threshold = min_anchor_length(p_value, gc, len);
 
-	g_assert_cmpfloat(1 - p_value, <, shustring_cum_prob(threshold + 1, gc / 2, len));
-	g_assert_cmpfloat(1 - p_value, <=, shustring_cum_prob(threshold, gc / 2, len));
-	g_assert_cmpfloat(1 - p_value, >, shustring_cum_prob(threshold - 1, gc / 2, len));
+	g_assert_cmpfloat(1 - p_value, <,
+					  shustring_cum_prob(threshold + 1, gc / 2, len));
+	g_assert_cmpfloat(1 - p_value, <=,
+					  shustring_cum_prob(threshold, gc / 2, len));
+	g_assert_cmpfloat(1 - p_value, >,
+					  shustring_cum_prob(threshold - 1, gc / 2, len));
 }
 
 int main(int argc, char *argv[]) {


=====================================
test/test_seq.c
=====================================
@@ -1,88 +1,85 @@
-#include <glib.h>
 #include "global.h"
+#include "sequence.h"
+#include <glib.h>
 #include <stdio.h>
 #include <string.h>
-#include "sequence.h"
 
 double ANCHOR_P_VALUE = 0.025;
 
 int FLAGS = F_NONE;
 
-void test_seq_basic(){
+void test_seq_basic() {
 
 	seq_t S;
 
-	seq_init( &S, "ACGT", "name");
+	seq_init(&S, "ACGT", "name");
 
 	g_assert_cmpstr(S.S, ==, "ACGT");
 	g_assert_cmpstr(S.name, ==, "name");
 	g_assert_cmpuint(S.len, ==, 4);
 
-	seq_free( &S);
+	seq_free(&S);
 }
 
-void test_seq_full(){
+void test_seq_full() {
 
 	seq_t S;
 	seq_subject subject;
 
-	seq_init( &S, "ACGTTGCA", "name");
-	int check = seq_subject_init( &subject, &S);
+	seq_init(&S, "ACGTTGCA", "name");
+	int check = seq_subject_init(&subject, &S);
 
 	g_assert_cmpint(check, ==, 0);
 
 	g_assert_cmpstr(subject.RS, ==, "TGCAACGT#ACGTTGCA");
-	g_assert_cmpuint(subject.RSlen, ==, 8*2+1);
-	g_assert( subject.gc == 0.5);
+	g_assert_cmpuint(subject.RSlen, ==, 8 * 2 + 1);
+	g_assert(subject.gc == 0.5);
 
-	seq_subject_free( &subject);
-	seq_free( &S);
+	seq_subject_free(&subject);
+	seq_free(&S);
 }
 
-void test_seq_nonacgt(){
+void test_seq_nonacgt() {
 	seq_t S;
 	seq_subject subject;
 
-	seq_init( &S, "11ACGTNN7682394689NNTGCA11", "name");
-	seq_subject_init( &subject, &S);
+	seq_init(&S, "11ACGTNN7682394689NNTGCA11", "name");
+	seq_subject_init(&subject, &S);
 
 	g_assert_cmpstr(S.S, ==, "ACGTTGCA");
-	g_assert_cmpuint(S.len, ==, 8 );
-	g_assert( FLAGS & F_NON_ACGT);
+	g_assert_cmpuint(S.len, ==, 8);
+	g_assert(FLAGS & F_NON_ACGT);
 
 	g_assert_cmpstr(subject.RS, ==, "TGCAACGT#ACGTTGCA");
-	g_assert_cmpuint(subject.RSlen, ==, 8*2+1);
-	g_assert( subject.gc == 0.5);
+	g_assert_cmpuint(subject.RSlen, ==, 8 * 2 + 1);
+	g_assert(subject.gc == 0.5);
 
-	seq_subject_free( &subject);
-	seq_free( &S);
+	seq_subject_free(&subject);
+	seq_free(&S);
 
 	FLAGS = F_NONE;
 
-	seq_init( &S, "@ACGT_!0TGCA        ", "name");
-	seq_subject_init( &subject, &S);
+	seq_init(&S, "@ACGT_!0TGCA        ", "name");
+	seq_subject_init(&subject, &S);
 
 	g_assert_cmpstr(S.S, ==, "ACGT!TGCA");
-	g_assert_cmpuint(S.len, ==, 9 );
-	g_assert( FLAGS & F_NON_ACGT);
+	g_assert_cmpuint(S.len, ==, 9);
+	g_assert(FLAGS & F_NON_ACGT);
 
 	g_assert_cmpstr(subject.RS, ==, "TGCA;ACGT#ACGT!TGCA");
-	g_assert_cmpuint(subject.RSlen, ==, 9*2+1);
+	g_assert_cmpuint(subject.RSlen, ==, 9 * 2 + 1);
 
-	seq_subject_free( &subject);
-	seq_free( &S);
+	seq_subject_free(&subject);
+	seq_free(&S);
 
 	FLAGS = F_NONE;
-
 }
 
-int main(int argc, char *argv[])
-{
-	g_test_init( &argc, &argv, NULL);
+int main(int argc, char *argv[]) {
+	g_test_init(&argc, &argv, NULL);
 	g_test_add_func("/seq/basic", test_seq_basic);
 	g_test_add_func("/seq/full", test_seq_full);
 	g_test_add_func("/seq/non acgt", test_seq_nonacgt);
 
 	return g_test_run();
 }
-



View it on GitLab: https://salsa.debian.org/med-team/andi/-/commit/2d2acd5e563e7fffc77215c48be93a1deda0af33

-- 
View it on GitLab: https://salsa.debian.org/med-team/andi/-/commit/2d2acd5e563e7fffc77215c48be93a1deda0af33
You're receiving this email because of your account on salsa.debian.org. Manage all notifications: https://salsa.debian.org/-/profile/notifications | Help: https://salsa.debian.org/help


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20261110/eb24a935/attachment-0001.htm>


More information about the debian-med-commit mailing list