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

use strict;
use warnings;

=head1 NAME

cell_type_tree.pl v1.0 - Build a cell type tree.

=head1 SYNOPSIS

cell_type_tree

 Basic Options:
  -h --help Get full man page output
  -v --verbose Verbose output with details of mutations
  -d --debug Debug output

=head1 DESCRIPTION

This program is part of the TraP Project suite.

=head1 OPTIONS

=over 8

=item B<-h, --help>

Print this brief help message from the command line.

=item B<-d, --debug>

Print debug output showing how the text is being mutated with thesaurus usage.

=item B<-v, --verbose>

Verbose output showing how the text is changing.

=back

=head1 EXAMPLES

To get some help output do:

skeleton --help

=head1 AUTHOR

B<<NAME>> - I<<EMAIL>>

B<<NAME>> - I<<EMAIL>>

B<<NAME>> - I<<EMAIL>>

=head1 NOTICE

=over 4

=item B<<NAME>> (2011) First features added.

=item B<<NAME>> (2011) First features added.

=item B<<NAME>> (2011) First features added.

=back

=head1 LICENSE AND COPYRIGHT

B<Copyright 2011 <NAME>, <NAME>, <NAME>>

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

=cut

#By default use the TraP libraries, assuming executing from the bin dir
use lib qw'../lib';

=head1 DEPENDANCY

TraP dependancies:

=over 4

=item B<TraP::SQL::TissueMRCA> Used to perform SQL queries.

=back

CPAN dependancies:

=over 4

=item B<Getopt::Long> Used to parse command line options.

=item B<Pod::Usage> Used for usage and help output.

=item B<Data::Dumper> Used for debug output.

=back

=cut

use Getopt::Long; #Deal with command line options
use Pod::Usage;   #Print a usage man page from the POD comments
use Data::Dumper; #Allow easy print dumps of datastructures for debugging

use TraP::SQL::TissueMRCA qw/:all/;

# Command Line Options
#-------------------------------------------------------------------------------
my $verbose; #Flag for verbose output from command line opts
my $debug;   #As above for debug
my $help;    #Same again but this time should we output the POD man page defined after __END__

#Set command line flags and parameters.
GetOptions("verbose|v!"  => \$verbose,
           "debug|d!"  => \$debug,
           "help|h!" => \$help,
        ) or die "Fatal Error: Problem parsing command-line ".$!;

#Get other command line arguments that weren't optional flags.
#my @files= @ARGV;

#Print out some help if it was asked for or if no arguments were given.
pod2usage(-exitstatus => 0, -verbose => 2) if $help;

=head1 FUNCTIONS DEFINED

=over 4

=cut

# Main Script Content
#-------------------------------------------------------------------------------

my %experiment_genomes;
my %experiment_ncbi;
my %experiment_sfs;
foreach my $experiment (@{human_cell_type_experiments()}) {
	print "running $experiment...\n";
	$experiment_sfs{$experiment} = experiment_sfs($experiment);
	print "got superfamilies\n";
}
	my $source_id = 1;
	my $supfams = all_sfs($source_id);
	my $sf_genomes = sf_genomes($supfams);
	print "got genomes\n";
	my ($taxon_id,$name,$rank) = calculate_MRCA_NCBI_placement($sf_genomes);
	$experiment_ncbi{$experiment}{'taxon_id'} = $taxon_id;
	$experiment_ncbi{$experiment}{'name'} = $name;
	$experiment_ncbi{$experiment}{'rank'} = $rank;
	print "got ncbi details\n";

open(GENOMES,'>../../data/genomes.txt');
print GENOMES Dumper(\%experiment_genomes);
open(NCBI,'>../../data/ncbi.txt');
print NCBI Dumper(\%experiment_ncbi);

=pod

=back<commit_msg>debugged scripts, ready for adams tree stuff to get added<commit_after>#!/usr/bin/env perl

use strict;
use warnings;

=head1 NAME

cell_type_tree.pl v1.0 - Build a cell type tree.

=head1 SYNOPSIS

cell_type_tree

 Basic Options:
  -h --help Get full man page output
  -v --verbose Verbose output with details of mutations
  -d --debug Debug output

=head1 DESCRIPTION

This program is part of the TraP Project suite.

=head1 OPTIONS

=over 8

=item B<-h, --help>

Print this brief help message from the command line.

=item B<-d, --debug>

Print debug output showing how the text is being mutated with thesaurus usage.

=item B<-v, --verbose>

Verbose output showing how the text is changing.

=back

=head1 EXAMPLES

To get some help output do:

skeleton --help

=head1 AUTHOR

B<<NAME>> - I<<EMAIL>>

B<<NAME>> - I<<EMAIL>>

B<<NAME>> - I<<EMAIL>>

=head1 NOTICE

=over 4

=item B<<NAME>> (2011) First features added.

=item B<<NAME>> (2011) First features added.

=item B<<NAME>> (2011) First features added.

=back

=head1 LICENSE AND COPYRIGHT

B<Copyright 2011 <NAME>, <NAME>, <NAME>>

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

=cut

#By default use the TraP libraries, assuming executing from the bin dir
use lib qw'../lib';

=head1 DEPENDANCY

TraP dependancies:

=over 4

=item B<TraP::SQL::TissueMRCA> Used to perform SQL queries.

=back

CPAN dependancies:

=over 4

=item B<Getopt::Long> Used to parse command line options.

=item B<Pod::Usage> Used for usage and help output.

=item B<Data::Dumper> Used for debug output.

=back

=cut

use Getopt::Long; #Deal with command line options
use Pod::Usage;   #Print a usage man page from the POD comments
use Data::Dumper; #Allow easy print dumps of datastructures for debugging

use TraP::SQL::TissueMRCA qw/:all/;

# Command Line Options
#-------------------------------------------------------------------------------
my $verbose; #Flag for verbose output from command line opts
my $debug;   #As above for debug
my $help;    #Same again but this time should we output the POD man page defined after __END__

#Set command line flags and parameters.
GetOptions("verbose|v!"  => \$verbose,
           "debug|d!"  => \$debug,
           "help|h!" => \$help,
        ) or die "Fatal Error: Problem parsing command-line ".$!;

#Get other command line arguments that weren't optional flags.
#my @files= @ARGV;

#Print out some help if it was asked for or if no arguments were given.
pod2usage(-exitstatus => 0, -verbose => 2) if $help;

=head1 FUNCTIONS DEFINED

=over 4

=cut

# Main Script Content
#-------------------------------------------------------------------------------

my %experiment_genomes;
my %experiment_ncbi;
my %experiment_sfs;
foreach my $experiment (@{human_cell_type_experiments()}) {
	print "running $experiment...\n";
	$experiment_sfs{$experiment} = experiment_sfs($experiment);
	print "got superfamilies\n";
}
	print "now getting all sfs\n";
	my $source_id = 1;
	my $supfams = all_sfs($source_id);
	print "now genomes for each sf\n";
	
	my $sf_genomes = sf_genomes($supfams);
	print "got genomes\n";
	#my ($taxon_id,$name,$rank) = calculate_MRCA_NCBI_placement($sf_genomes);
	print "got ncbi details\n";

#open(GENOMES,'>../../data/genomes.txt');
#print GENOMES Dumper(\%experiment_genomes);
#open(NCBI,'>../../data/ncbi.txt');
#print NCBI Dumper(\%experiment_ncbi);

=pod

=back
{'fraction_non_alphanumeric': 0.1512245691330828, 'fraction_numerical': 0.010625890890242322, 'mean_word_length': 3.448414985590778, 'pattern_counts': {'":': 0, '<': 61, '<?xml version=': 0, '>': 75, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '3670528', 'n_tokens_mistral': 2573, 'n_tokens_neox': 2443, 'n_words': 935}