JLSteenwyk/PhyKIT

ValueError: x and y must have length at least 2.

chun-he-316 opened this issue · 12 comments

Hello,
I want to use phykit to evaluate gene-gene covariation, the command looks like this: "phykit cover treefiles/gene1.treefile.rooted treefiles/gene2.treefile.rooted -r tree.rooted.txt". However, I met this error: "ValueError: x and y must have length at least 2". Please tell me how to resolve this problem. Thanks.
The best,
Chun

Hi Chun,

Thank you so much for writing and for using PhyKIT!

Would you please share your input files for me to better diagnose the issue?

Feel free to send them here or email me directly https://jlsteenwyk.com/contact.html.

best,

Jacob

Hi Chun,

I got an email that you responded but do not see the response on GitHub. If this correct, please send your files via email.

All the best,

Jacob

Hi Jacob,

Thank you so much for answering me.
I will send the input file to you by email. tree.rooted.txt is the species tree. gene1.treefile and gene2.treefile are two gene trees, and the branch length is the inferred corresponding gene count. So I use the command "phykit cover gene1.treefile gene2.treefile -r tree.rooted.txt". I have sent it to you by email, please check.
The error is "ValueError: x and y must have length at least 2". Please tell me how to resolve this problem. Thanks.
In addition, I tried the examples in "https://jlsteenwyk.com/PhyKIT/tutorials/index.html#evaluating-gene-gene-covariation", but the result was nothing like the tutorials. I do not know why. The results are as follows:
"phykit cover Shen_etal_SciAdv_2020_NDC80.treefile.rooted Shen_etal_SciAdv_2020_SEC7.treefile.rooted -r Shen_etal_SciAdv_2020_species_tree.tre
0.2105 0.0
phykit cover Shen_etal_SciAdv_2020_NUF2.treefile.rooted Shen_etal_SciAdv_2020_SEC7.treefile.rooted -r Shen_etal_SciAdv_2020_species_tree.tre
0.1885 0.0"

The best,
Chun

Hi Chun,

I haven't received an email yet and checked my spam box.

Please email me here: jlsteenwyk[at]berkeley[dot]edu

best,

Jacob

Hi Jacob,

I have sent these files, please check.

The best,
Chun

Hi Chun,

I'm sorry but I am still not receiving the emails. I'm sorry about the hassle.

Would you mind providing me your email address so I can send you a message?

best,

Jacob

I sent it again with Google Mail. Did it work this time? My E-mail address is chun31589@gmail.com

In addition, I do not know what the two values in the output mean respectively. Can you explain it to me?

Message received - thank you so much! I will work on diagnosing the issue now and get back to you 😄

Hi Chen,

I have received the files - thank you for working with me on getting the files!

The reason you got this error is because the branch lengths in your input trees are really long compared to the species tree. As described in Steenwyk et al. (2022), Science Advances, outlier branch lengths get removed because they can cause spurious correlations. Outlier branches are defined as being 5 times the length of the species tree.

In your case, all branches are outlier branches. Accordingly, all branches were getting removed.

To resolve this issue, I've added a new argument to the cover function, the -ot/--outlier_threshold argument. This argument takes a float as input or a string "None" to specify that no threshold should be used.

Thus, for your example, you can execute the following command:
pk_cover gene1.treefile gene2.treefile -r tree.rooted.txt -ot None, which will produce the following output:
0.8732 0.0

As described in the help message of the cover function (which you can view by executing pk_cover -h), these two values indicate the coevolutionary coefficient and the associated p-value. Here, the coevolutionary coefficient is 0.8732 and the p-value is 0.0.

The interpretation would be that there is strong evidence for coevolution because there is a high coevolutionary coefficient and a statistically significant signature of coevolution.

This is now available in PhyKIT version 1.16.0, which can be downloaded using pip install phykit -U; (https://pypi.org/project/phykit/1.16.0/).

Lastly, regarding the error in the tutorial. Thank you for spotting that. I will address it shortly. The tutorial is currently incorrect and I will fix it soon. However, given that the tutorial is not pertinent to your use case, and I demonstrated the result with your example files, I will go ahead and close the comment. Please feel free to reopen the comment if you have an additional inquiry.

All the best,

Jacob

Hi Jacob,

I already tried that, and it worked. Thank you very much.

The best,
Chun

Dear Chun,

The tutorial has been fixed.

Thank you again for pointing out this error.

best,

Jacob