Unconfigured Ad

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • abisko00
    Member
    • Jul 2015
    • 14

    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'))
  • stianlagstad
    Junior Member
    • Apr 2015
    • 7

    #2
    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, 01:07 PM.

    Comment

    • abisko00
      Member
      • Jul 2015
      • 14

      #3
      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

      Comment

      • stianlagstad
        Junior Member
        • Apr 2015
        • 7

        #4
        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

        Comment

        • abisko00
          Member
          • Jul 2015
          • 14

          #5
          You could also use the gapped.bam from the Gviz sample data twice:
          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.

          Comment

          • stianlagstad
            Junior Member
            • Apr 2015
            • 7

            #6
            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?

            Comment

            • abisko00
              Member
              • Jul 2015
              • 14

              #7
              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 Files
              Last edited by abisko00; 04-21-2016, 01:16 AM. Reason: more info

              Comment

              • stianlagstad
                Junior Member
                • Apr 2015
                • 7

                #8
                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.

                Comment

                • abisko00
                  Member
                  • Jul 2015
                  • 14

                  #9
                  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!

                  Comment

                  • stianlagstad
                    Junior Member
                    • Apr 2015
                    • 7

                    #10
                    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.

                    Comment

                    • abisko00
                      Member
                      • Jul 2015
                      • 14

                      #11
                      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 Files

                      Comment

                      Latest Articles

                      Collapse

                      • SEQadmin2
                        From Collection to Sequencing: Why Sample Preparation and Preservation Define Sequencing Data
                        by SEQadmin2


                        Data variability is still an issue in sequencing technologies despite the advances in reproducibility and accuracy of these platforms. But the problem does not originate in the sequencing itself, but in the previous steps, before the sample reaches the sequencer.


                        The first step is collection, followed by preservation and sample preparation for analysis. Most scientists overlook those steps, but not being careful might just be skewing the experiment’s results.
                        ...
                        Yesterday, 10:05 AM
                      • SEQadmin2
                        Single-Cell Sequencing at an Inflection Point: Early Impacts of New Platforms and Emerging Trends
                        by SEQadmin2


                        With the launch of new single-cell sequencing platforms in 2026, the field stands at an exciting inflection point. This article surveys the most impactful advances in the field and discusses how they’re reshaping research in cancer, immunology, and beyond.


                        Introduction

                        Single-cell sequencing technologies have undergone remarkable advances over the past decade, transitioning from low-throughput experimental approaches to highly scalable platforms capable of...
                        05-22-2026, 06:42 AM
                      • SEQadmin2
                        Environmental Genomics in the Age of NGS: From Microbes to Conservation Strategies
                        by SEQadmin2

                        Studying ecosystems means dealing with complex, multi-species communities that are hard to observe at scale. This complexity, however, hides many important questions to be answered, from how biogeochemical cycles work and how climate change can affect species distribution to how conservation strategies can work best.


                        Genomics, particularly since the expansion of NGS, has transformed ecosystem ecology. By sequencing environmental DNA, we can now assess biodiversity without direct...
                        05-06-2026, 09:04 AM

                      ad_right_rmr

                      Collapse

                      News

                      Collapse

                      Topics Statistics Last Post
                      Started by SEQadmin2, Yesterday, 12:03 PM
                      0 responses
                      19 views
                      0 reactions
                      Last Post SEQadmin2  
                      Started by SEQadmin2, Yesterday, 11:40 AM
                      0 responses
                      14 views
                      0 reactions
                      Last Post SEQadmin2  
                      Started by SEQadmin2, 05-28-2026, 11:40 AM
                      0 responses
                      29 views
                      0 reactions
                      Last Post SEQadmin2  
                      Started by SEQadmin2, 05-26-2026, 10:12 AM
                      0 responses
                      31 views
                      0 reactions
                      Last Post SEQadmin2  
                      Working...