Skip to content

Commit

Permalink
SWARM 2.1.8: Fix rare bug, do not show alignment parameters for d=1
Browse files Browse the repository at this point in the history
  • Loading branch information
torognes committed Mar 11, 2016
1 parent 4e37873 commit a84e112
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 15 deletions.
24 changes: 20 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ Table of Content
* [Third-party pipelines](#pipelines)
* [Alternatives](#alternatives)
* [New features](#features)
* [version 2.1.8](#version218)
* [version 2.1.7](#version217)
* [version 2.1.6](#version216)
* [version 2.1.5](#version215)
* [version 2.1.4](#version214)
Expand Down Expand Up @@ -434,6 +436,19 @@ methods, here are some links:
<a name="features"/>
## New features##

<a name="version218"/>
### version 2.1.8 ###

**swarm** 2.1.8 fixes a rare bug triggered when clustering extremely
short undereplicated sequences. Also, alignment parameters are not
shown when d=1.

<a name="version217"/>
### version 2.1.7 ###

**swarm** 2.1.7 fixes more problems with seed output. Ignore CR
characters in FASTA files. Improved help and error messsages.

<a name="version216"/>
### version 2.1.6 ###

Expand All @@ -459,10 +474,11 @@ with the `-w` option when d>1.
<a name="version212"/>
### version 2.1.2 ###

**swarm** 2.1.2 adds the -a (--append-abundance) option to set a default
abundance value to be used when abundance information is missing from
the input file. If this option is not specified, missing abundance information
will result in a fatal error. The error message in that case is improved.
**swarm** 2.1.2 adds the -a (--append-abundance) option to set a
default abundance value to be used when abundance information is
missing from the input file. If this option is not specified, missing
abundance information will result in a fatal error. The error message
in that case is improved.

<a name="version211"/>
### version 2.1.1 ###
Expand Down
7 changes: 6 additions & 1 deletion man/swarm.1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.\" ============================================================================
.TH swarm 1 "February 24, 2016" "version 2.1.7" "USER COMMANDS"
.TH swarm 1 "March 11, 2016" "version 2.1.8" "USER COMMANDS"
.\" ============================================================================
.SH NAME
swarm \(em find clusters of nearly-identical nucleotide amplicons
Expand Down Expand Up @@ -329,6 +329,11 @@ New features and important modifications of \fBswarm\fR (short lived
or minor bug releases are not mentioned):
.RS
.TP
.BR v2.1.8\~ "released March 11, 2016"
Version 2.1.8 fixes a rare bug triggered when clustering extremely
short undereplicated sequences. Also, alignment parameters are not
shown when \fId\rR=1.
.TP
.BR v2.1.7\~ "released February 24, 2016"
Version 2.1.7 fixes a bug in the output of seeds with the \-w option
when \fId\fR > 1 that was not properly fixed in version 2.1.6. It also
Expand Down
21 changes: 12 additions & 9 deletions src/algod1.cc
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ static int * global_hits_data = 0;
static int global_hits_alloc = 0;
static int global_hits_count = 0;

static unsigned long threads_used = 0;

inline unsigned int hash_getindex(unsigned long hash)
{
#ifdef POWEROFTWO
Expand Down Expand Up @@ -315,7 +317,7 @@ void generate_variants(unsigned long thread,

#if 1
/* identical non-variant */
if (thread == threads - 1)
if (thread == threads_used - 1)
find_variant_matches(thread, varseq, seqlen, seed);
#endif

Expand Down Expand Up @@ -470,16 +472,17 @@ void process_seed(int seed, int subseed)
{
unsigned long seqlen = db_getsequencelen(subseed);

unsigned long thr = threads;
if (thr > seqlen + 1)
thr = seqlen+1;
threads_used = threads;
if (threads_used > seqlen + 1)
threads_used = seqlen+1;

/* prepare work for the threads */
unsigned long start = 0;
for(unsigned long t=0; t<thr; t++)
for(unsigned long t=0; t<threads_used; t++)
{
struct thread_info_s * tip = ti + t;
unsigned long length = (seqlen - start + thr - t) / (thr - t);
unsigned long length =
(seqlen - start + threads_used - t) / (threads_used - t);
tip->seed = subseed;
tip->mut_start = start;
tip->mut_length = length;
Expand All @@ -491,8 +494,8 @@ void process_seed(int seed, int subseed)
pthread_mutex_unlock(&tip->workmutex);
}

/* wait for theads to finish their work */
for(unsigned int t=0; t<thr; t++)
/* wait for threads to finish their work */
for(unsigned int t=0; t<threads_used; t++)
{
struct thread_info_s * tip = ti + t;
pthread_mutex_lock(&tip->workmutex);
Expand All @@ -503,7 +506,7 @@ void process_seed(int seed, int subseed)

/* join hits from the threads */

for(unsigned int t=0; t<thr; t++)
for(unsigned int t=0; t<threads_used; t++)
{
if (global_hits_count + ti[t].hits_count > global_hits_alloc)
{
Expand Down
4 changes: 4 additions & 0 deletions src/swarm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,13 @@ void args_show()
fprintf(logfile, "Uclust file: %s\n", uclustfilename);
fprintf(logfile, "Resolution (d): %ld\n", resolution);
fprintf(logfile, "Threads: %lu\n", threads);

if (resolution > 1)
{
fprintf(logfile, "Scores: match: %ld, mismatch: %ld\n", matchscore, mismatchscore);
fprintf(logfile, "Gap penalties: opening: %ld, extension: %ld\n", gapopen, gapextend);
fprintf(logfile, "Converted costs: mismatch: %ld, gap opening: %ld, gap extension: %ld\n", penalty_mismatch, penalty_gapopen, penalty_gapextend);
}
fprintf(logfile, "Break OTUs: %s\n", opt_no_otu_breaking ? "No" : "Yes");
if (opt_fastidious)
fprintf(logfile, "Fastidious: Yes, with boundary %ld\n", opt_boundary);
Expand Down
2 changes: 1 addition & 1 deletion src/swarm.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
#define LINE_MAX 2048
#endif

#define SWARM_VERSION "2.1.7"
#define SWARM_VERSION "2.1.8"
#define WIDTH 32
#define WIDTH_SHIFT 5
#define BLOCKWIDTH 32
Expand Down

0 comments on commit a84e112

Please sign in to comment.