1 Star 0 Fork 0

陈同 / s-plot

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
sp_scatterplotContour.bak.sh 2.94 KB
一键复制 编辑 原始数据 按行查看 历史
Admin 提交于 2014-03-07 19:42 . Change names FOR <*>
#!/bin/bash
#set -x
usage()
{
cat <<EOF
${txtcyn}
***CREATED BY Chen Tong (chentong_biology@163.com)***
Usage:
$0 options${txtrst}
${bldblu}Function${txtrst}:
This script is used to do scatter plot using function scatterplot from
package car.
The parameters for logical variable are either TRUE or FALSE.
${txtbld}OPTIONS${txtrst}:
-f Data file (with header line, the first column is the
colname, tab seperated)${bldred}[NECESSARY]${txtrst}
-t Title of picture[${txtred}Default empty title${txtrst}]
[Scatter plot of horizontal and vertical variable]
-x xlab of picture[${txtred}Default empty xlab${txtrst}]
[The description for horizontal variable]
-y ylab of picture[${txtred}Default empty ylab${txtrst}]
[The description for vertical variable]
-o The variable for horizontal axis.${bldred}[NECESSARY]${txtrst}
-v The variable for vertical axis.${bldred}[NECESSARY]${txtrst}
-g The variable for grouping.${bldred}[selective]${txtrst}
-w The width of output picture.
${bldred}[Default R default value, selective]${txtrst}
-a The height of output picture.
${bldred}[Default R default value, selective]${txtrst}
-r The resolution of pictures.
${bldred}[Default R default value, selective]${txtrst}
-e Execute or not[${bldred}Default TRUE${txtrst}]
-i Install the required packages[${bldred}Default FALSE${txtrst}]
EOF
}
file=''
title=''
xlab=''
ylab=''
xval=''
yval=''
execute='TRUE'
ist='FALSE'
group=''
legend='FALSE'
width=''
height=''
res=''
while getopts "hf:t:x:y:o:v:g:w:r:a:e:i:" OPTION
do
case $OPTION in
h)
usage
exit 1
;;
f)
file=$OPTARG
;;
t)
title=$OPTARG
;;
x)
xlab=$OPTARG
;;
y)
ylab=$OPTARG
;;
o)
xval=$OPTARG
;;
v)
yval=$OPTARG
;;
g)
group=$OPTARG
;;
w)
width=$OPTARG
;;
a)
height=$OPTARG
;;
r)
res=$OPTARG
;;
e)
execute=$OPTARG
;;
i)
ist=$OPTARG
;;
?)
usage
exit 1
;;
esac
done
midname=".scatterplot"
if [ -z $file ] || [ -z $xval ] || [ -z $yval ]; then
echo 1>&2 "Please give filename, xval and yval."
usage
exit 1
fi
if [ ! -z $group ]; then
group='|'$group
legend="TRUE"
fi
cat <<END >${file}${midname}.r
if ($ist){
install.packages("car", repo="http://cran.us.r-project.org")
}
library(car)
data <- read.table(file="$file", sep="\t", header=T, row.names=1)
#postscript(file="${file}${midname}.eps", onefile=FALSE,
#horizontal=FALSE,paper="special" , width=10, height = 12,pointsize=10)
#if ($width!="" && $width >0 && $height > 0 && $res > 0){
# png(filename="${file}${midname}.png", width=$width, height=$height,
# res=$res)
#}else{
png(filename="${file}${midname}.png")
#}
scatterplot($yval~${xval}${group}, data=data, xlab="$xlab", ylab="$ylab",
main="$title", label=row.names(data), id.method="identify",
boxplots="xy", legend.plot=${legend}, ellipse=TRUE)
dev.off()
END
if [ "$execute" == "TRUE" ]; then
Rscript ${file}${midname}.r
fi
#convert -density 200 -flatten ${file}${midname}.eps ${first}${midname}.png
Shell
1
https://gitee.com/ct5869/s-plot.git
git@gitee.com:ct5869/s-plot.git
ct5869
s-plot
s-plot
master

搜索帮助