makefile流程搭建学习——一个生信小流程搭建Fasta_stat
建议有些Makefile文件编辑,python和perl知识,方便后面理解
这里可能和我前面设计的Fasta_stat的目录有点出入,但是基本功能实现,其他的就先这样吧。
1. Fasta_stat
确定目标
输入文件:test.fa。完成三个目标:cutadapt(去除adapt序列),gc.py(统计GC含量),length.pl(统计序列长度)
输出文件:test_clean.fa,gc和length文件
设计目录
这里提到的cutadapt安装和基本使用,gc,py,stat.pl,run.ini,Fasta_stat_run.py以及测试数据及结果,下面都有举例,大家可以预览,然后自行完成,若需要源代码请私信我奥~
2. 安装cutadapt,并测试,可以正确运行
** 对test.fa进行adapt去除,得到test_clean.fa **
** 这里我是想直接在shell脚本中进行conda虚拟环境cutadapt的激活和使用**
3. 准备gc.py和stat.pl,并测试,可以正确运行
现在,已经将三个任务都完成了,现在就可以完成Makefile的撰写
4. 撰写run.ini文件,Makefile配置文件
5. 撰写Fasta_stat_run.py,自动化生成Makefile文件和run.sh
#执行Fasta_stat_run.py
/usr/bin/python3 /home/zhaohuiyao/test/makefile/Fasta_stat/Fasta_stat_run.py -i /home/zhaohuiyao/test/makefile/Fasta_stat/test/test.fa -o /home/zhaohuiyao/test/makefile/Fasta_stat/test -ca '-g AGATCGGAAGAGCACACGTCTGAACTCCAGTCA'
#输入:fasta文件绝对路径,输出目录全路径,以及cutadapt的参数
#输出:在输出目录下生成新的目录/home/zhaohuiyao/test/makefile/Fasta_stat/test/Fasta_stat_test/,并在该目录下生成两个文件Makefile和run.sh
#执行/bin/bash run.sh或者nohup /bin/bash ./run.sh 2>&1 &
#你也会在/home/zhaohuiyao/test/makefile/Fasta_stat/db/目录下发现test.txt的生成,包括一些信息
zhaohuiyao@lenovo-ThinkStation-P920:~/test/makefile/Fasta_stat/db$ cat ./test.txt
This is cutadapt 1.18 with Python 3.7.13
Command line parameters: -g AGATCGGAAGAGCACACGTCTGAACTCCAGTCA /home/zhaohuiyao/test/makefile/Fasta_stat/test/test.fa -o /home/zhaohuiyao/test/makefile/Fasta_stat/test/Fasta_stat_test/test_clean.fa
Processing reads on 1 core in single-end mode ...
Finished in 0.00 s (332 us/read; 0.18 M reads/minute).
=== Summary ===
Total reads processed: 4
Reads with adapters: 3 (75.0%)
Reads written (passing filters): 4 (100.0%)
Total basepairs processed: 600 bp
Total written (filtered): 501 bp (83.5%)
=== Adapter 1 ===
Sequence: AGATCGGAAGAGCACACGTCTGAACTCCAGTCA; Type: regular 5'; Length: 33; Trimmed: 3 times.
No. of allowed errors:
0-9 bp: 0; 10-19 bp: 1; 20-29 bp: 2; 30-33 bp: 3
Overview of removed sequences
length count expect max.err error counts
27 1 0.0 2 1
33 1 0.0 3 1
39 1 0.0 3 1
fasta file: /home/zhaohuiyao/test/makefile/Fasta_stat/test/Fasta_stat_test/test_clean.fa
2022-05-05 21:24:39 - gc.py - INFO - /home/zhaohuiyao/test/makefile/Fasta_stat/test/Fasta_stat_test/test_clean.fa is exists
GC_content 0.3313373253493014
Total_read: 4
Total_length: 501
end on 2022年 05月 05日 星期四 21:24:39 CST