2008-06-13

How to run R codes from UltraEdit?

1) check the R Folder, you will see a file - Rscript.exe.. It's the one we need
2) Execute UltraEdit, check the Table: Advanced\Tool Configuration; then follow the pics

3) Insert a new tool
# Command table
- named "R" or whatever you like
- apply :"Rscript.exe %p%n%e" in command line (%p for path; %n for file name; %e for file extension. )
- key in the folder for Rscript.exe
- assign a icon for it
# Options Table
- it's a DOS program
- SAVE the file before it's executed

# Output Table
- Set up how to save/capture the output
- Here I set up for opening a new file for each run


The drawback:
can't execute selected lines.. It executes whole file..

Reorganized the top table

Leave the original links here, since we have finished the course STAT578
















STAT530 HomeworksKY's Official PageYa-Chi's PageGuest Book
website stats
Homework #1 - 9/19
Homework #2 - 10/03
Homework #3

First Thing First!

Let's start over~~~

ls()
rm(list=ls())

Bad Luck...

Recently lost all of my R codes in several projects due to a harddrive crash..
So.. hardly to recall details about R codes without those original R files

Damn it~~~

Now I regret that I didn't maintain this site well..

2008-01-25

Test CSS codes


TEST


Since we need to list lots of R codes, I found a more convenient way (instead of the table) to demonstrate them from the following URL: http://synnwang.blogspot.com/2006/11/blog.html

Thank the author for sharing the tips, codes as well as the pictures.

ALL I have to do is to put the following section into the CSS template section,

code {
display: block;
font-family: 'Courier New';
overflow: auto;
border: 1px solid #ccc;
padding: 1px 10px 10px 21px;
max-height: 1200px;
line-height: 1.2em;
letter-spacing: 0px;
margin: 5px 5px 0 15px;
}


code.general{
font-size: 9pt;
color: #FFFFFF;
background: #000 url(http://ky.hsiao.googlepages.com/sBar_code.gif) left top repeat-y;
}

code.R{
font-size: 9pt;
color: #33CC00;
background: #000 url(http://ky.hsiao.googlepages.com/sBar_R-code.gif) left top repeat-y;
}

code.html{
font-size: 9pt;
color: #FFCC00;
background: #000 url(http://ky.hsiao.googlepages.com/sBar_html.gif) left top repeat-y;
}



Then use < code class="R"> put R codes here </code> to bracket your codes!

2007-09-26

The main dish is coming? Q1.1 ~ 4... XD

Q1.1) fold change:
easy thought, easy Done! Sorting data by AVE(schz)/AVE(ctrl) and then pick up the first 200 genes. But how?


>aa<-array(round(rnorm(24),2),dim=c(6,4))  # randomly generate number based on normal dist
>aa
[,1] [,2] [,3] [,4]
[1,] -0.53 -1.26 0.87 1.92
[2,] 1.00 0.26 -0.40 -0.67
[3,] 1.39 -0.16 -0.11 -0.06
[4,] -0.51 0.35 0.28 0.07
[5,] -1.59 1.80 0.52 -0.63
[6,] 0.03 -0.60 0.61 -0.17
>order(aa[ ,2]) # sort by column 2
>order(aa[3, ]) # sort by row 5
>order(aa[3, ], decreasing=TRUE) # this one is the default
>order(aa[3, ], decreasing=FALSE)
>aa[order(aa[3,]),]
>aa[order(aa[3,])[1:2],3:5] #aa[order(aa[3,])[row],col]
As you can see the order() returning the order of row or column as a vector, and that's why it's a beautiful thing for us when selecting genes by kinda order.

Heatmap is so pretty and vivid.. XD

Don't just try heatmap..There are more options such as heatmap.2 from gplots package, and heatmap_2 from Heatplus package.
Both heatmap.2 and heatmap_2 can show the bar of color code for arbitrary unit (color key ); in addition to that, heatmap_2 can repress the dendrogram for rows (but unable to suppress the clustering) and show different colors for dendrogram of columns based on their clusters.
Don't worry about the data format! They "eat" the same format of data, meaning what heatmap can load is good for heatmap.2 & heatmap_2 too.
Some miscellaneous setup just for pretty look
1) color pattern
Color palette can be easily assigned by using col=ColorPattern.
Here are some internal/pre-defined color palettes:
heat.colors(n), topo.colors(n), redgreen(n) and cm.colors(n)
Change (n) to set up how many levels you want in the color gradient
rev(): reverse the color pattern, for example rev(redgreen(100)) will get a gradient from green to red instead of the one from red to green.

2) color-stripe for specific group of sample
scol=c(...) is a vector with the length equaling to the number of your column.
Just assign the color you want in th vector, like c("red","red","skyblue","skyblue") for a 4-coulmned dataset.
3) scaling
scaling="row", "col", "none"; although keeping this option ON usually makes the heatmap pretty, I thought turning it OFF can help us have an ideal how many genes is in relatively low expression levels.