MMseqs2 icon indicating copy to clipboard operation
MMseqs2 copied to clipboard

Question: Best way to find connections between clusters

Open adimil opened this issue 8 years ago • 13 comments

We would like to find the relations between the clusters produced with the default parameters. Basically some kind of clustering of the clusters (or hierarchical clustering). Is there a way to do that using mmseqs? (Other than running clustering again with higher sensitivity or taking the representative of each cluster and clustering aligning them.)

Thanks

adimil avatar Feb 27 '18 15:02 adimil

We don't have a good way to produce a tree from a cascaded clustering currently.

The default cascaded clustering workflow produces exactly that however, if you look into the tmp folder you will find the clustering results of previous steps, there you can find whatever representatives from the previous iterations and reconstruct a tree based on these.

milot-mirdita avatar Feb 27 '18 15:02 milot-mirdita

Can you elaborate a little bit more? do I look at the files: aln_step1...? what should I look for?

adimil avatar Feb 27 '18 15:02 adimil

MMseqs2 uses internally a cascaded workflow. This means it will first cluster with a low sensitivity and get step by step higher ( see https://github.com/soedinglab/MMseqs2/wiki#cascaded-clustering). But there is also a way to recluster clustered databases again to create a hierarchy. Please check out the guide at https://github.com/soedinglab/MMseqs2/wiki#how-to-manually-cascade-cluster

The structure of the clustering (clust_stepN files) would look like this

 Seq.DB.   Clustering Result 1         Clustering Result 2
 ID1       ID3 -> ID2, ID7.            ID3 -> ID5
 ID2       ID5 -> ID1                  ID9
 ID3       ID9 -> ID8, ID6             ID4
 ID4       ID4
 ID5
 ID6
 ID7
 ID8
 ID9

All entries on the left side of -> are the keys in the .index file. While the right side is in the data file. I do now know how you want to use the hierarchy. If you give us more information, maybe we can help you how to use the tools to achieve it.

You could also use profiles to cluster more senstive. See issue https://github.com/soedinglab/MMseqs2/issues/66.

martin-steinegger avatar Mar 01 '18 14:03 martin-steinegger

I have clustering results and I would like to see if any of the clusters are related, so I guess adding another step using the manual cascade clustering is what I need.

So 2 questions about this process:

  1. Do I need to add a result2repseq step before createsubdb? (I think it is missing in the wiki link that you attached)
  2. If the first step was done using mmseqs cluster with default parameters, do I need to change the sensitivity for the manual step? (should I increase or reduce it?)

Alternatively, is it possible to create a profile for each cluster and then cluster the profiles (like in issue #66)?

adimil avatar Mar 07 '18 13:03 adimil

1.) createsubdb is enough. No need to use result2repseq 2.) I would search all sequence all-against-all to find the relatedness.

# first clustering run
mmseqs cluster sequenceDB clu1 tmp1
# create a subset of the sequenceDB only with representative sequences
mmseqs createsubdb clu1 sequenceDB cluSequenceDB
# search representative all against all
mmseqs search cluSequenceDB cluSequenceDB cluSequenceDB_aln tmp 

3.) You can turn a clustering result into a profile and search with them profile-again-consensus

# first clustering run
mmseqs cluster sequenceDB clu1 tmp1
# create a subset of the sequenceDB only with representative sequences
mmseqs result2profile sequenceDB sequenceDB profileDB
mmseqs createsubdb clu1 profileDB cluProfileDB
mmseqs createsubdb clu1 profileDB_consensus cluProfileDB_consensus
# search representative all against all
mmseqs search cluProfileDB cluProfileDB_consensus cluProfileDB_aln tmp --add-self-matches 

martin-steinegger avatar Mar 07 '18 15:03 martin-steinegger

Thanks Martin. Few issues regarding the profile option:

  1. The result2profile command requires 4 DBs, I'm assuming clu1 is the missing one? mmseqs result2profile sequenceDB sequenceDB clu1 profileDB
  2. If I'm correct about the first issue - then the createsubdb steps are unnecessary?
  3. A possible bug: the results2profile command resulted in 2 files: profileDB_tmp_0.dbtype and profileDB_tmp_0_consensus.dbtype which I had to rename manually in order to move forward (remove the _tmp_0)

MMseqs2 Version: 9f344f3d6765a1131f22794d9a6fd9fcd8ca2cdf

adimil avatar Mar 08 '18 12:03 adimil

The _tmp_0 indicates that something went wrong (the merge was unsuccessful). Could you post the log?

milot-mirdita avatar Mar 08 '18 13:03 milot-mirdita

Hi Milot, This is the log:

MPI Init...
Rank: 0 Size: 1
Program call:
all_genomes.genes.db all_genomes.genes.db all_genomes.genes.clu4.db all_genomes.genes.clu4.profile.db 

MMseqs Version:                    	9f344f3d6765a1131f22794d9a6fd9fcd8ca2cdf
Sub Matrix                         	blosum62.out
Profile e-value threshold          	0.001
Compositional bias                 	1
Use global sequence weighting      	false
Filter MSA                         	1
Maximum sequence identity threshold	0.9
Minimum seq. id.                   	0
Minimum score per column           	-20
Minimum coverage                   	0
Select n most diverse seqs         	1000
Pseudo count a                     	0
Pseudo count b                     	1.5
Omit Consensus                     	false
No preload                         	false
Early exit                         	false
Threads                            	56
Verbosity                          	3

Compute split from 0 to 6159847
Start computing profiles.
Query database type: Aminoacid
Target database type: Aminoacid
..............................................................................................................................................................	2 Mio. sequences processed
...	1 Mio. sequences processed
............................	4 Mio. sequences processed
............................................................	3 Mio. sequences processed
.....................................................................	5 Mio. sequences processed
.............................	6 Mio. sequences processed
......................................................................................................................................................................................................................................................................Time for merging files: 0 h 0 m 21 s Time for merging files: 0 h 13 m 43 s

Done.
Time for merging files: 0 h 0 m 1 s
Time for merging files: 0 h 0 m 1 s
Time for processing: 2 h 53 m 18s

adimil avatar Mar 11 '18 09:03 adimil

@adimil do you run mmseqs using MPI? If not, please compile MMseqs without MPI. This might resolve the issue.

martin-steinegger avatar Mar 27 '18 05:03 martin-steinegger

Is this issue resolved?

martin-steinegger avatar Jul 08 '18 16:07 martin-steinegger

Hi Martin, I didn't try to run it again, but the results were fine.

adimil avatar Jul 09 '18 09:07 adimil

Hey Adimil, thanks for the answer. I will close it. Please let me know if the issues occurs again.

martin-steinegger avatar Jul 09 '18 13:07 martin-steinegger

I had this same issue when trying to use mmseqs2. Are you sure it's safe to simply rename these files?

altaetran avatar Nov 02 '18 01:11 altaetran