-
Notifications
You must be signed in to change notification settings - Fork 4
/
23andme_to_gen.pl
executable file
·63 lines (51 loc) · 1.7 KB
/
23andme_to_gen.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/usr/bin/perl -w
#
# Wrapper script to allow format conversion without performing full imputation
#
use strict;
use warnings;
use Getopt::Long;
# Allow status updates without a newline
use IO::Handle;
STDOUT->autoflush(1);
use twentythree;
my $help_message = <<END;
Usage: 23andme_to_gen.pl -i <input_file> -o <output_prefix> -s <sex>
Converts the raw data output from 23 and me to .gen files for each
chromosome
-i, --input The 'raw data' file from 23 and me, which has four tab
separated columns: rsid, chromosome, position, genotype
-o, --output The prefix for the output .gen files (default is the
input name)
-s, --sex The sex of the subject, either male (m) or female (f). If
omitted a guess will be made based on presence of Y
chromosome sites
-h, --help Displays this help message
END
#****************************************************************************************#
#* Main *#
#****************************************************************************************#
#* Gets input parameters
my ($input_file, $output_prefix, $sex, $help);
GetOptions ("input|i=s" => \$input_file,
"output|o=s" => \$output_prefix,
"sex|s=s" => \$sex,
"help|h" => \$help
) or die($help_message);
# Check necessary files exist
if (defined($help))
{
print $help_message;
}
elsif (!defined($input_file))
{
print ("Input file does not exist!\n\n");
print $help_message;
}
else
{
#Convert
my $sex = twentythree::format_convert($input_file, $output_prefix, $sex);
}
print "Done.\n";
exit(0);