MMseqs2 icon indicating copy to clipboard operation
MMseqs2 copied to clipboard

Confusing/misformed clustered-fasta output

Open tomblaze opened this issue 6 years ago • 3 comments

Hope I am not making a simple mistake but output seems to be not what I expect. Thanks for any help.

Expected Behavior

Fasta-formatted cluster results have output following documentation.

Current Behavior

Fasta-formatted cluster results have empty lines that don't seem to correspond to correct clustering.

Examples:

>Pip8wV
>Pip8wV
MQKNLIQRYIPLSDKNWFCTGGPARFYTEPETTQEFVKSLEFANLHNLELFILGKGANILISDNGFDGLVIKPNLQQISHQDYDNDHALVHAQAGACIKDLITYCLKNNMTGPEEFSGIPGTIGGSVYINIHYFNFFLSDFLYNAQVIHKKTGDIFTVTKNWFNFGYDKSKLFEKEYFLVQATFKLKKITPIKAAYATGRSIEIIRHRNARYPNSGTCGSFFRNFLDSEVTLNIAGTEKKMIYVGYYLDKLGVKGNLNVGGASVSHKHANMIVNTNNATSTDIINLARQMQKLVQENFGITPQPECQLIGFKKYPLL*
>PJB17I
>E7HKRc
MFKRSVCVFCGSRKGRNPAHEAAATDLGTALAQNDMRLVYGAGDVGLMGAVARAAQAAGGETFGVIPDHLVKWEVGKTDLTRYIVTETMHERKKVMFMNCDAVVVLPGGAGSLDEYFEVLTWRQIGLHEKPVFLLNTEGYWTKLIHLIDHVIDEGFADASLRDYTTVVDTVQDLMDGLGATGR*

and

>S2LnDK
>S2LnDK
MNNKSENQSSQGDARRGMLIGMALGMGIGAVIGLVLGDISSGFIIGMGIGAAVGYWRFRDTPIGMRYPPHLVRQLIISGLLYLVTLIGVIYLLEYNLNRSIEIILVLLPALPGIWFLVSLGRAIASLDELQRFIQLEGIAIGFGITAMAALTYGLLGMAGVPQVSWMYVPVVMVFGWFLGKMWTLWRYR*
>E6GnE9
>PYRss2
MKKAMATSKSQFKTMDEYIATFPENVRDVLEKLRRTIMESAPKAEETISYGMPAFKLNGKSLVYFAAWKNHIGFYPAGPSAIKAFKKELSPFRQAKGTIQFPLDKPIPIDLVKKIVKFRVEENESKKK*

Where in original input file, we see:

>PJB17I
MQKRSICVFCGASDGIDSAYGAAADTLGRLIASHKMRLVYGAGDVGLMGRVARAAQKDGAATFGVIPKHLVNWEVGKTDLTTYIITENMHERKKVMFMNSDAIALLPGGAGSLDEFFEVLTWAQLGLHDKPIVLININSYWGPLLALLDHVIAQGFAKENIKDFFQIAVTPEEAMSKLA*

... and elsewhere in file ...

>E6GnE9
MNNKTGIQPIDEYIAAFPEEVQEKLISIYRLIAGDVPEATVKISYGMPTFVLNGNLVHFAAFKNHIGFYPAPSGIQAFQEELAGYKTSKGAIQFPLDKPVPYELISKITAFRVAENVKNN*

It seems that PJB17I should cluster with E7HKRc (they're ~50% identical) but then I would expect the output to be:

>PJB17I
>PJB17I
MQKRSICVFCGASDGIDSAYGAA...
>E7HKRc
MFKRSVCVFCGSRKGRNPAHE...

Based on latest documentation.

Steps to Reproduce (for bugs)

Just the commands (see full log below):

user@user:~$ ./mmseqs/bin/mmseqs createdb experiments/small_sample.fa experiments/small.mm.db user@user:~$ ./mmseqs/bin/mmseqs linclust experiments/small.mm.db experiments/small50.mm.db experiments/tmp/ --min-seq-id 0.5 user@user:~$ ./mmseqs/bin/mmseqs createseqfiledb experiments/small.mm.db experiments/small50.mm.db experiments/small50_seq user@user:~$ ./mmseqs/bin/mmseqs result2flat experiments/small.mm.db experiments/small.mm.db experiments/small50_seq experiments/small50_seq.fa

MMseqs Output (for bugs)

Full session output:

user@user:~$ ./mmseqs/bin/mmseqs createdb experiments/small_sample.fa experiments/small.mm.db
Converting sequences
[24948] 0s 72ms
Time for merging to small.mm.db_h: 0h 0m 0s 37ms
Time for merging to small.mm.db: 0h 0m 0s 16ms
Database type: Aminoacid
Time for merging to small.mm.db.lookup: 0h 0m 0s 0ms
Time for processing: 0h 0m 0s 204ms
user@user:~$ ./mmseqs/bin/mmseqs linclust experiments/small.mm.db experiments/small50.mm.db experiments/tmp/ --min-seq-id 0.5
linclust experiments/small.mm.db experiments/small50.mm.db experiments/tmp/ --min-seq-id 0.5 

MMseqs Version:                     	02be0c4ea6183fce9cf45521a8c145d10f3928c1
Cluster mode                        	0
Max depth connected component       	1000
Similarity type                     	2
Threads                             	12
Compressed                          	0
Verbosity                           	3
Substitution matrix                 	nucl:nucleotide.out,aa:blosum62.out
Add backtrace                       	false
Alignment mode                      	2
Allow wrapped scoring               	false
E-value threshold                   	0.001
Seq. id. threshold                  	0.5
Min. alignment length               	0
Seq. id. mode                       	0
Alternative alignments              	0
Coverage threshold                  	0.8
Coverage mode                       	0
Max sequence length                 	65535
Compositional bias                  	1
Realign hits                        	false
Max reject                          	2147483647
Max accept                          	2147483647
Include identical seq. id.          	false
Preload mode                        	0
Pseudo count a                      	1
Pseudo count b                      	1.5
Score bias                          	0
Gap open cost                       	11
Gap extension cost                  	1
Alphabet size                       	21
K-mers per sequence                 	21
scale k-mers per sequence           	0
Adjust k-mer length                 	false
Mask residues                       	0
Mask lower case residues            	0
K-mer size                          	0
Shift hash                          	5
Split memory limit                  	0
Include only extendable             	false
Skip repeating k-mers               	false
Rescore mode                        	0
Remove hits by seq. id. and coverage	false
Sort results                        	0
Remove temporary files              	false
Force restart with latest tmp       	false
MPI runner                          	

Set cluster mode SET COVER.
kmermatcher experiments/small.mm.db experiments/tmp//6404161245249296443/pref --sub-mat nucl:nucleotide.out,aa:blosum62.out --alph-size 13 --min-seq-id 0.5 --kmer-per-seq 21 --kmer-per-seq-scale 0 --adjust-kmer-len 0 --mask 0 --mask-lower-case 0 --cov-mode 0 -k 0 -c 0.8 --max-seq-len 65535 --hash-shift 5 --split-memory-limit 0 --include-only-extendable 0 --ignore-multi-kmer 0 --threads 12 --compressed 0 -v 3 

kmermatcher experiments/small.mm.db experiments/tmp//6404161245249296443/pref --sub-mat nucl:nucleotide.out,aa:blosum62.out --alph-size 13 --min-seq-id 0.5 --kmer-per-seq 21 --kmer-per-seq-scale 0 --adjust-kmer-len 0 --mask 0 --mask-lower-case 0 --cov-mode 0 -k 0 -c 0.8 --max-seq-len 65535 --hash-shift 5 --split-memory-limit 0 --include-only-extendable 0 --ignore-multi-kmer 0 --threads 12 --compressed 0 -v 3 

Database size: 25000 type: Aminoacid
Reduced amino acid alphabet: (A S T) (C) (D B N) (E Q Z) (F Y) (G) (H) (I V) (K R) (L J M) (P) (W) (X) 

Estimated memory consumption 8 MB
Generate k-mers list for 1 split
[=================================================================] 100.00% 25.00K 0s 120ms    
Sort kmer 0h 0m 0s 37ms
Sort by rep. sequence 0h 0m 0s 0ms
Time for fill: 0h 0m 0s 0ms
Time for merging to pref: 0h 0m 0s 5ms
Time for processing: 0h 0m 0s 219ms
rescorediagonal experiments/small.mm.db experiments/small.mm.db experiments/tmp//6404161245249296443/pref experiments/tmp//6404161245249296443/pref_rescore1 --sub-mat nucl:nucleotide.out,aa:blosum62.out --rescore-mode 0 --wrapped-scoring 0 --filter-hits 0 -e 0.001 -c 0.8 -a 0 --cov-mode 0 --min-seq-id 0.5 --min-aln-len 0 --seq-id-mode 0 --add-self-matches 0 --sort-results 0 --db-load-mode 0 --threads 12 --compressed 0 -v 3 

[=================================================================] 100.00% 25.00K 0s 11ms     
Time for merging to pref_rescore1: 0h 0m 0s 8ms==================>] 99.34% 24.84K eta 0s       
Time for processing: 0h 0m 0s 48ms
clust experiments/small.mm.db experiments/tmp//6404161245249296443/pref_rescore1 experiments/tmp//6404161245249296443/pre_clust --cluster-mode 0 --max-iterations 1000 --similarity-type 2 --threads 12 --compressed 0 -v 3 

Clustering mode: Set Cover
[=================================================================] 100.00% 25.00K 0s 9ms       
Sort entries
Find missing connections
Found 597 new connections.
Reconstruct initial order
[=================================================================] 100.00% 25.00K 0s 17ms     
Add missing connections
[=================================================================] 100.00% 25.00K 0s 1ms      

Time for read in: 0h 0m 0s 42ms
Total time: 0h 0m 0s 47ms

Size of the sequence database: 25000
Size of the alignment database: 25000
Number of clusters: 24598

Writing results 0h 0m 0s 4ms
Time for merging to pre_clust: 0h 0m 0s 11ms
Time for processing: 0h 0m 0s 87ms
createsubdb experiments/tmp//6404161245249296443/order_redundancy experiments/small.mm.db experiments/tmp//6404161245249296443/input_step_redundancy -v 3 --subdb-mode 1 

Time for merging to input_step_redundancy: 0h 0m 0s 2ms
Time for processing: 0h 0m 0s 6ms
createsubdb experiments/tmp//6404161245249296443/order_redundancy experiments/tmp//6404161245249296443/pref experiments/tmp//6404161245249296443/pref_filter1 -v 3 --subdb-mode 1 

Time for merging to pref_filter1: 0h 0m 0s 2ms
Time for processing: 0h 0m 0s 6ms
filterdb experiments/tmp//6404161245249296443/pref_filter1 experiments/tmp//6404161245249296443/pref_filter2 --filter-file experiments/tmp//6404161245249296443/order_redundancy 

Filtering using file(s)
[=================================================================] 100.00% 24.60K 0s 11ms     
Time for merging to pref_filter2: 0h 0m 0s 21ms
Time for processing: 0h 0m 0s 56ms
rescorediagonal experiments/tmp//6404161245249296443/input_step_redundancy experiments/tmp//6404161245249296443/input_step_redundancy experiments/tmp//6404161245249296443/pref_filter2 experiments/tmp//6404161245249296443/pref_rescore2 --sub-mat nucl:nucleotide.out,aa:blosum62.out --rescore-mode 1 --wrapped-scoring 0 --filter-hits 1 -e 0.001 -c 0.8 -a 0 --cov-mode 0 --min-seq-id 0.5 --min-aln-len 0 --seq-id-mode 0 --add-self-matches 0 --sort-results 0 --db-load-mode 0 --threads 12 --compressed 0 -v 3 

[=================================================================] 100.00% 24.60K 0s 11ms     
Time for merging to pref_rescore2: 0h 0m 0s 19ms=================>] 99.48% 24.47K eta 0s       
Time for processing: 0h 0m 0s 59ms
align experiments/tmp//6404161245249296443/input_step_redundancy experiments/tmp//6404161245249296443/input_step_redundancy experiments/tmp//6404161245249296443/pref_rescore2 experiments/tmp//6404161245249296443/aln --sub-mat nucl:nucleotide.out,aa:blosum62.out -a 0 --alignment-mode 2 --wrapped-scoring 0 -e 0.001 --min-seq-id 0.5 --min-aln-len 0 --seq-id-mode 0 --alt-ali 0 -c 0.8 --cov-mode 0 --max-seq-len 65535 --comp-bias-corr 1 --realign 0 --max-rejected 2147483647 --max-accept 2147483647 --add-self-matches 0 --db-load-mode 0 --pca 1 --pcb 1.5 --score-bias 0 --gap-open 11 --gap-extend 1 --threads 12 --compressed 0 -v 3 

Compute score and coverage
Query database size: 24598 type: Aminoacid
Target database size: 24598 type: Aminoacid
Calculation of alignments
[=================================================================] 100.00% 24.60K 0s 159ms    
Time for merging to aln: 0h 0m 0s 22ms

25322 alignments calculated.
24830 sequence pairs passed the thresholds (0.980570 of overall calculated).
1.009432 hits per query sequence.
Time for processing: 0h 0m 0s 211ms
clust experiments/tmp//6404161245249296443/input_step_redundancy experiments/tmp//6404161245249296443/aln experiments/tmp//6404161245249296443/clust --cluster-mode 0 --max-iterations 1000 --similarity-type 2 --threads 12 --compressed 0 -v 3 

Clustering mode: Set Cover
[=================================================================] 100.00% 24.60K 0s 10ms     
Sort entries
Find missing connections
Found 232 new connections.
Reconstruct initial order
[=================================================================] 100.00% 24.60K 0s 18ms     
Add missing connections
[=================================================================] 100.00% 24.60K 0s 1ms      

Time for read in: 0h 0m 0s 47ms
Total time: 0h 0m 0s 56ms

Size of the sequence database: 24598
Size of the alignment database: 24598
Number of clusters: 24385

Writing results 0h 0m 0s 4ms
Time for merging to clust: 0h 0m 0s 19ms
Time for processing: 0h 0m 0s 101ms
mergeclusters experiments/small.mm.db experiments/small50.mm.db experiments/tmp//6404161245249296443/pre_clust experiments/tmp//6404161245249296443/clust --threads 12 --compressed 0 -v 3 

Clustering step 1
[=================================================================] 100.00% 24.60K 0s 9ms      
Clustering step 2
[=================================================================] 100.00% 24.39K 0s 43ms     
Write merged clustering
[=================================================================] 100.00% 25.00K 0s 65ms     
Time for merging to small50.mm.db: 0h 0m 0s 22ms
Time for processing: 0h 0m 0s 112ms
user@user:~$ ./mmseqs/bin/mmseqs createseqfiledb experiments/small.mm.db experiments/small50.mm.db experiments/small50_seq
createseqfiledb experiments/small.mm.db experiments/small50.mm.db experiments/small50_seq 

MMseqs Version:	02be0c4ea6183fce9cf45521a8c145d10f3928c1
Min sequences	1
Max sequences	2147483647
HH format    	false
Threads      	12
Compressed   	0
Verbosity    	3

Time for merging to small50_seq: 0h 0m 0s 12ms
Time for processing: 0h 0m 0s 75ms
user@user:~$ ./mmseqs/bin/mmseqs result2flat experiments/small.mm.db experiments/small.mm.db experiments/small50_seq experiments/small50_seq.fa
result2flat experiments/small.mm.db experiments/small.mm.db experiments/small50_seq experiments/small50_seq.fa 

MMseqs Version: 	02be0c4ea6183fce9cf45521a8c145d10f3928c1
Use fasta header	false
Verbosity       	3

Time for processing: 0h 0m 0s 107ms

Context

Input file (small_sample.fa): https://gist.github.com/tomblaze/818f17864d3afeb5475b054a66169571

Output file (small50_seq.fa): https://gist.github.com/tomblaze/e7840473fcfb4992ec709327c358d679

Your Environment

Ubuntu 16.04 (this output from my computer, but bug also occurred on an AWS run)

MMseqs Version: 02be0c4ea6183fce9cf45521a8c145d10f3928c1

Downloaded from https://mmseqs.com/latest/mmseqs-linux-sse41.tar.gz

tomblaze avatar Dec 15 '19 18:12 tomblaze

Thank you for this detailed bug report. It really helped to find the bug. I introduced it recently. The issue should be fixed by https://github.com/soedinglab/MMseqs2/commit/be1a9822cde9389cda4d927d32f22c51790506d3.

If you want a set of stickers though (see https://twitter.com/thesteinegger/status/1201076220957315074), sent me your address via mail.

martin-steinegger avatar Dec 15 '19 21:12 martin-steinegger

Hi @martin-steinegger, I've been getting this exact same error, not sure what could be happening. I am using the latest version of mmseqs2 (14-7e284). What other information could I provide to help debug?

Thank you, Vini

vinisalazar avatar Jun 08 '23 02:06 vinisalazar

Can you please make a new issue, with the output of MMseqs2 and excerpts of your result files?

milot-mirdita avatar Jun 08 '23 06:06 milot-mirdita