软件: bbmap filterbyname.sh
下载地址:https://sourceforge.net/projects/bbmap/
./filterbyname.sh -h
Written by Brian Bushnell
Last modified September 1, 2016
Description: Filters reads by name.
Usage: filterbyname.sh in=<file> in2=<file2> out=<outfile> out2=<outfile2> names=<string,string,string> include=<t/f>
in2 and out2 are for paired reads and are optional.
If input is paired and there is only one output file, it will be written interleaved.
Important! Leading > and @ symbols are NOT part of sequence names; they are part of
the fasta, fastq, and sam specifications. Therefore, this is correct:
names=e.coli_K12
And these are incorrect:
names=>e.coli_K12
names=@e.coli_K12
Parameters:
include=f Set to 'true' to include the filtered names rather than excluding them.
substring=f Allow one name to be a substring of the other, rather than a full match.
f: No substring matching.
t: Bidirectional substring matching.
header: Allow input read headers to be substrings of names in list.
name: Allow names in list to be substrings of input read headers.
prefix=f Allow names to match read header prefixes.
casesensitive=t (case) Match case also.
ow=t (overwrite) Overwrites files that already exist.
app=f (append) Append to files that already exist.
zl=4 (ziplevel) Set compression level, 1 (low) to 9 (max).
int=f (interleaved) Determines whether INPUT file is considered interleaved.
names= A list of strings or files. The files can have one name per line, or
be a standard read file (fasta, fastq, or sam).
minlen=0 Do not output reads shorter than this.
ths=f (truncateheadersymbol) Ignore a leading @ or > symbol in the names file.
tws=f (truncatewhitespace) Ignore leading or trailing whitespace in the names file.
truncate=f Set both ths and tws at the same time.
Positional parameters:
These optionally allow you to output only a portion of a sequence. Zero-based, inclusive.
Intended for a single sequence and include=t mode.
from=-1 Only print bases starting at this position.
to=-1 Only print bases up to this position.
range= Set from and to with a single flag.
Java Parameters:
-Xmx This will be passed to Java to set memory usage, overriding the program's automatic memory detection.
-Xmx20g will specify 20 gigs of RAM, and -Xmx200m will specify 200 megs. The max is typically 85% of physical memory.
-eoom This flag will cause the process to exit if an out-of-memory exception occurs. Requires Java 8u92+.
-da Disable assertions.
To read from stdin, set 'in=stdin'. The format should be specified with an extension, like 'in=stdin.fq.gz'
To write to stdout, set 'out=stdout'. The format should be specified with an extension, like 'out=stdout.fasta'
Please contact Brian Bushnell at bbushnell@lbl.gov if you encounter any problems
命令:~/bin/bbmap/filterbyname.sh in=proper.sam out=pick.sam names=name.id2 include=t
输入:
head proper.sam
A00184:770:HWV23DSXY:3:1101:10004:12618::umi:C7P242498724-GGTTGTA 147 7 142498724 60 36M = 142498724 -36 GAGGACCTGAAAAACGTGTTCCCACCCGAGGTCGCT FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF NM:i:0 MD:Z:36 MC:Z:36M AS:i:36XS:i:0
A00184:770:HWV23DSXY:3:1101:10004:12618::umi:C7P242498724-GGTTGTA 99 7 142498724 60 36M = 142498724 36 GAGGACCTGAAAAACGTGTTCCCACCCGAGGTCGCT FFFFFFFFFFFFF:FFFFFFFFFFFFFFFFFFFFFF NM:i:0 MD:Z:36 MC:Z:36M AS:i:36XS:i:0
head name.id2
A00184:770:HWV23DSXY:3:1171:27001:18161::umi:C9P233738047-TATAATG
A00184:770:HWV23DSXY:3:1309:19397:22216::umi:C10P143615217-TGTTCTT
A00184:770:HWV23DSXY:3:2364:29695:33849::umi:C11P169456137-GTTCTTT
A00184:770:HWV23DSXY:3:2321:8594:14998::umi:C16P102134348-CCACCTC
输出:
head pick.sam
A00184:770:HWV23DSXY:3:1101:13042:19257::umi:C4P155589827-ACTCTTT 147 4 55589827 60 59S91M = 55589827 -91 GGAGTAACACTCTTTCCCTACACGACGCTCTCCGATCTACTCTTTAGCCGGTAGAGTATACAATAGATTGGTATTTTTGTCCAGGAACTGAGCAGAGGTGAGATGATTATTTTTGGCACTGCTTATAATGCAGAGGGGAAGGACTGCAAT FFF:FFFFFFFFFFFFFFFFF,FF:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF NM:i:0 MD:Z:91 MC:Z:91M AS:i:91 XS:i:19
A00184:770:HWV23DSXY:3:1101:13042:19257::umi:C4P155589827-ACTCTTT 99 4 55589827 60 91M = 55589827 91 ACAATAGATTGGTATTTTTGTCCAGGAACTGAGCAGAGGTGAGATGATTATTTTTGGCACTGCTTATAATGCAGAGGGGAAGGACTGCAAT FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF NM:i:0 MD:Z:91 MC:Z:59S91M AS:i:91 XS:i:19