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

use FindBin;
use lib "$FindBin::Bin/../lib";
use FuncBasics qw(:all);

# This script parses the bowtie output of the EXSK (A priori, simplex exon skipping) mapping.
use Getopt::Long;

use Cwd qw(abs_path);
$cwd = abs_path($0);
($dir)=$cwd=~/(.+)\/bin/;

my $dbDir;
my $sp;
my $length;
my $root;

GetOptions("dbDir=s" => \$dbDir, "sp=s" => \$sp,
           "readLen=i" => \$length, "root=s" => \$root);


#($sp,$length)=$ARGV[0]=~/(.{3})EXSK\-(\d+?)\-/; # input file format

#($file)=$ARGV[0]=~/(.+?\.out)/;
#system "gunzip $ARGV[0]" if $ARGV[0]=~/\.gz/;

### parses the general information for the events
open (TEMPLATE, "$dbDir/TEMPLATES/$sp.EXSK.Template.1.txt") || die "No SIMPLE EXSK Template for $sp\n";
while (<TEMPLATE>){
    chomp;
    @t=split(/\t/);
    $event=$t[3];
    $pre_data{$t[3]}=join("\t",@t[0..11]);
    $COMPLEX{$t[3]}=$t[12];
    $NAME{$t[3]}=$t[13];
}
close TEMPLATE;

### Loads mappability information
open (MAPPABILITY, "$dbDir/FILES/EXSK-$length-gDNA.eff") || die "No Mappability for $sp\n";
while (<MAPPABILITY>){
    chomp;
    @t=split(/\t/);
    ($event,$eej)=$t[0]=~/(.+)_(.+?_\d+?_\d+?_\d+)/;
    $eff{$event}{$eej}=$t[1];
}
close MAPPABILITY;

#### parses the bowtie output file for the EEJ sequences
#($root)=$file=~/(.+\-$length\-.+?)\-e/;
#$I = openFileHandle ($file); # DEPRECATED --TSW
while (<STDIN>){
    chomp;
    @t=split(/\t/);

    # this is to get the actual read name to avoid doublecounting in a sorted output
#    ($read)=$t[0]=~/(.+) /;
#    ($read)=$t[0]=~/(.+)\:/ if !$read;
#    ($read)=$t[0]=~/(.+)\#/ if !$read;
#    ($read)=$t[0]=~/(.+)\// if !$read;
    ($read)=$t[0]=~/(.+)\-\d+/;<commit_msg>Update Analyze_EXSK.pl<commit_after>#!/usr/bin/env perl

use FindBin;
use lib "$FindBin::Bin/../lib";
use FuncBasics qw(:all);

# This script parses the bowtie output of the EXSK (A priori, simplex exon skipping) mapping.
use Getopt::Long;

use Cwd qw(abs_path);
$cwd = abs_path($0);
($dir)=$cwd=~/(.+)\/bin/;

my $dbDir;
my $sp;
my $length;
my $root;

GetOptions("dbDir=s" => \$dbDir, "sp=s" => \$sp,
           "readLen=i" => \$length, "root=s" => \$root);


#($sp,$length)=$ARGV[0]=~/(.{3})EXSK\-(\d+?)\-/; # input file format

#($file)=$ARGV[0]=~/(.+?\.out)/;
#system "gunzip $ARGV[0]" if $ARGV[0]=~/\.gz/;

### parses the general information for the events
open (TEMPLATE, "$dbDir/TEMPLATES/$sp.EXSK.Template.1.txt") || die "No SIMPLE EXSK Template for $sp\n";
while (<TEMPLATE>){
    chomp;
    @t=split(/\t/);
    $event=$t[3];
    $pre_data{$t[3]}=join("\t",@t[0..11]);
    $COMPLEX{$t[3]}=$t[12];
    $NAME{$t[3]}=$t[13];
}
close TEMPLATE;

### Loads mappability information
open (MAPPABILITY, "$dbDir/FILES/EXSK-$length-gDNA.eff") || die "No Mappability for $sp\n";
while (<MAPPABILITY>){
    chomp;
    @t=split(/\t/);
    ($event,$eej)=$t[0]=~/(.+)_(.+?_\d+?_\d+?_\d+)/;
    $eff{$event}{$eej}=$t[1];
}
close MAPPABILITY;

#### parses the bowtie output file for the EEJ sequences
#($root)=$file=~/(.+\-$length\-.+?)\-e/;
#$I = openFileHandle ($file); # DEPRECATED --TSW
while (<STDIN>){
    chomp;
    @t=split(/\t/);

    # this is to get the actual read name to avoid doublecounting in a sorted output
#    ($read)=$t[0]=~/(.+) /;
#    ($read)=$t[0]=~/(.+)\:/ if !$read;
#    ($read)=$t[0]=~/(.+)\#/ if !$read;
#    ($read)=$t[0]=~/(.+)\// if !$read;
    ($read)=$t[0]=~/(.+)\-/;
{'fraction_non_alphanumeric': 0.28668639053254436, 'fraction_numerical': 0.014792899408284023, 'mean_word_length': 3.65702479338843, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 17, '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': '7418161', 'n_tokens_mistral': 1559, 'n_tokens_neox': 1479, 'n_words': 300}