Mercurial > repos > boris > hetbox
changeset 2:57c5ea9c3c5c draft
Uploaded
author | boris |
---|---|
date | Fri, 21 Jun 2013 16:05:46 -0400 |
parents | b4f9a4f2f65d |
children | 479f860eb8a9 |
files | hetbox.py |
diffstat | 1 files changed, 16 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/hetbox.py Thu Jun 13 15:10:09 2013 -0400 +++ b/hetbox.py Fri Jun 21 16:05:46 2013 -0400 @@ -8,6 +8,7 @@ import os import sys +import array import numpy from rpy2.robjects import Formula from rpy2.robjects.packages import importr @@ -49,6 +50,7 @@ +"line.\nAdding an artificial header..") add_header = True +r = robjects.r base = importr('base') utils = importr('utils') stats = importr('stats') @@ -86,24 +88,31 @@ # The "environment" in .getenvironment() is the entire R workspace in which the # Formula object exists. The R workspace meaning all the defined variables. # Here, the .getenvironment() method is being used to set some variables in the +# R workspace -# R workspace formula.getenvironment()['minor_freq'] = minor_freq formula.getenvironment()['samples'] = samples + +r.par(oma=array.array('i', [0,0,0,0])) +r.par(mar=array.array('i', [10,4,4,2])) +ylimit = array.array('i',[-5,50]) + # create boxplot - fill kwargs1 with the options for the boxplot function kwargs1 = {'ylab':"Minor allele frequency (%)", 'col':"gray", 'xaxt':"n", 'outpch':"*",'main':"Distribution of minor allele frequencies", 'cex.lab':"1.5"} -p = graphics.boxplot(formula, **kwargs1) -table = base.table(DATA.rx2('SAMPLE')) -graphics.text(0.5, 1, 'N:', font=2) +p = graphics.boxplot(formula, axes=0,ylim=ylimit, lty=1,**kwargs1) + +table = base.table(DATA.rx2('SAMPLE')) +#graphics.text(-1, 1, 'N:', font=2) for i in range(1, base.length(table)[0]+1, 1): - graphics.text(i, 1, table[i-1], font=2) + graphics.text(i, -1, table[i-1], font=2) graphlabels = base.names(table) -kwargs3 = {'pos':"0", 'las':"2", 'cex.axis':"1"} -graphics.axis(1, at=range(1, len(graphlabels)+1, 1), labels=graphlabels, **kwargs3) +kwargs3 = {'pos':"-2", 'las':"2", 'cex.axis':"1"} +graphics.axis(1, at=range(1, len(graphlabels)+1, 1),labels=graphlabels, **kwargs3) +graphics.axis(2,at=(range(0,60,10)),pos=0,font=2) grdevices.dev_off() if not report: