DiffBind: dba.plotProfile() Change sample order
1
0
Entering edit mode
2.7 years ago
Kate • 0

Hi,

Is it possible to change the order of samples when using dba.plotProfile()? I've tried defining them with the samples= parameter, but I haven't been successful. I've made lovely plots (this is a great tool!), but instead of the default order (ex A, B, C, D), I'd like to reorder them (ex B, A, D, C).

This is after I've defined my sites with this line:

repObj <- dba.report(dbObj, contrast=2, bDB=TRUE)

If it changes things, I have quite a few samples, most of which are not used to create contrast 2. I'm looking at the profiles across the samples at the sites defined by contrast 2.

Thanks!
Kate

DiffBind • 1.3k views
ADD COMMENT
1
Entering edit mode
2.7 years ago
Rory Stark ★ 2.0k

By default, when you use a report-based DBA, all the samples are included even if they are not "in" the contrast as it doesn't really know which contrast it came from.

To select which samples to include, and in which order, use the list option to specify samples to the initial call to dba.plotProfile().

For example, consider an example from the plotProfileDemo workbook:

data(tamoxifen_analysis)
tamoxifen$config$RunParallel <- TRUE

# Add contrast #2 with a subset of samples
tamoxifen <- dba.contrast(tamoxifen,contrast=c("Tissue","ZR75","BT474"))
tamoxifen <- dba.analyze(tamoxifen)

# plot only the samples in contrast #2, merged into two groups
profiles  <- dba.plotProfile(tamoxifen, sites=2)
dba.plotProfile(profiles)

# get report DB for contrast #2 and plot with all samples
repObj <- dba.report(tamoxifen, contrast=2, bDB=TRUE)
profiles  <- dba.plotProfile(tamoxifen, sites=repObj)
dba.plotProfile(profiles)

# plot with only contrast samples and reverse order
profiles  <- dba.plotProfile(tamoxifen, sites=repObj,
                             samples=list(BT474=1:2,ZR75=10:11))
dba.plotProfile(profiles)

# plot only samples not in contrast
repObj <- dba.report(tamoxifen, contrast=2, 
                     bGain=TRUE, bLoss=TRUE, bAll=FALSE)
profiles  <- dba.plotProfile(tamoxifen, sites=repObj,
                             samples=list(MCF7_RESPOND=3:5,
                                          MCF7_RESIST=8:9,
                                          T47D=6:7))
dba.plotProfile(profiles)
ADD COMMENT
0
Entering edit mode

Thanks so much! It worked like a charm.

ADD REPLY

Login before adding your answer.

Traffic: 2498 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6