/usr/bin/bp_process_wormbase is in bioperl 1.7.2-2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 | #!/usr/bin/perl
use constant ACEDB => 'sace://aceserver.cshl.org:2005';
use strict;
use warnings;
use Ace;
my @framework = qw(mex-3 spe-15 lin-17 unc-11 dhc-1 unc-40 smg-5
unc-13 unc-29 eat-16 lin-11 spe-9 par-6 unc-59 unc-54 mab-9 lin-42
sri-71 smu-2 vab-1 bli-2 dpy-10 him-14 mig-5 unc-4 bli-1 sqt-1 rol-1
his-14 unc-52 unc-45 par-2 let-805 sel-8 mab-21 daf-4 sma-3 lin-39
unc-32 tax-4 ced-9 tra-1 nob-1 daf-1 ced-2 lin-1 unc-17 dpy-13 unc-5
smg-7 dif-1 lin-49 elt-1 daf-14 dpy-20 dpy-26 unc-30 tra-3 sup-24
rho-1 egl-8 unc-60 srh-36 apx-1 unc-62 let-418 dpy-11 let-413 sel-9
unc-42 egl-9 sma-1 sqt-3 odr-3 hda-1 unc-76 gcy-20 skr-5 par-4 unc-51
egl-17 lim-6 fox-1 fax-1 lon-2 unc-97 unc-6 unc-18 mec-10 sop-1 mab-18
sdc-2 odr-7 unc-9 unc-3 gas-1 ace-1);
my %framework = map {$_=>1} @framework;
my %framework_seen = ();
my $USAGE = <<USAGE;
This script massages the Wormbase GFF files located at
ftp://www.wormbase.org/pub/wormbase/GENE_DUMPS into a version of the
GFF format suitable for display by the generic genome browser. It
mainly adds comments to the annotations and designates certain
well-spaced genetic loci as framework landmarks.
This script requires the AcePerl distribution, which is available on
CPAN (look for the "Ace" module).
To use this script, get the WormBase GFF files from the FTP site
listed above and place them in a directory. It might be a good idea
to name the directory after the current release, such as WS61. You do
not need to uncompress the files.
Then give that directory as the argument to this script and capture
the script's output to a file:
% process_wormbase.pl ./WS61 > wormbase.gff
It may take a while before you see output from this script, since it
must first fetch gene and protein database from the remote AceDB
running at www.wormbase.org.
The wormbase.gff file can then be loaded into a Bio::DB::GFF database
using the following command:
% bulk_load_gff.pl -d <databasename> wormbase.gff
USAGE
;
#'
die $USAGE if $ARGV[0]=~/^-?-h/i;
my $db = Ace->connect(-url=>ACEDB,
-query_timeout=>500) or die "Can't open ace database:",Ace->error;
if (-d $ARGV[0]) {
@ARGV = <$ARGV[0]/*.gff.gz>;
}
@ARGV || die $USAGE;
foreach (@ARGV) { # GFF FILES
$_ = "gunzip -c $_ |" if /\.gz$/;
}
my (%NOTES,%LOCUS,%GENBANK,%CONFIRMED,%ORFEOME);
get_confirmed($db,\%CONFIRMED);
get_genbank($db,\%GENBANK);
get_loci($db,\%LOCUS);
get_notes($db,\%NOTES);
get_orfeome($db,\%ORFEOME);
while (<>) {
chomp;
next if /^\#/;
my ($ref,$source,$method,$start,$stop,$score,$strand,$phase,$group) = split /\t/;
next if $source eq 'assembly_tag'; # don't want 'em, don't need 'em
$ref =~ s/^CHROMOSOME_//;
$group =~ s/CHROMOSOME_//;
$source ='' if $source eq '*UNKNOWN*';
if ($method eq 'Sequence' && ($source eq 'curated' || $source eq 'RNA') && $group =~ /Sequence "(\w+\.\d+[a-z]?)"/) {
my @notes;
push @notes,map { qq(Note "$_") } @{$NOTES{$1}} if $NOTES{$1};
push @notes,map { qq(Note "$_") } @{$LOCUS{$1}} if $LOCUS{$1};
push @notes,qq(Confirmed_by "$CONFIRMED{$1}") if $CONFIRMED{$1};
$group = join ' ; ',$group,@notes;
if (my $loci = $LOCUS{$1}) {
foreach (@$loci) {
print join("\t",$ref,$source,'gene',$start,$stop,$score,$strand,$phase,"Locus $_"),"\n";
print join("\t",$ref,'framework','gene',$start,$stop,$score,$strand,$phase,"Locus $_"),"\n"
if $framework{$_} && !$framework_seen{$_}++;
}
}
}
if ($method eq 'Sequence' && $source eq 'Genomic_canonical' && $group =~ /Sequence "(\w+)"/) {
if (my $accession = $GENBANK{$1}) {
$group .= qq( ; Note "Genbank $accession");
print join("\t",$ref,'Genbank',$method,$start,$stop,$score,$strand,$phase,"Genbank \"$accession\""),"\n";
}
}
if ($method eq 'reagent' && $source eq 'Orfeome_project' && $group =~ /PCR_product "([^\"]+)"/) {
my $amp = $ORFEOME{$1};
$group .= qq( ; Amplified $amp) if defined $amp;
}
# fix variant fields: Variant "T" => Note "T"
$group =~ s/(?:Variant|Insert) "(\w+)"/Note "$1"/;
# fix UTR fields
if ($group =~ /UTR "([35])_UTR:(\S+)"/) {
$method = 'UTR';
$source = "$1_UTR";
$group = qq(Sequence "$2");
}
print join("\t",$ref,$source,$method,$start,$stop,$score,$strand,$phase,$group),"\n";
}
sub get_loci {
my ($db,$hash) = @_; # hash keys are predicted gene names, values are one or more loci names
my @genes = $db->fetch(-query=>'find Locus Genomic_sequence',-filltag=>'Genomic_sequence');
foreach my $obj (@genes) {
my @genomic = $obj->Genomic_sequence or next;
foreach (@genomic) {
push @{$hash->{$_}},$obj;
}
}
}
sub get_notes {
my ($db,$hash) = @_; # hash keys are predicted gene names, values are one or more brief identifications
my @genes = $db->fetch(-query=>'find Sequence Brief_identification',-filltag=>'Brief_identification');
foreach my $obj (@genes) {
my @notes = $obj->Brief_identification or next;
$hash->{$obj} = \@notes;
}
}
sub get_genbank {
my ($db,$hash) = @_; # hash keys are cosmid names, values are genbank accessions (1 to 1)
my @cosmids = $db->fetch(-query=>'find Genome_Sequence Database',-filltag=>'Database');
for my $cosmid (@cosmids) {
my ($database,undef,$accession) = $cosmid->Database(1)->row;
next unless $accession;
$hash->{$cosmid} = $accession;
}
}
sub get_confirmed {
my ($db,$hash) = @_; # hash keys are predicted gene names, values are confirmation type
my @confirmed = $db->fetch(-query=>'find Sequence Confirmed_by',-filltag=>'Confirmed_by');
foreach my $obj (@confirmed) {
my $confirmed_by = $obj->Confirmed_by || 'Unknown';
$hash->{$obj} = $confirmed_by;
}
}
sub get_orfeome {
my ($db,$hash) = @_;
my @mv_primers = $db->fetch(-query=>'find PCR_Product mv*',-filltag=>'Amplified');
for my $obj (@mv_primers) {
my $amplified = $obj->Amplified;
$hash->{$obj} = $amplified;
}
}
__END__
=head1 NAME
bp_process_wormbase.pl - Massage WormBase GFF files into a version suitable for the Generic Genome Browser
=head1 SYNOPSIS
% bp_process_wormbase.pl ./WS61 > wormbase.gff
=head1 DESCRIPTION
This script massages the Wormbase GFF files located at
ftp://www.wormbase.org/pub/wormbase/GENE_DUMPS into a version of the
GFF format suitable for display by the generic genome browser. It
mainly adds comments to the annotations and designates certain
well-spaced genetic loci as framework landmarks.
This script requires the AcePerl distribution, which is available on
CPAN (look for the "Ace" module).
To use this script, get the WormBase GFF files from the FTP site
listed above and place them in a directory. It might be a good idea
to name the directory after the current release, such as WS61. You do
not need to uncompress the files.
Then give that directory as the argument to this script and capture
the script's output to a file:
% bp_process_wormbase.pl ./WS61 > wormbase.gff
It may take a while before you see output from this script, since it
must first fetch gene and protein database from the remote AceDB
running at www.wormbase.org.
The wormbase.gff file can then be loaded into a Bio::DB::GFF database
using the following command:
% bulk_load_gff.pl -d <databasename> wormbase.gff
=head1 SEE ALSO
L<Bio::DB::GFF>, L<bulk_load_gff.pl>, L<load_gff.pl>
=head1 AUTHOR
Lincoln Stein E<lt>lstein@cshl.orgE<gt>
Copyright (c) 2002 Cold Spring Harbor Laboratory
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself. See DISCLAIMER.txt for
disclaimers of warranty.
=cut
|