Browse files

travis

  • Loading branch information...
2 parents 72f13b0 + 0d465f6 commit 7a435995a2c3b008f121dff38ed836cade632d04 @pjotrp committed Feb 27, 2014
Showing with 16 additions and 13 deletions.
  1. +0 −1 .travis.yml
  2. +4 −5 Gemfile
  3. +7 −3 README.md
  4. +5 −4 lib/bio-table/parsers/fastareader.rb
View
1 .travis.yml
@@ -5,6 +5,5 @@ rvm:
- rbx-19mode
- ruby-head
- jruby-head
-
# uncomment this line if your project needs to run something other than `rake`:
# script: bundle exec rspec spec
View
9 Gemfile
@@ -8,12 +8,11 @@ gem "bio-logger"
# Add dependencies to develop your gem here.
# Include everything needed to run rake, tests, features, etc.
group :development do
- gem "rspec", "~> 2.8.0"
- gem "rdoc", "~> 3.12"
- gem "cucumber", ">= 0"
- gem "bundler", "> 1.0.0"
+ gem "rspec"
+ gem "cucumber"
+ gem "bundler"
gem "jeweler", "~> 1.8.3"
gem "bio", ">= 1.4.2"
- gem "rdoc", "~> 3.12"
+ gem "rdoc"
gem "regressiontest", ">= 0.0.2"
end
View
10 README.md
@@ -268,7 +268,8 @@ to be sorted). For non-matching rownames the fields will be filled
with NA's, unless you add a filter, e.g.
```sh
- bio-table --merge table1.csv table2.csv --num-filter "values.compact.size == values.size"
+ bio-table --merge table1.csv table2.csv --num-filter "values.compact.size == values.to_a.size"
+
```
### Splitting a table
@@ -325,9 +326,12 @@ a flexible regular expression to fetch the IDs
bio-table --fasta '^(\S+)' test/data/input/aa.fa
```
-notice the parentheses.
+notice the parentheses - these capture the ID and create the first
+column. If two captures are defined another column gets added. Try
-(more soon)
+```sh
+ bio-table --fasta '^(\S+).*?(\d+) aa' test/data/input/aa.fa
+```
### Using STDIN
View
9 lib/bio-table/parsers/fastareader.rb
@@ -22,6 +22,7 @@ def initialize fn, regex = nil
@fread_once = false
@regex = regex
@regex = '^(\S+)' if @regex == nil
+ @regex = '('+regex+')' if regex !~ /\(/
@logger.info "Parsing FASTA with ID regex '"+@regex+"'"
end
@@ -105,10 +106,10 @@ def get_by_index idx
def digest_tag tag
if tag =~ /^>/
descr = $'.strip
- if descr =~ /#{@regex}/
- id = $1
- # p [descr,id]
- return id, descr
+ matches = /#{@regex}/.match(descr).captures
+ if matches.size > 0
+ # p matches
+ return matches.join("\t"), descr
end
p descr # do not remove these
p @regex

0 comments on commit 7a43599

Please sign in to comment.