hy4m / linket Goto Github PK
View Code? Open in Web Editor NEWEverything is Linkable
Everything is Linkable
I want give bray curtis distance in spec_dist and euclidean distance in env_dist but unfortunately I unable to give and it automatically taking euclidean distance for both the data. How to set different distance matrix for both the data in matel_test() function.
library(linkET)
data("varespec", package = "vegan")
data("varechem", package = "vegan")
random_forest(varespec[1:3], varechem[1:3])
#> Error: 'rp.importance' is not an exported object from 'namespace:rfPermute'
Created on 2021-10-11 by the reprex package (v2.0.1)
想请问一下大家,一开始我的环境数据有缺失,默认参数时
mantel_test()
using 'euclidean' dist method for 'spec'.
mantel_test()
using 'euclidean' dist method for 'env'.
我尝试着设置spec_dist = "bray", env_dist = "euclidean",这时候报错
Error in purrr::pmap()
:
ℹ In index: 1.
Caused by error in cor()
:
! cov/cor中有遗漏值
Run rlang::last_trace()
to see where the error occurred.
Warning messages:
1: In .FUN(.data, ...) : you have empty rows: their dissimilarities may be
meaningless in method “bray”
2: In .FUN(.data, ...) : missing values in results
我的丰度数据是没有任何缺失值的。我把环境数据里的缺失值填补了,却还是不能实现丰度数据采用'bray',环境数据采用'euclidean',这是为什么呢
library(linkET)
correlate(mtcars) %>%
qcorrplot(extra_mat = list(extra = matrix(1, nrow = 11, ncol = 11))) +
geom_square()
#> Error in as_md_tbl(data, ...): 参数没有用(extra_mat = list(c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)))
Created on 2021-09-23 by the reprex package (v2.0.0)
Hi Houyun,
I want to see the correlation between two dataframe using linkET, but one dataframe has missing values - NA.
Should I move out the rows with NA? Or replace the NA using 0?
What I am doing now is to replace the NA with 0, but not sure if it is right.
Could you give me some suggestions?
Best,
Bing
Hi Houyun,
How do you usually do when your matrix have some missed values? If I don't fill the missed values, I will have error when using the linkET.
Matrix
matrix.txt
Thank you very much.
Best,
Bing
为什么demo的数据可以跑出图,但是用自己的数据会出现这个问题
Hi Houyun,
When I try to load the linkET package --- library(linkET) today, error shown as below.
Error
namespace ‘vctrs’ 0.5.1 is already loaded, but >= 0.5.2 is required
I tried to reinstall the linkET package and the vctrs package, but failed.
install.packages("devtools")
devtools::install_github("Hy4m/linkET", force = TRUE)
install.packages("vctrs")
What can I do for this problem?
Best,
Bing
Hi Houyun,
I am using the linkET to see the correlation between two matrixes, error always happened in the Rstudio.
The code
linkET_Sib_amo_cox_code.pdf
The excel table
omstrup33_sillebotten_mam copy.xlsx
Do you have any idea why it always occcurs?
Best,
Bing
从Github安装失败:错误: Failed to install 'linkET' from GitHub:
Multiple results for CFLAGS found, something is wrong.FALSE
以下是我的版本信息:
_
platform aarch64-apple-darwin20
arch aarch64
os darwin20
system aarch64, darwin20
status
major 4
minor 2.3
year 2023
month 03
day 15
svn rev 83980
language R
version.string R version 4.2.3 (2023-03-15)
nickname Shortstop Beagle
我从您的GitHub库也没找到tar.gz源文件,请问您这怎么解决?
library(linkET)
as_matrix_data(mtcars, cluster = "all")
#> Error in attr(x, i) <- attrs[[i]]: cannot set attribute on a symbol
Created on 2021-09-26 by the reprex package (v2.0.0)
Hi,
Thank you for this great package!
I use your code example (linkET v.0.07.1) below:
mantel_test(varespec, varechem,
spec_select = list(spec01 = 1:5, spec02 = 6:12))
'mantel_test()' using 'bray' dist method for 'spec'.
'mantel_test()' using 'euclidean' dist method for 'env'.
which applies bray to spec.
However, on my 16S amplicon dataset, I would like to manually specify the distance for spec
and chem
becaue by default it always applies euclidean distances to my species data but I want to use Bray-Curtis.
In the help manual to mantel_test()
, I found that you can specify spec_dist =
and env_dist =
, however, the function dist_func()
does not seem to offer the usually applied distances found in e.g. vegan::vegdist(method = "bray").
Could you please provide an example of how to specify e.g. Bray-Curtis using dist_func()
.
Also when looking up the help page for dist_func()
one gets redirected to gdist()
, without a clear explanation of how they relate and are supposed to be implemented in the mantel_test().
Thank you for helping and for sharing your expertise!
as the title, and i had tried several ways to achieve this.
scale_x_discrete
: not in avail. And there are glaring wrong with the square.ggtext::markdown
: not in avail.linkET::element_formula
: with parse=T
, there is nothing change with the orgin label, that is, remain displaying CO[2]
on the figure.linkET::latex_formula
: not in avail. this function change CO[2]
to CO *'['*, 2, *']'*
and then just straightfoward display in the figure.here's the figure with problem, and code attach it. Figure is the result when try the function ggtext::element_markdown
and scale_x_discrete
as description above.
qcorrplot(correlate(na.omit(eda.lon[,3:9])), type = "lower", diag = F)+
geom_square() +
# geom_tile()+
scale_x_discrete(labels = eda.abbr)+
scale_y_discrete(labels = eda.abbr)
geom_couple(aes(colour = pd, size = rd),
data = mantel.mod,
curvature = nice_curvature()) +
# geom_mark(r = NA,size = 3,only_mark = T)+
scale_fill_gradientn(colours = RColorBrewer::brewer.pal(11, "RdBu"),breaks = seq(1, -1, -0.4),limits = c(-1,1)) +
scale_size_manual(values = c(0.5, 1, 2)) +
scale_colour_manual(values = color_pal(3)) +
guides(size = guide_legend(title = "Mantel's r",
override.aes = list(colour = "grey35"),
order = 2),
colour = guide_legend(title = "Mantel's p",
override.aes = list(size = 3),
order = 1),
fill = guide_colorbar(title = "Pearson's r", order = 3))+
theme(
axis.text = element_markdown(color = "black",size = 10))
I found a R package named correlation with many different kinds of correlations. So would you like to intergrate it into linkET?
Hi Houyun,
I carefully looked into the changing trend of my two matrixes, and not sure my command lines were right. So, could you please help me have a check? I attached my data and code.
Thank you very much.
Best,
Bing
您好,我在绘制mantel test相关性热图的时候没有展示对角线上的相关性数据,但是这让我的相关性热图的方块都很小。我的相关性热图的相关性系数范围时-0.2到0.2(排除了对角线上的相关系数),现在我想将geom_square的范围调到-0.2到0.2之间,我应该怎么做呢?
Hi,
As you mentioned in other posts, the row sum of the OTU table can not be zero in order to use the bray distance in the mantel_test().
I checked the out table I am working with, and there was no zero row sum:
> sum(rowSums(otuITS.OR) == 0)
[1] 0
Still encountered the error:
Error in `purrr::pmap()`:
ℹ In index: 1.
Caused by error in `cor()`:
! missing observations in cov/cor
Run `rlang::last_trace()` to see where the error occurred.
Warning messages:
1: In .FUN(.data, ...) : you have empty rows: their dissimilarities may be
meaningless in method “bray”
2: In .FUN(.data, ...) : missing values in results
With this, I wondered whether we could calculate bray distance and use this matrix as input for the mantel_test? - I did not get an error for using the vegdist() to calculate the bray distance. Also, does the mantel_test scale for the env matrix?
Maybe something like this:
dist16S = as.matrix(vegdist(otu16S, method = "bray", upper = T, diag = T))
mantest.16S = mantel_test(
spec = dist16S,
env = scale(soilprop16S),
spec_dist = "none",
env_dist = "euclidean",
)
Thank you,
Xiao
不太清楚现在是否可以实现改变Mantel test连线起点和终点的形状和颜色?如果可以实现的话,使用哪个函数呢?
When i use the example for qcorrplot
correlate(mtcars) %>% as_md_tbl() %>% qcorrplot()
it's return :
Error: Need a cor_tbl.
Hi,
This linkET is fantastic!When I use this package to draw a basic correlation heatmap, I want to add significant level stars on the color blocks to represent the P-values, but I have not been successful. Could you help me check if this package can achieve this? I would greatly appreciate any response from you.
先感谢非常好用的包
出图的结果希望,热图部分能进行聚类再展示,可以实现吗
library(linkET)
x <- correlate(mtcars, adjust = TRUE)
print(class(x$p))
## numeric
Hello, I would like to inquire if the linkET package can run a data volume of over 20000 lines?
Hi, can I set the dote(spec data) in my own order?
Thanks for your great package!
When I perform a mantel_test analysis using the default parameters (mantel_fun = "mantel"), I am a little confused as to how the correlation r-values and p-values are calculated.
After checking the source code, I guessed that the Pearson was used. If so, I would like to know if other methods can be used to calculate the correlation, such as Spearman.
PS: I also tried adding "method='spearman'" to the mantel_test function, but the step ran for more than 2 hours with no results. On the contrary, without adding this parameter, it only took half an hour to complete.
Thanks in advance for your help!
Best!
xiaojjia
Hi Houyun,
Could you add one feature requirement to show the negative correlation using the dotted curves and the positive correlation using the solid curves? Then it will be easier for people to directly see the negative or positive correlation between two matrixes.
For now, all my correlated curves are solid.
Best,
Bing
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.