Seqanswers Leaderboard Ad

Collapse

Announcement

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

  • How to use combat in R??

    I'm trying to use combat to correct for batch effect in our dataset. The sample csv files contains genes in rows, and samples in columns, and expression values are from different microarray. We have in total 6 batches, and the sif file contains 3 columns : arrays, samples, batch (as per the manual). R generates an error message when running combat.. I'm not sure what to do from here. What am I doing wrong??


    Library(sva)
    dat = read.csv("Combat_matrix_input.csv");
    sif = read.csv("sif.csv");

    modcombat = model.matrix(~1, data=dat)

    newdata = ComBat(dat=dat, batch=sif$Batch, par.prior = TRUE, mod = modcombat)
    Found 6 batches
    Error in cbind(batchmod, mod) :
    number of rows of matrices must match (see arg 2)

  • #2
    I think the problem is that your modcombat matrix doesn't have the right dimensions. When you run

    Code:
    modcombat = model.matrix(~1, data=dat)
    you'll get an n by 1 matrix with each entry equal to 1, where n is the number of records or lines in the csv file. What you really want is an m by 1 matrix full of 1's, where m is the number of fields or columns of the csv file, assuming that you don't have any covariates in your data. If you do have covariates, just make a vector that describes the covariate and pass that in to the model.matrix function. Like this

    Code:
    modcombat = model.matrix(~ covariates)

    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 on Modified Bases...
      Yesterday, 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, 04-11-2024, 12:08 PM
    0 responses
    37 views
    0 likes
    Last Post seqadmin  
    Started by seqadmin, 04-10-2024, 10:19 PM
    0 responses
    41 views
    0 likes
    Last Post seqadmin  
    Started by seqadmin, 04-10-2024, 09:21 AM
    0 responses
    35 views
    0 likes
    Last Post seqadmin  
    Started by seqadmin, 04-04-2024, 09:00 AM
    0 responses
    54 views
    0 likes
    Last Post seqadmin  
    Working...
    X