bam files to hilbert curve
1
0
Entering edit mode
adklts • 0
@adklts-21974
Last seen 3.7 years ago

Good day. I am trying to convert on the chromosome from bam file to GRobject and the to plot with package HilbertCurve. But I receive an error

> hc = GenomicHilbertCurve(chr = "chr1", background = reads  level = 5, reference = TRUE, 
Error: unexpected symbol in "hc = GenomicHilbertCurve(chr = "chr1", background = reads  level"
>     reference_gp = gpar(lty = 1, col = "grey"), arrow = FALSE)
Error: unexpected ',' in "    reference_gp = gpar(lty = 1, col = "grey"),"
> hc_segments(hc, g, gp = gpar(lwd = 6, col = rand_color(length(g))))
Error in grid.Call.graphics(C_downviewport, name$name, strict) : 
  Viewport 'hilbert_curve_0' was not found

My code in the follow

library(chromstaR)
library(GenomicRanges)
library(HilbertCurve)
library(circlize)
bampath <-"C:/Users/Admin/Documents/R/win-library/3.6/GenomicRanges/extdata/wgEncodeUwRepliSeqBg02esG1bAlnRep1.bam"
bam <- bampath

reads <- readBamFileAsGRanges(bam, chromosomes='chr1', pairedEndReads=FALSE,
                    min.mapq=10, remove.duplicate.reads=TRUE)


hc = GenomicHilbertCurve(chr = "chr1", background = reads  level = 5, reference = TRUE, 
    reference_gp = gpar(lty = 1, col = "grey"), arrow = FALSE)
hc_segments(hc, g, gp = gpar(lwd = 6, col = rand_color(length(g))))

I appreciate very much if you help me to create a Hilbert curve from bam files or to convert bam files to the data frame and then to use in the Hilbert curve package. Thank you!

HilbertCurve error bamfiles GRobject • 1.5k views
ADD COMMENT
2
Entering edit mode
Zuguang Gu ▴ 290
@zuguang-gu-7797
Last seen 7 weeks ago
Germany / Heidelberg / DKFZ

You missed a comma here:

hc = GenomicHilbertCurve(chr = "chr1", background = reads  level = 5, 
                                                        ~~~~ <---
ADD COMMENT
0
Entering edit mode

Thank you very much . But now giving me new error

Error in GenomicHilbertCurve(chr = "chr1", background = reads, level = 5, : Chromosomes cannot be duplicated in background regions.

hcsegments(hc, g, gp = gpar(lwd = 6, col = randcolor(length(g)))) Error in grid.Call.graphics(Cdownviewport, name$name, strict) : Viewport 'hilbertcurve_0' was not found

ADD REPLY
1
Entering edit mode

Value for background argument should contain ranges of chromosomes. In your code, I think reads contains the mapped regions that needs to be visualized. Try:

hc = GenomicHilbertCurve(chr = "chr1", level = 5)
hc_points(hc, reads, col = "red")    
ADD REPLY
0
Entering edit mode

Thanks again. We pass the problem of duplicate chromosome but appear Error in .local(object, ...) : unused argument (col = "red")

ADD REPLY
1
Entering edit mode

Sorry, it should be

hc = GenomicHilbertCurve(chr = "chr1", level = 5)
hc_points(hc, reads, gp = gpar(col = "red"))  
ADD REPLY
0
Entering edit mode

Giving error

Error in grid.Call.graphics(Cdownviewport, name$name, strict) : Viewport 'hilbertcurve_1' was not found

ADD REPLY
0
Entering edit mode

Solved by installing ellipse package. Thank you very much Zuguang Gu!!!

ADD REPLY

Login before adding your answer.

Traffic: 677 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