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

## temp script to create a table of evidence values for mart building



use strict;
use warnings;
use DBI;
use Getopt::Long;

my ($db, $host, $user, $pass);

GetOptions ("db=s"    => \$db,
            "host=s"  => \$host,
            "user=s"  => \$user,
            "pass=s"  => \$pass,
    );

die usage() unless defined $host && defined $user && defined $pass;

my $databases;
if( defined $db){
    push @{$databases}, $db;
}
else{
    ## find all variation databases on the host
    $databases = get_dbs_by_host($host, $user, $pass);
} 

foreach my $db_name (@{$databases}){
    
    my $dbh = DBI->connect( "dbi:mysql:$db_name\:$host\:3306", $user, $pass, undef);

    $dbh->do(qq[update variation set evidence_attribs = NULL where evidence_attribs = '';]);
    $dbh->do(qq[update variation_feature set evidence_attribs = NULL where evidence_attribs = '';]);
    
    $dbh->do(qq[create table MTMP_evidence (
              variation_id int(10) , 
              evidence SET('Multiple_observations','Frequency','HapMap','1000Genomes','Cited','ESP','Phenotype_or_Disease'), 
              primary key( variation_id ) ) ])||die;

    
    my $evidence_id = get_evidence_id($dbh);

    
    my $filename = "$db\.dat";
    open my $out, ">$filename"||die "Failed to open $filename to write evidence statuses : $!\n"; 
    <commit_msg>use unique file name per database<commit_after>#!/usr/bin/env perl

## temp script to create a table of evidence values for mart building



use strict;
use warnings;
use DBI;
use Getopt::Long;

my ($db, $host, $user, $pass);

GetOptions ("db=s"    => \$db,
            "host=s"  => \$host,
            "user=s"  => \$user,
            "pass=s"  => \$pass,
    );

die usage() unless defined $host && defined $user && defined $pass;

my $databases;
if( defined $db){
    push @{$databases}, $db;
}
else{
    ## find all variation databases on the host
    $databases = get_dbs_by_host($host, $user, $pass);
} 

foreach my $db_name (@{$databases}){
    
    my $dbh = DBI->connect( "dbi:mysql:$db_name\:$host\:3306", $user, $pass, undef);

    $dbh->do(qq[update variation set evidence_attribs = NULL where evidence_attribs = '';]);
    $dbh->do(qq[update variation_feature set evidence_attribs = NULL where evidence_attribs = '';]);
    
    $dbh->do(qq[create table MTMP_evidence (
              variation_id int(10) , 
              evidence SET('Multiple_observations','Frequency','HapMap','1000Genomes','Cited','ESP','Phenotype_or_Disease'), 
              primary key( variation_id ) ) ])||die;

    
    my $evidence_id = get_evidence_id($dbh);

    
    my $filename = "$db_name\.dat";
    open my $out, ">$filename"||die "Failed to open $filename to write evidence statuses : $!\n"; 
    
{'fraction_non_alphanumeric': 0.16263100831225152, 'fraction_numerical': 0.007228044813877846, 'mean_word_length': 3.156156156156156, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 21, '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': '5508862', 'n_tokens_mistral': 988, 'n_tokens_neox': 925, 'n_words': 245}