R data frame - last line plotted with line 1
1
0
Entering edit mode
8.6 years ago
waqasnayab ▴ 250

Hi,

I am using sushi package for visualizing genome data.

My data frame looks like this:

head (mydata) chrom start end name score strand row 1 COSN17118087 23 36 AP2D_f1 0 . 1 2 COSN17118087 15 34 BHE41_f1 0 . 2 3 COSN17118087 7 15 COT1_si 0 . 3 4 COSN17118087 6 15 COT2_f1 0 . 4

tail (mydata) 22 COSN17118087 7 16 THB_f1 0 . 20 23 COSN17118087 21 30 TWST1_f1 0 . 21 24 COSN17118087 32 40 ZIC3_f1 0 . 22

My R code is: mydata = read.table ("svlfctrs.bed" , header = T)

chrom = "COSN17118087" chromstart = 1 chromend = 41 mydata$color =maptocolors(mydata$row,col=SushiColors(6)) plotBed(beddata = mydata,chrom = chrom, chromstart = chromstart,chromend =chromend, rownumber = mydata$row, type = "region", color=mydata$color,row="given",plotbg="grey95",rowlabels=unique(mydata$name),rowlabelcol=unique(mydata$color),rowlabelcex=0.75) labelgenome(chrom,chromstart,chromend,n=10,scale="bp")

The problem is with the plot (I did not find attach option to attach my plot here at BioStars). The data point of first line, that is, 1 COSN17118087 23 36 AP2D_f1 0 . 1 merges with the last data point of my data frame, that is, 24 COSN17118087 32 40 ZIC3_f1 0 . 22

Is there any way to solve the issue?

Thanks,

Waqas.

R R data frame sushi package plotBed • 2.4k views
ADD COMMENT
1
Entering edit mode

You do not have to restrict just to one package if you cant figure it out. If you want to plot bed file you can take a look at this thread . Alternatively you can also take a look at this . There are different tools to do plot bed like this. If you have a genome file then you must be having a bam file. Index it and then upload both in the IGV browser and then the corresponding bed of interest. Then you can actually visualize you coverage over the bed file as well and based on desired zooming you can just take a png output format. You can also take a look at this

ADD REPLY
0
Entering edit mode

You can upload the plot here, and include it in your post like this:

enter image description here

It would also be helpful if you included example code that leads to the problem you're having.

ADD REPLY
0
Entering edit mode

Hi,

Thanks vchris_ngs for providing me the links. I will look deep into that.

My scenario is a bit different. I amusing Sushi PACKAGE (https://www.bioconductor.org/packages/3.3/bioc/vignettes/Sushi/inst/doc/Sushi.pdf) and have a data like shown in my question posted. This data have the same format like as in Sushi example:

head (Sushi_ChIPSeq_severalfactors.bed) chrom start end name score strand row 1 chr15 73029871 73030050 CTCF 0 . 1 2 chr15 72879646 72879809 CTCF 0 . 1 3 chr15 72850543 72850714 CTCF 0 . 1 4 chr15 73108786 73108931 CTCF 0 . 1 5 chr15 72848345 72848488 CTCF 0 . 1 6 chr15 72914769 72914897 CTCF 0 . 1

tail (Sushi_ChIPSeq_severalfactors.bed) chrom start end name score strand row 125 chr15 72867167 72867457 ZNF143 0 . 10 126 chr15 72848270 72848560 ZNF143 0 . 10 127 chr15 72859691 72859981 ZNF143 0 . 10 128 chr15 72861229 72861519 ZNF143 0 . 10 129 chr15 72952526 72952816 ZNF143 0 . 10 130 chr15 73033628 73034512 ZNF274 0 . 11

and If i run the example code:

Sushi_ChIPSeq_severalfactors.bed$color =maptocolors(Sushi_ChIPSeq_severalfactors.bed$row, col=SushiColors(6)) chrom = "chr15" chromstart = 72800000 chromend = 73100000 plotBed(beddata = Sushi_ChIPSeq_severalfactors.bed,chrom = chrom, chromstart = chromstart,chromend =chromend, rownumber = Sushi_ChIPSeq_severalfactors.bed$row, type = "region", color=Sushi_ChIPSeq_severalfactors.bed$color,row="given", plotbg="grey95",rowlabels=unique(Sushi_ChIPSeq_severalfactors.bed$name), rowlabelcol=unique(Sushi_ChIPSeq_severalfactors.bed$color),rowlabelcex=0.75) labelgenome(chrom,chromstart,chromend,n=3,scale="Mb") mtext("ChIP-seq",side=3, adj=-0.065,line=0.5,font=2)

It generates a plot as shown in page 17 of the pdf link mentioned above.

I also have the same formatted data and it gives me a plot of my data but the only problem is (see the attached figure):

this

My plot shows that the last data point or data value of my data dont know why combines or merges with the first data point.

Any help appreciated,

Cheers,

Waqas.

ADD REPLY
0
Entering edit mode

Here is your image, since you didn't have the correct url in your post:

enter image description here

I don't know how to solve your problem, but if you haven't figured it out in a few days you could post a question on the Bioconductor support site. The Sushi author seems to be active there.

ADD REPLY
0
Entering edit mode

Thanks stianlagstad, yeah, I will ask that..,,,,,!!!!!

ADD REPLY
0
Entering edit mode

From the image below does not seems to have a problem of the command. It is the dimension. You have to reduce the fontsize of the texts and also the size of the bed regions , to reduce the dimensions which might help to have a better view.

ADD REPLY
0
Entering edit mode

That's not the case. You can see the AP2D_f1 is plotted at right place as it is one with start and ending of 23-36.

ZIC3_f1 should be at the top of TWST_f1 but it merges with the AP2D_f1 and its data points that si 32-40 are not plotted. This is the issue.

Is there any thing to avoid the wrong plotting of ZIC3_f1?

Thanks,

Waqas.

ADD REPLY
0
Entering edit mode

Then you would have to put your bed file in some link so that someone from the community can run it to diagnose the problem. It is a problem of plotting dimension as far as I can understand. From what I understand from your unformatted code is that you have 20 genes in chr 15 for which you are plotting the bed regions and each block corresponds to peak length right? We need to see your data to see where the code is going wrong. Since it is plotting so the problem is not with the function rather the plotting dimension where you have less less and it is squished. Please try to few lines from the bed file you have and also try to format the command and then we can say something. Is your bed file in the same format as that of the Sushi_ChIPSeq_severalfactors.bed

and also add

par(mar=c(3,3,3,3))
chrom = "COSN17118087" 
chromstart = 1 
chromend = 50 
mydata$color =maptocolors(mydata$row,col=SushiColors(6)) 
plotBed(beddata = mydata,chrom = chrom, chromstart = chromstart,chromend =chromend, rownumber = mydata$row, type = "region", color=mydata$color,row="given",plotbg="grey95",rowlabels=unique(mydata$name),rowlabelcol=unique(mydata$color),rowlabelcex=0.60) labelgenome(chrom,chromstart,chromend,n=10,scale="bp")

Try to increase the chrend to 50

It is a problem of the scale since you chrname is quite big as you can see it crosses the first x axis interval of 10. So try to fix the scale. Try to run thre above and see if it works else we would have to take a look at your bed file

ADD REPLY
0
Entering edit mode
8.6 years ago
waqasnayab ▴ 250

Hi,

I made it. There is no bug or any formatting issue in the plot. The problem is in my input (column no. 7 – row column). I gave the same numbering to two different transcription factors that’s why they overlapped. Everything sorted now.

Thanks for everyone,

Regards,

Waqas.

ADD COMMENT

Login before adding your answer.

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