Aug 20 2008

Shell code used in my project

分类: programmingazalea @ 10:36 pm 5次阅读

Step 20:
#########################################
#split all contigs and take only contig1#
#########################################
for file in *
do
echo processing $file
if test -d $file
then
python getcontig1.py $file/reads.all.contigs >$file/contig1
fi
done

#########
#Genscan#
#########
for file in *
do
echo processing $file ...
if test -d $file
then
genscan /usr/lib/GENSCAN/Arabidopsis.smat $file/contig1 -cds -subopt -ps>$file/genscan.out
fi
done

#############################################
#Get the coding sequence of A.thaliana genes#
#############################################
for file in *
do
echo processing $file ...
if test -d $file
then
python athcds.py $file>$file/athcds
fi
done

########################################################
#Get the genscan-predicted coding sequences of A.lyrata#
########################################################
for file in *
do
echo processing $file ...
if test -d $file
then
python alycds_parse_genscan.py $file
fi
done

##########################################
#Catenate athcds and alycds if both exist#
##########################################
#for file in *
#do
#echo processing $file ...
#  if test -d $file
#  then
#    if test -s $file/athcds && test -s $file/alycds
#    then
#      cat $file/athcds $file/alycds>$file/cdsall
#    fi
#    if test ! -s $file/alycds
#    then
#      echo $file
#    fi
#  fi
#done

for file in *
do
if test -d $file
then
i=1
while [ $i -le 3 ]  #has been tested that at most 3 cds are predicted by GENSCAN
do
if test -s $file/alycds_$i && test -s $file/athcds
then
cat $file/athcds $file/alycds_$i>$file/cdsboth_$i
fi
i=$((i+1))
done
fi
done

#########################################################################################
#align all cds if file cdsall exists, and convert clustal format to aligned fasta format#
#########################################################################################
for file in *
do
if test -d $file
then
i=1
while [ $i -le 3 ]  #has been tested that at most 3 cds are predicted by GENSCAN
do
if test -s $file/cdsboth_$i
then
clustalw -infile=$file/cdsboth_$i
python clw2afa.py $file/cdsboth_$i.aln >$file/cdsboth_$i.afa
fi
i=$((i+1))
done
fi
done

###################################################
#find the corresponding miRNA for each target gene#
###################################################
for file in *
do
if test -d $file
then
python pair_miRNA_target.py $file
fi
done

相关文章



Jan 31 2008

Shell编程(七)—CD管理程序简介 zz

分类: ubuntu, zzazalea @ 7:43 pm 357次阅读

Shell编程(七)—CD管理程序简介

简单的程序.
需求
假如我们有一个扩展的CD集合.要使得我们的生活更为简单,我们设计和实现在一个管理CD的程序.用我们所学的Linux编程的知识来实现一个电子目录似乎是一个很不错的主意.
我们希望,至少最初是这样的,我们的程序可以存储基本的CD信息,例如标签,音乐种类或是艺术家.我们还希望可以保存一些跟踪信息.
我们希望可以在每一个CD项目上进行搜索,但是却不会在跟踪细节上进行搜索.
为了使得我们的程序完整,我们希望可以输入,更新,删除任何信息.

继续阅读 “Shell编程(七)—CD管理程序简介 zz”

相关文章



Jan 31 2008

Shell编程(六)—Here Documents与Dialog zz

分类: ubuntu, zzazalea @ 7:41 pm 414次阅读

Shell编程(六)—Here Documents与Dialog

Here Documents
从一个Shell脚本传递给一个命令的一个比较特殊的方法就是使用here document.这个文档可以使得执行的命令就像是由文件或是键盘读入的,而事实上,这是由这个脚本读入的.
一 个here document是以<<开头的,后面所跟的是要在文档的结尾处重复出现的字符序列.<<是Shell的重定向标签,在这样的情 况下,他会强制将命令输入给here document.这个特殊的序列的作用就像是一个标记,来告诉Shell here document要在哪里结束.这个标记充列不可以出现在要传递给命令的行上,所以最好是将他们标记为最不常用的或是难以忘记的内容.
如下面的这个例子:

继续阅读 “Shell编程(六)—Here Documents与Dialog zz”

相关文章



Jan 31 2008

Shell编程(五)—find与grep命令简介及正则表达式 zz

分类: ubuntu, zzazalea @ 7:40 pm 526次阅读

Shell编程(五)—find与grep命令简介及正则表达式

两个更为有用的命令和正则表达式
在我们开始学习新的Shell编程知识之前,我们先来看一下两个更为有用的两个命令,这两个命令虽然并不是Shell的一部分,但是在进行Shell编程时却会经常用到.随后我们会来看一下正则表达式.
find命令
我们先来看的是find命令.这个命令对于我们用来查找文件时是相当有用的,但是对于Linux新手来说却有一些难于使用,在一定程序是由于他所带的选项,测试,动作类型参数,而且一个参数的执行结果会影响接下来的参数.
在我们深入这些选项和参数之前,我们先来看一个非常简单的例子.假如在我们的机子上有一个文件wish.我们来进行这个操作时要以root身份来运行,这样就可以保证我们可以搜索整个机子:

继续阅读 “Shell编程(五)—find与grep命令简介及正则表达式 zz”

相关文章



Jan 31 2008

Shell编程(四)—Shell内建命令简介 zz

分类: ubuntu, zzazalea @ 7:40 pm 358次阅读

Shell编程(四)—Shell内建命令简介

命令
我 们从一个Shell脚本的内部执行两种类型的命令。也就是通常(normal)的命令,这样的命令我们也可以在命令行的方式下来运行,称为处部命令,另一 种就是我们前面所说的内建(built-in)命令,称之为内部命令。内建命令是在Shell的内部来实现的而不能为外部程序所调用。然而大多数的内部命 令也会作为相对独立的单一程序来提供,而这也是POSIX 标准所要求的一部分。通常来说内部命令与外部命令并没有太大的区别,除非是这个内部运行得更为高效。
然而在这里我们只会讨论一些主要的命令,包括我们编写一下脚本时所需要用到的外部与内部命令。作为一个Linux用户我们会知道一些其他的可以在命令行来运行的命令。我们应该记住除了我们在这里所提到一些内建命令以后我们还可以在脚本中使用我们所知道的一些其他的命令。

继续阅读 “Shell编程(四)—Shell内建命令简介 zz”

相关文章



第 1 页,共 2 页12>