<commit_before>#!/usr/bin/env perl 

#input: .fna, .fasta, .fq, or .fastq 
#outputs: output.stats.txt

use strict;
use warnings;
no warnings('once');

use PipelineAWE;
use Getopt::Long;
use Digest::MD5;
umask 000;

# options
my $input_file = "";
my $input_json_file = "";
my $output_json_file = "";
my $type = "fasta";
my $help = "";
my $options = GetOptions ("input=s" => \$input_file,
                          "input_json=s" => \$input_json_file,
                          "output_json=s" => \$output_json_file,
                          "type=s" => \$type,
                          "help!" => \$help
                         );

# Validate input file path.
if ($help) {
    print_usage();
    exit 0;
} elsif (length($input_file)==0) {
    PipelineAWE::logger('error', "input file was not specified");
    exit 1;
} elsif (! -e $input_file) {
    PipelineAWE::logger('error', "input sequence file [$input_file] does not exist");
    exit 1;
}
if ($type ne 'fasta' && $type ne 'fastq') {
    PipelineAWE::logger('error', "file type must be fasta or fastq format (default is fasta)");
    exit 1;
}

# Validate other input and output file paths.
my $data = PipelineAWE::read_json($input_json_file);<commit_msg>more options<commit_after>#!/usr/bin/env perl 

#input: .fna, .fasta, .fq, or .fastq 
#outputs: output.stats.txt

use strict;
use warnings;
no warnings('once');

use PipelineAWE;
use Getopt::Long;
use Digest::MD5;
umask 000;

# options
my $input_file       = "";
my $input_json_file  = "";
my $output_json_file = "";
my $type             = "fasta";
my $stats_only       = 0;
my $is_protein       = 0;
my $help             = "";

my $options = GetOptions (
    "input=s"       => \$input_file,
    "input_json=s"  => \$input_json_file,
    "output_json=s" => \$output_json_file,
    "stats_only"    => \$stats_only,
    "is_protein"    => \$is_protein,
    "type=s"        => \$type,
    "help!"         => \$help
);

# Validate input file path.
if ($help) {
    print_usage();
    exit 0;
} elsif (length($input_file)==0) {
    PipelineAWE::logger('error', "input file was not specified");
    exit 1;
} elsif (! -e $input_file) {
    PipelineAWE::logger('error', "input sequence file [$input_file] does not exist");
    exit 1;
}
if ($type ne 'fasta' && $type ne 'fastq') {
    PipelineAWE::logger('error', "file type must be fasta or fastq format (default is fasta)");
    exit 1;
}

# Validate other input and output file paths.
my $data = PipelineAWE::read_json($input_json_file);

if ($stats_only) {
    $data->{statistics} = PipelineAWE::get_seq_stats($input_file, $type, $is_protein);
    PipelineAWE::print_json($output_json_file, $data);
    exit 0;
}
{'fraction_non_alphanumeric': 0.163112607557052, 'fraction_numerical': 0.007856341189674524, 'mean_word_length': 2.985096870342772, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2954175', 'n_tokens_mistral': 980, 'n_tokens_neox': 942, 'n_words': 244}