Skip to content

Commit fe86d7f

Browse files
author
mdsouza
committed
Merge pull request #1 from MG-RAST/master
latest code
2 parents 880b128 + 9f857ab commit fe86d7f

422 files changed

Lines changed: 3098 additions & 16277 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.gitignore‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
# ignore all generated files
44
site
55
site/**/*
6+
conf/Conf.pm
67
conf/Config.pm
78
conf/FIG_Config.pm
9+
bin/*.r
810

911
# ignore files with # and ~
1012
*\#*

‎Makefile‎

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export TARGETDIR = $(TOPDIR)/$(TARGET)
1919
libdir = $(TARGETDIR)/lib
2020
bindir = $(PWD)/bin
2121
cgidir = $(TARGETDIR)/CGI
22-
workdir = $(TARGETDIR)/tmp
22+
tmpdir = $(cgidir)/Tmp
2323
srcdir = $(PWD)/src
2424

2525
TOOL_HDR := $(TOPDIR)/$(TARGET)/tool_hdr
@@ -61,10 +61,10 @@ all: installdirs $(TOOL_HDR) lib
6161
ALL.LIB = $(foreach var,$(PACKAGES),$(srcdir)/$(var).lib)
6262
lib: Makefile $(ALL.LIB)
6363

64-
clean: Makefile purge installdirs
64+
clean: Makefile purge
6565

6666
purge:
67-
rm -rf $(TARGET)/bin $(TARGET)/lib $(TARGET)/tmp $(TARGET)/CGI
67+
rm -rf $(TARGET) bin/*.r
6868

6969

7070
##
@@ -77,9 +77,9 @@ purge:
7777
# then lib and tmp are not made. So we add two rules here
7878
# to handle that case.
7979

80-
installdirs: $(libdir) $(bindir) $(cgidir) $(cgidir)/Html $(cgidir)/Html/css $(workdir)
80+
installdirs: $(libdir) $(bindir) $(cgidir) $(cgidir)/Html $(cgidir)/Html/css $(tmpdir)
8181
- mkdir -p $(libdir)
82-
- mkdir -p $(workdir)
82+
- mkdir -p $(tmpdir)
8383
- mkdir -p $(bindir)
8484
- mkdir -p $(cgidir)
8585

@@ -89,8 +89,11 @@ $(libdir): $(foreach var,$(PACKAGES),$(libdir)/$(var).installdirs)
8989

9090
$(libdir)/%.installdirs:
9191
- mkdir -p $(@:.installdirs=)
92-
- mkdir -p $(@:.installdirs=)Gen
9392

93+
$(tmpdir):
94+
- mkdir -p $(tmpdir)
95+
- chmod a+w $(tmpdir)
96+
9497
$(bindir):
9598
- mkdir -p $(bindir)
9699

@@ -103,8 +106,6 @@ $(cgidir)/Html:
103106
$(cgidir)/Html/css:
104107
mkdir -p $(cgidir)/Html/css
105108

106-
$(workdir): $(foreach var,$(PACKAGES),$(workdir)/$(var).installdirs)
107-
108109
$(workdir)/%.installdirs:
109110
- mkdir -p $(@:.installdirs=)
110111

‎README.html‎

Lines changed: 0 additions & 47 deletions
This file was deleted.

‎bin/compute_sequence_statistics.pl‎

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
#!/soft/packages/perl/5.12.1/bin/perl
2+
use warnings;
3+
use strict;
4+
5+
use Getopt::Long;
6+
7+
my ($file, $dir, $file_format);
8+
9+
GetOptions( 'file=s' => \$file,
10+
'dir=s' => \$dir,
11+
'file_format=s' => \$file_format );
12+
13+
### report keys:
14+
# bp_count, sequence_count, length_max, id_length_max, length_min, id_length_min, file_size,
15+
# average_length, standard_deviation_length, average_gc_content, standard_deviation_gc_content,
16+
# average_gc_ratio, standard_deviation_gc_ratio, ambig_char_count, ambig_sequence_count, average_ambig_chars
17+
18+
my $filetype = "";
19+
if ($file_format eq 'fastq') {
20+
$filetype = " -t fastq"
21+
}
22+
23+
my @stats = `seq_length_stats.py -i '$dir/$file'$filetype -s`;
24+
chomp @stats;
25+
26+
my $report = {};
27+
foreach my $stat (@stats) {
28+
my ($key, $value) = split(/\t/, $stat);
29+
$report->{$key} = $value;
30+
}
31+
my $header = `head -1 '$dir/$file'`;
32+
my $options = '-s '.$report->{sequence_count}.' -a '.$report->{average_length}.' -d '.$report->{standard_deviation_length}.' -m '.$report->{length_max};
33+
my $method = `tech_guess -f '$header' $options`;
34+
35+
my $success = 1;
36+
my $message = "";
37+
if ( $stats[0] =~ /^ERROR/i ) {
38+
$success = 0;
39+
my @parts = split(/\t/, $stats[0]);
40+
if ( @parts == 3 ) {
41+
$message = $parts[1] . ": " . $parts[2];
42+
} else {
43+
$message = join(" ", @stats);
44+
}
45+
}
46+
47+
# count unique ids
48+
my $unique_ids = 0;
49+
if ($file_format eq 'fasta') {
50+
$unique_ids = `grep '>' $dir/$file | cut -f1 -d' ' | sort -T $dir/.tmp -u | wc -l`;
51+
chomp $unique_ids;
52+
}
53+
elsif ($file_format eq 'fastq') {
54+
$unique_ids = `awk '0 == (NR + 3) % 4' $dir/$file | cut -f1 -d' ' | sort -T $dir/.tmp -u | wc -l`;
55+
chomp $unique_ids;
56+
}
57+
58+
push(@stats, "unique_id_count\t$unique_ids");
59+
60+
# write results
61+
open(FH, ">>$dir/$file.stats_info") or die "could not open stats file for $dir/$file.stats_info: $!";
62+
if ($success) {
63+
if ($report->{sequence_count} eq "0") {
64+
print FH "Error\tFile contains no sequences\n";
65+
return 0;
66+
}
67+
foreach my $line (@stats) {
68+
print FH $line."\n";
69+
}
70+
print FH "sequencing_method_guess\t$method";
71+
} else {
72+
print FH "Error\t$message\n";
73+
}
74+
close FH;

‎bin/makeScriptHeaders‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
11
#!/bin/sh
22

33
TOOL_HDR=$1
4-
5-
echo "#!/usr/bin/env perl
4+
PERL=`which perl`
5+
echo "#!${PERL}
66
77
BEGIN {
88
unshift @INC, qw(
99
${TARGETDIR}/lib
1010
${TARGETDIR}/lib/WebApplication
1111
${TARGETDIR}/lib/PPO
1212
${TARGETDIR}/lib/MGRAST
13+
${TARGETDIR}/lib/Babel
1314
${TOPDIR}/conf
1415
);
1516
}
16-
use Data::Dumper;
17-
use FIG_Config;
18-
# end of tool_hdr
19-
########################################################################" > ${TOOL_HDR}
17+
########################################################################" > ${TOOL_HDR}

‎conf/Config_template.pm‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package Config;
22

3-
$ROOT = "";
3+
$ROOT = ""; # set to path
44

55
$html_base = $ROOT."/site/CGI/Html";
66
$bin = $ROOT."/bin";
@@ -35,7 +35,7 @@ $mgrast_metadata_user = '';
3535
$mgrast_metadata_password = '';
3636

3737
# FormWiz
38-
$mgrast_formWizard_templates = "$ROOT/src/MGRAST/Templates";
38+
$mgrast_formWizard_templates = $ROOT."/src/MGRAST/Templates";
3939

4040
# Analysis DB
4141
$mgrast_db = '';

‎src/Babel/ACH.pm‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
package AnnotationClearingHouse::ACH;
1010

11-
use FIG_Config;
11+
use Conf;
1212
use Data::Dumper;
1313
use strict;
1414
use DB_File;

‎src/Babel/UploadAnnotation.cgi‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use warnings;
88
use base qw( WebPage );
99

1010
use AnnoClearinghouse;
11-
use FIG_Config;
11+
use Conf;
1212

1313
1;
1414

@@ -20,8 +20,8 @@ sub init {
2020
$self->application->register_action($self, 'upload_annotation', 'upload_annotation');
2121

2222
my $dbh = $self->application->data_handle('ACH');
23-
my $anno = new AnnoClearinghouse($FIG_Config::clearinghouse_data,
24-
$FIG_Config::clearinghouse_contrib,
23+
my $anno = new AnnoClearinghouse($Conf::clearinghouse_data,
24+
$Conf::clearinghouse_contrib,
2525
0,
2626
$dbh);
2727
$self->data('aclh', $anno);

‎src/Babel/WebPage/Evaluate.pm‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use warnings;
88
use base qw( WebPage );
99

1010
use AnnoClearinghouse;
11-
use FIG_Config;
11+
use Conf;
1212
use FIG;
1313
use DBMaster;
1414

@@ -25,8 +25,8 @@ sub init {
2525
sub output {
2626
my ($self) = @_;
2727

28-
my $anno = new AnnoClearinghouse($FIG_Config::clearinghouse_data,
29-
$FIG_Config::clearinghouse_contrib);
28+
my $anno = new AnnoClearinghouse($Conf::clearinghouse_data,
29+
$Conf::clearinghouse_contrib);
3030

3131
my $category = $self->application->cgi->param('category') || 'identifier';
3232
my $query = $self->application->cgi->param('query') || '';

‎src/Babel/WebPage/SearchResults.pm‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use warnings;
88
use base qw( WebPage );
99

1010
use Babel::lib::Babel;
11-
use FIG_Config;
11+
use Conf;
1212
use Data::Dumper;
1313

1414
1;

0 commit comments

Comments
 (0)