er::Metrics;
use Pheno::Ranker::Graph;
use Exporter 'import';
our @EXPORT_OK = qw($VERSION write_json);
# Personalize warn and die functions
$SIG{__WARN__} = sub { warn BOLD YELLOW "Warn: ", @_ };
$
as hpo_file => (
default => catfile( $share_dir, 'db', 'hp.json' ),
coerce => sub { $_[0] // catfile( $share_dir, 'db', 'hp.json' ) },
is => 'ro',
isa => sub { die "Error <$_
ed_phenotypicFeatures align align_basename export export_basename
log verbose age cytoscape_json graph_stats/
] => ( is => 'ro' );
has [qw/append_prefixes reference_files patients_of_interest/]
#!/usr/bin/perl
#
# A script that creates a disease-based
# BFF/PXF JSON array from HPO CSV data
#
# Last Modified: Jan/15/2024
#
# $VERSION taken from Pheno::Ranker
#
# Copyright (C) 2023-
program helps you in your research, please cite.
use strict;
use warnings;
use Text::CSV_XS;
use JSON::XS;
use Getopt::Long qw(:config no_ignore_case);
# Command-line arguments
GetOptions(
'i|in
to arrays for JSON encoding
my %output_data;
foreach my $type (keys %diseases) {
$output_data{$type} = [ values %{ $diseases{$type} } ];
}
# Initialize JSON encoder
my $json = JSON::XS->new->utf
nk create_glob_and_ref_hashes randomize_variables remap_hash create_binary_digit_string parse_hpo_json);
use constant DEVEL_MODE => 0;
our %nomenclature = ();
sub check_format {
my $data = shi
weight hamming-distance json-path label/;
# The dataframe will have two header lines
# *** IMPORTANT ***
# nsort does not yield same results as canonical from JSON::XS
# NB: we're sor
tamic Pyruvic Transaminase, CTCAE'
my @dataframe = join ';', 'Id', @labels;
# Variables (json path)
push @dataframe, join ';', 'Id', @sort_keys_glob_hash;
# 0/1
push @dataframe,
package Pheno::Ranker::Graph;
use strict;
use warnings;
use autodie;
use feature qw(say);
use JSON::XS;
use Pheno::Ranker::IO;
use Exporter 'import';
our @EXPORT = qw(matrix2graph cytoscape2graph);
u
my $arg = shift;
my $input = $arg->{matrix};
my $output = $arg->{json};
my $verbose = $arg->{verbose};
my $graph_stats = $arg->{graph_stats};
# Open t
edges => \@edges,
}
);
# Open a file to write JSON output
say "Writting <$output> file " if $verbose;
write_json( { filepath => $output, data => \%graph } );
return defin
nk create_glob_and_ref_hashes randomize_variables remap_hash create_binary_digit_string parse_hpo_json);
use constant DEVEL_MODE => 0;
our %nomenclature = ();
sub check_format {
my $data = shif
weight hamming-distance json-path label/;
# The dataframe will have two header lines
# *** IMPORTANT ***
# nsort does not yield same results as canonical from JSON::XS
# NB: we're sor
tamic Pyruvic Transaminase, CTCAE'
my @dataframe = join ';', 'Id', @labels;
# Variables (json path)
push @dataframe, join ';', 'Id', @sort_keys_glob_hash;
# 0/1
push @dataframe,
e);
use JSON::XS;
#use Data::Dumper;
#use Sort::Naturally qw(nsort);
use Exporter 'import';
our @EXPORT =
qw(serialize_hashes write_alignment io_yaml_or_json read_json read_yaml write_json write_a
rray2txt array2object validate_json write_poi coverage_stats check_existence_of_include_terms append_and_rename_primary_key restructure_pxf_interpretations);
use constant DEVEL_MODE => 0;
###########
my $export_basename = $arg->{export_basename};
write_json(
{ data => $data->{$_}, filepath => qq/$export_basename.$_.json/ } )
for keys %{$data};
return 1;
}
sub write_alig