<commit_before>package MIP::Program::Alignment::Chanjo;

use Carp;
use strict;
use warnings;
use warnings qw{ FATAL utf8 };
use utf8;    #Allow unicode characters in this script
use open qw{ :encoding(UTF-8) :std };
use charnames qw{ :full :short };

use FindBin qw{$Bin};    #Find directory of script
use File::Basename qw{dirname};
use File::Spec::Functions qw{catdir};

## MIPs lib/
use lib catdir( dirname($Bin), 'lib' );
use MIP::Unix::Standard_streams qw{unix_standard_streams};
use MIP::Unix::Write_to_file qw{unix_write_to_file};

BEGIN {
    require Exporter;

    # Set the version for version checking
    our $VERSION = 1.00;

    use base qw {Exporter};

    # Functions and variables which can be optionally exported
    our @EXPORT_OK = qw{chanjo_sex};

}

use Params::Check qw{check allow last_error};
use Readonly;

Readonly my $SPACE => q{ };

sub chanjo_sex {

##chanjo_sex

##Function : Perl wrapper for writing chanjo sex recipe to $FILEHANDLE. Based on chanjo 4.0.0
##Returns  : "@commands"
##Arguments: $FILEHANDLE, $infile_path, $outfile_path, $stderrfile_path, $log_file_path, $chr_prefix, $log_level
##         : $FILEHANDLE      => Sbatch filehandle to write to
##         : $infile_path     => Infile path
##         : $outfile_path    => Outfile path
##         : $stderrfile_path => Stderrfile path
##         : $log_file_path   => Log file path
##         : $chr_prefix      => Chromosome prefix
##         : $log_level       => Level of logging

    my ($arg_href) = @_;

    ## Default(s)
    my $log_level;

    ## Flatten argument(s)
    my $FILEHANDLE;
    my $infile_path;
    my $outfile_path;
    my $stderrfile_path;
    my $log_file_path;
    my $chr_prefix;
    my $stderrfile_path_append;

    my $tmpl = {
        FILEHANDLE  => { required => 1, store => \$FILEHANDLE },
        infile_path => {
            required    => 1,
            defined     => 1,
            strict_type => 1,
            store       => \$infile_path
        },
        outfile_path    => { strict_type => 1, store => \$outfile_path },
        stderrfile_path => { strict_type => 1, store => \$stderrfile_path },
        log_file_path   => { strict_type => 1, store => \$log_file_path },
        chr_prefix      => {
            allow       => [qw{undef chr}],
            strict_type => 1,
            store       => \$chr_prefix
        },
        log_level => {
            default     => q{INFO},
            allow       => [qw{DEBUG INFO WARNING ERROR CRITICAL}],
            strict_type => 1,
            store       => \$log_level
        },
    };

    check( $tmpl, $arg_href, 1 ) or croak qw{Could not parse arguments!};

    ## Chanjo
    my @commands = qw{chanjo};    #Stores commands depending on input parameters

    ## Chanjo main options
    if ($log_level) {

        push @commands, q{--log-level} . $SPACE . $log_level;
    }
    if ($log_file_path) {

        push @commands, q{--log-file} . $SPACE . $log_file_path;
    }<commit_msg>Fixed minor bug<commit_after>package MIP::Program::Alignment::Chanjo;

use Carp;
use strict;
use warnings;
use warnings qw{ FATAL utf8 };
use utf8;    #Allow unicode characters in this script
use open qw{ :encoding(UTF-8) :std };
use charnames qw{ :full :short };

use FindBin qw{$Bin};    #Find directory of script
use File::Basename qw{dirname};
use File::Spec::Functions qw{catdir};

## MIPs lib/
use lib catdir( dirname($Bin), 'lib' );
use MIP::Unix::Standard_streams qw{unix_standard_streams};
use MIP::Unix::Write_to_file qw{unix_write_to_file};

BEGIN {
    require Exporter;

    # Set the version for version checking
    our $VERSION = 1.00;

    use base qw {Exporter};

    # Functions and variables which can be optionally exported
    our @EXPORT_OK = qw{chanjo_sex};

}

use Params::Check qw{check allow last_error};
use Readonly;

Readonly my $SPACE => q{ };

sub chanjo_sex {

##chanjo_sex

##Function : Perl wrapper for writing chanjo sex recipe to $FILEHANDLE. Based on chanjo 4.0.0
##Returns  : "@commands"
##Arguments: $FILEHANDLE, $infile_path, $outfile_path, $stderrfile_path, $log_file_path, $chr_prefix, $log_level
##         : $FILEHANDLE      => Sbatch filehandle to write to
##         : $infile_path     => Infile path
##         : $outfile_path    => Outfile path
##         : $stderrfile_path => Stderrfile path
##         : $log_file_path   => Log file path
##         : $chr_prefix      => Chromosome prefix
##         : $log_level       => Level of logging

    my ($arg_href) = @_;

    ## Default(s)
    my $log_level;

    ## Flatten argument(s)
    my $FILEHANDLE;
    my $infile_path;
    my $outfile_path;
    my $stderrfile_path;
    my $log_file_path;
    my $chr_prefix;
    my $stderrfile_path_append;

    my $tmpl = {
        FILEHANDLE  => { required => 1, store => \$FILEHANDLE },
        infile_path => {
            required    => 1,
            defined     => 1,
            strict_type => 1,
            store       => \$infile_path
        },
        outfile_path    => { strict_type => 1, store => \$outfile_path },
        stderrfile_path => { strict_type => 1, store => \$stderrfile_path },
        log_file_path   => { strict_type => 1, store => \$log_file_path },
        chr_prefix      => {
            allow       => [undef, qw{chr}],
            strict_type => 1,
            store       => \$chr_prefix
        },
        log_level => {
            default     => q{INFO},
            allow       => [qw{DEBUG INFO WARNING ERROR CRITICAL}],
            strict_type => 1,
            store       => \$log_level
        },
    };

    check( $tmpl, $arg_href, 1 ) or croak qw{Could not parse arguments!};

    ## Chanjo
    my @commands = qw{chanjo};    #Stores commands depending on input parameters

    ## Chanjo main options
    if ($log_level) {

        push @commands, q{--log-level} . $SPACE . $log_level;
    }
    if ($log_file_path) {

        push @commands, q{--log-file} . $SPACE . $log_file_path;
    }
{'fraction_non_alphanumeric': 0.1261548798924912, 'fraction_numerical': 0.006383336133042164, 'mean_word_length': 2.388730791121229, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 71, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7570680', 'n_tokens_mistral': 2016, 'n_tokens_neox': 1916, 'n_words': 518}