I'm printing data in Perl6 with Data::Printer
which is a spectacular package, but I am trying to alter parameters and I am not able to.
For example, I want:
HG00112 {
gained_site {
9:10162 0,
9:10272 var{HG00112}{gained_site}{9:10162},
9:10326 var{HG00112}{gained_site}{9:10162},
...
}(tied to Perl6::Hash)
to look like
HG00112 {
gained_site {
9:10162 0,
9:10272 0,
9:10326 0,
...
}(tied to Perl6::Hash)
for easier readability (I don't care about tied to Perl6::Hash
specifically)
this hash element can be seen with JSON:
"HG00112": {
"discordant_multiallelic_loss": 0,
"concordant_hom_alt": 4,
"discordant_het_to_alt": 0,
"discordant_hom_alt_to_ref": 0,
"discordant_hom_ref_to_alt": 0,
"lost_site": 0,
"concordant_het": 3,
"discordant_multiallelic_gain": 0,
"discordant_hom_alt_to_het": 0,
"discordant_call_to_no_call": 0,
"discordant_het_to_ref": 0,
"concordant_hom_ref": 5,
"concordant_site": 18,
"discordant_no_call_to_call": 0,
"concordant_no_call": 6,
"concordant_multiallelic": 0,
"gained_site": 0,
"discordant_hom_ref_to_het": 0
}
I normally load the package using use Data::Printer:from<Perl5>
, and using suggestions from
Terminal ANSI colors does not work with Inline::Perl5 (Data::Printer)
I have tried using that with advice from https://metacpan.org/pod/Data::Printer , namely
use Data::Printer:from<Perl5> {show_tied => 0}
& use Data::Printer:from<Perl5> show_tied => 0
but both show the error
Error while importing from '
Data::Printer
': no such tag 'show_tied
'
How can I get the output from Data::Printer
to look like the second code selection, without the ugly var{...
?
---edit---
a slight improvement, the script recognizes the option show_tied
but still doesn't use it:
my test script:
use JSON::Fast;
use Data::Printer:from<Perl5> 'show_tied', 0;
my %conc = from-json '{"HG00112": {
"discordant_multiallelic_loss": 0,
"concordant_hom_alt": 4,
"discordant_het_to_alt": 0,
"discordant_hom_alt_to_ref": 0,
"discordant_hom_ref_to_alt": 0,
"lost_site": 0,
"concordant_het": 3,
"discordant_multiallelic_gain": 0,
"discordant_hom_alt_to_het": 0,
"discordant_call_to_no_call": 0,
"discordant_het_to_ref": 0,
"concordant_hom_ref": 5,
"concordant_site": 18,
"discordant_no_call_to_call": 0,
"concordant_no_call": 6,
"concordant_multiallelic": 0,
"gained_site": 0,
"discordant_hom_ref_to_het": 0
}}';
p %conc;
shows nearly useless output:
{
HG00112 {
concordant_het 3,
concordant_hom_alt var{HG00112}{concordant_het},
concordant_hom_ref var{HG00112}{concordant_het},
concordant_multiallelic var{HG00112}{concordant_het},
concordant_no_call var{HG00112}{concordant_het},
concordant_site var{HG00112}{concordant_het},
discordant_call_to_no_call var{HG00112}{concordant_het},
discordant_het_to_alt var{HG00112}{concordant_het},
discordant_het_to_ref var{HG00112}{concordant_het},
discordant_hom_alt_to_het var{HG00112}{concordant_het},
discordant_hom_alt_to_ref var{HG00112}{concordant_het},
discordant_hom_ref_to_alt var{HG00112}{concordant_het},
discordant_hom_ref_to_het var{HG00112}{concordant_het},
discordant_multiallelic_gain var{HG00112}{concordant_het},
discordant_multiallelic_loss var{HG00112}{concordant_het},
discordant_no_call_to_call var{HG00112}{concordant_het},
gained_site var{HG00112}{concordant_het},
lost_site var{HG00112}{concordant_het}
} (tied to Perl6::Hash)
} (tied to Perl6::Hash)