From: Tara L Andrews Date: Wed, 8 Aug 2012 20:46:59 +0000 (+0200) Subject: small nomenclature rationalization; save reversion roots X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=be5900459c4e9cbcadd56ff104ae17e270bbf0c7;p=scpubgit%2Fstemmatology.git small nomenclature rationalization; save reversion roots --- diff --git a/lib/Text/Tradition/Analysis.pm b/lib/Text/Tradition/Analysis.pm index feb4675..fd01b8a 100644 --- a/lib/Text/Tradition/Analysis.pm +++ b/lib/Text/Tradition/Analysis.pm @@ -649,6 +649,7 @@ sub analyze_location { if( $classinfo ) { @reversions = grep { $classinfo->{$_} eq 'revert' } $rdghash->{'group'}->members; + $rdghash->{'reversions'} = \@reversions; } my @group = @{$rdghash->{'group'}}; @@ -659,7 +660,7 @@ sub analyze_location { my $sourceparents = _find_reading_parents( $rid, $graph, $contig, @roots ); # Work out relationships between readings and their non-followed parent. _resolve_parent_relationships( $c, $rid, $rdg, $sourceparents ); - $rdghash->{'reading_parents'} = $sourceparents; + $rdghash->{'source_parents'} = $sourceparents; if( @reversions ) { my $revparents = _find_reading_parents( $rid, $graph, $contig, @reversions ); diff --git a/script/analyze.pl b/script/analyze.pl index a0b5c83..5477c64 100755 --- a/script/analyze.pl +++ b/script/analyze.pl @@ -109,7 +109,7 @@ foreach my $tinfo( $dir->traditionlist ) { # treat it as genealogical for the parent. _add_reading_relations( $rdghash->{'readingid'}, $loc->{'id'}, $rdg, ( $type eq 'reverted' ? 'genealogical' : $type ), - $rdghash->{'reading_parents'}, \%datahash, \@unknown ); + $rdghash->{'source_parents'}, \%datahash, \@unknown ); # Add relation stats for reading reversions if they exist. if( $type eq 'reverted' ) { # Get relationship between reverted readings and their non-matching diff --git a/t/analysis.t b/t/analysis.t index 811d6ba..3d48eff 100755 --- a/t/analysis.t +++ b/t/analysis.t @@ -94,7 +94,7 @@ foreach my $row ( @{$results->{'variants'}} ) { say sprintf( "=== Looking at rank %d (%s) ===", $row->{'id'}, $row->{'genealogical'} ? 'genealogical' : 'not genealogical' ); foreach my $rdg ( @{$row->{'readings'}} ) { - my $parents = $rdg->{'reading_parents'}; + my $parents = $rdg->{'source_parents'}; say sprintf( "Reading %s: %s", $rdg->{'readingid'}, $rdg->{'conflict'} ? '(conflicted)' : '' ); if( $parents && @$parents ) { @@ -132,7 +132,7 @@ foreach my $row ( @{$results->{'variants'}} ) { my %is_parent; my @has_no_parent; foreach my $rdg ( @{$row->{'readings'}} ) { - my $parents = $rdg->{'reading_parents'} || {}; + my $parents = $rdg->{'source_parents'} || {}; foreach my $p ( keys %$parents ) { push( @{$is_parent{$p}}, $rdg->{'readingid'} ); }