数据库及工具方法学Linux

批量对多个测序文件进行fastqc

2019-05-28  本文已影响49人  Y大宽

这篇是质量控制fastqc和multiqc的前传。

现在一共是728*2=1456个测序文件,需要全部进行质控。
fastqc的命令很简单,直接跟文件即可,参数里面主要用-o(输出路径)和-t(线程,一般用2或4)

$ ls SRR85182*.gz|while read id;do  nohup fastqc -t 4 $id ;done& 

上面这个代码是错的,&放错了位置,后面会说原因,但是竟然还是可以运行。
这个代码对测序文件一个个进行,全部完成是无法忍受的时间。所以需要改进。

当我google后,发现了这个命令

ls SRR85182*.gz|while read id;do  nohup fastqc  $id &;done

但奇怪的是我一直报错报错....

-bash: syntax error near unexpected token `;'

于是又google,总体是产生这种错题提示的原因上千种,没有统一解决方案。后来发现这个描述觉得有点用

The first and foremost reason why you might experience this error message is that of bad syntax in your code or you not following the exact format of the commands. Each command has a predefined format which you can see in its documentation. Several parameters are optional which others are mandatory.
Furthermore, extra care should be taken for extra space, use of double quotes, and the mandatory parameters required. If any of them are missing or have been declared incorrectly, you will not be able to execute your code.

所以我就去查了nohup用法,但没发现错误。
最后我直接把&放到done的后面,“令人惊喜”的可以运行了,但又沮丧的发现仍然是一个个任务进行。

折腾了几个小时,最后求助Jimmy,被告知

&放错了位置。

我说放前面就报错,并复制了错误信息-bash: syntax error near unexpected token;'`。
然后Jimmy说,错误信息的原因是

nohup&之间需要用()括起来,表示执行()内的命令。
同时告知不要用ls SRR85182*这种方式选择样本不建议,建议用循环。

暂时我现在这么运行。

第一种方法

$ ls SRR85182*.gz | while read id;do (nohup fastqc $id &);done

应该seq是可以的。

有个疑惑,为什么sra到fq的时候不用()就可以呢?
什么是可以省略?


一次运行40个文件为佳。

第二种

$ find SRR851819*.gz|xargs fastqc -t 20

-t 20 一次运行20个文件。(-t 是线程) 根据服务器情况选择,我的配置可以承受的住20个。

上一篇下一篇

猜你喜欢

热点阅读