Fixed $PRIOR support and bugfix in shrinkage results handling
[PsN.git] / bin / single_valued_columns
blob32864711cfb51caeba6c73fbd86f1824b3bc712a
1 #!/usr/local/bin/perl
3 use FindBin qw($Bin);
4 use lib "$Bin/../lib";
6 # Don't edit the line below, it must look exactly like this.
7 # Everything above this line will be replaced #
9 use PsN;
10 use data;
11 use strict;
13 use Getopt::Long;
14 use vars qw/ $opt_help /;
15 use vars qw/ $opt_data
16 $opt_idcolumn
17 $opt_subset_name
18 $opt_remainder_name
19 $opt_do_not_test_columns
20 $opt_debug
21 $opt_debug_package
22 $opt_debug_subroutine /;
24 ## Configure the command line parsing
25 Getopt::Long::config("auto_abbrev");
27 ## Declare the options
28 my $res = GetOptions("help", # Display help message
29 "idcolumn:i",
30 "data:s",
31 "subset_name:s",
32 "remainder_name:s",
33 "do_not_test_columns:s",
34 "directory:s",
35 "debug:0",
36 "debug_package:s",
37 "debug_subroutine:s" );
39 exit unless $res;
41 if($opt_help or not defined $opt_data) {
42 print <<'ENDHELP';
44 single_valued_columns
46 Perl script for identification of columns which contain only one
47 value per individual. Creates two new data files: one containing the
48 columns that are single valued and one containing the rest.
50 Usage:
52 single_valued_columns -data=filename
53 [-idcolumn=column_number]
54 [-subset_name=single_value_filename]
55 [-remainder_name=remaining_data_filename]
56 [-do_not_test_columns='2,3,5..7']
58 Example:
60 perl single_valued_columns -data=pheno.dta -idc=1 -sub=mysub.dta -rem=myrem.dta -do_not='2,3'
62 ENDHELP
64 exit;
67 ## Check that we do have a data file
68 unless ( $opt_data ) {
69 die "A data file must be specified\n";
70 return;
73 ui -> category( 'data' );
75 debug -> level( $opt_debug );
76 debug -> package( $opt_debug_package );
77 debug -> subroutine( $opt_debug_subroutine );
79 my @dont_test = split(',',$opt_do_not_test_columns);
81 my $data = data -> new ( filename => $opt_data,
82 idcolumn => $opt_idcolumn );
84 $data -> single_valued_data ( subset_name => $opt_subset_name,
85 remainder_name => $opt_remainder_name,
86 do_not_test_columns => \@dont_test,
87 target => 'disk' );