Unconfigured Ad

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

    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

      • GATTACAT
        Reply to Nine Things a Sample Prep Scientist Thinks About Before Sequencing
        by GATTACAT
        Love this - good data definitely starts from good input, and poor input can only give relatively poor data. I particularly like the mention of Nanodrop/absorbance based methods for quantification. It's such a toss up if you'll get an accurate reading or what amounts to a randomly generated number, and a lot of library/sequencing related issues can be traced back to poor quant.
        07-01-2026, 11:43 AM
      • SEQadmin2
        Nine Things a Sample Prep Scientist Thinks About Before Sequencing
        by SEQadmin2


        I’m not a sequencing expert. I’m a purification scientist who uses NGS to evaluate workflows my group develops. With this perspective, we think about the sample first and the NGS workflow second. The sequencer is an exceptionally honest reporter, but it can only report on what you give it, so whether you get clean, interpretable data from an NGS workflow is largely determined before you begin.

        Here are nine questions we think about, in roughly the order they matter, before...
        06-18-2026, 07:11 AM

      ad_right_rmr

      Collapse

      News

      Collapse

      Topics Statistics Last Post
      Started by SEQadmin2, 07-02-2026, 11:08 AM
      0 responses
      22 views
      0 reactions
      Last Post SEQadmin2  
      Started by SEQadmin2, 06-30-2026, 05:37 AM
      0 responses
      23 views
      0 reactions
      Last Post SEQadmin2  
      Started by SEQadmin2, 06-26-2026, 11:10 AM
      0 responses
      22 views
      0 reactions
      Last Post SEQadmin2  
      Started by SEQadmin2, 06-17-2026, 06:09 AM
      0 responses
      55 views
      0 reactions
      Last Post SEQadmin2  
      Working...