Seqanswers Leaderboard Ad

Collapse

Announcement

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

  • cummeRbund csHeatmap columns in user-defined order

    Hello to all!
    This is my first post on RNAseq and let me start by thanking you for existing, I was able to get many answers here
    I am using the R package cummeRbund (from Bioconductor) to visualize RNA-seq data, I created a cuffGeneSet instance called "DEG_genes" that contains 662 genes that are significantly differentially expressed between males and females. My goal is to create a heatmap using csHeatmap() in which the male and female samples (replicates) are separated but with a specific user-defined order within the sex category.
    I used:

    Code:
    > DEG<-diffData(genes(cuff))   # take differentially expressed genes
        > DEG_significant<-subset(DEG,significant=='yes') # retain only significant changes
        > DEG_sign_IDs <- DEG_significant$gene_id # retrieve IDs
        > DEG_genes<-getGenes(cuff,DEG_sign_IDs) # get CuffGeneSet instance
    
        > DEG_genes
        CuffGeneSet instance for  662  genes
     
        Slots:
        	 annotation
        	 fpkm
        	 repFpkm
        	 diff
        	 count
        	 isoforms	 CuffFeatureSet instance of size 930 
        	 TSS		 CuffFeatureSet instance of size 785 
        	 CDS		 CuffFeatureSet instance of size 230 
        	 promoters		 CuffFeatureSet instance of size 662 
        	 splicing		 CuffFeatureSet instance of size 785 
        	 relCDS		 CuffFeatureSet instance of size 662 
    
        > summary(DEG_genes)
             Length       Class        Mode 
                662 CuffGeneSet          S4 
        > hmap<-csHeatmap(DEG_genes,clustering='none',labRow=F,replicates=T)
    This gives me ALMOST what I want: the heatmap shows Females on the left and Males on the right but they are alphabetically ordered (Female_0,Female_1,Female_10,Female_11,Female_12...Female_19,Female_2,Female_20,Female_21..,Female_29 on the left and similarly for males Male_0,Male_1,Male_10...Male_19,Male_2,Male_20...etc on the right) and I want them to be in a specific order (clusterReps). I created a test vector with replicate names on a specific order (Males on the left with 0 and 6 echanged and females on the right) as follows:
    Code:
    clusterReps<-c("Male_6","Male_1","Male_2","Male_3","Male_4","Male_5","Male_0","Male_7","Male_8","Male_9","Male_10","Male_11","Male_12","Male_13","Male_14","Male_15","Male_16","Male_17","Male_18","Male_19","Male_20","Male_21","Male_22","Male_23","Male_24","Male_25","Male_26","Male_27","Male_28","Male_29","Male_30","Male_31","Male_32","Male_33","Female_0","Female_1","Female_2","Female_3","Female_4","Female_5","Female_6","Female_7","Female_8","Female_9","Female_10","Female_11","Female_12","Female_13","Female_14","Female_15","Female_16","Female_17","Female_18","Female_19","Female_20","Female_21","Female_22","Female_23","Female_24","Female_25","Female_26","Female_27","Female_28")
    I would like the data to be exactly the same except the order of the columns that must follow the order of the "clusterReps" vector. Knowing that the heatmap is a ggplot, I looked everywhere for a solution the last 2 days but with no success (despite a closely ressembling problem with heatmap.2() instead of csHeatmap() on stackoverflow, I tried to get a replicate fpkm matrix and use heatmap.2 but could only use heatmap_2 and some options were not accepted).
    Using:
    Code:
     > hmap<-hmap+scale_x_discrete(limits=clusterReps)
        Scale for 'x' is already present. Adding another scale for 'x', which will replace the existing scale.
    only changes the x-axis labels but not the actual data (the heatmap remains identical).
    Is there a similar function that rearranges the columns and not just labels? There must be a way to do this but I haven't found it yet.
    Thanks in advance for your help, I'm not familiar with handling ggplot objects, and in particular heatmaps from cummeRbund.
    I am afraid I can't give more information for the moment, please let me know if you want me to execute a command and report the output if it can help you help me .

Latest Articles

Collapse

  • 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
  • seqadmin
    Strategies for Sequencing Challenging Samples
    by seqadmin


    Despite advancements in sequencing platforms and related sample preparation technologies, certain sample types continue to present significant challenges that can compromise sequencing results. Pedro Echave, Senior Manager of the Global Business Segment at Revvity, explained that the success of a sequencing experiment ultimately depends on the amount and integrity of the nucleic acid template (RNA or DNA) obtained from a sample. “The better the quality of the nucleic acid isolated...
    03-22-2024, 06:39 AM

ad_right_rmr

Collapse

News

Collapse

Topics Statistics Last Post
Started by seqadmin, 04-11-2024, 12:08 PM
0 responses
30 views
0 likes
Last Post seqadmin  
Started by seqadmin, 04-10-2024, 10:19 PM
0 responses
32 views
0 likes
Last Post seqadmin  
Started by seqadmin, 04-10-2024, 09:21 AM
0 responses
28 views
0 likes
Last Post seqadmin  
Started by seqadmin, 04-04-2024, 09:00 AM
0 responses
52 views
0 likes
Last Post seqadmin  
Working...
X