<commit_before>#!/usr/bin/perl

# basic script to load maps


# copy and edit this file as necessary
# common changes include the following:
# specified linkage groups
# different column headings
# "pos" field versus separate "chromosome" and "position" fields

=head1 NAME

load_map_data.pl - a script to load maps into the SGN database.

=head1 DESCRIPTION

usage: load_map_data -H dbhost -D dbname [-r] [-n "map name"] [-i map_id] <map file>

example: load_map_data.pl -H devel -D sandbox -r -i 9 map-file.csv

Options:

=over 5

=item -H

The hostname of the server hosting the database.

=item -D

the name of the database

=item -r

(optional) if present, rollback after the script terminates. Database should not be affected. Good for test runs.

=item -i

(optional) the map_id. If not present, will insert a brand new map (confirm dialog).

=item -v 

add data to map version provided. Conflicts with -i and -n.

=item -n

required if -i is not used. Provides the map name.

=item -f

force to 'unknown' protocol type if no protocol is provided.

=back

The tab-delimited map file has the following columns:

 MARKER
 CONFIDENCE
 LINKAGE_GROUP
 POSITION (must be a float! 0.0 )
 PROTOCOL


=head1 AUTHORS

<NAME>, <NAME>, <NAME>, <NAME> (among others).

Current maintainer: <NAME>/<NAME>.

=cut

use strict;

use Getopt::Std;
use CXGN::Tools::List qw | str_in |;
use CXGN::Tools::File::Spreadsheet;
use CXGN::Tools::Text;
use CXGN::Marker::Modifiable;
use CXGN::Marker::Tools;
use CXGN::Marker::Location;
use CXGN::Map::Version;
use CXGN::DB::Connection;
use CXGN::DB::InsertDBH;
use Data::Dumper;


our ($opt_H, $opt_D, $opt_i, $opt_r, $opt_n, $opt_f, $opt_v);

getopts('H:D:i:rn:fv:');

my $map_id;
my $map_file;
# specify linkage groups
# example: my $linkage_groups = ['1','2','3','4','5'];
my $linkage_groups = [ qw | 1 2 3 4 5 6 7 8 9 10 11 12 | ];
<commit_msg>add an option for specifying names/count of linkage groups.<commit_after>#!/usr/bin/perl

# basic script to load maps


# copy and edit this file as necessary
# common changes include the following:
# specified linkage groups
# different column headings
# "pos" field versus separate "chromosome" and "position" fields

=head1 NAME

load_map_data.pl - a script to load maps into the SGN database.

=head1 DESCRIPTION

usage: load_map_data -H dbhost -D dbname [-r] [-n "map name"] [-i map_id] <map file>

example: load_map_data.pl -H devel -D sandbox -r -i 9 map-file.csv

Options:

=over 5

=item -H

The hostname of the server hosting the database.

=item -D

the name of the database

=item -r

(optional) if present, rollback after the script terminates. Database should not be affected. Good for test runs.

=item -i

(optional) the map_id. If not present, will insert a brand new map (confirm dialog).

=item -v 

add data to map version provided. Conflicts with -i and -n.

=item -n

required if -i is not used. Provides the map name.

=item -l

specify name of linkage groups as a comma separated list:
1,2,3,4,5,6,7,8,9,10,11,12
default is names from one to twelve. 

=item -f

force to 'unknown' protocol type if no protocol is provided.

=back

The tab-delimited map file has the following columns:

 MARKER
 CONFIDENCE
 LINKAGE_GROUP
 POSITION (must be a float! 0.0 )
 PROTOCOL


=head1 AUTHORS

<NAME>, <NAME>, <NAME>, <NAME> (among others).

Current maintainer: <NAME>/<NAME>.

=cut

use strict;

use Getopt::Std;
use CXGN::Tools::List qw | str_in |;
use CXGN::Tools::File::Spreadsheet;
use CXGN::Tools::Text;
use CXGN::Marker::Modifiable;
use CXGN::Marker::Tools;
use CXGN::Marker::Location;
use CXGN::Map::Version;
use CXGN::DB::Connection;
use CXGN::DB::InsertDBH;
use Data::Dumper;


our ($opt_H, $opt_D, $opt_i, $opt_r, $opt_n, $opt_f, $opt_v, $opt_l);

getopts('H:D:i:rn:fv:l:');

my $map_id;
my $map_file;
# specify linkage groups
# example: my $linkage_groups = ['1','2','3','4','5'];

my $linkage_groups;
if ($opt_l) { 
    $linkage_groups = [ split /\s*\,\s*/, $opt_l ];
}
else {
    $linkage_groups = [ qw | 1 2 3 4 5 6 7 8 9 10 11 12 | ];
}

{'fraction_non_alphanumeric': 0.1271647699158832, 'fraction_numerical': 0.01707075705096487, 'mean_word_length': 4.137229987293519, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3583178', 'n_tokens_mistral': 1553, 'n_tokens_neox': 1450, 'n_words': 545}