my $svg;
my $variants = [];
- # Read in the file and stemma
- my @lines;
- open( INFILE, "$file" ) or die "Could not read $file";
- binmode INFILE, ':utf8';
- @lines = <INFILE>;
- close INFILE;
-
+ # Read in the file and stemma
my $tradition = Text::Tradition->new(
- 'Self' => join( '', @lines ),
+ 'input' => 'Self',
+ 'file' => $file,
'linear' => 1,
);
my $stemma = Text::Tradition::Stemma->new(
my $rdg_wits = {};
my $col_rdgs = shift @$all_wits_table;
my $rank;
+ my $lacunose = [];
foreach my $j ( 0 .. $#{$col_rdgs} ) {
my $rdg = $col_rdgs->[$j];
my $rdg_text = '(omitted)'; # Initialize in case of empty reading
if( $rdg ) {
- $rdg_text = $rdg->is_lacuna ? undef : $rdg->text; # Don't count lacunae
- # Get the rank from any real reading; they should be identical.
- $rank = $rdg->rank unless $rank || $rdg->is_lacuna;
+ if( $rdg->is_lacuna ) {
+ $rdg_text = undef; # Don't count lacunae
+ push( @$lacunose, $col_wits->[$j] );
+ } else {
+ $rdg_text = $rdg->text;
+ # Get the rank from any real reading; they should be identical.
+ $rank = $rdg->rank;
+ }
}
if( defined $rdg_text ) {
# Initialize the witness array if we haven't got one yet
# For all the groups with more than one member, collect the list of all
# contiguous vertices needed to connect them.
# TODO: deal with a.c. reading logic
- my $sc = analyze_variant_location( $group_readings, $groups, $stemma->apsp );
- $variant_row->{'genealogical'} = keys %$sc ? 1 : undef;
+ my $conflict = analyze_variant_location(
+ $group_readings, $groups, $stemma->apsp );
+ $variant_row->{'genealogical'} = keys %$conflict ? undef : 1;
foreach my $grp ( sort keys %$group_readings ) {
my $rdg = $group_readings->{$grp};
- push( @{$variant_row->{'readings'}}, { 'text' => $rdg, 'group' => $grp } );
+ my $in_conflict = exists $conflict->{$grp};
+ push( @{$variant_row->{'readings'}},
+ { 'text' => $rdg, 'group' => $grp, 'conflict' => $in_conflict,
+ 'missing' => wit_stringify( $lacunose ) } );
}
# Now run the same analysis given the calculated distance tree(s).