SEQanswers

Go Back   SEQanswers > Bioinformatics > Bioinformatics



Similar Threads
Thread Thread Starter Forum Replies Last Post
maybe a Gviz issue??? emolinari Bioinformatics 2 06-24-2013 07:26 AM
BioConductor GViz: BiomartGeneRegionTrack/GeneRegionTrack stack height AndreasD Bioinformatics 1 06-10-2013 04:03 AM
R bioconductor: Gviz dependency valei Bioinformatics 1 03-07-2013 12:06 PM
peak height on chip-seq emilyjia2000 Bioinformatics 0 08-13-2012 01:30 PM

Reply
 
Thread Tools
Old 11-05-2015, 01:30 AM   #1
abisko00
Member
 
Location: Munich

Join Date: Jul 2015
Posts: 14
Default Gviz - adjust track height

Dear all,

I have a probably trivial problem where I need a hint into the right direction:

I am trying to visualize RNA-seq data in Gviz (nice!). I have two bam files loaded as AlignmentsTrack (just coverage and sashimi, no reads). Individually, they fill the square plotting area completey (the Y-axis is scaled to fill all available space). I can also add GenomeAxisTrack and a BioMartGeneRegionTrack, which reduces the height accordingly. But when I add the second AlignmentsTrack, the plot no longer scales in y-direction and I get a very narrow band in the middle of my square plotting area (maybe 25% of the available space).

How can I scale the two AlignmentsTracks to use more y-space in the plotting area? The parameters "sizes" or any type of "height" parameter just affects the ratio within the band, but not the overall size.



Code:
gTrack<-GenomeAxisTrack()
alTrack<-AlignmentsTrack(range='WT.bam',genome='hg19', name='Wildtype', chromosome='chr8',ispaired=T)
alTrack2<-AlignmentsTrack(range='Mut.bam',genome='hg19', name='Mutant', chromosome='chr8',ispaired=T)
bmt<-BiomartGeneRegionTrack(genome='hg19',chromosome='chr8',start=afrom,end=ato,filter=list(with_ox_refseq_mrna=T),stacking='squish',showExonId=F)
plotTracks(c(gTrack,bmt,alTrack,alTrack2),from=afrom,to=ato,type=c('coverage','sashimi'))
abisko00 is offline   Reply With Quote
Old 04-20-2016, 01:56 AM   #2
stianlagstad
Junior Member
 
Location: Oslo

Join Date: Apr 2015
Posts: 7
Default

Did you have the same problem as I'm experiencing here? If so, did you ever find a solution?

Edit: If that was your problem, the solution is in the thread I linked to

Last edited by stianlagstad; 04-20-2016 at 02:07 PM.
stianlagstad is offline   Reply With Quote
Old 04-21-2016, 12:41 AM   #3
abisko00
Member
 
Location: Munich

Join Date: Jul 2015
Posts: 14
Default

Hi,

thanks for pointing me to your thread. Meanwhile, I have given up on this problem, but although my plot is slightly different, I'll give the max.height parameter a try.

Markus
abisko00 is offline   Reply With Quote
Old 04-21-2016, 12:43 AM   #4
stianlagstad
Junior Member
 
Location: Oslo

Join Date: Apr 2015
Posts: 7
Default

If you provide a runnable code example (not dependent on your own data sets), it will be much easier to understand what the problem is See some tips for how to do that here: How to create a Minimal, Complete, and Verifiable example
stianlagstad is offline   Reply With Quote
Old 04-21-2016, 01:51 AM   #5
abisko00
Member
 
Location: Munich

Join Date: Jul 2015
Posts: 14
Default

You could also use the gapped.bam from the Gviz sample data twice:
Quote:
bamFile<-system.file("extdata/gapped.bam",package="Gviz")
gTrack<-GenomeAxisTrack()
alTrack<-AlignmentsTrack(range=bamFile,genome='hg19', name='Wildtype', chromosome='chr12',ispaired=T)
alTrack2<-AlignmentsTrack(range=bamFile,genome='hg19', name='Mutant', chromosome='chr12',ispaired=T)
plotTracks(c(gTrack,alTrack,alTrack2),from=2965000,to=3000000,type=c('coverage','sashimi'))
Setting the min.height parameter did not change it, unfortunately.
abisko00 is offline   Reply With Quote
Old 04-21-2016, 01:56 AM   #6
stianlagstad
Junior Member
 
Location: Oslo

Join Date: Apr 2015
Posts: 7
Default

Executable code - great! So this code:

Code:
bamFile <- system.file(
  "extdata/gapped.bam",
  package = "Gviz")
gTrack <- GenomeAxisTrack()
alTrack<- AlignmentsTrack(
  range = bamFile,
  genome = 'hg19',
  name = 'Wildtype',
  chromosome = 'chr12',
  ispaired = T)
alTrack2 <- AlignmentsTrack(
  range = bamFile,
  genome = 'hg19',
  name = 'Mutant',
  chromosome = 'chr12',
  ispaired = T)
plotTracks(
  c(gTrack, alTrack, alTrack2),
  from = 2965000,
  to = 3000000,
  type = c('coverage', 'sashimi'))
Produces this plot for me:



To me it looks like the available y-space is used. What exactly is the problem?
stianlagstad is offline   Reply With Quote
Old 04-21-2016, 02:15 AM   #7
abisko00
Member
 
Location: Munich

Join Date: Jul 2015
Posts: 14
Default

I attached what it produces on my system. I saved it as pdf, though, because that format is easiest to use in Illustrator.
Code:
pdf('test.pdf')
plotTracks(
  c(gTrack, alTrack, alTrack2),
  from = 2965000,
  to = 3000000,
  type = c('coverage', 'sashimi'))
dev.off()
EDIT: png gives the same
Attached Images
File Type: png test.png (9.9 KB, 8 views)

Last edited by abisko00; 04-21-2016 at 02:16 AM. Reason: more info
abisko00 is offline   Reply With Quote
Old 04-21-2016, 02:19 AM   #8
stianlagstad
Junior Member
 
Location: Oslo

Join Date: Apr 2015
Posts: 7
Default

I see. I'm also experiencing these issues when exporting Gviz plots to pdf. Maybe you could try using svg instead? I don't know whether this is a problem with Gviz or with the pdf device, but you could ask a question over at the Bioconductor support site. The Gviz author, Florian Hahne, is responsive to questions there.
stianlagstad is offline   Reply With Quote
Old 04-21-2016, 02:38 AM   #9
abisko00
Member
 
Location: Munich

Join Date: Jul 2015
Posts: 14
Default

How did you produce your image? I am relatively new to R and completely autodidactic. Maybe I miss a very simple setting. But thanks anyway!
abisko00 is offline   Reply With Quote
Old 04-21-2016, 03:19 AM   #10
stianlagstad
Junior Member
 
Location: Oslo

Join Date: Apr 2015
Posts: 7
Default

If you mean the plot in my post above, I exported it as a png image from RStudio. But you could also do this:

Code:
png(
  'test.png',
  width = 600,
  height = 300)
plotTracks(
  c(gTrack, alTrack, alTrack2),
  from = 2965000,
  to = 3000000,
  type = c('coverage', 'sashimi'))
dev.off()
Or you could switch png with svg, pdf or something else. A list of available plotting devices can be found here.
stianlagstad is offline   Reply With Quote
Old 04-21-2016, 06:05 AM   #11
abisko00
Member
 
Location: Munich

Join Date: Jul 2015
Posts: 14
Default Solved

Normally, I hate these kind of solutions, because you learn nothing from them, but after you've shown that the code is working, I did a clean install of R and Gviz and here we go!

Thanks!
Attached Images
File Type: png test.png (5.0 KB, 5 views)
abisko00 is offline   Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off




All times are GMT -8. The time now is 01:37 AM.


Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Single Sign On provided by vBSSO