X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=bp_bin%2Flist_genomes;h=accaffe9ca1e4953d8e3e57caa17a54225aa172f;hb=HEAD;hp=4cd1d4413a253b7338666f848168a0f9929fba03;hpb=5cbfb1e379cfbe79bd871359fd3455b590c9b396;p=biopieces.git diff --git a/bp_bin/list_genomes b/bp_bin/list_genomes index 4cd1d44..accaffe 100755 --- a/bp_bin/list_genomes +++ b/bp_bin/list_genomes @@ -1,6 +1,103 @@ #!/usr/bin/env perl +# Copyright (C) 2007-2009 Martin A. Hansen. + +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +# http://www.gnu.org/copyleft/gpl.html + + +# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> DESCRIPTION <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< + +# Display available genomes. + +# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< + + use warnings; use strict; - +use Term::ANSIColor; +use Maasha::Common; use Maasha::Biopieces; + + +# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< + + +my ( $options, @genomes, $genome, @formats, $format, %hash, %found, @row ); + +$options = Maasha::Biopieces::parse_options(); + +@genomes = Maasha::Filesys::ls_dirs( "$ENV{ 'BP_DATA' }/genomes" ); + +foreach $genome ( @genomes ) +{ + next if $genome =~ /\.$/; + + @formats = Maasha::Filesys::ls_dirs( $genome ); + + foreach $format ( @formats ) + { + if ( $format =~ /\/([^\/]+)\/(\w+)$/ ) + { + $hash{ $1 }{ $2 } = 1; + + $found{ $2 } = 1; + } + } +} + +@row = "Genome"; + +map { push @row, $_ } sort keys %found; + +print join( "\t", @row ), "\n"; + +foreach $genome ( sort keys %hash ) +{ + @row = $genome; + + foreach $format ( sort keys %found ) + { + if ( exists $hash{ $genome }{ $format } ) { + push @row, colored( "yes", "green" ); + } else { + push @row, colored( "no", "red" ); + } + } + + print join( "\t", @row ), "\n"; +} + + +# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< + + +BEGIN +{ + Maasha::Biopieces::status_set(); +} + + +END +{ + Maasha::Biopieces::status_log(); +} + + +# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< + + +__END__