Comments (6)
Hi Ashley, sorry for not answering earlier. I'll look into your data soon, and come up with a more complete answer.
from swarm.
from swarm.
Here is the code that builds the final table:
STATS="amplicons.stats"
SWARMS="amplicons.swarms"
AMPLICON_TABLE="amplicon_contingency_table.csv"
OTU_TABLE="OTU_contingency_table.csv"
# Header
echo -e "OTU\t$(head -n 1 "${AMPLICON_TABLE}")" > "${OTU_TABLE}"
# Compute "per sample abundance" for each OTU
awk -v SWARM="${SWARMS}" \
-v TABLE="${AMPLICON_TABLE}" \
'BEGIN {FS = " "
while ((getline < SWARM) > 0) {
swarms[$1] = $0
}
FS = "\t"
while ((getline < TABLE) > 0) {
table[$1] = $0
}
}
{# Parse the stat file (OTUs sorted by decreasing abundance)
seed = $3
n = split(swarms[seed], OTU, " ")
for (i = 1; i < n; i = i + 2) {
s = split(table[OTU[i]], abundances, "\t")
for (j = 1; j < s; j++) {
samples[j] += abundances[j+1]
}
}
printf "%s\t%s", NR, $3
for (j = 1; j < s; j++) {
printf "\t%s", samples[j]
}
printf "\n"
delete samples
}' "${STATS}" >> "${OTU_TABLE}"
I've changed the line seed = $3 "_" $4
for seed = $3
to adapt the code to the your amplicon name format.
However, your dataset seems to be incomplete. For example, amplicon TDA23-3508
forms its own cluster and is marked as representing 6 reads (see amplicons.stats
), but a look at amplicon_contingency_table.csv
shows that TDA23-3508
has a total of 2 reads, all from sample TDA23
. So 4 reads are missing here, and the resulting OTU table will likely be wrong.
Did you perform a global dereplication of your fasta data before clustering?
from swarm.
from swarm.
I do perform a global dereplication using USEARCH before clustering, is that the reason why the OTU table lose some information?
Performing a global dereplication is strongly recommended, so it is good you did it. When dereplicating, did you use the --sizein
option to take into account the per-sample abundance values?
There are count differences between your stats, swarms and table files, so something is wrong. However, it is hard for me to say exactly what step of your process went wrong.
from swarm.
Sorry for the delay. I added -sizein option and redone the whole process, but unfortunately, there is still some absence data. I'm gonna try several more times and see if I can work this out. Thank you again for your effort.
from swarm.
Related Issues (20)
- Incorrect results with long sequences, very high gap penalties, and d>1 HOT 9
- Roadmap HOT 9
- table formats for making OTU table from swarm results HOT 2
- documentation: maximal input sequence length HOT 9
- Link to new swarm 3 paper HOT 3
- way too many clusters? HOT 7
- Issues with plotting: OTU not found HOT 3
- Compiling fails on Windows HOT 3
- maximal header length HOT 1
- uc file question HOT 7
- Invalid numeric argument for option -t or --threads HOT 8
- integer division might be one byte too small in some cases HOT 14
- Seeds not in same order as clusters in output files HOT 2
- Option to exclude seeds or clusters with low abundance HOT 1
- risk of silent 8-bit unsigned integer overflow in score matrix HOT 5
- fastidious boundary applies to the consolidated cluster mass? HOT 1
- Option to output cluster member ids/sequence id? HOT 3
- swarm terminates if any sequence in the input fasta file has an N HOT 2
- Refactor Bloom filter code
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from swarm.