Skip to content

Commit

Permalink
more comments
Browse files Browse the repository at this point in the history
svn path=/bioperl-dev/branches/maj-nexml/; revision=15885
  • Loading branch information
maj committed Jul 23, 2009
1 parent 18d8173 commit 5ec11e9
Showing 1 changed file with 32 additions and 3 deletions.
35 changes: 32 additions & 3 deletions Bio/Nexml/Util.pm
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ Bio::Nexml::Util - A utility module for parsing nexml documents
This is a utility module in the nexml namespace. It contains methods
that are needed by multiple modules.
A few key design issues pertaining to this module will be
described here.
=head1 FEEDBACK
=head2 Mailing Lists
Expand Down Expand Up @@ -104,6 +107,7 @@ use Bio::Phylo::Matrices::Datatype::Rna;

my $fac = Bio::Phylo::Factory->new();

# PODPODPOD

sub _make_aln {
my ($self, $proj) = @_;
Expand All @@ -121,6 +125,10 @@ sub _make_aln {
unless ($mol_type eq 'dna' || $mol_type eq 'rna' || $mol_type eq 'protein')
{
next;
# something for the back-burner: BioPerl has objects
# to handle arbitrary genotypes; might be cool to
# be able to create something besides alignments
# here .../maj
}

my $basename = $matrix->get_name();
Expand All @@ -142,10 +150,12 @@ sub _make_aln {

$seq = Bio::LocatableSeq->new(
-seq => $newSeq,
-display_id => "$seqID",
# -display_id => "$seqID",
-display_id => "$rowlabel",
#-description => $desc,
-alphabet => $mol_type,
);

my $feat;
#check if taxon linked to sequence if so create feature to attach to alignment
foreach my $taxa_o (@$taxa)
Expand Down Expand Up @@ -174,6 +184,8 @@ sub _make_aln {
return \@alns;
}

#PODPODPOD

sub _make_tree {
my($self, $proj) = @_;
my @trees;
Expand Down Expand Up @@ -259,6 +271,8 @@ sub _make_tree {
return \@trees;
}

#PODPODPOD

sub _make_seq {
my($self, $proj) = @_;
my $matrices = $proj->get_matrices();
Expand Down Expand Up @@ -326,6 +340,8 @@ sub _make_seq {
return \@seqs;
}

#PODPODPOD

sub create_bphylo_tree {
my ($self, $bptree) = @_;
#most of the code below ripped form Bio::Phylo::Forest::Tree::new_from_bioperl()d
Expand Down Expand Up @@ -353,7 +369,7 @@ sub create_bphylo_tree {
return $tree, $taxa;
}


#PODPODPOD

sub _copy_tree {
my ( $tree, $bpnode, $parent, $taxa ) = @_;
Expand All @@ -376,6 +392,8 @@ sub _copy_tree {
return $tree, $taxa;
}

#PODPODPOD

sub create_bphylo_aln {

my ($self, $aln, @args) = @_;
Expand Down Expand Up @@ -423,6 +441,8 @@ sub create_bphylo_aln {
}
}

#PODPODPOD

sub create_bphylo_seq {
my ($self, $seq, @args) = @_;
my $type = $seq->alphabet || $seq->_guess_alphabet || 'dna';
Expand All @@ -438,6 +458,9 @@ sub create_bphylo_seq {
if ( $seqstring and $seqstring =~ /\S/ ) {
eval { $dat->set_char( $seqstring ) };
#TODO Test debuggin

# let's convert Rutger's cool exceptions to the more pedestrian Bioperl throws/maj

if ( $@ and UNIVERSAL::isa($@,'Bio::Phylo::Util::Exceptions::InvalidData') ) {
$self->throw(
"\nAn exception of type Bio::Phylo::Util::Exceptions::InvalidData was caught\n\n".
Expand Down Expand Up @@ -471,6 +494,8 @@ sub create_bphylo_seq {
return $matrix, $taxa;
}

#PODPODPOD (there's a leitmotif here...)

sub create_bphylo_taxa {
my ($aln, $seq) = @_;

Expand All @@ -480,6 +505,8 @@ sub create_bphylo_taxa {

}

#PODPODPOD

sub create_bphylo_datum {
#ripped from Bio::Phylo::Matrices::Datum::new_from_bioperl()
my ( $seq, $feats, $taxa, @args ) = @_;
Expand All @@ -493,7 +520,9 @@ sub create_bphylo_datum {
my $seqstring = $seq->seq;
if ( $seqstring and $seqstring =~ /\S/ ) {
eval { $self->set_char( $seqstring ) };


# let's convert Rutger's cool exceptions to the more pedestrian Bioperl throws/maj

if ( $@ and UNIVERSAL::isa($@,'Bio::Phylo::Util::Exceptions::InvalidData') ) {
$self->throw(
"\nAn exception of type Bio::Phylo::Util::Exceptions::InvalidData was caught\n\n".
Expand Down

0 comments on commit 5ec11e9

Please sign in to comment.