-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathPlink2NAToRA.pl
49 lines (41 loc) · 1.16 KB
/
Plink2NAToRA.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
use strict;
use Getopt::Long;
use Data::Dumper;
my ($help, $input, $output, $help, $kinship);
my (@split);
GetOptions (
"help!"=>\$help,
"input=s"=>\$input,
"output=s"=>\$output,
)or die(apresentaAjuda());
if($help or $input eq "" or $output eq ""){
apresentaAjuda();
}
open(IF, $input) or die("Erro: $input não encontrado");
open(OF, ">$output");
my $cabecalho=1;
while(<IF>){
if($cabecalho==0){
@split=split(/\s+/,$_);
# print Dumper @split;
# <STDIN>;
$kinship=(@split[8]/4)+(@split[9]/2);
print OF @split[2]."\t".@split[4]."\t".$kinship."\n";
}else{
$cabecalho=0;
}
}
sub apresentaAjuda(){
print "\n";
print "=========================================================================================\n";
print "** **\n";
print "** **\n";
print "** Opcoes: **\n";
print "** **\n";
print "** -input <Nome do arquivo> Arquivo com o resultado do .genome **\n";
print "** **\n";
print "** -output <Nome do arquivo> Nome do arquivo de saída **\n";
print "** **\n";
print "=========================================================================================\n";
die("\n");
}