Commit 634c3628 authored by cvs2git's avatar cvs2git
Browse files

This commit was manufactured by cvs2svn to create tag 'dec1-merge'.

Sprout from master 2000-11-24 11:33:05 UTC Elia Stupka <elia@sanger.ac.uk> 'Modified chromosome name from varchar(5) to varchar(20)'
Cherrypick from master 2000-06-25 16:27:22 UTC Elia Stupka <elia@sanger.ac.uk> 'Added comments on dates to distinguish between creation and modification of clones':
    modules/Bio/EnsEMBL/Analysis.pm
    modules/Bio/EnsEMBL/AnalysisI.pm
    modules/Bio/EnsEMBL/DB/CloneI.pm
    modules/Bio/EnsEMBL/DB/ContigI.pm
    modules/Bio/EnsEMBL/DB/RawContigI.pm
    modules/Bio/EnsEMBL/DBLoader.pm
    modules/Bio/EnsEMBL/FeaturePairI.pm
    modules/Bio/EnsEMBL/PerlDB/Clone.pm
    modules/Bio/EnsEMBL/PerlDB/Contig.pm
    modules/Bio/EnsEMBL/PerlDB/Obj.pm
    modules/Bio/EnsEMBL/Repeat.pm
    modules/Bio/EnsEMBL/SeqFeatureI.pm
Cherrypick from branch-freeze-july 2000-11-29 17:00:10 UTC Web Admin <w3adm@sanger.ac.uk> 'Now passing args to SUPER::_initialize during init':
    modules/Bio/EnsEMBL/AceDB/Contig.pm
    modules/Bio/EnsEMBL/Analysis/Genscan.pm
    modules/Bio/EnsEMBL/Analysis/MSPType.pm
    modules/Bio/EnsEMBL/Analysis/MSPcrunch.pm
    modules/Bio/EnsEMBL/ContigOverlap.pm
    modules/Bio/EnsEMBL/DB/ConvertibleVirtualContig.pm
    modules/Bio/EnsEMBL/DB/MapContig.pm
    modules/Bio/EnsEMBL/DB/VirtualContig.pm
    modules/Bio/EnsEMBL/DB/VirtualMap.pm
    modules/Bio/EnsEMBL/DBArchive/Obj.pm
    modules/Bio/EnsEMBL/DBSQL/BaseAdaptor.pm
    modules/Bio/EnsEMBL/DBSQL/Clone.pm
    modules/Bio/EnsEMBL/DBSQL/CrossMatchDBAdaptor.pm
    modules/Bio/EnsEMBL/DBSQL/DBPrimarySeq.pm
    modules/Bio/EnsEMBL/DBSQL/Feature_Obj.pm
    modules/Bio/EnsEMBL/DBSQL/GapContig.pm
    modules/Bio/EnsEMBL/DBSQL/Gene_Obj.pm
    modules/Bio/EnsEMBL/DBSQL/Obj.pm
    modules/Bio/EnsEMBL/DBSQL/Protein_Feature_Adaptor.pm
    modules/Bio/EnsEMBL/DBSQL/RawContig.pm
    modules/Bio/EnsEMBL/DBSQL/StaticGoldenPathAdaptor.pm
    modules/Bio/EnsEMBL/DBSQL/SymmetricContigFeatureContainer.pm
    modules/Bio/EnsEMBL/DBSQL/Utils.pm
    modules/Bio/EnsEMBL/Exon.pm
    modules/Bio/EnsEMBL/FeatureFactory.pm
    modules/Bio/EnsEMBL/FeaturePair.pm
    modules/Bio/EnsEMBL/Gene.pm
    modules/Bio/EnsEMBL/GeneComparison/ExonCompare.pm
    modules/Bio/EnsEMBL/GeneComparison/GeneCompare.pm
    modules/Bio/EnsEMBL/GeneComparison/GeneComparisonStats.pm
    modules/Bio/EnsEMBL/SeqFeature.pm
    modules/Bio/EnsEMBL/StickyExon.pm
    modules/Bio/EnsEMBL/Temp.pm
    modules/Bio/EnsEMBL/TimDB/Clone.pm
    modules/Bio/EnsEMBL/TimDB/Contig.pm
    modules/Bio/EnsEMBL/TimDB/Obj.pm
    modules/Bio/EnsEMBL/Transcript.pm
    modules/Bio/EnsEMBL/Utils/Eprof.pm
    modules/Bio/EnsEMBL/Utils/EprofStack.pm
    modules/Bio/EnsEMBL/Utils/GTF_handler.pm
    modules/Bio/EnsEMBL/Virtual/Contig.pm
    modules/Bio/EnsEMBL/Virtual/Map.pm
    modules/Bio/EnsEMBL/Virtual/MapContig.pm
    modules/Bio/EnsEMBL/Virtual/PrimarySeq.pm
    modules/Bio/EnsEMBL/Virtual/StaticContig.pm
    modules/Bio/EnsEMBL/VirtualGene.pm
Delete:
    modules/t/overlap.dump
    modules/t/overlap.t
    modules/t/writeablevc.dump
    modules/t/writeablevc.t
parent caca5840
......@@ -935,7 +935,7 @@ sub _load_overlaps {
$self->{'_got_overlaps'} = 1;
my $id = $self->id;
my @over = $self->get_ContigOverlaps;
my @over = $self->get_all_ContigOverlaps;
foreach my $lap (@over) {
my( $end, $helper ) = $lap->make_ContigOverlapHelper($id);
if ($end eq 'left') {
......
......@@ -231,23 +231,4 @@ sub gff_feature {
return $self->{_gff_feature};
}
=head2 has_database
Title : has_database
Usage :
Function:
Example :
Returns :
Args :
=cut
sub has_database{
my ($self,@args) = @_;
if( defined $self->db ){ return 1; }
return 0;
}
1;
......@@ -320,15 +320,18 @@ EXON: foreach my $exon ($tran->each_Exon) {
my $exseq = new Bio::Seq(-seq => $seq);
my @trans;
my $phase;
# print("Exon seq iis $seq [" . $exseq->seq . "] " . length($seq) . "\n");
#print STDERR ("Exon seq is $seq [" . $exseq->seq . "] " . length($seq) . "\n");
if (length($seq) < 3) {
$phase = 0;
} else {
$trans[0] = $exseq->translate();
# read the translate function **very carefully** to understand this.
# means translate wrt to standard genetic code and no edit on M
$trans[0] = $exseq->translate('*','X',0,1,1);
# this is because a phase one intron leaves us 2 base pairs, whereas a phase 2
# intron leaves one base pair.
$trans[1] = $exseq->translate('*','X',2);
$trans[2] = $exseq->translate('*','X',1);
$trans[1] = $exseq->translate('*','X',2,1,1);
$trans[2] = $exseq->translate('*','X',1,1,1);
my $i = 0;
$phase = 4;
......@@ -347,13 +350,20 @@ EXON: foreach my $exon ($tran->each_Exon) {
# if we have an X, substitute it to a .
$tmp =~ s/X/\./g;
# if last amino acid is a stop, remove it
$tmp =~ s/\*$//g;
# if we have a stop - forget it?
$tmp =~ /\*/ && next;
# substitute * for X's
#$tmp =~ s/\*/X/g;
# Compare strings to see if the exon peptide is contained in
# the full sequence
# print STDERR "Comparing $tmp to $pep ($i)\n";
if ($pep =~ /$tmp/ ) {
#print STDERR "setting to $i\n";
$phase = $i;
}
}
......
......@@ -61,6 +61,7 @@ my $msptype = [['swir_p', 'blastp', 'swir', 'pep', '.blastp_swir.msptmp',
['dbest_p', 'tblastn', 'dbest', 'dna', '.tblastn_dbest.msptmp', 'msp' , 1 ,1,'similarity'],
['pfam_p', 'hmmpfam', 'PfamFrag', 'pep', '.hmmpfam_frag', 'pfam', 1 ,1,'pfam_prediction'],
['repeat_n','RepeatMasker', '' , 'dna', '.RepMask.out.gff', 'repeat','','042199','similarity'],
['genewise_p','genewise', 'swir' , 'pep', '.swir.msptmp', 'msp',1,1,'similarity'],
];
sub _initialize {
......
......@@ -57,9 +57,9 @@ use Bio::Root::Object;
use Bio::EnsEMBL::Analysis;
use Bio::EnsEMBL::Analysis::MSPType;
use Bio::EnsEMBL::FeaturePair;
use Bio::EnsEMBL::Pep_SeqFeature;
use FileHandle;
# Inherits from the base bioperl object
@ISA = qw(Bio::Root::Object);
......@@ -117,8 +117,13 @@ sub _parse {
my $fh = new FileHandle("<$file") || $self->throw("Can't open $file");
while (defined(my $line = <$fh>)) {
my $homol = $self->_read_Homol($line);
$self->add_Homol($homol);
eval {
my $homol = $self->_read_Homol($line);
$self->add_Homol($homol);
};
if ($@) {
print STDERR "Couldn't parse line [$line] [$@]\n";
}
}
$fh->close;
......@@ -138,8 +143,6 @@ sub _parse {
sub _read_Homol {
my ($self,$line) = @_;
#chomp($line); # Unnecessary because of split
my ($score, $pid,
$qstart, $qend, $id1,
$hstart, $hend, $id2,
......@@ -160,13 +163,21 @@ sub _read_Homol {
if ($hstart > $hend ) {
my $tmp = $hend;
$hend = $hstart;
$hstart = $tmp;
$hend = $hstart;
$hstart = $tmp;
$strand2 = -1;
}
print STDERR "Strands are $strand1 $strand2\n";
my $strand = 1;
if ($strand1 == -1 || $strand2 == -1) {
$strand = -1;
}
my ($type1,$type2) = $self->get_types;
......@@ -191,25 +202,22 @@ sub _read_Homol {
if ($type2 eq "PEP") {
$sf2 = new Bio::EnsEMBL::Pep_SeqFeature(-start => $hstart,
-end => $hend,
-strand => $strand1);
-strand => $strand);
$sf2->start_frac(1);
$sf2->end_frac (3);
} else {
$sf2 = new Bio::EnsEMBL::SeqFeature(-start => $hstart,
-end => $hend,
-strand => $strand1);
-strand => $strand);
}
$sf1->score($score);
$sf2->score($score);
$sf1->seqname($self->contig_id);
$sf2->seqname($id2);
$sf1->primary_tag('similarity');
$sf2->primary_tag('similarity');
......@@ -220,7 +228,6 @@ sub _read_Homol {
$sf2->source_tag($self->source_tag);
my $fp = new Bio::EnsEMBL::FeaturePair(-feature1 => $sf1,
-feature2 => $sf2,
);
......@@ -230,9 +237,7 @@ sub _read_Homol {
$self->throw("Can't make analysis\n") unless defined($self->analysis);
$sf1->analysis($self->analysis);
$sf2->analysis($self->analysis);
$fp->analysis ($self->analysis);
return ($fp);
}
......@@ -370,9 +375,9 @@ BEGIN {
$self->{_type} = $type;
}
use Carp;
#use Carp;
#use Data::Dumper;
confess("No type", $self) unless defined $self->{_type};
#confess("No type", Dumper($self)) unless defined $self->{_type};
return $self->{_type};
}
......
......@@ -131,26 +131,6 @@ sub program_version{
$self->throw("No program version on analysis implementing object");
}
=head2 has_database
Title : has_database
Usage :
Function:
Example :
Returns :
Args :
=cut
sub has_database {
my ($self,@args) = @_;
$self->throw("No has_database analysis implementing object");
}
1;
......
......@@ -99,6 +99,8 @@ sub is_similar {
$self->throw("Trying to test against a [$co] which is not good");
}
#warn $self->hash_string, "\n", $co->hash_string, "\n";
if( $self->contiga->id eq $co->contiga->id ) {
if( $self->contigb->id ne $co->contigb->id ) {
return 0;
......@@ -401,7 +403,7 @@ sub distance {
$self->{_distance} = $arg;
}
return $self->{_distance} || 0;
return $self->{_distance} || 1;
}
......
......@@ -299,23 +299,6 @@ sub get_all_Genes {
$self->warn("Base class has not implemented get_all_Genes yet!");
}
=head2 get_all_ContigOverlaps
Title : get_all_ContigOverlaps
Usage :
Function:
Example :
Returns :
Args :
=cut
sub get_all_ContigOverlaps {
my ($self) = @_;
$self->throw("Base class has not implemented get_all_ContigOverlaps");
}
=head2
Decorating functions. You do not need to implement these functions
......
......@@ -43,7 +43,6 @@ Bio::EnsEMBL::DB::ContigI.pm - Abstract Interface for Contig
$seqout->write_seq($contig);
=head1 DESCRIPTION
The contig interface defines a single continuous piece of DNA with both
......@@ -58,7 +57,6 @@ by implementations. Two good implementations are the RawContig implementation
found in Bio::EnsEMBL::DBSQL::RawContig and the generic VirtualContig interface
in Bio::EnsEMBL::DB::VirtualContig
=head1 CONTACT
Ewan Birney, <birney@ebi.ac.uk>
......@@ -83,7 +81,6 @@ use Bio::Root::RootI
@ISA = qw( Bio::SeqI Bio::Root::RootI );
=head2 primary_seq
Title : seq
......@@ -101,7 +98,6 @@ sub primary_seq {
$self->throw("Object did not provide the primary_seq method on a contig interface");
}
=head2 id
Title : id
......@@ -120,22 +116,6 @@ sub id{
}
=head2 internal_id
Title : internal_id
Usage : $obj->internal_id($newval)
Function:
Example :
Returns : value of database internal id
Args : newvalue (optional)
=cut
sub internal_id {
my ($self,$value) = @_;
$self->throw("Object did not provide the id method on a contig interface");
}
=head2 get_all_SeqFeatures
Title : get_all_SeqFeatures
......@@ -155,8 +135,6 @@ sub get_all_SeqFeatures{
}
=head2 get_all_SimilarityFeatures_above_score
Title : get_all_SimilarityFeatures_above_score
......@@ -177,8 +155,6 @@ sub get_all_SimilarityFeatures_above_score{
}
=head2 get_all_SimilarityFeatures
Title : get_all_SimilarityFeatures
......@@ -198,9 +174,6 @@ sub get_all_SimilarityFeatures{
}
=head2 get_all_RepeatFeatures
Title : get_all_RepeatFeatures
......@@ -220,9 +193,6 @@ sub get_all_RepeatFeatures{
}
=head2 get_all_ExternalFeatures
Title : get_all_ExternalFeatures (Abstract)
......@@ -244,9 +214,6 @@ sub get_all_ExternalFeatures{
=head2 get_all_Genes
Title : get_all_Genes
......@@ -267,36 +234,6 @@ sub get_all_Genes{
}
=head2 get_Genes_by_Type
Title : get_Genes_by_Type
Usage :
Function:
Example :
Returns :
Args :
=cut
sub get_Genes_by_Type{
my ($self) = @_;
$self->throw("Object did not provide the get_Genes_by_Type method on Contig interface!");
}
=head2 length
Title : length
......@@ -701,73 +638,6 @@ sub as_seqfeatures {
return @sf;
}
=head2 embl_order
Title : embl_order
Usage : $obj->embl_order
Function:
Returns :
Args :
=cut
sub embl_order{
my ($self) = @_;
$self->throw("Object did not provide the embl_order method on a contig interface");
}
=head2 embl_offset
Title : embl_offset
Usage : $obj->embl_offset
Function:
Returns :
Args :
=cut
sub embl_offset{
my ($self) = @_;
$self->throw("Object did not provide the embl_offset method on a contig interface");
}
=head2 seq_date
Title : seq_date
Usage : $contig->seq_date()
Function: Gives the unix time value of the dna table
created datetime field, which indicates
the original time of the dna sequence data
Example : $contig->seq_date()
Returns : unix time
Args : none
=cut
sub seq_date{
my ($self) = @_;
$self->throw("Object did not provide the seq_date method on a contig interface");
}
=head2 version
Title : version
Usage : $obj->version($newval)
Function:
Returns : value of version
Args : newvalue (optional)
=cut
sub version{
my $self = shift;
$self->throw("Object did not provide the version method on a contig interface");
}
=head1 Cruft
......
......@@ -122,6 +122,15 @@ sub convert_Gene_to_raw_contig {
$clonedgene->add_DBLink($dbl);
}
# Convert all the exons and keep track of the name
# mapping for the translation.
my %namehash;
foreach my $exon ($gene->each_unique_Exon) {
my @clonedexons = $self->_reverse_map_Exon($exon);
$namehash{$exon->id} = [];
push(@{$namehash{$exon->id}},@clonedexons);
}
foreach my $trans ( $gene->each_Transcript ) {
my $clonedtrans = Bio::EnsEMBL::Transcript->new();
$clonedtrans->id($trans->id);
......@@ -135,30 +144,31 @@ sub convert_Gene_to_raw_contig {
$clonedgene->add_Transcript($clonedtrans);
foreach my $exon ( $trans->each_Exon ) {
my @clonedexons = $self->_reverse_map_Exon($exon);
# my @clonedexons = $self->_reverse_map_Exon($exon);
my @clonedexons = @{$namehash{$exon->id}};
foreach my $ce ( @clonedexons ) {
$clonedtrans->add_Exon($ce);
}
# translations
if( exists $translation{$trans->translation->id} ) {
$clonedtrans->translation($translation{$trans->translation->id});
} else {
my $trl = $trans->translation();
my $clonedtrl = Bio::EnsEMBL::Translation->new();
$clonedtrl->id($trl->id);
$clonedtrl->start_exon_id($trl->start_exon_id);
$clonedtrl->end_exon_id($trl->end_exon_id);
$clonedtrl->version($trl->version);
my ($srawcontig,$start,$sstrand) = $self->_vmap->raw_contig_position($trl->start,1);
$clonedtrl->start($start);
my ($erawcontig,$end,$estrand) = $self->_vmap->raw_contig_position($trl->end,1);
$clonedtrl->end($end);
}
# translations
if( exists $translation{$trans->translation->id} ) {
$clonedtrans->translation($translation{$trans->translation->id});
} else {
my $trl = $trans->translation();
my $clonedtrl = Bio::EnsEMBL::Translation->new();
$clonedtrl->id($trl->id);
$clonedtrl->start_exon_id($trl->start_exon_id);
$clonedtrl->end_exon_id($trl->end_exon_id);
$clonedtrl->version($trl->version);
my ($srawcontig,$start,$sstrand) = $self->_vmap->vcpos_to_rcpos($trl->start,1);
$clonedtrl->start($start);
my ($erawcontig,$end,$estrand) = $self->_vmap->vcpos_to_rcpos($trl->end,1);
$clonedtrl->end($end);
$translation{$trl->id} = $clonedtrl;
$clonedtrans->translation($clonedtrl);
}
$translation{$trl->id} = $clonedtrl;
$clonedtrans->translation($clonedtrl);
}
}
......
......@@ -160,26 +160,15 @@ sub end{
# not the entire golden length used here (!)
# the mysterious +1 is to keep the overlapping base convention.
if( $self->orientation == 1 ) {
return $self->start + ($self->contig->golden_end - $self->start_in -1);
return $self->start + ($self->contig->golden_end - $self->start_in);
} else {
return $self->start + ($self->start_in - $self->contig->golden_start -1);
return $self->start + ($self->start_in - $self->contig->golden_start);
}
} else {
return $self->start + $self->contig->golden_length-1;
}
}
sub _leftmost_end {
my ($obj,$value) = @_;
if( defined $value) {
$obj->{'_leftmost_end'} = $value;
}
return $obj->{'_leftmost_end'};
}
=head2 end_in
Title : end_in
......@@ -205,6 +194,23 @@ sub end_in {
}
sub length {
my $self = shift;
return $self->end - $self->start +1;
}
sub _leftmost_end {
my ($obj,$value) = @_;
if( defined $value) {
$obj->{'_leftmost_end'} = $value;
}
return $obj->{'_leftmost_end'};
}
=head2 rightmost_end
Title : rightmost_end
......
......@@ -261,24 +261,7 @@ sub golden_end{
}
}
=head2 is_golden
Title : is_golden
Usage :
Function: