User:James Estevez/Notebook/Spring 2011: Bdellovibrio Independent Study/2011/02/21

From OpenWetWare
Jump to: navigation, search
HD100128.png Bdellovibrio Independent Study Report.pngMain project page
Resultset previous.pngPrevious entry      

Generating figures in R

Not exactly intuitive, but it's coming along. Location is indicated by a number:

1 Cytoplasmic
2 Cytoplasmic Membrane
3 Periplasmic
4 Outer Membrane
5 Extracellular
6 Unknown


Pred scatterplot asc.png


Hexagon Binning

I didn't like how these came out so I tried the hexbin package from BioConductor

Hex asc bm.png

Hex asc bd100.png

Source code

<syntaxhighlight lang="rsplus">

  1. Clear all variables and plots

rm(list = ls()) graphics.off()

  1. Import localization data

bd100_numloc_asc<-read.csv('/home/james/Data/bdcost/R/N/bd100_psortb_asc_numloc.csv') bm_numloc_asc<-read.csv('/home/james/Data/bdcost/R/N/b_marinus_psort_ASC_numloc.csv')

library(RSvgDevice) # Output to SVG for direct manipulation in Inkscape devSVG(file='scatter_asc.svg', height=6, width=12, onefile=TRUE) # Height and width are in inches

par(mfcol = c(1,2))

  1. Plot vs location

plot(bm_numloc_asc$asc,jitter(bm_numloc_asc$F_L_num), main="Average Synthetic Cost (ASC)", sub="B. marinus SJ", xlab = "ATPs/aa", ylab = "Location", pch=".") plot(bd100_numloc_asc$asc,jitter(bd100_numloc_asc$F_L_num), sub="B. bacteriovorax ", xlab = "ATPs/aa", ylab = "Location", pch=".") title(main="Average Synthetic Cost (ASC)") dev.off()


  1. These don't look right, so let's try hexbinned plots of the same data

library(hexbin) hplot_bm <- hexbin(bm_numloc_asc$asc,jitter(bm_numloc_asc$F_L_num)) hplot_bd100 <- hexbin(bd100_numloc_asc$asc,jitter(bd100_numloc_asc$F_L_num))

devSVG(file='hex_asc_bm.svg', height=6, width=9, onefile=TRUE) # SVG output

plot(hplot_bm, main="Average Synthetic Cost (ASC) in B. marinus SJ", xlab = "ATPs/aa", ylab = "Location") dev.off() devSVG(file='hex_asc_bd100.svg', height=6, width=9, onefile=TRUE) plot(hplot_bd100, main = "Average Synthetic Cost (ASC) in B. bacteriovorax HD100", xlab = "ATPs/aa", ylab = "Location") dev.off()

</syntaxhighlight>