~ubuntu-branches/ubuntu/trusty/bioperl/trusty

« back to all changes in this revision

Viewing changes to scripts/Bio-DB-GFF/process_sgd.PLS

  • Committer: Package Import Robot
  • Author(s): Charles Plessy
  • Date: 2013-09-22 13:39:48 UTC
  • mfrom: (3.1.11 sid)
  • Revision ID: package-import@ubuntu.com-20130922133948-c6z62zegjyp7ztou
Tags: 1.6.922-1
* New upstream release.
* Replaces and Breaks grinder (<< 0.5.3-3~) because of overlaping contents.
  Closes: #722910
* Stop Replacing and Breaking bioperl ( << 1.6.9 ): not needed anymore. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/perl
2
 
 
3
 
# This script will convert from SGD format to GFF format
4
 
# See http://db.yeastgenome.org/schema/Schema.html
5
 
 
6
 
use strict;
7
 
 
8
 
# hard-coded length data that I couldn't get directly
9
 
my %CHROMOSOMES = (I => 230_203,
10
 
                   II => 813_139,
11
 
                   III => 316_613,
12
 
                   IV  => 1_531_929,
13
 
                   V   => 576_869,
14
 
                   VI => 270_148,
15
 
                   VII => 1_090_937,
16
 
                   VIII => 562_639,
17
 
                   IX => 439_885,
18
 
                   X => 745_444,
19
 
                   XI => 666_445,
20
 
                   XII => 1_078_173,
21
 
                   XIII => 924_430,
22
 
                   XIV => 784_328,
23
 
                   XV  => 1_091_284,
24
 
                   XVI => 948_061,
25
 
                   Mit => 85_779);
26
 
my @ROMAN = qw(I II III IV V VI VII VIII IX X
27
 
               XI XII XIII XIV XV XVI Mit);
28
 
 
29
 
if ($ARGV[0] =~ /^--?h/) {
30
 
  die <<USAGE;
31
 
 Usage: $0 <SGD features file>
32
 
 
33
 
This script massages the SGD sequence annotation flat files located at
34
 
ftp://genome-ftp.stanford.edu/pub/yeast/data_dump/feature/chromosomal_features.tab
35
 
into a version of the GFF format suitable for display by the generic
36
 
genome browser.
37
 
 
38
 
To use this script, get the SGD chromosomal_features.tab file from the
39
 
FTP site listed above, and run the following command:
40
 
 
41
 
  % process_sgd.pl chromosomal_features.tab > yeast.gff
42
 
 
43
 
The yeast.gff file can then be loaded into a Bio::DB::GFF database
44
 
using the following command:
45
 
 
46
 
  % bulk_load_gff.pl -d <databasename> yeast.gff
47
 
 
48
 
USAGE
49
 
;
50
 
}
51
 
 
52
 
# first print out chromosomes
53
 
# We hard coded the lengths because they are not available in the features table.
54
 
for my $chrom (sort keys %CHROMOSOMES) {
55
 
  print join("\t",$chrom,'chromosome','Component',1,$CHROMOSOMES{$chrom},'.','.','.',qq(Sequence "$chrom")),"\n";
56
 
}
57
 
 
58
 
# this is hard because the SGD idea of a feature doesn't really map onto the GFF idea.
59
 
while (<>) {
60
 
  chomp;
61
 
  my($id,$gene,$aliases,$type,$chromosome,$start,$stop,$strand,$sgdid,$sgdid2,$description,$date) = split "\t";
62
 
  my $ref = $ROMAN[$chromosome-1];
63
 
  $description =~ s/"/\\"/g;
64
 
  $description =~ s/;/\\;/g;
65
 
 
66
 
  $strand = $strand eq 'W' ? '+' : '-';
67
 
  ($start,$stop) = ($stop,$start) if $strand eq '-';
68
 
  die "Strand logic is messed up" if $stop < $start;
69
 
 
70
 
  if ($gene) {
71
 
     my @aliases = split(/\|/,$aliases);
72
 
     my $aliases = join " ; ",map {qq(Alias "$_")} @aliases;
73
 
     my $group = qq(Gene "$gene" ; Note "$description");
74
 
     $group .= " ; $aliases" if $aliases;
75
 
     print join("\t",$ref,'sgd','gene',$start,$stop,'.',$strand,'.',$group),"\n";
76
 
     $description .= "\\; AKA @aliases" if @aliases;
77
 
  }
78
 
 
79
 
  print join("\t",$ref,'sgd',$type,$start,$stop,'.',$strand,'.',qq($type "$id" ; Note "$description")),"\n";
80
 
}
81
 
 
82
 
__END__
83
 
 
84
 
=head1 NAME
85
 
 
86
 
process_sgd.pl - Massage SGD annotation flat files into a version suitable for the Generic Genome Browser
87
 
 
88
 
=head1 SYNOPSIS
89
 
 
90
 
  % process_sgd.pl chromosomal_features.tab > yeast.gff
91
 
 
92
 
=head1 DESCRIPTION
93
 
 
94
 
This script massages the SGD sequence annotation flat files located at
95
 
ftp://genome-ftp.stanford.edu/pub/yeast/data_dump/feature/chromosomal_features.tab
96
 
into a version of the GFF format suitable for display by the generic
97
 
genome browser.
98
 
 
99
 
To use this script, get the SGD chromosomal_features.tab file from the
100
 
FTP site listed above, and run the following command:
101
 
 
102
 
  % process_sgd.pl chromosomal_features.tab > yeast.gff
103
 
 
104
 
The yeast.gff file can then be loaded into a Bio::DB::GFF database
105
 
using the following command:
106
 
 
107
 
  % bulk_load_gff.pl -d <databasename> yeast.gff
108
 
 
109
 
=head1 SEE ALSO
110
 
 
111
 
L<Bio::DB::GFF>, L<bulk_load_gff.pl>, L<load_gff.pl>
112
 
 
113
 
=head1 AUTHOR
114
 
 
115
 
Lincoln Stein, lstein@cshl.org
116
 
 
117
 
Copyright (c) 2002 Cold Spring Harbor Laboratory
118
 
 
119
 
This library is free software; you can redistribute it and/or modify
120
 
it under the same terms as Perl itself.  See DISCLAIMER.txt for
121
 
disclaimers of warranty.
122
 
 
123
 
=cut
124
 
 
125