Seqanswers Leaderboard Ad

Collapse

Announcement

Collapse
No announcement yet.
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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

  • #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


    • #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

      • seqadmin
        Essential Discoveries and Tools in Epitranscriptomics
        by seqadmin




        The field of epigenetics has traditionally concentrated more on DNA and how changes like methylation and phosphorylation of histones impact gene expression and regulation. However, our increased understanding of RNA modifications and their importance in cellular processes has led to a rise in epitranscriptomics research. “Epitranscriptomics brings together the concepts of epigenetics and gene expression,” explained Adrien Leger, PhD, Principal Research Scientist...
        04-22-2024, 07:01 AM
      • seqadmin
        Current Approaches to Protein Sequencing
        by seqadmin


        Proteins are often described as the workhorses of the cell, and identifying their sequences is key to understanding their role in biological processes and disease. Currently, the most common technique used to determine protein sequences is mass spectrometry. While still a valuable tool, mass spectrometry faces several limitations and requires a highly experienced scientist familiar with the equipment to operate it. Additionally, other proteomic methods, like affinity assays, are constrained...
        04-04-2024, 04:25 PM

      ad_right_rmr

      Collapse

      News

      Collapse

      Topics Statistics Last Post
      Started by seqadmin, Today, 08:47 AM
      0 responses
      10 views
      0 likes
      Last Post seqadmin  
      Started by seqadmin, 04-11-2024, 12:08 PM
      0 responses
      60 views
      0 likes
      Last Post seqadmin  
      Started by seqadmin, 04-10-2024, 10:19 PM
      0 responses
      59 views
      0 likes
      Last Post seqadmin  
      Started by seqadmin, 04-10-2024, 09:21 AM
      0 responses
      53 views
      0 likes
      Last Post seqadmin  
      Working...
      X