Permalink
Browse files

Fasta rewrite examples

  • Loading branch information...
pjotrp committed May 21, 2013
1 parent 8ceb0ed commit 3f43d9365cdf04320a6bdc519a9b4c68d2fde382
Showing with 15 additions and 0 deletions.
  1. +13 −0 README.md
  2. +2 −0 bin/fasta_filter.rb
View
@@ -79,13 +79,26 @@ so to skip every other record
fasta_filter.rb --filter "num % 2 == 0"
```
+Find all sequences that contain a stop codon in the sequence
+
+```sh
+fasta_filter.rb --filter 'rec.seq =~ /\*./' aa.fa
+```
+
Rewrite all sequences to lower case, you can use the useful rewrite
option
```sh
fasta_filter.rb --rewrite 'rec.seq = rec.seq.downcase'
```
+Rewrite the FASTA descriptors
+
+```sh
+fasta_filter.rb --rewrite 'rec.descr =~ /gene=(\S+)/; rec.descr = $1' test.fa
+```
+
+
Filters and rewrites can be combined. The rest is up to your imagination!
# API Examples
View
@@ -60,6 +60,8 @@ def self.parse(args)
opts.separator " fasta_filter.rb --filter \"rec.descr =~ /C. elegans/\" test/data/fasta/nt.fa"
opts.separator " fasta_filter.rb --filter \"num % 2 == 0\" test/data/fasta/nt.fa"
opts.separator " fasta_filter.rb test/data/fasta/nt.fa --rewrite 'rec.seq.downcase!'"
+ opts.separator " fasta_filter.rb --rewrite 'rec.descr =~ /gene=(\S+)/; rec.descr = $1' test.fa"
+ opts.separator " fasta_filter.rb --filter 'rec.seq =~ /\*./' aa.fa"
opts.separator ""
opts.separator "Other options:"
opts.separator ""

0 comments on commit 3f43d93

Please sign in to comment.