Unconfigured Ad

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • SeqTroubles
    Member
    • Sep 2016
    • 20

    #1

    Using R package ape and cophyloplot to make tanglegram

    Hi All,

    I am currently using R to make my phylogenic images Im more familiar with ggtrees and Im not an expert in R in general but can get by.

    My aim is to produce a tanglegram of a core and accessory gene data set and colour the association lines based on metadata. I have a file in tab delimited format with this information. It is a rather large phylogeny so inputting colour data for each leaf would be time consuming.

    Is there a way colour the association lines using information from separate file to get an end result similar to this


    Ive tried playing around with the following
    cophyloplot(t1, t2, assoc = A1, space=80, length.line=2, show.tip.label = F, col = cols) %<+% info$V3

    (cols is a defined set of colours for the metadata Im trying to colour)

    cophyloplot help page
    This function plots two trees face to face with the links if specified. It is possible to rotate the branches of each tree around the nodes by clicking.


    Thanks
  • SeqTroubles
    Member
    • Sep 2016
    • 20

    #2
    Hi All,

    I have found this tutorial. https://rpubs.com/tursiops/18942

    Which should work but I dont quiet understand how they distinguished and defined the links to be coloured.

    Comment

    • SeqTroubles
      Member
      • Sep 2016
      • 20

      #3
      Partially solved

      Originally posted by SeqTroubles View Post
      Hi All,

      I have found this tutorial. https://rpubs.com/tursiops/18942

      Which should work but I dont quiet understand how they distinguished and defined the links to be coloured.
      Hi All,

      Just in case anyone is interested Ive figured it out, similar to above I extracted the topology order from t1. and merged it without sorting the order with my metadata table. From here I extracted the column of interest as a vector and plugged it into cophyloplot. Please note that x is a numeric vector of genotype data (text vectors would have to be converted from what I can see). See below:

      #make association matrix and colour vector
      order <- cbind(t1$tip.label)
      list <- merge(order, info, by.x="V1", by.y="Samplename", sort=F)
      x<- list$Gene
      A1 <- cbind(t1$tip.label, t1$tip.label)

      #plot tanglegram and colour lines based on associations
      cophyloplot(t1,t2, assoc=A1, space=30, length.line=2, show.tip.label = F, col=x)

      Now all I need to figure out is how to assign specific colours. Any ideas?

      Comment

      Latest Articles

      Collapse

      • SEQadmin2
        Multiomic Liquid Biopsy: What DNA/RNA Panels Reveal That DNA Alone Can’t
        by SEQadmin2



        Tumors contain complex mixtures of cell populations that evolve in response to treatment and host-specific factors. Tissue biopsies provide only static snapshots of a tumor’s state. But what if we could follow that evolution over time using a minimally invasive technique?

        Liquid biopsies can detect tumor-derived material circulating in the bloodstream, providing a way to study treatment response, detect emerging resistance, and discover new biomarkers. Circulating
        ...
        10-14-2026, 09:55 AM
      • SEQadmin2
        New Genomics Technologies Take Aim at Long-Standing Limits
        by SEQadmin2


        Researchers using sequencing and genomics tools often have to make trade-offs. They can choose between speed or scale, short reads or long-range information, or targeted panels or a view of the whole transcriptome. New technologies that have been released this year are built to address those tough choices.

        We asked six companies the same four questions to learn about their latest products. The new technologies bring a lot to the table, including rethinking sequencing
        ...
        09-28-2026, 10:25 AM

      ad_right_rmr

      Collapse

      News

      Collapse

      Topics Statistics Last Post
      Started by SEQadmin2, 10-22-2026, 11:13 AM
      0 responses
      53 views
      0 reactions
      Last Post SEQadmin2  
      Started by SEQadmin2, 10-22-2026, 10:48 AM
      0 responses
      39 views
      0 reactions
      Last Post SEQadmin2  
      Started by SEQadmin2, 10-15-2026, 10:52 AM
      0 responses
      46 views
      0 reactions
      Last Post SEQadmin2  
      Started by SEQadmin2, 10-14-2026, 05:39 AM
      0 responses
      46 views
      0 reactions
      Last Post SEQadmin2  
      Working...