ParBLiSS / FastANI

Fast Whole-Genome Similarity (ANI) Estimation
Apache License 2.0
368 stars 66 forks source link

fastANI's .visualize output for small sequences #133

Open sinamajidian opened 3 months ago

sinamajidian commented 3 months ago

Dear fastANI team

I'm trying to visualize the fastANI output for a simple case where two fasta files have identical sequences (with different record IDs). In each fasta file, there are two random sequences generated using this website with the length of 800 and 1100 bases. The visualisation results doesn't seem to be as expected.

This is the command line I used:

fastANI -q 1.fa -r 2.fa --visualize -o fastani.out --minFraction 0.1 --fragLen 1000

which resulted in these outputs

$ cat fastani.out
1.fa    2.fa    100 1   1
$ cat fastani.out.visual 
1.fa    2.fa    100 NA  NA  NA  0   999 800 1799    NA  NA

So the ANI value is correctly estimated 100. Then I used this R code, generating this figure

fastani out visual

I would have expected to see a different visualisation where the first record (with 800 bases) is ignored, and there is a match for the second record (with 1100 bases).

When I check the R code,

comparison <- try(read_comparison_from_blast(fastANI_visual_file))

The output visual file is converted to this R dataframe:

Screenshot 2024-06-10 at 7 07 41 PM

So I can guess 0 999 (as it is evident in the image), shows the start and end on the first fasta file, and also 800 1799 shows the start and end on the second sequences. It seems that coordinate of FastANI .visual output are a concatenation.

Please find attached the dataset fastani_case.zip.

It seems that it happens when the first sequence (record) in the fasta file is smaller than fragLen. This doesn't happened for another dataset with larger sequences. I agree this is very edge case and might not happen for usual real dataset.

Best regards, Sina