Navigation Menu

Skip to content

Commit

Permalink
Fixed tests; release
Browse files Browse the repository at this point in the history
  • Loading branch information
pjotrp committed May 16, 2014
1 parent 75321bf commit cbb6d8a
Show file tree
Hide file tree
Showing 11 changed files with 96 additions and 62 deletions.
12 changes: 4 additions & 8 deletions Gemfile
@@ -1,15 +1,11 @@
source "http://rubygems.org"
# Add dependencies required to use your gem here.
# Example:
# gem "activesupport", ">= 2.3.5"
gem "bio", ">= 1.4.1"
gem "bio-logger", ">= 0.9.0"
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.3.0"
gem "bundler", "~> 1.0.0"
gem "jeweler", "~> 1.5.2"
gem "rcov", ">= 0"
gem "rspec"
gem "bundler"
gem "jeweler"
end
82 changes: 60 additions & 22 deletions Gemfile.lock
@@ -1,34 +1,72 @@
GEM
remote: http://rubygems.org/
specs:
bio (1.4.1)
bio-logger (0.9.0)
addressable (2.3.6)
bio (1.4.3)
bio-logger (1.0.1)
log4r (>= 1.1.9)
diff-lcs (1.1.2)
git (1.2.5)
jeweler (1.5.2)
bundler (~> 1.0.0)
builder (3.2.2)
descendants_tracker (0.0.4)
thread_safe (~> 0.3, >= 0.3.1)
diff-lcs (1.1.3)
faraday (0.9.0)
multipart-post (>= 1.2, < 3)
git (1.2.6)
github_api (0.11.3)
addressable (~> 2.3)
descendants_tracker (~> 0.0.1)
faraday (~> 0.8, < 0.10)
hashie (>= 1.2)
multi_json (>= 1.7.5, < 2.0)
nokogiri (~> 1.6.0)
oauth2
hashie (2.1.1)
highline (1.6.21)
jeweler (2.0.1)
builder
bundler (>= 1.0)
git (>= 1.2.5)
github_api
highline (>= 1.6.15)
nokogiri (>= 1.5.10)
rake
log4r (1.1.9)
rake (0.8.7)
rcov (0.9.9)
rspec (2.3.0)
rspec-core (~> 2.3.0)
rspec-expectations (~> 2.3.0)
rspec-mocks (~> 2.3.0)
rspec-core (2.3.1)
rspec-expectations (2.3.0)
diff-lcs (~> 1.1.2)
rspec-mocks (2.3.0)
rdoc
json (1.8.1)
jwt (0.1.11)
multi_json (>= 1.5)
log4r (1.1.10)
mini_portile (0.5.3)
multi_json (1.9.3)
multi_xml (0.5.5)
multipart-post (2.0.0)
nokogiri (1.6.1)
mini_portile (~> 0.5.0)
oauth2 (0.9.3)
faraday (>= 0.8, < 0.10)
jwt (~> 0.1.8)
multi_json (~> 1.3)
multi_xml (~> 0.5)
rack (~> 1.2)
rack (1.5.2)
rake (10.3.1)
rdoc (4.1.1)
json (~> 1.4)
rspec (2.10.0)
rspec-core (~> 2.10.0)
rspec-expectations (~> 2.10.0)
rspec-mocks (~> 2.10.0)
rspec-core (2.10.1)
rspec-expectations (2.10.0)
diff-lcs (~> 1.1.3)
rspec-mocks (2.10.1)
thread_safe (0.3.3)

PLATFORMS
ruby

DEPENDENCIES
bio (>= 1.4.1)
bio-logger (>= 0.9.0)
bundler (~> 1.0.0)
jeweler (~> 1.5.2)
rcov
rspec (~> 2.3.0)
bio-logger
bundler
jeweler
rspec
2 changes: 1 addition & 1 deletion LICENSE.txt
@@ -1,4 +1,4 @@
Copyright (c) 2011-2013 Pjotr Prins
Copyright (c) 2011-2014 Pjotr Prins

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
Expand Down
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -250,5 +250,5 @@ This Biogem is published on [biogems.info](http://biogems.info/index.html#bigbio

# Copyright

Copyright (c) 2011-2013 Pjotr Prins. See LICENSE for further details.
Copyright (c) 2011-2014 Pjotr Prins. See LICENSE for further details.

2 changes: 1 addition & 1 deletion Rakefile
Expand Up @@ -40,7 +40,7 @@ end
task :test => :spec
task :default => :spec

require 'rake/rdoctask'
require 'rdoc/task'
Rake::RDocTask.new do |rdoc|
version = File.exist?('VERSION') ? File.read('VERSION') : ""

Expand Down
2 changes: 1 addition & 1 deletion VERSION
@@ -1 +1 @@
0.1.5
0.1.6
2 changes: 1 addition & 1 deletion bin/getorf
@@ -1,4 +1,4 @@
#! /usr/bin/ruby
#! /usr/bin/env ruby
#
# Predict ORF's from nucleotide sequences using the BigBio predictors.
# The input is a fasta file, the output consists of
Expand Down
2 changes: 1 addition & 1 deletion bin/nt2aa.rb
@@ -1,4 +1,4 @@
#! /usr/bin/ruby
#! /usr/bin/env ruby
#
# Translate nucleotide sequences into aminoacids sequences in all
# reading frames.
Expand Down
48 changes: 24 additions & 24 deletions spec/emitter_spec.rb
Expand Up @@ -10,7 +10,7 @@

it "should emit small parts" do
s = ""
FastaEmitter.new("test/data/fasta/nt.fa",10).emit_seq do | part, index, tag, seq |
Bio::Big::FastaEmitter.new("test/data/fasta/nt.fa",10).emit_seq do | part, index, tag, seq |
# p [index, part, tag, seq]
s += seq
if index == 95 and part == :tail
Expand Down Expand Up @@ -38,7 +38,7 @@
end

it "should emit large parts" do
FastaEmitter.new("test/data/fasta/nt.fa").emit_seq do | part, index, tag, seq |
Bio::Big::FastaEmitter.new("test/data/fasta/nt.fa").emit_seq do | part, index, tag, seq |
# p [index, part, tag, seq]
if index == 95
seq.should == "ATCATTAGCAACACCAGCTTCCTCTCTCTCGCTTCAAAGTTCACTACTCGTGGATCTCGTCTTCAGTGTACAGTATCAAGGGCTCGATCTGCGGTGGATGAGACATCAGATTCAGGAGCTTTTCAAAGAACTGCATCGACATCCGTAACTTCGTTTCAAAAGATTCCAATTCTCAGTTTCAGCTGAATCTGGTAGATACCATCTTTACATATCGTATGCTTGTCATGGGCTTCTAGATGCCTTTCATACTTAAAGATCAAAGGACTTGACGATGCAATAAGCTTCTCGTCTGTAAAACCC"
Expand All @@ -47,12 +47,12 @@
end
end

describe Bio::Big::ShortFrameState, "when using the ShortFrameState" do
describe Bio::Big::ShortFrameState, "when using the Bio::Big::ShortFrameState" do

include Bio::Big

it "should find an ORF" do
fr = ShortFrameState.new "atggattaaatgtaatggatttaatgtaaa",0,0
fr = Bio::Big::ShortFrameState.new "atggattaaatgtaatggatttaatgtaaa",0,0
orfs = fr.get_stopstop_orfs
orfs.map{ | orf | orf.pos }.should == [ 3, 5 ]
orfs.map{ | orf | orf.to_seq }.should == ["ATGTAA", "TGGATTTAA"]
Expand All @@ -61,14 +61,14 @@
orfs.map{ | orf | orf.to_seq }.should == ["ATGGATTAA","ATGTAA"]
end
it "should handle min_size" do
fr = ShortFrameState.new "atggattaaatgtaatggatttaatgtaaa",0,9
fr = Bio::Big::ShortFrameState.new "atggattaaatgtaatggatttaatgtaaa",0,9
orfs = fr.get_stopstop_orfs
orfs.map{ | orf | orf.to_seq }.should == [ "TGGATTTAA"]
orfs.map{ | orf | orf.pos }.should == [ 5 ]
fr.get_startstop_orfs.should == []
end
it "should find ORFs in" do
fr = ShortFrameState.new "atgttttaaatgtaatgttgttaaatgttttaaatgtaatgttgttaa",0,0
fr = Bio::Big::ShortFrameState.new "atgttttaaatgtaatgttgttaaatgttttaaatgtaatgttgttaa",0,0
orfs = fr.get_stopstop_orfs
orfs.map{ | orf | orf.to_seq }.should == ["ATGTAA", "TGTTGTTAA", "ATGTTTTAA", "ATGTAA", "TGTTGTTAA"]
orfs.map{ | orf | orf.pos }.should == [3, 5, 8, 11, 13]
Expand Down Expand Up @@ -108,17 +108,17 @@

# Frame 0
minsize = 0
fr = ShortFrameState.new s,0,minsize
fr = Bio::Big::ShortFrameState.new s,0,minsize
orfs = fr.get_stopstop_orfs
orfs.map{ | orf | orf.to_seq }.should == []

# Frame 1
fr = ShortFrameState.new s[1..-1],0,minsize
fr = Bio::Big::ShortFrameState.new s[1..-1],0,minsize
os = fr.get_stopstop_orfs
os.map{ | orf | orf.to_seq }.should == ["TTNCGCGTGCCGCCTTCTTTCTCCTTTTTCTCTTTTACTTCTTCATCATCATCTTCTTCTTCTTCCTCTTCGATATTCGTCAGTGTGTGTATTTTGGGGAAAACTTTGTGA"]
orfs += os
# Frame 2
fr = ShortFrameState.new s[2..-1],0,minsize
fr = Bio::Big::ShortFrameState.new s[2..-1],0,minsize
os = fr.get_stopstop_orfs
os.map{ | orf | orf.to_seq }.should == ["GCGGANCGGTAA", "GAAAATCGCGGATGTGGCTTTCAAAGCTTCAAGGACTATCGATTGGGATGGTATGGCTAA", "GGTCCTTGTCACAGATGA", "GGCTCGTAG"]
orfs += os
Expand All @@ -132,14 +132,14 @@

# Frame 0
minsize = 0
fr = ShortFrameState.new s,0,minsize
fr = Bio::Big::ShortFrameState.new s,0,minsize
orfs = fr.get_startstop_orfs

# Frame 1
fr = ShortFrameState.new s[1..-1],0,minsize
fr = Bio::Big::ShortFrameState.new s[1..-1],0,minsize
orfs += fr.get_startstop_orfs
# Frame 2
fr = ShortFrameState.new s[2..-1],0,minsize
fr = Bio::Big::ShortFrameState.new s[2..-1],0,minsize
orfs += fr.get_startstop_orfs
orfs.map{ | orf | orf.to_seq }.should == []
orfs.size.should == 0
Expand All @@ -151,11 +151,11 @@
it "should combine a forward frame" do
s1 = "atggattaaatgtaata"
s2 = "atggatttaatgtaaa"
fr = ShortFrameState.new s1,0,0
fr = Bio::Big::ShortFrameState.new s1,0,0
fr.ntseq_pos.should == 0
orfs = fr.get_stopstop_orfs
orfs.size == 1 # in codons
fr3 = FrameCodonHelpers::CreateShortFrame.create_right(fr,orfs,s2)
fr3 = Bio::Big::FrameCodonHelpers::CreateShortFrame.create_right(fr,orfs,s2)
fr3.ntseq_pos.should == 15
fr3.codons.to_seq.should == "TAATGGATTTAATGTAAA"
norfs = fr3.get_stopstop_orfs
Expand All @@ -169,11 +169,11 @@
# ......---===xx
s2 = "atggatttaattattataaa"
# x======xxx======xxx.
fr = ShortFrameState.new s1,0,0
fr = Bio::Big::ShortFrameState.new s1,0,0
fr.ntseq_pos.should == 0
orfs = fr.get_stopstop_orfs
orfs.size == 0 # in codons
fr3 = FrameCodonHelpers::CreateShortFrame.create_right(fr,orfs,s2)
fr3 = Bio::Big::FrameCodonHelpers::CreateShortFrame.create_right(fr,orfs,s2)
fr3.ntseq_pos.should == 0
fr3.codons.to_seq.should == "ATGGATTAAATGTAATGGATTTAATTATTATAA"
norfs = fr3.get_stopstop_orfs
Expand All @@ -187,11 +187,11 @@
# ......---===xx
s2 = "atggatttaatgtaaa"
# x======xxx
fr = ShortFrameState.new s1,0,0
fr = Bio::Big::ShortFrameState.new s1,0,0
fr.ntseq_pos.should == 0
orfs = fr.get_stopstop_orfs
orfs.size == 0 # in codons
fr3 = FrameCodonHelpers::CreateShortFrame.create_right(fr,orfs,s2)
fr3 = Bio::Big::FrameCodonHelpers::CreateShortFrame.create_right(fr,orfs,s2)
# p fr3
fr3.ntseq_pos.should == 0 # on the combined sequences
fr3.codons.to_seq.should == "ATGGATTAAATGTAATGGATTTAATGTAAA"
Expand Down Expand Up @@ -221,14 +221,14 @@
s1 = "atggattaaatgta"
# ......xxx=====
# now move the other way, as sequences get emitted on the left
fr = ShortReversedFrameState.new s2,0,0
fr = Bio::Big::ShortReversedFrameState.new s2,0,0
# p fr
fr.codons.to_seq.should == "ATTTAAATGGATTTAATGTAAATT"
fr.ntseq_pos.should == 0
orfs = fr.get_stopstop_orfs
orfs.map{ | orf | orf.to_seq }.should == ["ATGGATTTAATGTAA"]
orfs.first.pos.should == 2 # in codons
fr3 = FrameCodonHelpers::CreateShortFrame.create_left(fr,orfs,s1)
fr3 = Bio::Big::FrameCodonHelpers::CreateShortFrame.create_left(fr,orfs,s1)
fr3.ntseq_pos.should == 18 # 6 codons
fr3.codons.to_seq.should == "ATGGATTAAATGTATATTTAA"
norfs = fr3.get_stopstop_orfs
Expand All @@ -244,9 +244,9 @@
include Bio::Big

it "should emit STOP-STOP ORFs in all frames" do
f = FastaEmitter.new("test/data/fasta/nt.fa")
f = Bio::Big::FastaEmitter.new("test/data/fasta/nt.fa")
seqs = []
OrfEmitter.new(f,:stopstop)::emit_seq do | frame, index, tag, pos, seq |
Bio::Big::OrfEmitter.new(f,:stopstop)::emit_seq do | frame, index, tag, pos, seq |
break if index != 0
if frame == 0 and index == 0 and pos == 39
seq.should == "TTNCGCGTGCCGCCTTCTTTCTCCTTTTTCTCTTTTACTTCTTCATCATCATCTTCTTCTTCTTCCTCTTCGATATTCGTCAGTGTGTGTATTTTGGGGAAAACTTTGTGA"
Expand All @@ -259,9 +259,9 @@
seqs.join(';')[50..350].should == "TNCGCGTGCCGCCTTCTTTCTCCTTTTTCTCTTTTACTTCTTCATCATCATCTTCTTCTTCTTCCTCTTCGATATTCGTCAGTGTGTGTATTTTGGGGAAAACTTTGTGA;GCAAAGAGCGAGAAAATGAGCGGANCGGTAAGAAAATCGCGGATGTGGCTTTCAAAGCTTCAAGGACTATCGATTGGGATGGTATGGCTAAGGTCCTTGTCACAGATGAGGCTCGTAGAGAGTTCTCTAACCTTCGTCGTGCTTTCGATGAGGTTAACACACAGCTCCAGACCAAATTTAGTCAGGACCT"
end
it "should emit STOP-STOP ORFs in all frames using a shorter emitter" do
f = FastaEmitter.new("test/data/fasta/nt.fa",150)
f = Bio::Big::FastaEmitter.new("test/data/fasta/nt.fa",150)
seqs = []
OrfEmitter.new(f,:stopstop)::emit_seq do | frame, index, tag, pos, seq |
Bio::Big::OrfEmitter.new(f,:stopstop)::emit_seq do | frame, index, tag, pos, seq |
break if index != 0
if frame == 0 and index == 0 and pos == 39
seq.should == "TTNCGCGTGCCGCCTTCTTTCTCCTTTTTCTCTTTTACTTCTTCATCATCATCTTCTTCTTCTTCCTCTTCGATATTCGTCAGTGTGTGTATTTTGGGGAAAACTTTGTGA"
Expand Down
2 changes: 1 addition & 1 deletion test/performance/translate_with_biolib.rb
@@ -1,4 +1,4 @@
#! /usr/bin/ruby
#! /usr/bin/env ruby
#
# Performance testing routing for translating a FASTA file into six
# reading frames using the Biolib (EMBOSS) routines.
Expand Down
2 changes: 1 addition & 1 deletion test/performance/translate_with_bioruby.rb
@@ -1,4 +1,4 @@
#! /usr/bin/ruby
#! /usr/bin/env ruby
#
# Performance testing routing for translating a FASTA file into six
# reading frames using the Bioruby routines.
Expand Down

0 comments on commit cbb6d8a

Please sign in to comment.