Modify plot R mtDNA indel
0
0
Entering edit mode
6 months ago
marco.barr ▴ 150

Hello everyone, I'm trying to modify a part of an R script that is part of a complex pipeline used to determine deletions and duplications on mtDNA. The original script did not include the gene names. Therefore, I would like to add the gene names along the gray axis, and for this, I have a bed file with the coordinates available. I am trying out a series of scripting attempts, but I'm not getting the results I want. Perhaps someone can give me some suggestions? I'll write down the part of the script involved and an example of the plot that comes out. Thank you very much for the advice and help.

original code: 
    #BUILD MT AXIS
    mt.axis<-data.frame(name=0:floor(mlength/1000),position=seq(0,mlength,1000))
    mt.axis$deg.axis<-90+(358*mt.axis$position/mlength)
    mt.axis$name<-as.character(mt.axis$name)

    #PLOT DELETIONS/DUPLICATIONS
    pdf(plotfile)
    par(mar=c(1,1,1,1),xpd=TRUE)
    plot(c(1,800),c(1,800),type="n",axes=FALSE,xlab="",ylab="",main="")
    draw.circle(400,400,410,lwd=3,border="gray50")
    for(i in 1:nrow(mt.axis)){
        draw.radial.line(410, 415, center=c(400,400),deg=mt.axis$deg.axis[i],col="gray40")
        radialtext(mt.axis$name[i], center=c(400,400),deg=mt.axis$deg.axis[i],start=416,nice=T,col="gray30")
    }
    with(dat[order(dat$value),],draw.arc(400,400,radius,deg1=deg1,deg2=deg2, lwd=lwd.arc,col=col))

    dev.off()

plot mtDNA R • 230 views
ADD COMMENT

Login before adding your answer.

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