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
        Advancing Precision Medicine for Rare Diseases in Children
        by seqadmin




        Many organizations study rare diseases, but few have a mission as impactful as Rady Children’s Institute for Genomic Medicine (RCIGM). “We are all about changing outcomes for children,” explained Dr. Stephen Kingsmore, President and CEO of the group. The institute’s initial goal was to provide rapid diagnoses for critically ill children and shorten their diagnostic odyssey, a term used to describe the long and arduous process it takes patients to obtain an accurate...
        12-16-2024, 07:57 AM
      • seqadmin
        Recent Advances in Sequencing Technologies
        by seqadmin



        Innovations in next-generation sequencing technologies and techniques are driving more precise and comprehensive exploration of complex biological systems. Current advancements include improved accessibility for long-read sequencing and significant progress in single-cell and 3D genomics. This article explores some of the most impactful developments in the field over the past year.

        Long-Read Sequencing
        Long-read sequencing has seen remarkable advancements,...
        12-02-2024, 01:49 PM

      ad_right_rmr

      Collapse

      News

      Collapse

      Topics Statistics Last Post
      Started by seqadmin, 12-17-2024, 10:28 AM
      0 responses
      32 views
      0 likes
      Last Post seqadmin  
      Started by seqadmin, 12-13-2024, 08:24 AM
      0 responses
      48 views
      0 likes
      Last Post seqadmin  
      Started by seqadmin, 12-12-2024, 07:41 AM
      0 responses
      34 views
      0 likes
      Last Post seqadmin  
      Started by seqadmin, 12-11-2024, 07:45 AM
      0 responses
      46 views
      0 likes
      Last Post seqadmin  
      Working...
      X