Why goes galaxy think rpy's hist wants a matrix?
Hi, let me lead in with how impressed I am at the professional packaging of galaxy -- dropped right in. Amazing! Now on to the problem, I'm sure we're just missing something here on our end, but we're seeing an error when running the histogram tool which says hist wants a vector not a matrix. An error occurred running this job: Error in hist.default(list(68, 71, 62, 75, 58, 60, 67, 68, 71, 69), xlab = "V1", : 'x' must be numeric Looking at http://bitbucket.org/galaxy/galaxy-central/src/tip/tools/plotting/histogram.... and the history thereof it's clear that's always been the case back to revision 0, but when we try from the console we get rpy complaining that a matrix isn't a vactor, and it works when we try a vector. By hand with a matrix: $ python Python 2.6.4 (r264:75706, Mar 9 2010, 10:00:44) [GCC 4.2.1 (Apple Inc. build 5646) (dot 1)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import sys >>> from rpy import * >>> matrix = [] >>> vals = ["23","14","32","25","12","9","35","18","24"] >>> for i in vals: ... row = [];row.append(float(i));matrix.append(row) ... >>> matrix [[23.0], [14.0], [32.0], [25.0], [12.0], [9.0], [35.0], [18.0], [24.0]] >>> a = array(matrix) >>> r.pdf("histtest.pdf", 8, 8) >>> title = "Histogram Test";xlab="Count";breaks="Sturges" >>> r.hist( a, probability=True, main=title, xlab=xlab, breaks=breaks ) Traceback (most recent call last): File "<stdin>", line 1, in <module> rpy.RPy_RException: Error in hist.default(list(23, 14, 32, 25, 12, 9, 35, 18, 24), xlab = "Count", : 'x' must be numeric >>> a array([[ 23.], [ 14.], [ 32.], [ 25.], [ 12.], [ 9.], [ 35.], [ 18.], [ 24.]]) However, when we build a vector instead of rows R/rpy is happy: >>> v = [] >>> for i in vals: ... v.append(float(i)) ... >>> v [23.0, 14.0, 32.0, 25.0, 12.0, 9.0, 35.0, 18.0, 24.0] >>> r.hist(v, probability=True, main=title, xlab=xlab, breaks=breaks ) {'density': [0.022222217777778667, 0.044444444444444446, 0.02222222222222223, 0.066666666666666666, 0.0, 0.044444444444444446], 'equidist': True, 'breaks': [5.0, 10.0, 15.0, 20.0, 25.0, 30.0, 35.0], 'intensities': [0.022222217777778667, 0.044444444444444446, 0.02222222222222223, 0.066666666666666666, 0.0, 0.044444444444444446], 'counts': [1, 2, 1, 3, 0, 2], 'xname': 'c(23, 14, 32, 25, 12, 9, 35, 18, 24)', 'mids': [7.5, 12.5, 17.5, 22.5, 27.5, 32.5]} >>> >>> a = array(v) >>> r.hist( a, probability=True, main=title, xlab=xlab, breaks=breaks ) {'density': [0.022222217777778667, 0.044444444444444446, 0.02222222222222223, 0.066666666666666666, 0.0, 0.044444444444444446], 'equidist': True, 'breaks': [5.0, 10.0, 15.0, 20.0, 25.0, 30.0, 35.0], 'intensities': [0.022222217777778667, 0.044444444444444446, 0.02222222222222223, 0.066666666666666666, 0.0, 0.044444444444444446], 'counts': [1, 2, 1, 3, 0, 2], 'xname': 'c(23, 14, 32, 25, 12, 9, 35, 18, 24)', 'mids': [7.5, 12.5, 17.5, 22.5, 27.5, 32.5]} The relevant versions are: Galaxy: 297d8c9c5eb0 (galaxy-dist from a few weeks ago) R: 2.10.1 rpy: 1.0.3 (slightly tweaked for two-digit R minor-version strings, sigh) So after all that, how does your histogram work passing a matrix to something that wants a vector and can ours work that way too please? :) Thanks, -- Ry4an Brase 612-626-6575 University of Minnesota Supercomputing Institute for Advanced Computational Research http://www.msi.umn.edu
participants (1)
-
Ry4an Brase