<commit_before>#!/usr/bin/perl

# translates data from ensembl database to intermine items XML file

BEGIN {
    push (@INC, ($0 =~ m:(.*)/.*:)[0] . '/../../../intermine/perl/lib');    
}

use strict;
use warnings;
use Switch;

use XML::Writer;
use InterMine::Item;
use InterMine::ItemFactory;
use InterMine::Model;
use Bio::EnsEMBL::DBSQL::DBAdaptor;
use InterMine::Util qw(get_property_value);
use IO qw(Handle File);
use Cwd;
use Digest::MD5 qw(md5);

if (@ARGV != 3) {
  die "usage: mine_name taxon_ids data_destination \n eg. flymine 9606 /shared/data/ensembl/current\n";  
}

my ($mine_name, $taxon_ids, $data_destination) = @ARGV;

my $start_time = time();

my $model_file = "../../../$mine_name/dbmodel/build/main/genomic_model.xml";
my $model = new InterMine::Model(file => $model_file);
my $item_factory = new InterMine::ItemFactory(model => $model);

my $datasource = 'Ensembl';
my @items = (); 
my %organisms = parse_orgs($taxon_ids);
my $datasource_item = make_item("DataSource");
$datasource_item->set('name', $datasource);
my $org_item;
my $dataset_item;

my $config_file = '../../sources/ensembl/resources/ensembl_config.properties';
parse_config(read_file($config_file));

my $properties_file = "$ENV{HOME}/.intermine/$mine_name.properties";

foreach my $taxon_id(keys %organisms) {
    
    my %proteins = ();
    my %exons = ();
    my %sequences = ();

    $org_item = make_item("Organism");
    $org_item->set("taxonId", $taxon_id);

    $dataset_item = make_item("DataSet");
    $dataset_item->set('title', "$datasource data set for taxon id: $taxon_id");

    my %chromosomes = ();
    my $chromosomes_string = $organisms{$taxon_id};

    if ($chromosomes_string) {
        %chromosomes = parse_chromosomes($chromosomes_string);
    }

    my $host = get_property_value("db.ensembl.$taxon_id.core.datasource.serverName", $properties_file);<commit_msg>fix file location<commit_after>#!/usr/bin/perl

# translates data from ensembl database to intermine items XML file

BEGIN {
    push (@INC, ($0 =~ m:(.*)/.*:)[0] . '/../../intermine/perl/lib');    
}

use strict;
use warnings;
use Switch;

use XML::Writer;
use InterMine::Item;
use InterMine::ItemFactory;
use InterMine::Model;
use Bio::EnsEMBL::DBSQL::DBAdaptor;
use InterMine::Util qw(get_property_value);
use IO qw(Handle File);
use Cwd;
use Digest::MD5 qw(md5);

if (@ARGV != 3) {
  die "usage: mine_name taxon_ids data_destination \n eg. flymine 9606 /shared/data/ensembl/current\n";  
}

my ($mine_name, $taxon_ids, $data_destination) = @ARGV;

my $start_time = time();

my $model_file = "../../$mine_name/dbmodel/build/main/genomic_model.xml";
my $model = new InterMine::Model(file => $model_file);
my $item_factory = new InterMine::ItemFactory(model => $model);

my $datasource = 'Ensembl';
my @items = (); 
my %organisms = parse_orgs($taxon_ids);
my $datasource_item = make_item("DataSource");
$datasource_item->set('name', $datasource);
my $org_item;
my $dataset_item;

my $config_file = '../sources/ensembl/resources/ensembl_config.properties';
parse_config(read_file($config_file));

my $properties_file = "$ENV{HOME}/.intermine/$mine_name.properties";

foreach my $taxon_id(keys %organisms) {
    
    my %proteins = ();
    my %exons = ();
    my %sequences = ();

    $org_item = make_item("Organism");
    $org_item->set("taxonId", $taxon_id);

    $dataset_item = make_item("DataSet");
    $dataset_item->set('title', "$datasource data set for taxon id: $taxon_id");

    my %chromosomes = ();
    my $chromosomes_string = $organisms{$taxon_id};

    if ($chromosomes_string) {
        %chromosomes = parse_chromosomes($chromosomes_string);
    }

    my $host = get_property_value("db.ensembl.$taxon_id.core.datasource.serverName", $properties_file);
{'fraction_non_alphanumeric': 0.17018434410900346, 'fraction_numerical': 0.004808976756612343, 'mean_word_length': 4.724770642201835, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '3187319', 'n_tokens_mistral': 1409, 'n_tokens_neox': 1337, 'n_words': 281}