if( $opts->{exclude_layer} ) {
# Filter out all alignment table rows that do not correspond
# to a named witness - these are the layered witnesses.
- my $newtable = { alignment => [] };
- foreach my $row ( $table->{alignment} ) {
+ my $newtable = { alignment => [], length => $table->{length} };
+ foreach my $row ( @{$table->{alignment}} ) {
if( $tradition->has_witness( $row->{witness} ) ) {
push( @{$newtable->{alignment}}, $row );
}
# And then we run the program.
my $program = File::Which::which( 'pars' );
- unless( -x $program ) {
+ unless( $program && -x $program ) {
throw( "Phylip pars not found in path" );
}
sub alignment_table {
my( $self ) = @_;
- $self->calculate_ranks() unless $self->_graphcalc_done;
return $self->cached_table if $self->has_cached_table;
# Make sure we can do this
throw( "Need a linear graph in order to make an alignment table" )
unless $self->linear;
- $self->calculate_ranks unless $self->end->has_rank;
-
+ $self->calculate_ranks()
+ unless $self->_graphcalc_done && $self->end->has_rank;
+
my $table = { 'alignment' => [], 'length' => $self->end->rank - 1 };
my @all_pos = ( 1 .. $self->end->rank - 1 );
foreach my $wit ( sort { $a->sigil cmp $b->sigil } $self->tradition->witnesses ) {
if( $oldreading ne $reading || $flag || $oldreading =~ /\./ ) {
my $int = $reading;
$int .= " ($flag)" if $flag;
- say STDERR "Interpreted $oldreading as $int given $lemma";
+ # say STDERR "Interpreted $oldreading as $int given $lemma";
}
return( $reading, $flag );
}
# Now output what we have been asked to.
if( $outformat eq 'stemma' ) {
- my $cdata = character_input( $tradition->collation->alignment_table );
+ my $cdata = character_input( $tradition );
try {
print phylip_pars( $cdata );
} catch( Text::Tradition::Error $e ) {