如果需要对fasta文件截取长度,比如每行碱基个数为100或者为60,还记得硕士期间处理它的方法是用了一个排列软件,现在只需要用一个linux命令即可。看下面这个简单的例子,就能立刻明白fold的用途。
学习链接:https://www.gnu.org/software/coreutils/manual/html_node/index.html#SEC_Contents
$ fold --help
Usage: fold [OPTION]... [FILE]...
Wrap input lines in each FILE, writing to standard output.
With no FILE, or when FILE is -, read standard input.
Mandatory arguments to long options are mandatory for short options too.
-b, --bytes count bytes rather than columns
-s, --spaces break at spaces
-w, --width=WIDTH use WIDTH columns instead of 80
--help display this help and exit
--version output version information and exit
GNU coreutils online help: <http://www.gnu.org/software/coreutils/>
Full documentation at: <http://www.gnu.org/software/coreutils/fold>
or available locally via: info '(coreutils) fold invocation'
$ fold --version
fold (GNU coreutils) 8.25
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by David MacKenzie.
选项列表
选项 | 说明 |
---|---|
--help | 显示帮助文档 |
--version | 显示版本信息 |
-b | --bytes | 以字节为单位,指定宽度 |
-c | --characters | 以字符为单位,指定宽度 |
-s | --space | 以空格分割 |
-w | --width | 指定列宽,默认80 |
示例
$ echo ATGCGCGCGC|fold -w 3
ATG
CGC
GCG
C
$ echo ATGCGCGCGC|fold -w 3|tee new.fa
# 宽度,默认80
$ cat fa1|fold -b3
ATG
CGC
GCG
C
# 字节个数
网友评论