美文网首页linux
3_0_4 要理解并会用的几个脚本

3_0_4 要理解并会用的几个脚本

作者: Y大宽 | 来源:发表于2019-05-30 22:51 被阅读65次

    这个介于3和4之间,目的是练习几个有用的脚本,学几个命令。

    随便找几个文件进行练习,只是为了说明问题,这些其实是RNA-seq数据,但无所谓,只是看脚本的处理
    有以下几个文件



    假如现在觉得文件太大,想快速走下流程,那么可以提取文件中的前比如说1w行进行比对。align下建try_small文件夹,进到里面
    所以

    $ find /mnt/d/RNA-seq/RNAseqdata/try/*.fastq > fq.txt
    
    :~/project/wes/align$ cat fq.txt
    /mnt/d/RNA-seq/RNAseqdata/try/RNAseq_F-shEZH2_rep2.fastq
    /mnt/d/RNA-seq/RNAseqdata/try/RNAseq_F-shEZH2_rep3.fastq
    /mnt/d/RNA-seq/RNAseqdata/try/RNAseq_F-shNT_rep1.fastq
    /mnt/d/RNA-seq/RNAseqdata/try/RNAseq_F-shNT_rep2.fastq
    /mnt/d/RNA-seq/RNAseqdata/try/RNAseq_F-shNT_rep3.fastq
    /mnt/d/RNA-seq/RNAseqdata/try/RNAseq_F-shSUZ12_rep1.fastq
    /mnt/d/RNA-seq/RNAseqdata/try/RNAseq_F-shSUZ12_rep2.fastq
    /mnt/d/RNA-seq/RNAseqdata/try/RNAseq_F-shSUZ12_rep3.fastq
    

    假如说现在想取文件的前10000列,输入到一个新的文件,目的是快速运行
    基本结构如下

    $ cat fq.txt|while read id ;do echo $id;done
    

    扩展

    $ cat fq.txt|while read id ;do (basename $id);done
    
    RNAseq_F-shEZH2_rep2.fastq
    RNAseq_F-shEZH2_rep3.fastq
    RNAseq_F-shNT_rep1.fastq
    RNAseq_F-shNT_rep2.fastq
    RNAseq_F-shNT_rep3.fastq
    RNAseq_F-shSUZ12_rep1.fastq
    RNAseq_F-shSUZ12_rep2.fastq
    RNAseq_F-shSUZ12_rep3.fastq
    

    注意

     cat fq.txt|while read id ;do (zcat $id|head -10000 > $(basename $id) $id;
    done
    
    align/try_small$ ls -lh
    total 4.9M
    -rw-rw-rw- 1 kelly kelly  453 May 30 22:27 fq.txt
    -rw-rw-rw- 1 kelly kelly 567K May 30 22:29 RNAseq_F-shEZH2_rep2.fastq
    -rw-rw-rw- 1 kelly kelly 567K May 30 22:29 RNAseq_F-shEZH2_rep3.fastq
    -rw-rw-rw- 1 kelly kelly 582K May 30 22:29 RNAseq_F-shNT_rep1.fastq
    -rw-rw-rw- 1 kelly kelly 567K May 30 22:29 RNAseq_F-shNT_rep2.fastq
    -rw-rw-rw- 1 kelly kelly 567K May 30 22:29 RNAseq_F-shNT_rep3.fastq
    -rw-rw-rw- 1 kelly kelly 582K May 30 22:29 RNAseq_F-shSUZ12_rep1.fastq
    -rw-rw-rw- 1 kelly kelly 567K May 30 22:29 RNAseq_F-shSUZ12_rep2.fastq
    -rw-rw-rw- 1 kelly kelly 567K May 30 22:29 RNAseq_F-shSUZ12_rep3.fastq
    

    可见文件小多了,这样可以快速进行。

    如果不想试探性运行,上面这一步可以不做。可以从下面开始。

    相关文章

      网友评论

        本文标题:3_0_4 要理解并会用的几个脚本

        本文链接:https://www.haomeiwen.com/subject/iuubtctx.html