This is a test version of Biostars. For the public version, visit https://www.biostars.org.
DiffBind error: No contrasts added. There must be at least two sample groups with at least three replicates.

Good morning, I'm working with ATACseq data for the fist time, and I'm using DiffBind for the Differential Accessibility Analysis, but I have this message error when I make the contrast: No contrasts added. There must be at least two sample groups with at least three replicates. I have two samples of 2 replicates for each sample. I don't know if I can perform this analysis with DiffBind, I would like to know if it's possible and whats the problem, and if its not possible what package I can use instead DiffBind.

This is my script:

GFP_vs_NT<-dba.peakset(NULL,
                        peaks="../bash_results/macs2/ATAC_GFP_1_peaks.xls",
                        peak.caller="macs", sampID="ATAC_GFP_1",
                        condition = "GFP", replicate=1,
                        bamReads ="../bash_results/final_bam/ATAC_GFP_1.BL.bam")

GFP_vs_NT<-dba.peakset(GFP_vs_NT,
                        peaks="../bash_results/macs2/ATAC_GFP_2_peaks.xls",
                        peak.caller="macs", 
                        sampID="ATAC_GFP_2",
                        condition = "GFP", replicate=2, 
                        bamReads = "../bash_results/final_bam/ATAC_GFP_2.BL.bam")

GFP_vs_NT<-dba.peakset(GFP_vs_NT,
                        peaks="../bash_results/macs2/ATAC_NT_1_peaks.xls",
                        peak.caller="macs", sampID="ATAC_NT_1",condition = "NT", replicate=1,
                        bamReads = "../bash_results/final_bam/ATAC_NT_1.BL.bam")

GFP_vs_NT<-dba.peakset(GFP_vs_NT,
                        peaks="../bash_results/macs2/ATAC_NT_2_peaks.xls",
                        peak.caller="macs", sampID="ATAC_NT_2",
                        condition = "NT", replicate=2, 
                        bamReads = "../bash_results/final_bam/ATAC_NT_1.BL.bam")

counts<-dba.count(GFP_vs_NT, 
                  bParallel = TRUE,
                  score=DBA_SCORE_READS)

GFP_vs_NT_counts<-dba.contrast(counts,
                               categories=DBA_CONDITION, 
                               minMembers = 2)

GFP_vs_NT_counts <- dba.contrast(counts,
                                 contrast = c("condition", "replicate"))

GFP_vs_NT_analyzed<-dba.analyze(GFP_vs_NT_counts, 
                                method = DBA_ALL_METHODS)

GFP_vs_NT_DE_peaks <- dba.report(GFP_vs_NT_analyzed)
atac-seq diffbind

1 answer

You can do this in DiffBind, but you're continuously overwriting your peakset object with each dba.peakset call. Thus, your peakset only has one sample in it (ATAC_NT_2).

Read the vignette to learn how to properly load your data (start on page 6).

Thanks! I saw that but I don't know how to do the samplesheet, I don't have any .csv, my output are bamfiles and peaks, I don't know if I have to do it manually and what I have to put there

You can put it together manually - the vignette has clear examples of the format. It will contain columns that point to your BAM and peak files for each sample.

Log in to answer this question.