-
Notifications
You must be signed in to change notification settings - Fork 7
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
Incorrect clustering result in clusterMotifs function #13
Comments
I think the issue is the cutoff value for the clusters. Those motifs are very close to each others. You can try to close the reversecompletmement alignment and try it again. If it does still not work, please let me know.Best!Your sincerely,Jianhong OuOn Oct 28, 2023, at 3:20 PM, Feng Xu ***@***.***> wrote:
Hi Jianhong, thanks for developing motifStack which helps me a lot.
Recently, I want to cluster a list of motifs using motifStack. But when I replaced the test data with the motifs mentioned earlier in the tutorial, I found that the clustering results were not correct. My running environment is R 4.3.1, and the motifStack version is 1.44.1. The code is as follows:
motifs <- importMatrix(dir(path, "*.pcm", full.names = TRUE),
format = "pcm", to = "pcm")
hc <- clusterMotifs(motifs)
## convert the hclust to phylog object
library(ade4)
phylog <- hclust2phylog(hc)
## reorder the pfms by the order of hclust
leaves <- names(phylog$leaves)
motifs <- motifs[leaves]
## create a list of pfm objects
#motifs <- mapply(motifs, names(motifs),
# FUN=function(.pfm, .name){
# new("pcm",mat=.pfm, name=.name)})
## extract the motif signatures
motifSig <- motifSignature(motifs, phylog, cutoffPval = 0.0001, min.freq=1)
sig <- signatures(motifSig)
## get the group color for each signature
gpCol <- sigColor(motifSig)
library(RColorBrewer)
color <- brewer.pal(12, "Set3")
## plot the logo stack with pile style.
motifPiles(phylog=phylog, pfms=motifs, pfms2=sig,
col.tree=rep(color, each=5),
col.leaves=rep(rev(color), each=5),
col.pfms2=gpCol,
r.anno=c(0.02, 0.03, 0.04),
col.anno=list(sample(colors(), 50),
sample(colors(), 50),
sample(colors(), 50)),
motifScale="logarithmic",
plotIndex=TRUE)
The out plot displayed as below:
As seen from the plot, the "bin_SOLEXA" and "fkh_NAR" were clustered into cluster2 which should be composed of "bin_SOLEXA", "slp1_SOLEXA" and "FoxP_SOLEXA".
I think it was due to the incorrect clustering of the clusterMotifs that led to the subsequent visualization errors. Perhaps the result is correct, just because I did not use motifStack correctly. If that's the case, how can I cluster correctly by using motifStack? Thank you in advance.
Feng
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
Hi, @jianhong. Actually I am new to R and motifStack, and I don't know how to close the reverse complement alignment. Can you show me a example? Thanks! Feng |
Hi Feng,
clusterMotifs will pass the parameters to matalign function, which has parameters method and revcomp. Revcomp can be a single logical value or a logical vector with length of pcms.
Matalign is modified from Matalign-v4a (from Stormo lab). Previously, MotIV::motifDistances (R implementation of STAMP) is used to calculated the distance. However, the MotIV package were dropped from Bioconductor 3_12 release. You can also try that one.
Jianhong.
From: Feng Xu ***@***.***>
Date: Sunday, October 29, 2023 at 10:18 PM
To: jianhong/motifStack ***@***.***>
Cc: JIANHONG OU ***@***.***>, Mention ***@***.***>
Subject: Re: [jianhong/motifStack] Incorrect clustering result in clusterMotifs function (Issue #13)
Hi, @jianhong<https://github.com/jianhong>. Actually I am new to R and motifStack, and I don't know how to close the reverse complement alignment. Can you show me a example? Thanks!
Feng
—
Reply to this email directly, view it on GitHub<#13 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ABLBEAZEUJR4MD4M732JRGDYB4FBDAVCNFSM6AAAAAA6UI7BLGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTOOBUGM3TEOJUGY>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Hi, @jianhong. Thanks for your advice, I get the correct cluster plot as it should be with the following code: hc <- clusterMotifs(motifs, revcomp=F) And the plot is: |
Try to increase your cutoffPval in the function of `motifSignature`
From: Feng Xu ***@***.***>
Date: Wednesday, November 1, 2023 at 4:11 AM
To: jianhong/motifStack ***@***.***>
Cc: jianhong ou ***@***.***>, Mention ***@***.***>
Subject: Re: [jianhong/motifStack] Incorrect clustering result in clusterMotifs function (Issue #13)
Hi, @jianhong<https://github.com/jianhong>. Thanks for your advice, I get the correct cluster plot as it should be with the following code:
hc <- clusterMotifs(motifs, revcomp=F)
And the plot is:
[image]<https://user-images.githubusercontent.com/20716042/279612455-b9f140b7-c56d-49e1-bd20-a5766a606780.png>
BTW, as can be seen from the plot, the first three motif were clustered into Cluster2. But actually, if these motifs are reverse complementary, they can be clustered into Cluster1. So how can I cluster all these motifs into one cluster? Thank you in advance.
Feng
—
Reply to this email directly, view it on GitHub<#13 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ABLBEA33KP2GMAAIUSSWQEDYCH733AVCNFSM6AAAAAA6UI7BLGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTOOBYGU3TANJZGQ>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Hi Jianhong, thanks for developing motifStack which helps me a lot.
Recently, I want to cluster a list of motifs using motifStack. But when I replaced the test data with the
motifs
mentioned earlier in the tutorial, I found that the clustering results were not correct. My running environment isR 4.3.1
, and the motifStack version is1.44.1
. The code is as follows:The out plot displayed as below:

As seen from the plot, the "bin_SOLEXA" and "fkh_NAR" were clustered into
cluster2
which should be composed of "bin_SOLEXA", "slp1_SOLEXA" and "FoxP_SOLEXA".I think it was due to the incorrect clustering of the
clusterMotifs
that led to the subsequent visualization errors. Perhaps the result is correct, just because I did not use motifStack correctly. If that's the case, how can I cluster correctly by using motifStack? Thank you in advance.Feng
The text was updated successfully, but these errors were encountered: