1. Ubuntu
sudo apt-get install r-base r-base-html r-doc-html
2. getting help on a function
help(mean)
?mean
example(mean)
3. getting and setting the working directory
getwd()
setwd()
4. Accessing the functions in a package
library(packageName)
5. Accessing built-in datasets
data(dsname, package="pkname")
6.installing packages from CRAN
install.packages("packagename")
7. running a script
source("myScript.R")
8. Running a batch script
R CMD BATCH scriptfile outputfile
--slave, inhibiting echo of the input
Rscript myScript.R arg1 arg2 arg3
9. loading packages
require(tseries)
10. redirecting output to a file
cat("The answer is", answer, "\n", file="filename")
cat(data,file="filename", append=TRUE)
sink("filename") # begin writing output to file
....
sink() # resume writing output to console
11. reading fixed-width records
read.fwf("filename", widths=c(w1,w2,...wn))
12. reading tabular data files (white space)
read.table("filename")
13. reading from csv files
read.csv("filename")
14. writing to csv files
write.csv(x,"filename", row.names=FALSE)
15. Selecting data frame columns by name
dfrm[["name"]]
dfrm$name
16. selecting rows and columns
select columns
subset(dfrm, select=colname)
subset(dfrm, select=c(colname1, colname2, ... colnamen))
select rows
subset(dfrm, subset=(colname > 0))
subset(dfrm, select=c(predictor, response),subset=(response > 0))
17. removing NAs from a data frame
clean <- na.omit(dfrm)
18. excluding columns by name
subset(dfrm, select=-badboy) # all columns except badboy
19. merge data frames by common column
m <- merge(df1, df2, by="name")
20. accessing data frame contents more easily
attach(dataframe)
21. converting one atomic value to another
as.character(x)
as.complex(x)
as.numeric(x)
as.double(x)
as.integer(x)
as.logical(x)
22.
Monday, May 14, 2012
Friday, May 4, 2012
Wednesday, March 7, 2012
openssh server on ubuntu
sudo apt-get install openssh-server
ssh-server 配置文件位于:
/etc/ssh/sshd_config
在这里可以定义ssh的服务端口,默认为22,为了更安全,建议更改,然后重启ssh服务
sudo /etc/init.d/ssh restart
ssh-server 配置文件位于:
/etc/ssh/sshd_config
在这里可以定义ssh的服务端口,默认为22,为了更安全,建议更改,然后重启ssh服务
sudo /etc/init.d/ssh restart
Sunday, March 4, 2012
wii刻盘
1.建议使用酒精 1.9.5 以上版本来刻盘..
第一: 下载网上的游戏一般都为 ISO
第二: 先打开酒精..用其虚拟光驱把 ISO 读出并加载..
第三: 使用酒精制作其虚拟光驱的 ISO ->生产 WiiGame.mdf 和 WiiGam.mds (镜像制作向导)
第四: 使用酒精选择烧录 WiiGame.mdf 和 WiiGam.mds.. (镜像烧录向导)
第五: 放入刻录盘 DVD+-R..烧录方式: DVD-DAO (反正是默认) / 4X~6X 速度刻录!
2。GCM格式的镜像用ImgBurn烧录 4x
第一: 下载网上的游戏一般都为 ISO
第二: 先打开酒精..用其虚拟光驱把 ISO 读出并加载..
第三: 使用酒精制作其虚拟光驱的 ISO ->生产 WiiGame.mdf 和 WiiGam.mds (镜像制作向导)
第四: 使用酒精选择烧录 WiiGame.mdf 和 WiiGam.mds.. (镜像烧录向导)
第五: 放入刻录盘 DVD+-R..烧录方式: DVD-DAO (反正是默认) / 4X~6X 速度刻录!
2。GCM格式的镜像用ImgBurn烧录 4x
Friday, February 17, 2012
Affymetrix 6.0 call genotype without .ARR file
Affymetrix Genotyping Console export plink file
My colleague just got the genotyping data typed by Affymetrix 6.0 chips. Delivered to him in CEL files. After QC and genotype call, he want to analyze the data using the popular software Plink.
And here is an easy way to use the Affy 6.0 genotyping data in Plink without the ARR file.
Since Plink support transposed PED (tped) format as input, which is almost identical to the exported genotyping format by AGC. You just need to simply modify the file a little bit to fit the requirement. An example of the exported genotyping data file is as below:
#GenomeWideSNP_6.na30.annot.db
#%genome-version-ucsc=hg18
#%genome-version-ncbi=36.1
Probe Set ID sample1 sample2
SNP_A-2131660 CC CC
SNP_A-2131666 CC CT
To make the tped file, the annotation lines need to be skip (lines begin by #)
and the chromosome number/morgan position/physical position should be added in to the beginning of each SNP typing line.all these infomation will be easily get in the annotation file of affymetrix 6.0.
Tfam file which contain individual and family info should be made afterword.
when these two files are ready, it is simply to use the plink to convert it into bed format as
plink --tped tpedfile --tfam famfile --recode --make-bed --out newbedfile name
Update: Forgot to mention that the genotype data in tped data should be like "C C" rather "CC"
there should be a tab between otherwise you will get error message.
source "http://geneticsnote.blogspot.com/2010/09/gwas-data-export-to-plink.html"
Monday, January 9, 2012
Saturday, January 7, 2012
Subscribe to:
Posts (Atom)
