Hi Estefania,
I would suggest you upgrade to the latest R and Bioconductor versions. There is much nicer support for Bam files in  version 1.8. You should take a look at the new AlignmentsTrack class.
Let me know if you have remaining questions after that.
Cheers,
Florian

From: Estefania Mancini <mancini.estefania@gmail.com<mailto:mancini.estefania@gmail.com>>
Date: Tuesday 13 May 2014 17:55
To: Florian Hahne <florian.hahne@novartis.com<mailto:florian.hahne@novartis.com>>
Subject: displaying coverage RNAseq Gviz

Dear Florian,
I'm trying to plot bam coverage with Gviz.
I'd like to mimic IGB picture but I dont know which parameter is missing
Can you help me?
I suspect I have to change the "range" in which bars are defined. I need to plot a point/bar per base.
I attach both pictures, and Gviz chunk of code.
Many thanks in advance
Estefania

############################################################
#genome
genomeAT<-loadDb(file="c1.sqlite")

class(genomeAT)
[1] "TranscriptDb"
attr(,"package")
[1] "GenomicFeatures"

GeneRegionTrack(genomeAT)
GeneRegionTrack(txdb)

txTrAT <- GeneRegionTrack(genomeAT, chromosome = "1",
                        start = 3631, end = 5899,
                        options(ucscChromosomeNames=FALSE))
feature(txTrAT)
plotTracks(txTrAT) #OK

###coverage
bamfile="ColA.c1.bam"
gen1Cov <- DataTrack(range = bamfile,
                     genome = "genomeAT",
                     type = "h",
                     name = "Coverage",
                     windowSize=1,
                     chromosome = "1",
                    options(ucscChromosomeNames=FALSE))
gen1Cov2<- DataTrack( range = bamfile,
                      genome = "genomeAT",
                      name = "Coverage",
                      chromosome = "1",
                      options(ucscChromosomeNames=FALSE),
                      type="b"
)

gen1Cov3 <- DataTrack(range = bamfile,
                     genome = "genomeAT",
                     type = "histogram",
                     name = "Coverage",
                     windowSize=1,
                     chromosome = "1",
                     col.histogram="blue",
                     fill.histogram="blue",
                     options(ucscChromosomeNames=FALSE))

plotTracks(list(gen1Cov, gen1Cov2,gen1Cov3, txTrAT),
           from = 3631,
           to = 5899,
           chromosome = "1"
           )
#############################################
sessionInfo()

R version 3.0.2 (2013-09-25)
Platform: x86_64-unknown-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8    LC_PAPER=en_US.UTF-8       LC_NAME=C
 [9] LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] grid      parallel  stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
 [1] Rsamtools_1.14.3       Biostrings_2.30.1      Gviz_1.6.0             multicore_0.1-7        ASpli_1.6
 [6] edgeR_3.4.2            limma_3.18.13          GenomicFeatures_1.14.5 AnnotationDbi_1.24.0   Biobase_2.22.0
[11] GenomicRanges_1.14.4   XVector_0.2.0          IRanges_1.20.7         BiocGenerics_0.8.0

loaded via a namespace (and not attached):
 [1] biomaRt_2.18.0      biovizBase_1.10.8   bitops_1.0-6        BSgenome_1.30.0     cluster_1.15.2      colorspace_1.2-4
 [7] DBI_0.2-7           dichromat_2.0-0     Formula_1.1-1       Hmisc_3.14-4        lattice_0.20-29     latticeExtra_0.6-26
[13] munsell_0.4.2       plyr_1.8.1          RColorBrewer_1.0-5  Rcpp_0.11.1         RCurl_1.95-4.1      RSQLite_0.11.4
[19] rtracklayer_1.22.7  scales_0.2.4        splines_3.0.2       stats4_3.0.2        survival_2.37-7     tools_3.0.2
[25] XML_3.98-1.1        zlibbioc_1.8.0



	[[alternative HTML version deleted]]

