Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

FastTree, Glimmer3, tRNAscan-SE #57

Closed
wants to merge 23 commits into from

2 participants

@bosborne

FastTree can handle alignments with up to a million of sequences in a reasonable amount of time and memory. Glimmer3 (genes) and tRNAscan-SE (tRNAs) are standard prokaryotic genome prediction tools. All have tests.

glimmer302a.rb
((28 lines not shown))
+
+ end
+
+ def test
+ Dir.glob("#{lib}/test.*") do |out|
+ system "rm -f #{out}"
+ end
+
+ cd lib do
+ system "g3-from-scratch.csh #{lib}/tpall.fna test"
+ end
+
+ if FileTest.exists? "#{lib}/test.predict"
+ %x(diff #{lib}/test.predict #{lib}/from-scratch.predict).empty? ? system("true") : system("false")
+ else
+ system "false"
@samueljohn Owner

Don't need system here. Just false is enough.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@samueljohn
Owner

Thanks for your work here. Looks already good.
The tests should not write output into lib. Perhaps mktemp or something?
The system("false") was just in the template as place holder. I will review in more detail next week.

@bosborne
glimmer302a.rb
((2 lines not shown))
+require 'tmpdir'
+
+class Glimmer302a < Formula
+ homepage 'http://www.cbcb.umd.edu/software/glimmer/'
+ url 'http://www.cbcb.umd.edu/software/glimmer/glimmer302a.tar.gz'
+ sha1 '27fbd2498f997e0a47026b348b2fc95b073b712a'
+ version '3.02'
+
+ def install
+ cd 'src' do
+ system 'make'
+ end
+
+ cd 'bin' do
+ bin.install %w[window-acgt start-codon-distrib long-orfs entropy-score build-fixed uncovered
+ score-fixed glimmer3 entropy-profile anomaly multi-extract extract build-icm]
@samueljohn Owner

Are all these binaries needed, or do you just call one main binary and the others are internally called? I am asking because "extract" may perhaps be a fairly common name and may conflict when it is symlinked into $(brew --prefix)/bin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
glimmer302a.rb
@@ -0,0 +1,46 @@
+require 'formula'
+require 'tmpdir'
+
+class Glimmer302a < Formula
+ homepage 'http://www.cbcb.umd.edu/software/glimmer/'
+ url 'http://www.cbcb.umd.edu/software/glimmer/glimmer302a.tar.gz'
+ sha1 '27fbd2498f997e0a47026b348b2fc95b073b712a'
+ version '3.02'
@samueljohn Owner

Often homebrew can extract the version from the url. In this case perhaps "302" or "302a" wich would both be fine. When we upgrade it's easier to let the automatic to the work -- if possible.

@samueljohn Owner

Sorry not to be clear. Just remove the version '3.02' line. Don't have to do anything special.

@samueljohn Owner

I see. This seems a problem of homebrew's automatic. Sorry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
glimmer302a.rb
@@ -0,0 +1,46 @@
+require 'formula'
+require 'tmpdir'
+
+class Glimmer302a < Formula
@samueljohn Owner

We would just name it Glimmer. Or, if there is already a Glimmer formula (say for the 2.x), we would call it Glimmer3, so both can be installed. Note upgrading to a future 303 would not work because the formula's name changed.

@samueljohn Owner

where is that glimmer2 from? Is it a formula of some kind or the name of a software that is different from glimmer3?
Is it the same as for python and python3 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
glimmer302a.rb
((19 lines not shown))
+
+ lib.install Dir.glob('scripts/*.awk')
+ lib.install Dir.glob('sample-run/*.predict')
+ lib.install 'sample-run/tpall.fna'
+
+ Dir.glob('scripts/*.csh').each do |script|
+ inreplace script, '/fs/szgenefinding/Glimmer3/scripts', lib
+ inreplace script, '/fs/szgenefinding/Glimmer3', '/usr/local'
+ bin.install script
+ end
+
+ end
+
+ def test
+ tmp_dir = File.join(Dir::tmpdir, "#{Time.now.to_i}")
+ Dir.mkdir(tmp_dir)
@samueljohn Owner

Does the mktemp do block not work here, as you have done for fasttree? Then, we would not need the require tmpdir.
The mktemp do automatically generates a new private dir and cds into it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
glimmer302a.rb
((28 lines not shown))
+ end
+
+ end
+
+ def test
+ tmp_dir = File.join(Dir::tmpdir, "#{Time.now.to_i}")
+ Dir.mkdir(tmp_dir)
+
+ cd tmp_dir do
+ system "g3-from-scratch.csh #{lib}/tpall.fna test"
+ end
+
+ if FileTest.exists? "#{tmp_dir}/test.predict"
+ %x(diff #{tmp_dir}/test.predict #{lib}/from-scratch.predict).empty? ? "true" : "false"
+ else
+ "false"
@samueljohn Owner
Python :snake: :heart: Ruby explanation
False false boolean value
"false" "false" The string with content "false". if "false" is true.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@samueljohn samueljohn commented on the diff
trnascan.rb
((2 lines not shown))
+
+class Trnascan < Formula
+ homepage 'http://selab.janelia.org/tRNAscan-SE/'
+ url 'http://selab.janelia.org/software/tRNAscan-SE/tRNAscan-SE.tar.Z'
+ sha1 'fd2db5b1bb059dfdcf0fced1c865909da601d71f'
+ version '1.23'
+
+ def install
+ inreplace 'makefile' do |s|
+ s.change_make_var! 'CFLAGS', '-D_POSIX_C_SOURCE=1'
+ s.change_make_var! 'LIBDIR', lib
+ s.change_make_var! 'BINDIR', bin
+ end
+ system 'make all'
+
+ bin.install %w[coves-SE covels-SE eufindtRNA trnascan-1.4]
@samueljohn Owner

why is the binary called trnascan-1.4 when the version is 1.23?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
trnascan.rb
((9 lines not shown))
+ def install
+ inreplace 'makefile' do |s|
+ s.change_make_var! 'CFLAGS', '-D_POSIX_C_SOURCE=1'
+ s.change_make_var! 'LIBDIR', lib
+ s.change_make_var! 'BINDIR', bin
+ end
+ system 'make all'
+
+ bin.install %w[coves-SE covels-SE eufindtRNA trnascan-1.4]
+ bin.install 'tRNAscan-SE.src'.sub(/\.src/, '')
+
+ lib.install Dir.glob('gcode.*')
+ lib.install Dir.glob('*.cm')
+ lib.install 'Demo/F22B7.fa'
+ lib.install 'testrun.ref'
+ lib.install Dir.glob('*signal')
@samueljohn Owner

I have the feeling that we are installing here too much into lib, which will be symlinked into $(brew --prefix)/lib. We basically want only libraries there. Other stuff should go into (share/'trnascan').install especially the Demo, ref files and so forth...

We could also make up a new dir under prefix. For example prefix/'support' will not be symlinked into $(brew --prefix)/support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
trnascan.rb
((16 lines not shown))
+
+ bin.install %w[coves-SE covels-SE eufindtRNA trnascan-1.4]
+ bin.install 'tRNAscan-SE.src'.sub(/\.src/, '')
+
+ lib.install Dir.glob('gcode.*')
+ lib.install Dir.glob('*.cm')
+ lib.install 'Demo/F22B7.fa'
+ lib.install 'testrun.ref'
+ lib.install Dir.glob('*signal')
+
+ File.rename('tRNAscan-SE.man','tRNAscan-SE.1')
+ man1.install 'tRNAscan-SE.1'
+ end
+
+ def test
+ system "rm -f #{lib}/testrun.out"
@samueljohn Owner

please also mktemp do here, so we avoid the rm of the test output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@samueljohn
Owner

@bosborne no worries, I am not a Ruby person either :-)
I love homebrew even if it is written in Ruby and not because ^^

Please see my comments on the diff. I think the mktemp do block does not require require because brew did this already.

@samueljohn samueljohn commented on the diff
fasttree.rb
@@ -0,0 +1,27 @@
+require 'formula'
+
+class Fasttree < Formula
+ homepage 'http://meta.microbesonline.org/fasttree/'
+ url 'http://meta.microbesonline.org/fasttree/FastTree.c'
+ version '2.1.3'
+ sha1 '371f12d6177822f20d240327b4cdfd7c4a6923e4'
+
+ def install
+ system "#{ENV.cc} -lm -O3 -finline-functions -funroll-loops -Wall -o FastTree FastTree.c"
+ bin.install "FastTree"
+ end
+
+ def test
+ mktemp do
@samueljohn Owner

Recently, homebrew got an alternative way to do def test; mktemp do in one step.

test do
   <write temp files>
end
<things are cleaned up automatically>

But I can fix that when commiting - you don't have to. I learned about that quite recently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@samueljohn
Owner

Alright, I did some minor fixes and installed more into libexec instead of lib. The tests do all pass for me.
For fasttree, I had to add a fails_with :clang block because I got segfaults.

Can you please brew update an check if all the stuff works as you intended?

Thanks for the good work here! Pulled.

@samueljohn samueljohn closed this
@samueljohn samueljohn was assigned
@bosborne
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 7, 2013
  1. @bosborne

    FastTree infers approximately-maximum-likelihood phylogenetic trees f…

    bosborne authored
    …rom alignments of nucleotide or protein sequences. FastTree can handle alignments with up to a million of sequences in a reasonable amount of time and memory. For large alignments, FastTree is 100-1,000 times faster than PhyML 3.0 or RAxML 7.
Commits on Jan 9, 2013
  1. @bosborne
  2. @bosborne
Commits on Jan 10, 2013
  1. @bosborne
  2. @bosborne
  3. @bosborne

    Fix 'audit' errors

    bosborne authored
  4. @bosborne

    Fix 'audit' errors

    bosborne authored
  5. @bosborne

    Glimmer is a system for finding genes in microbial DNA, especially th…

    bosborne authored
    …e genomes of bacteria, archaea, and viruses. With test.
  6. @bosborne

    Pass audit

    bosborne authored
  7. @bosborne
  8. @bosborne

    Add a test

    bosborne authored
  9. @bosborne

    Simplify a bit

    bosborne authored
  10. @bosborne
  11. @bosborne

    Simplify a bit

    bosborne authored
  12. @bosborne

    Simplify code a bit

    bosborne authored
Commits on Jan 12, 2013
  1. @bosborne

    Suggested changes

    bosborne authored
Commits on Jan 13, 2013
  1. @bosborne

    Rename

    bosborne authored
  2. @bosborne

    Correct locations for 'test'

    bosborne authored
  3. @bosborne
Commits on Jan 15, 2013
  1. @bosborne
  2. @bosborne
  3. @bosborne

    Use mktemp()

    bosborne authored
  4. @bosborne

    Copy all fasta files

    bosborne authored
This page is out of date. Refresh to see the latest.
Showing with 112 additions and 0 deletions.
  1. +27 −0 fasttree.rb
  2. +43 −0 glimmer3.rb
  3. +42 −0 trnascan.rb
View
27 fasttree.rb
@@ -0,0 +1,27 @@
+require 'formula'
+
+class Fasttree < Formula
+ homepage 'http://meta.microbesonline.org/fasttree/'
+ url 'http://meta.microbesonline.org/fasttree/FastTree.c'
+ version '2.1.3'
+ sha1 '371f12d6177822f20d240327b4cdfd7c4a6923e4'
+
+ def install
+ system "#{ENV.cc} -lm -O3 -finline-functions -funroll-loops -Wall -o FastTree FastTree.c"
+ bin.install "FastTree"
+ end
+
+ def test
+ mktemp do
@samueljohn Owner

Recently, homebrew got an alternative way to do def test; mktemp do in one step.

test do
   <write temp files>
end
<things are cleaned up automatically>

But I can fix that when commiting - you don't have to. I learned about that quite recently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ Pathname.new('test.fa').write <<-EOF.undent
+ >1
+ LCLYTHIGRNIYYGSYLYSETWNTTTMLLLITMATAFMGYVLPWGQMSFWGATVITNLFSAIPYIGTNLV
+ >2
+ LCLYTHIGRNIYYGSYLYSETWNTGIMLLLITMATAFMGYVLPWGQMSFWGATVITNLFSAIPYIGTNLV
+ >3
+ LCLYTHIGRNIYYGSYLYSETWNTGIMLLLITMATAFMGTTLPWGQMSFWGATVITNLFSAIPYIGTNLV
+ EOF
+ `#{bin}/FastTree test.fa` =~ /1:0.\d+,2:0.\d+,3:0.\d+/ ? true : false
+ end
+ end
+end
View
43 glimmer3.rb
@@ -0,0 +1,43 @@
+require 'formula'
+
+class Glimmer3 < Formula
+ homepage 'http://www.cbcb.umd.edu/software/glimmer/'
+ url 'http://www.cbcb.umd.edu/software/glimmer/glimmer302a.tar.gz'
+ sha1 '27fbd2498f997e0a47026b348b2fc95b073b712a'
+ version '3.02'
+
+ def install
+ cd 'src' do
+ system 'make'
+ end
+
+ cd 'bin' do
+ bin.install %w[window-acgt start-codon-distrib long-orfs entropy-score build-fixed
+ uncovered score-fixed glimmer3 entropy-profile anomaly multi-extract extract build-icm]
+ end
+
+ lib.install Dir.glob('scripts/*.awk')
+
+ (share/"#{name}").install Dir.glob('sample-run/*.predict')
+ (share/"#{name}").install 'sample-run/tpall.fna'
+
+ Dir.glob('scripts/*.csh').each do |script|
+ inreplace script, '/fs/szgenefinding/Glimmer3/scripts', lib
+ inreplace script, '/fs/szgenefinding/Glimmer3', '/usr/local'
+ bin.install script
+ end
+
+ end
+
+ def test
+ mktemp do
+ system "g3-from-scratch.csh #{share}/#{name}/tpall.fna test"
+
+ if FileTest.exists? 'test.predict'
+ %x(diff test.predict #{share}/#{name}/from-scratch.predict).empty? ? true : false
+ else
+ false
+ end
+ end
+ end
+end
View
42 trnascan.rb
@@ -0,0 +1,42 @@
+require 'formula'
+
+class Trnascan < Formula
+ homepage 'http://selab.janelia.org/tRNAscan-SE/'
+ url 'http://selab.janelia.org/software/tRNAscan-SE/tRNAscan-SE.tar.Z'
+ sha1 'fd2db5b1bb059dfdcf0fced1c865909da601d71f'
+ version '1.23'
+
+ def install
+ inreplace 'makefile' do |s|
+ s.change_make_var! 'CFLAGS', '-D_POSIX_C_SOURCE=1'
+ s.change_make_var! 'LIBDIR', lib
+ s.change_make_var! 'BINDIR', bin
+ end
+ system 'make all'
+
+ bin.install %w[coves-SE covels-SE eufindtRNA trnascan-1.4]
@samueljohn Owner

why is the binary called trnascan-1.4 when the version is 1.23?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ bin.install 'tRNAscan-SE.src'.sub(/\.src/, '')
+
+ (share/"#{name}").install Dir.glob('Demo/*.fa')
+ (share/"#{name}").install 'testrun.ref'
+
+ lib.install Dir.glob('gcode.*')
+ lib.install Dir.glob('*.cm')
+ lib.install Dir.glob('*signal')
+
+ File.rename('tRNAscan-SE.man','tRNAscan-SE.1')
+ man1.install 'tRNAscan-SE.1'
+ end
+
+ def test
+ mktemp do
+ system "tRNAscan-SE -d -y -o test.out #{share}/#{name}/F22B7.fa"
+ if FileTest.exists? 'test.out'
+ %x(diff test.out #{share}/#{name}/testrun.ref).empty? ? true : false
+ else
+ false
+ end
+ end
+ end
+end
+
Something went wrong with that request. Please try again.