理解下列语句
mkdir -p RNA-Seq/aligned
for i in `seq 57 62`
do
hisat2 -t -x reference/index/hg19/genome -1 RNA-Seq/SRR35899${i}_1.fastq.gz -2 SRR35899${i}_2.fastq.gz -S RNA-Seq/aligned/SRR35899${i}.sam &
done
代码 | 意义 |
---|---|
mkdir -p **/** |
--parents 需要时创建上层目录,如目录早已存在则不当作错误 |
for i in '***' do...${i} done |
for循环,本例内i 分别引用字符seq;57;62。 |
& |
多任务并行,hisat2-align一个任务大概4G上下内存,根据资源设置最大并行数 |
hisat2 -x aaaa/genome -1 BBB/bbb.fastq.gz -2 CCC/ccc.fastq.gz -S DDD/ddd.sam |
hisat2基础句式,aaa为index文件夹,此处为hg19,bbb和ccc为双端fastq文件,ddd为目的sam文件,AAA,BBB,CCC为对应文件所在目录。 |
-t -x -1 -2 -S |
-x参考基因组-1第一个-2第二个-S为SAM。-t 记录运行时间。另外-U为单端;--summary-file为输出比对信息为file;-p **为线程数。 |
2>siSUZ12_2.log |
输出记录 |
活学活用
for i in `0 2 4`
do
hisat2 -t -x ../hg19/genome -1 ../../${i}h/${i}h_combined_R1.fastq.gz -2 ../../${i}h/R19000257LR01-${i}h_combined_R2.fastq.gz -S ../../aligned/${i}h.sam 2>../../aligned/${i}h.log
done
关于for语句的一点小问题
加上想要循环计算某一串数字+2
for i in 2 4 6; do ADD=$((2+$i)); echo $ADD; done
如果加上引号,就是字符类型而不是numeric了
for i in '2 4 6'; do ADD=$((2+$i)); echo $ADD; done
另外如果使用{}引用也行,记得加逗号分开...
用
seq 2 6
(注意是倒单引号`不是单引号)则指的是2.3.4.5.6参考文献
转录组入门(5): 序列比对//www.greatytc.com/p/681e02e7f9af
mkdir命令 https://blog.csdn.net/gao199108/article/details/77340753
避免使用裸的 mkdir -phttps://blog.csdn.net/colin5300/article/details/78067153
在Linux终端中进行算术运算的5种方法https://www.linuxidc.com/Linux/2019-01/156304.htm
linux命令 For循环https://blog.csdn.net/theomarker/article/details/81191738
利用简单的语句实现for循环并行处理命令(https://www.cnblogs.com/muuyouzhi/p/8898567.html)
shell脚本中使用for循环开启并行方法https://blog.csdn.net/zcb_data/article/details/80533808
Hisat官方手册https://ccb.jhu.edu/software/hisat2/manual.shtml
linux 中特殊符号用法详解
Bash脚本实现批量作业并行化https://www.linuxidc.com/Linux/2015-01/112363.htm可控
-m, --mode=MODE set file mode (as in chmod), not a=rwx - umask
-p, --parents no error if existing, make parent directories as needed
-v, --verbose print a message for each created directory
-Z set SELinux security context of each created directory
to the default type
--context[=CTX] like -Z, or if CTX is specified then set the SELinux
or SMACK security context to CTX
--help display this help and exit
--version output version information and exit