Entering edit mode
Kasper Daniel Hansen
▴
630
@kasper-daniel-hansen-459
Last seen 10.2 years ago
(I recently posted an empty message with almost the same subject. I
tried to resend it, but unfortunately our email servers were down.
Here
is an updated version).
I am looking at expanding the image methid for an AffyBatch object, in
the sense that I only want to plot certain (x,y) coordinates. I ahve
therefore looked at the code and have a little problem understanding
why
it is done as it is.
This problem might be because I am unsure where the (0,0) position on
the chips is. For some reason I have assumed it would be the upper,
left
corner - but I have no evidence for that
Bascially the code I have a problem with is
m <- x@exprs[, i]
### Some deleted stuff
m <- as.matrix(rev(as.data.frame(matrix(m, nrow = length(x.pos),
ncol = length(y.pos)))))
"m" is then used as the "z" argument of image.
If I do
> m <- matrix(1:9, ncol = 3)
> m
[,1] [,2] [,3]
[1,] 1 4 7
[2,] 2 5 8
[3,] 3 6 9
Here the number in the matrix takes the lace of indices, which have
the
following (x,y) coordinates
> indices2xy(1:9, nr = 3)
x y
[1,] 0 0
[2,] 1 0
[3,] 2 0
[4,] 0 1
[5,] 1 1
[6,] 2 1
[7,] 0 2
[8,] 1 2
[9,] 2 2
If I do
> m1 <- as.matrix(rev(as.data.frame(m)))
> m1
V3 V2 V1
1 7 4 1
2 8 5 2
3 9 6 3
> image(1:3, 1:3, m1)
I seem to get a plot where the (0,0) position is at the lower, right
corner, and increasing (x,y) means going to the left and up.
Basically, m1 = m[, 3:1]
If I instead do
> image(1:3, 1:3, m[3:1,])
I seem to get the right plot.
It seems to me that the image method rotates the chip 90 degress, but
in
the wrong direction.
Am I completely off, or?
Kasper