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
      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
    22 views
    0 likes
    Last Post seqadmin  
    Started by seqadmin, 04-10-2024, 10:19 PM
    0 responses
    24 views
    0 likes
    Last Post seqadmin  
    Started by seqadmin, 04-10-2024, 09:21 AM
    0 responses
    19 views
    0 likes
    Last Post seqadmin  
    Started by seqadmin, 04-04-2024, 09:00 AM
    0 responses
    50 views
    0 likes
    Last Post seqadmin  
    Working...
    X