Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cluster ASVs to OTUs with DECIPHER #1950

Open
Danyang1111 opened this issue May 9, 2024 · 2 comments
Open

Cluster ASVs to OTUs with DECIPHER #1950

Danyang1111 opened this issue May 9, 2024 · 2 comments

Comments

@Danyang1111
Copy link

Hi,
I am trying to cluster obtained ASVs to OTUs using DECIPHER, the code is as follows:
`
asv_sequences <- colnames(seqtab_nochim_subset)
sample_names <- rownames(seqtab_nochim_subset)

dna2 <- Biostrings::DNAStringSet(asv_sequences)

aln <- DECIPHER::AlignSeqs(dna2, processors = nproc)
d <- DECIPHER::DistanceMatrix(aln, processors = nproc)

clusters <- DECIPHER::TreeLine(
myDistMatrix=d,
method = "complete",
cutoff = 0.03, # use cutoff = 0.03 for a 97% OTU
processors = nproc)

merged_seqtab <- seqtab_nochim_subset %>%
t %>%
rowsum(clusters$cluster) %>%
t
`
and I got error like this:

Error in h(simpleError(msg, call)) : error in evaluating the argument 'x' in selecting a method for function 't': incorrect length for 'group'

what should I do?

@benjjneb
Copy link
Owner

In order to diagnose what is going wrong, I would start by breaking your multi-call line into individual steps to identify where the error is coming from.

val1 <- seqtab_nochim_subset %>% t
val2 <- rowsum(val1, clusters$cluster)
val3 <- t(val2)

After identifying which individual step is causing the error, you can inspect the help for the individual function (rowsum or t) and the input to the function to see if there are any mismatches that would cause the error.

@sigrik92
Copy link

Hi, I encountered the same issue and solved it by adding type = "clusters" (else the output is a dendrogram):

clusters <- DECIPHER::TreeLine(
myDistMatrix=d,
method = "complete",
type = "clusters",
cutoff = 0.03
processors = nproc)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants