Skip to content

Commit

Permalink
Swarm 1.2.7: Fix seed output, ignore some CR in FASTA files, etc
Browse files Browse the repository at this point in the history
  • Loading branch information
torognes committed Feb 24, 2016
1 parent 3b9bf54 commit adb033a
Show file tree
Hide file tree
Showing 21 changed files with 140 additions and 114 deletions.
17 changes: 12 additions & 5 deletions 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.6" "USER COMMANDS"
.TH swarm 1 "February 24, 2016" "version 2.1.7" "USER COMMANDS"
.\" ============================================================================
.SH NAME
swarm \(em find clusters of nearly-identical nucleotide amplicons
Expand Down Expand Up @@ -279,11 +279,11 @@ Concept by Frédéric Mahé, implementation by Torbjørn Rognes.
.SH CITATION
Mahé F, Rognes T, Quince C, de Vargas C, Dunthorn M. (2014)
Swarm: robust and fast clustering method for amplicon-based studies.
\fIPeerJ\fR 2:e593 <http://dx.doi.org/10.7717/peerj.593>
\fIPeerJ\fR 2:e593 <https://doi.org/10.7717/peerj.593>
.PP
Mahé F, Rognes T, Quince C, de Vargas C, Dunthorn M. (2015)
Swarm v2: highly-scalable and high-resolution amplicon clustering.
\fIPeerJ\fR 3:e1420 <http://dx.doi.org/10.7717/peerj.1420>
\fIPeerJ\fR 3:e1420 <https://doi.org/10.7717/peerj.1420>
.\" ============================================================================
.SH REPORTING BUGS
Submit suggestions and bug-reports at
Expand All @@ -296,7 +296,7 @@ Torbjørn Rognes <torognes@ifi.uio.no>.
The software is available from <https://github.com/torognes/swarm>
.\" ============================================================================
.SH COPYRIGHT
Copyright (C) 2012, 2013, 2014, 2015, 2016 Frédéric Mahé & Torbjørn Rognes
Copyright (C) 2012-2016 Frédéric Mahé & Torbjørn Rognes
.PP
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
Expand Down Expand Up @@ -329,10 +329,17 @@ New features and important modifications of \fBswarm\fR (short lived
or minor bug releases are not mentioned):
.RS
.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
handles ascii character no 13 (CR) in FASTA files better. Swarm will
now exit with status 0 if the \-h or the \-v option is specified. The
help text and some error messages have been improved.
.TP
.BR v2.1.6\~ "released December 14, 2015"
Version 2.1.6 fixes problems with older compilers that do not have the
x86intrin.h header file. It also fixes a bug in the output of seeds
with the `-w` option when \fId\fR > 1.
with the \-w option when \fId\fR > 1.
.TP
.BR v2.1.5\~ "released September 8, 2015"
Version 2.1.5 fixes minor bugs.
Expand Down
Binary file modified man/swarm_manual.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion src/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# SWARM
#
# Copyright (C) 2012-2015 Torbjorn Rognes and Frederic Mahe
# Copyright (C) 2012-2016 Torbjorn Rognes and Frederic Mahe
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
Expand Down
43 changes: 21 additions & 22 deletions src/algo.cc
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
/*
SWARM
SWARM
Copyright (C) 2012-2015 Torbjorn Rognes and Frederic Mahe
Copyright (C) 2012-2016 Torbjorn Rognes and Frederic Mahe
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Contact: Torbjorn Rognes <torognes@ifi.uio.no>,
Department of Informatics, University of Oslo,
PO Box 1080 Blindern, NO-0316 Oslo, Norway
Contact: Torbjorn Rognes <torognes@ifi.uio.no>,
Department of Informatics, University of Oslo,
PO Box 1080 Blindern, NO-0316 Oslo, Norway
*/

#include "swarm.h"
Expand Down Expand Up @@ -515,9 +515,8 @@ void algo_run()

unsigned long mass = 0;
unsigned previd = amps[0].swarmid;
unsigned prevamp = amps[0].ampliconid;
unsigned seed = prevamp;
mass += db_getabundance(prevamp);
unsigned seed = amps[0].ampliconid;
mass += db_getabundance(seed);

for (unsigned long i=1; i<amplicons; i++)
{
Expand All @@ -528,21 +527,21 @@ void algo_run()
fprintf(fp_seeds, ">");
fprint_id_with_new_abundance(fp_seeds, seed, mass);
fprintf(fp_seeds, "\n");
db_fprintseq(fp_seeds, prevamp, 0);
db_fprintseq(fp_seeds, seed, 0);

mass = 0;
seed = amps[i].ampliconid;
}

mass += db_getabundance(amps[i].ampliconid);
previd = id;
prevamp = amps[i].ampliconid;
mass += db_getabundance(prevamp);
progress_update(i);
}

fprintf(fp_seeds, ">");
fprint_id_with_new_abundance(fp_seeds, seed, mass);
fprintf(fp_seeds, "\n");
db_fprintseq(fp_seeds, prevamp, 0);
db_fprintseq(fp_seeds, seed, 0);

progress_done();
}
Expand Down
34 changes: 17 additions & 17 deletions src/algod1.cc
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
/*
SWARM
SWARM
Copyright (C) 2012-2015 Torbjorn Rognes and Frederic Mahe
Copyright (C) 2012-2016 Torbjorn Rognes and Frederic Mahe
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Contact: Torbjorn Rognes <torognes@ifi.uio.no>,
Department of Informatics, University of Oslo,
PO Box 1080 Blindern, NO-0316 Oslo, Norway
Contact: Torbjorn Rognes <torognes@ifi.uio.no>,
Department of Informatics, University of Oslo,
PO Box 1080 Blindern, NO-0316 Oslo, Norway
*/

/*
This version of the swarm algorithm uses Frederic's idea for d=1 to
enumerate all of the maximum 7L+4 possible variants of a sequence with only
one difference, where L is the length of the sequence.
enumerate all of the maximum 7L+4 possible variants of a sequence
with only one difference, where L is the length of the sequence.
*/

#include "swarm.h"
Expand Down
4 changes: 3 additions & 1 deletion src/arch.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
/*
Copyright (C) 2014-2015 Torbjorn Rognes
SWARM
Copyright (C) 2012-2016 Torbjorn Rognes and Frederic Mahe
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
Expand Down
4 changes: 3 additions & 1 deletion src/bitmap.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
/*
Copyright (C) 2012-2015 Torbjorn Rognes and Frederic Mahe
SWARM
Copyright (C) 2012-2016 Torbjorn Rognes and Frederic Mahe
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
Expand Down
4 changes: 3 additions & 1 deletion src/bloom.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
/*
Copyright (C) 2012-2015 Torbjorn Rognes and Frederic Mahe
SWARM
Copyright (C) 2012-2016 Torbjorn Rognes and Frederic Mahe
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
Expand Down
49 changes: 25 additions & 24 deletions src/db.cc
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
/*
SWARM
SWARM
Copyright (C) 2012-2015 Torbjorn Rognes and Frederic Mahe
Copyright (C) 2012-2016 Torbjorn Rognes and Frederic Mahe
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Contact: Torbjorn Rognes <torognes@ifi.uio.no>,
Department of Informatics, University of Oslo,
PO Box 1080 Blindern, NO-0316 Oslo, Norway
Contact: Torbjorn Rognes <torognes@ifi.uio.no>,
Department of Informatics, University of Oslo,
PO Box 1080 Blindern, NO-0316 Oslo, Norway
*/

#include "swarm.h"
Expand Down Expand Up @@ -215,7 +215,7 @@ void db_read(const char * filename)
fatal("Illegal header line in fasta file.");

long headerlen = 0;
if (char * stop = strpbrk(line+1, " \n"))
if (char * stop = strpbrk(line+1, " \r\n"))
headerlen = stop - (line+1);
else
headerlen = strlen(line+1);
Expand Down Expand Up @@ -278,10 +278,13 @@ void db_read(const char * filename)
*(datap+datalen) = m;
datalen++;
}
else if (c != '\n')
else if ((c != 10) && (c != 13))
{
char msg[100];
snprintf(msg, 100, "Illegal character '%c' in sequence on line %u", c, lineno);
if ((c >= 32) && (c <= 126))
snprintf(msg, 100, "Illegal character '%c' in sequence on line %u", c, lineno);
else
snprintf(msg, 100, "Illegal character (ascii no %d) in sequence on line %u", c, lineno);
fatal(msg);
}
line[0] = 0;
Expand Down Expand Up @@ -434,12 +437,10 @@ void db_read(const char * filename)
{
char * msg;
if (asprintf(&msg,
"Abundance annotations not found for %d sequences, "
"starting on line %u.\n"
"Fasta headers must end with abundance annotations "
"(_INT or ;size=INT)\n"
"Abundance annotations can be produced by "
"dereplicating the sequences\n",
"Abundance annotations not found for %d sequences, starting on line %u.\n"
"Fasta headers must end with abundance annotations (_INT or ;size=INT).\n"
"The -z option must be used if the abundance annotation is in the latter format.\n"
"Abundance annotations can be produced by dereplicating the sequences.\n",
missingabundance,
missingabundance_lineno) == -1)
fatal("Out of memory");
Expand Down
4 changes: 3 additions & 1 deletion src/derep.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
/*
Copyright (C) 2014-2015 Torbjorn Rognes
SWARM
Copyright (C) 2012-2016 Torbjorn Rognes and Frederic Mahe
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
Expand Down
2 changes: 1 addition & 1 deletion src/matrix.cc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
SWARM
Copyright (C) 2012-2015 Torbjorn Rognes and Frederic Mahe
Copyright (C) 2012-2016 Torbjorn Rognes and Frederic Mahe
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
Expand Down
2 changes: 1 addition & 1 deletion src/nw.cc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
SWARM
Copyright (C) 2012-2015 Torbjorn Rognes and Frederic Mahe
Copyright (C) 2012-2016 Torbjorn Rognes and Frederic Mahe
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
Expand Down
2 changes: 1 addition & 1 deletion src/qgram.cc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
SWARM
Copyright (C) 2012-2014 Torbjorn Rognes and Frederic Mahe
Copyright (C) 2012-2016 Torbjorn Rognes and Frederic Mahe
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
Expand Down
2 changes: 1 addition & 1 deletion src/scan.cc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
SWARM
Copyright (C) 2012-2015 Torbjorn Rognes and Frederic Mahe
Copyright (C) 2012-2016 Torbjorn Rognes and Frederic Mahe
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
Expand Down
2 changes: 1 addition & 1 deletion src/search16.cc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
SWARM
Copyright (C) 2012-2014 Torbjorn Rognes and Frederic Mahe
Copyright (C) 2012-2016 Torbjorn Rognes and Frederic Mahe
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
Expand Down
2 changes: 1 addition & 1 deletion src/search8.cc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
SWARM
Copyright (C) 2012-2014 Torbjorn Rognes and Frederic Mahe
Copyright (C) 2012-2016 Torbjorn Rognes and Frederic Mahe
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
Expand Down
2 changes: 1 addition & 1 deletion src/ssse3.cc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
SWARM
Copyright (C) 2012-2014 Torbjorn Rognes and Frederic Mahe
Copyright (C) 2012-2016 Torbjorn Rognes and Frederic Mahe
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
Expand Down
Loading

1 comment on commit adb033a

@torognes
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is version 2.1.7, not 1.2.7 as indicated in the commit title.

Please sign in to comment.