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

Generate distance matrix rather than pairwise #5

Closed
tseemann opened this issue Feb 8, 2018 · 11 comments
Closed

Generate distance matrix rather than pairwise #5

tseemann opened this issue Feb 8, 2018 · 11 comments

Comments

@tseemann
Copy link

tseemann commented Feb 8, 2018

Would it be possible to add an option to output a distance matrix in TSV or CSV instead of the pairwise list?

    A    B    C  
A   100  83   71 
B       100   92
C            100

It could be upper triangle, lower triangle, or both.

@cjain7
Copy link
Member

cjain7 commented Feb 9, 2018

Yes, this should be easy, will add it soon. Thanks for the feedback.

@tseemann
Copy link
Author

tseemann commented Mar 20, 2018

Assuming you haven't already done this, it should be output as a PHYLIP distance matrix. These can be in lower triangle form, or full matrix.

For full matrix, they need to be symetrical, so you will need to average A vs B and B vs A as fastANI is not symmetric?

For lower triangle, just use whatever is in query?

The PHYLIP format is:

4
A
B  33
C  12  99
D  25  87  8

@cjain7
Copy link
Member

cjain7 commented Mar 20, 2018

Yes thanks. Miguel, who is co-author of FastANI also pointed me to PHYLIP format for this purpose. I hope to add this soon, along with multi-threaded execution feature.

@tseemann
Copy link
Author

tseemann commented Apr 7, 2018

Looking forward to it !
I never managed to convince Brian at Mash to do it: marbl/Mash#9
CC: @schultzm

@cjain7
Copy link
Member

cjain7 commented Aug 2, 2018

Hi, option to output matrix is available in the latest version; please check when you get chance.

@cjain7 cjain7 closed this as completed Aug 2, 2018
@tseemann
Copy link
Author

tseemann commented Aug 6, 2018

@cjain7 is the matrix the default output now? or is there a command line option? I can't see "matrix" anywhere in the README.

@fmaguire
Copy link

@tseemann Looks like it is now a command line option --matrix (outputs a $output_filename.matrix file)

@cjain7
Copy link
Member

cjain7 commented Aug 11, 2018

@fmaguire is right. I've added this info to README now. Thanks!

@vinisalazar
Copy link

vinisalazar commented Jan 24, 2019

Hi, is it possible to reopen this issue to include a redundant matrix? Or could anyone provide a suggestion on how to transform the lower triangular which is outputted as a redundant/upper triangular?

Thank you for any assistance you can provide.

@cjain7
Copy link
Member

cjain7 commented Jan 27, 2019

@vinisalazar
If you are using some scripting language like R, there should be easy ways to convert a lower triangular matrix to upper triangular. I would expect you could first create a full symmetric matrix from a lower matrix, and then set lower values to 0.

Optionally, if you are familiar with C/C++, you can modify the source code; in particular the last ten or so instructions of the function outputPhylip in file fastANI/src/cgi/include/computeCoreIdentity.hpp should do the job.

@vinisalazar
Copy link

vinisalazar commented Jan 28, 2019

If you are using some scripting language like R, there should be easy ways to convert a lower triangular matrix to upper triangular.

So I thought, but I really could not find a tested function/library to do so. Thank you for the help regardless.

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

4 participants