11 use CXGN
::DB
::Connection
;
14 use CXGN
::Genomic
::CloneIdentifiers qw
/parse_clone_ident/;
15 use CXGN
::Genomic
::Clone
;
16 use CXGN
::Genomic
::Search
::Clone
;
17 use CXGN
::Tools
::Identifiers qw
/link_identifier/;
20 use CXGN
::Page
::FormattingHelpers qw
/columnar_table_html/;
21 use CatalystX
::GlobalContext
qw( $c );
23 my $page = CXGN::Page->new('BAC Registry <-> FTP Discrepancies','Robert Buels');
25 $page->header('BAC Registry <-> FTP Discrepancies','BAC Registry <-> FTP Discrepancies');
27 my $ftp_path = $c->config->{'ftpsite_root'};
30 my %sequenced_bacs = map {
31 my ($bacname,$dirname) = fileparse($_,qr|\..+$|)
33 my $parsed = parse_clone_ident($bacname,'agi_bac_with_chrom')
35 # $parsed->{match} eq $bacname
37 $parsed->{dirname} = $dirname;
41 } glob(File::Spec->catfile($ftp_path,'tomato_genome','bacs','chr*','*finished','*.tar.gz'));
44 my @sequenced_bac_names = sort keys %sequenced_bacs;
46 foreach my $bacname (@sequenced_bac_names) {
47 my $clone = CXGN::Genomic::Clone->retrieve_from_parsed_name($sequenced_bacs{$bacname})
48 or die "Could not retrieve clone $bacname\n";
49 $sequenced_bacs{$bacname}->{clone_object} = $clone;
50 my $dirname = $sequenced_bacs{$bacname}->{dirname};
51 my $truestatus = $dirname =~ m|unfinished| ? 'in_progress' : 'complete';
52 my ($chr_from_dir) = $dirname =~ /chr(\d{2})/;
53 $chr_from_dir += 0; #make sure it's numeric
54 $sequenced_bacs{$bacname}->{true_status} = $truestatus;
55 unless( $clone->sequencing_status eq $truestatus ) {
59 $clone->chromosome_num || $chr_from_dir,
60 link_identifier($clone->clone_name_with_chromosome || $clone->clone_name,'bac'),
62 $clone->sequencing_status,
67 # print "actually right!\n";
71 #now find all the BACs that are marked complete in the database and aren't
72 #found on the filesystem
73 my $search = CXGN::Genomic::Search::Clone->new;
74 my $query = $search->new_query;
75 $query->sequencing_status('=?','complete');
76 my $results = $search->do_search($query);
77 $results->autopage($query,$search);
78 while (my $clone = $results->next_result) {
79 my $chrname = $clone->clone_name_with_chromosome;
80 # print $clone->clone_name." = $chrname\n";
81 unless ( my $record = $sequenced_bacs{$chrname} ) {
85 $clone->chromosome_num || '',
86 link_identifier($chrname,'bac'),
88 $clone->sequencing_status,
93 # print "actually right!\n"
98 columnar_table_html( headings => ['Chr','Name','On FTP','In Database'],
99 data => [sort {$a->[0] <=> $b->[0]
100 || $a->[1] cmp $b->[1]
103 __tableattrs => 'width="50%" cellspacing="0"',
108 print '<center>Sorry, this page is temporarily unavailable.</center>';