small nomenclature rationalization; save reversion roots
Tara L Andrews [Wed, 8 Aug 2012 20:46:59 +0000 (22:46 +0200)]
lib/Text/Tradition/Analysis.pm
script/analyze.pl
t/analysis.t

index feb4675..fd01b8a 100644 (file)
@@ -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 );
index a0b5c83..5477c64 100755 (executable)
@@ -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
index 811d6ba..3d48eff 100755 (executable)
@@ -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'} );
                                }