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

no warnings ('redefine');

use strict;
use CGI;
use CGI::Ajax;
use CoGe::Accessory::LogUser;
use CoGe::Accessory::Web;
use HTML::Template;
use Text::Wrap qw($columns &wrap);
use Data::Dumper;
use LWP::Simple;
use LWP::Simple::Post qw(post post_xml);
use URI::Escape;
use CoGeX;
use POSIX;
use Digest::MD5 qw(md5_hex);
use Digest::MD5 qw(md5_base64);
use DBIxProfiler;
use File::Temp;
use File::Basename;
use File::Path;
use CoGe::Accessory::blast_report;
use CoGe::Accessory::blastz_report;
use CoGe::Graphics::GenomeView;
use CoGe::Graphics;
use CoGe::Graphics::Chromosome;
use CoGe::Graphics::Feature::HSP;
use Spreadsheet::WriteExcel;
use Benchmark qw(:all);
use Parallel::ForkManager;


use vars qw($P $DBNAME $DBHOST $DBPORT $DBUSER $DBPASS $connstr $PAGE_NAME $TEMPDIR $TEMPURL $DATADIR $FASTADIR $BLASTDBDIR $FORMATDB $BLAST_PROGS $FORM $USER $DATE $coge $cogeweb $RESULTSLIMIT $MAX_PROC $connstr $COOKIE_NAME);

$P = CoGe::Accessory::Web::get_defaults($ENV{HOME}.'coge.conf');
$ENV{PATH} = $P->{COGEDIR};
$ENV{BLASTDB}=$P->{BLASTDB};
$ENV{BLASTMAT}=$P->{BLASTMATRIX};


#refresh again?
$PAGE_NAME = "CoGeBlast.pl";
$TEMPDIR = $P->{TEMPDIR}."CoGeBlast";
mkpath ($TEMPDIR, 0,0777) unless -d $TEMPDIR;
$TEMPURL = $P->{TEMPURL}."CoGeBlast";
$DATADIR = $P->{DATADIR};
$FASTADIR = $P->{FASTADIR};
$BLASTDBDIR = $P->{BLASTDB};
$FORMATDB = $P->{FORMATDB};
$MAX_PROC=$P->{COGE_BLAST_MAX_PROC};
$BLAST_PROGS = {
		blast_legacy => $P->{BLAST}." -a $MAX_PROC",
		tblastn => $P->{TBLASTN}. " -num_threads $MAX_PROC",
		tblastx => $P->{TBLASTX}. " -num_threads $MAX_PROC",
		blastn => $P->{BLASTN}. " -num_threads $MAX_PROC -task blastn",
		dcmega => $P->{BLASTN}. " -num_threads $MAX_PROC -task dc-megablast",
		mega => $P->{BLASTN}. " -num_threads $MAX_PROC -task megablast",
		lastz => $P->{LASTZ},
	       };
$RESULTSLIMIT=100;


$DATE = sprintf( "%04d-%02d-%02d %02d:%02d:%02d",
		sub { ($_[5]+1900, $_[4]+1, $_[3]),$_[2],$_[1],$_[0] }->(localtime));

$FORM = new CGI;
my %ajax = CoGe::Accessory::Web::ajax_func();
$DBNAME = $P->{DBNAME};
$DBHOST = $P->{DBHOST};
$DBPORT = $P->{DBPORT};
$DBUSER = $P->{DBUSER};
$DBPASS = $P->{DBPASS};
$connstr = "dbi:mysql:dbname=".$DBNAME.";host=".$DBHOST.";port=".$DBPORT;
$coge = CoGeX->connect($connstr, $DBUSER, $DBPASS );
#$coge->storage->debugobj(new DBIxProfiler());
#$coge->storage->debug(1);

$COOKIE_NAME = $P->{COOKIE_NAME};

my ($cas_ticket) =$FORM->param('ticket');
$USER = undef;
($USER) = CoGe::Accessory::Web->login_cas(ticket=>$cas_ticket, coge=>$coge, this_url=>$FORM->url()) if($cas_ticket);
($USER) = CoGe::Accessory::LogUser->get_user(cookie_name=>$COOKIE_NAME,coge=>$coge) unless $USER;

my $pj = new CGI::Ajax(
		       gen_html=>\&gen_html,
		       source_search=>\&get_data_source_info_for_accn,
		       get_types=>\&get_types,
		       get_sequence=>\&get_sequence,
		       get_url=>\&get_url,
		       check_seq=>\&check_seq,
		       set_seq=>\&set_seq,
		       blast_param=>\&blast_param,<commit_msg>updated call to login_cas<commit_after>#! /usr/bin/perl -w

no warnings ('redefine');

use strict;
use CGI;
use CGI::Ajax;
use CoGe::Accessory::LogUser;
use CoGe::Accessory::Web;
use HTML::Template;
use Text::Wrap qw($columns &wrap);
use Data::Dumper;
use LWP::Simple;
use LWP::Simple::Post qw(post post_xml);
use URI::Escape;
use CoGeX;
use POSIX;
use Digest::MD5 qw(md5_hex);
use Digest::MD5 qw(md5_base64);
use DBIxProfiler;
use File::Temp;
use File::Basename;
use File::Path;
use CoGe::Accessory::blast_report;
use CoGe::Accessory::blastz_report;
use CoGe::Graphics::GenomeView;
use CoGe::Graphics;
use CoGe::Graphics::Chromosome;
use CoGe::Graphics::Feature::HSP;
use Spreadsheet::WriteExcel;
use Benchmark qw(:all);
use Parallel::ForkManager;


use vars qw($P $DBNAME $DBHOST $DBPORT $DBUSER $DBPASS $connstr $PAGE_NAME $TEMPDIR $TEMPURL $DATADIR $FASTADIR $BLASTDBDIR $FORMATDB $BLAST_PROGS $FORM $USER $DATE $coge $cogeweb $RESULTSLIMIT $MAX_PROC $connstr $COOKIE_NAME);

$P = CoGe::Accessory::Web::get_defaults($ENV{HOME}.'coge.conf');
$ENV{PATH} = $P->{COGEDIR};
$ENV{BLASTDB}=$P->{BLASTDB};
$ENV{BLASTMAT}=$P->{BLASTMATRIX};


#refresh again?
$PAGE_NAME = "CoGeBlast.pl";
$TEMPDIR = $P->{TEMPDIR}."CoGeBlast";
mkpath ($TEMPDIR, 0,0777) unless -d $TEMPDIR;
$TEMPURL = $P->{TEMPURL}."CoGeBlast";
$DATADIR = $P->{DATADIR};
$FASTADIR = $P->{FASTADIR};
$BLASTDBDIR = $P->{BLASTDB};
$FORMATDB = $P->{FORMATDB};
$MAX_PROC=$P->{COGE_BLAST_MAX_PROC};
$BLAST_PROGS = {
		blast_legacy => $P->{BLAST}." -a $MAX_PROC",
		tblastn => $P->{TBLASTN}. " -num_threads $MAX_PROC",
		tblastx => $P->{TBLASTX}. " -num_threads $MAX_PROC",
		blastn => $P->{BLASTN}. " -num_threads $MAX_PROC -task blastn",
		dcmega => $P->{BLASTN}. " -num_threads $MAX_PROC -task dc-megablast",
		mega => $P->{BLASTN}. " -num_threads $MAX_PROC -task megablast",
		lastz => $P->{LASTZ},
	       };
$RESULTSLIMIT=100;


$DATE = sprintf( "%04d-%02d-%02d %02d:%02d:%02d",
		sub { ($_[5]+1900, $_[4]+1, $_[3]),$_[2],$_[1],$_[0] }->(localtime));

$FORM = new CGI;
my %ajax = CoGe::Accessory::Web::ajax_func();
$DBNAME = $P->{DBNAME};
$DBHOST = $P->{DBHOST};
$DBPORT = $P->{DBPORT};
$DBUSER = $P->{DBUSER};
$DBPASS = $P->{DBPASS};
$connstr = "dbi:mysql:dbname=".$DBNAME.";host=".$DBHOST.";port=".$DBPORT;
$coge = CoGeX->connect($connstr, $DBUSER, $DBPASS );
#$coge->storage->debugobj(new DBIxProfiler());
#$coge->storage->debug(1);

$COOKIE_NAME = $P->{COOKIE_NAME};

my ($cas_ticket) =$FORM->param('ticket');
$USER = undef;
($USER) = CoGe::Accessory::Web->login_cas(cookie_name=>$COOKIE_NAME, ticket=>$cas_ticket, coge=>$coge, this_url=>$FORM->url()) if($cas_ticket);
($USER) = CoGe::Accessory::LogUser->get_user(cookie_name=>$COOKIE_NAME,coge=>$coge) unless $USER;

my $pj = new CGI::Ajax(
		       gen_html=>\&gen_html,
		       source_search=>\&get_data_source_info_for_accn,
		       get_types=>\&get_types,
		       get_sequence=>\&get_sequence,
		       get_url=>\&get_url,
		       check_seq=>\&check_seq,
		       set_seq=>\&set_seq,
		       blast_param=>\&blast_param,
{'fraction_non_alphanumeric': 0.2153846153846154, 'fraction_numerical': 0.012572373862696443, 'mean_word_length': 5.785634118967453, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 110, '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': '5784923', 'n_tokens_mistral': 2672, 'n_tokens_neox': 2588, 'n_words': 443}