Skip to content

Commit

Permalink
rename the R phylo related subs
Browse files Browse the repository at this point in the history
Make them consistent snake case.
And no need to append json to the name.
  • Loading branch information
shawnlaffan committed Sep 15, 2023
1 parent d07f88d commit 5006825
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions lib/Biodiverse/ReadNexus.pm
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,13 @@ sub import_data {
$self->set_param (USE_ELEMENT_PROPERTIES => $use_element_properties);

# no import_newick here as import_phylip handles such files
my @import_methods = qw/import_nexus import_phylip import_R_phylo_json import_tabular_tree/;
my @import_methods = qw/import_nexus import_phylip import_R_phylo import_tabular_tree/;
# promote most likely method to front of the list
if (defined $args{file} && $args{file} =~ /(txt|csv)$/) { # dirty hack
unshift @import_methods, 'import_tabular_tree';
}
elsif (is_ref ($args{data})) { # also a dirty hack
unshift @import_methods, 'import_R_phylo_json';
unshift @import_methods, 'import_R_phylo';
}
else {
my $method = $self->probe_file_type (%args);
Expand Down Expand Up @@ -631,7 +631,7 @@ sub get_csv_object_for_tabular_tree_import {
}
sub import_R_phylo_json {
sub import_R_phylo {
my $self = shift;
my %args = @_;
Expand Down
2 changes: 1 addition & 1 deletion lib/Biodiverse/TreeNode.pm
Original file line number Diff line number Diff line change
Expand Up @@ -2311,7 +2311,7 @@ sub to_newick { # convert the tree to a newick format. Based on the NEXUS li

# convert the tree to the same structure as used by the R phylo system
# this cannot be a recursive function
sub to_Rphylo {
sub to_R_phylo {
my $self = shift;
my %args = (use_internal_names => 1, @_);
my $remap = $args{remap} || {};
Expand Down
4 changes: 2 additions & 2 deletions t/13-Tree.t
Original file line number Diff line number Diff line change
Expand Up @@ -950,10 +950,10 @@ sub test_export_Rphylo {
my $i;
foreach my $tree ($tree1, $tree2) {
$i++;
my $result = $tree->to_Rphylo;
my $result = $tree->to_R_phylo;
# round trip it
$rn = Biodiverse::ReadNexus->new;
$rn->import_R_phylo_json(data => $result);
$rn->import_R_phylo(data => $result);
@trees = $rn->get_tree_array;
my $roundtripper = shift @trees;
ok($tree->trees_are_same(comparison => $roundtripper),
Expand Down
2 changes: 1 addition & 1 deletion t/21-ReadNexus.t
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ sub test_read_R_phylo_json_data {
my $readnex = Biodiverse::ReadNexus->new;
#diag $baddata;
$result = eval {
$readnex->import_R_phylo_json (data => $baddata);
$readnex->import_R_phylo (data => $baddata);
};
is $@,
'JSON data is not an R phylo structure',
Expand Down

0 comments on commit 5006825

Please sign in to comment.