4 load_sequence_metadata_protocol.pl - create a new sequence metadata protocol
7 This script uses the CXGN::Genotype::SequenceMetadata package to create a new
8 Sequence Metadata Protocol in the nd_protocol table and store its sequence
9 metadata protocol props in the nd_protocolprop table.
11 =head1 COMMAND-LINE OPTIONS
13 -H host name (required) e.g. "localhost"
14 -D database name (required) e.g. "cxgn_cassava"
15 -U database username (required)
16 -P database password (optional, default=prompt user for password)
17 -t Sequence Metadata Type ID, cvterm_id of term from 'sequence_metadata_types' CV (required)
18 -n protocol name (required)
19 -d protocol description (required)
20 -r reference genome name (required)
21 -s score description (optional)
22 -a attribute names and descriptions (optional)
23 Example: "ID=marker name,Locus=gene name,pvalue=p value"
24 -l external link definitions (optional)
25 Example: "JBrowse=https://wheat.pw.usda.gov/jb/?data=/ggds/whe-iwgsc2018&loc={{Locus}},Knetminer=https://knetminer.rothamsted.ac.uk/wheatknet/genepage?keyword={{Trait}}&list={{Locus}}"
28 David Waring <djw64@cornell.edu>
37 use Bio
::Chado
::Schema
;
38 use CXGN
::Genotype
::SequenceMetadata
;
42 our ($opt_H, $opt_D, $opt_U, $opt_P, $opt_t, $opt_n, $opt_d, $opt_r, $opt_s, $opt_a, $opt_l);
43 getopts
('H:D:U:P:t:n:d:r:s:a:l:');
46 # Check for required arguments
47 if ( !$opt_H || !$opt_U || !$opt_D ) {
48 die "ERROR: Database options -H, -D, and -U are required!\n";
51 die "ERROR: Sequence Metadata Type is required!\n";
54 die "ERROR: Sequence Metadata Protocol name is required!\n";
57 die "ERROR: Sequence Metadata Protocol description is required!\n";
60 die "ERROR: Reference genome name is required!\n";
67 print "Password for $opt_H / $opt_D: \n";
72 print STDERR
"Connecting to database...\n";
73 my $dsn = 'dbi:Pg:database='.$opt_D.";host=".$opt_H.";port=5432";
74 my $schema = Bio
::Chado
::Schema
->connect($dsn, $opt_U, $pass);
79 if ( defined $opt_a && $opt_a ne '' ) {
80 my @as = split(',', $opt_a);
82 my @vs = split('=', $a);
91 if ( defined $opt_l && $opt_l ne '' ) {
92 my @ls = split(',', $opt_l);
94 my @vs = split('=', $l);
102 my $smd = CXGN
::Genotype
::SequenceMetadata
->new(bcs_schema
=> $schema, type_id
=> $opt_t);
104 protocol_name
=> $opt_n,
105 protocol_description
=> $opt_d,
106 reference_genome
=> $opt_r,
107 score_description
=> $opt_s,
108 attributes
=> \
%attributes,
111 my $results = $smd->create_protocol(\
%args);
113 print STDERR
"Results:\n";
114 print STDERR Dumper
$results;