7 use CXGN
::BioTools
::AGP qw
/ agp_contigs agp_contig_seq agp_parse /;
8 use CXGN
::TomatoGenome
::BACPublish qw
/ agp_file /;
12 my $publisher = CXGN
::Publish
->new;
13 my $bcs = $c->dbic_schema('Bio::Chado::Schema');
15 if( my $contig_name = $cgi->param('contig') ) {
16 $contig_name =~ s/[^\w\.]//g; #< sanitize the contig name
18 my $p = CXGN
::Tools
::Identifiers
::parse_identifier
($contig_name,'tomato_bac_contig')
19 or $c->throw( message
=> "Invalid contig identifier $contig_name", is_error
=> 0 );
21 my $agp_file_unversioned = agp_file
( $p->{chr}, 'unpublished' )
22 or $c->throw( message
=> 'No AGP file found for chromosome '.$p->{chr} );
24 my $agp_publishing_record = $publisher->publishing_history( $agp_file_unversioned );
25 #$c->throw( message => 'break', developer_message => '<pre>'.Dumper($agp_publishing_record).'</pre>' );
27 # hash of file version => publishing record (which is { version => $num, fullpath => path to file })
28 my %agp_versions = map { $_->{version
} => $_ }
29 ( $agp_publishing_record, @
{ $agp_publishing_record->{ancestors
} || []} );
31 my $agp_file = $agp_versions{ $p->{ver
} }->{fullpath
}
32 or $c->throw( message
=> "No AGP file found for chromosome $p->{chr} version $p->{ver}",
33 developer_message
=> join '', (
35 Dumper
({ agp_versions
=> \
%agp_versions,
36 agp_publishing_record
=> $agp_publishing_record,
37 agp_file_unversioned
=> $agp_file_unversioned
43 my @contigs = agp_contigs
( agp_parse
( $agp_file ) );
44 my $contig = $contigs[ $p->{ctg_num
} - 1 ]
45 or $c->throw( message
=> "No contig $p->{ctg_num} found in AGP for chromosome $p->{chr}.$p->{ver}",
46 developer_message
=> join '', (
48 Dumper
({ contigs
=> \
@contigs,
49 contig_count
=> scalar(@contigs),
50 agp_file
=> $agp_file,
56 $c->forward_to_mason_view(
57 '/genomes/Solanum_lycopersicum/sequencing/view_contig/view.mas',
59 contig_name
=> $contig_name,
62 my $feat = $bcs->resultset('Sequence::Feature')->search({name
=> $seq_name},{rows
=> 1})->single
63 or $c->throw( message
=> "Sequence $seq_name not found" );
64 #die Dumper({ name => $feat->id, residues => $feat->seq });
65 return $feat->residues; #< feature acts as a Bio::PrimarySeqI
69 $c->forward_to_mason_view('/genomes/Solanum_lycopersicum/sequencing/view_contig/input.mas');