<commit_before>#! /usr/bin/perl -w

use strict;
use CoGeX;


# 9min 9 sec
my $connstr = 'dbi:mysql:genomes:biocon:3306';
my $s = CoGeX->connect($connstr, 'cnssys', 'CnS' );


$s->storage->debug(0);

my $org = $s->resultset('Dataset')->search(
    { 'organism.name' => {like => "%Poplar%" },
      'version'       => '1.1' 
    },
    { join => 'organism' }
);
my $did = $org->next()->dataset_id;


my $rs = $s->resultset('Feature')->search(
        { 
            'dataset_id' => $did,
#            'feature_names.name' =>  {like => 'P%%CDS'}, 
        },
        {
            join => ['feature_names','feature_type','sequences'],
            prefetch => ['feature_names','feature_type'],
            order_by => ['me.feature_id'],

        }
);

print "result count: " . $rs->count() . "\n";


my %FH;
foreach my $i (1..19){
    my $chr = $i < 10 ? "0". $i : $i;
    print $chr . "\n";
    open($FH{$chr},">/tmp/poplar/poplarchr$chr" . ".fasta");
}


while( my $feature = $rs->next()){
    my $name;
    #my $name = (grep { $_->name =~ /P\d+CDS/ } $feature->feature_names)[0]->name;
    map { print $_->name . "\t" } $feature->feature_names ;
    print "\n";
    next;
    print $name . "\n";
    my $chr = substr($name,1,2);
    my $fh = $FH{$chr};
    print $fh  ">" . $name . "\n";
    print $fh $feature->genome_sequence . "\n\n";
}
<commit_msg>updated poplar script<commit_after>#! /usr/bin/perl -w

use strict;
use CoGeX;


# 9min 9 sec
my $connstr = 'dbi:mysql:genomes:biocon:3306';
my $s = CoGeX->connect($connstr, 'cnssys', 'CnS' );


$s->storage->debug(0);

my $org = $s->resultset('Dataset')->search(
    { 'organism.name' => {like => "%Poplar%" },
      'version'       => '1.1' 
    },
    { join => 'organism' }
);
my $did = $org->next()->dataset_id;


my $rs = $s->resultset('Feature')->search(
        { 
            'dataset_id' => $did,
#            'feature_names.name' =>  {like => 'P%%CDS'}, 
        },
        {
            join => ['feature_names','feature_type','sequences'],
            prefetch => ['feature_names','feature_type'],
            order_by => ['me.feature_id'],

        }
);

print "result count: " . $rs->count() . "\n";

while( my $feature = $rs->next()){
    my $name;
    #my $name = (grep { $_->name =~ /P\d+CDS/ } $feature->feature_names)[0]->name;
    map { print $_->name . "\t" } $feature->feature_names ;
    print "\n";
    next;
#    print $name . "\n";
#    my $chr = substr($name,1,2);
#    my $fh = $FH{$chr};
#    print $fh  ">" . $name . "\n";
#    print $fh $feature->genome_sequence . "\n\n";
}

{'fraction_non_alphanumeric': 0.2381697301525225, 'fraction_numerical': 0.011732499022291749, 'mean_word_length': 2.397078353253652, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 60, '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': '4928755', 'n_tokens_mistral': 1018, 'n_tokens_neox': 979, 'n_words': 196}