Code Monkey home page Code Monkey logo

Comments (3)

Hy4m avatar Hy4m commented on August 25, 2024

I had no problems after the test, and can you tell me what your problem is?

image

library(linkET)
library(dplyr)
library(ggplot2)
data_o <- read.table(file.choose(), sep="\t", row.names = 1, header = TRUE)

O_e <- read.table(file.choose(), sep="\t", row.names = 1, header = TRUE)


###mantel test
mantel_oms <- mantel_test(data_o, O_e,  
                          spec_select = list(m1 = 1:1, 
                                             m2 = 2:2, 
                                             m3 = 3:3, 
                                             m4 = 4:4,
                                             m5 = 5:5,
                                             m6 = 6:6,
                                             m7 = 7:7,
                                             m8 = 8:8),
                          spec_dist = dist_func(.FUN = "vegdist",
                                                method = "euclidean")) %>% 
  mutate(rd = cut(r, breaks = c(-Inf, 0.2, 0.4, Inf),
                  labels = c("< 0.2", "0.2 - 0.4", ">= 0.4")),
         pd = cut(p, breaks = c(-Inf, 0.01, 0.05, Inf),
                  labels = c("< 0.01", "0.01 - 0.05", ">= 0.05")))

o_plot <- correlate(O_e, engine = "correlation") %>% 
  as_md_tbl(type = "lower", diag = FALSE) %>%
  qcorrplot() +
  geom_square() +
  geom_mark(
    sep = '\n', 
    size = 3,
    sig_level = c(0.05, 0.01, 0.001),
    mark = c("*", "**", "***"),
    colour = "#000000", only_mark = FALSE) +
  
  scale_fill_gradientn(
    colours = colorRampPalette(colors =c("#A6CEE3","white","#ED665D"),space="Lab")(10),
    limits = c(-1, 1),
    breaks = seq(-1,1,0.5))+ 
  
  geom_couple(aes(x = .x - 0.2, colour = pd, size = rd, linetype = r > 0),
              
              data = mantel_oms, 
              curvature = nice_curvature(0.1), label.size =4, nudge_x= 0.2) + 
  
  scale_size_manual(values = c(0.5, 1, 2)) +
  
  scale_color_manual(values = c("#d00000", "#fcbf49","#d9d9d9")) +  
  #scale_color_manual(values = c("#d9d9d9")) +  
  scale_linetype_manual(values = c("TRUE" = "solid", "FALSE" = "dashed"),
                        labels = c("Positive", "Negative")) +
  theme(axis.text.x.bottom = element_text(angle = 45, hjust = 1, vjust = 1)) +
  
  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 = 4),
         linetype = guide_legend(title = "Mantel's r > 0", 
                                 override.aes = list(size = 0.5, colour = "darkblue"), 
                                 order = 3))
o_plot

from linket.

B-1991-ing avatar B-1991-ing commented on August 25, 2024

Thank you Houyun.

My problem is that all significant relationships are denoted as positive relationship instead of some significant positive relationship and some significant negative relationship. I know I asked once. Sorry for the double asking. Maybe you can close the question.

Best,

Bing

from linket.

Hy4m avatar Hy4m commented on August 25, 2024

I think it's OK.

Finally, it's better to email me for similar questions rather than an issue, since it's not a question about linkET package.

from linket.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.