modified: Makefile
[GalaxyCodeBases.git] / perl / etc / WoodyMiaoLin / Tiger / generate_input_step1.pl
blob03362eef323e5f3e199be60e5bcf22bae699a505
1 #!/usr/bin/perl
2 use strict;
3 use warnings;
5 open I1, "<", "scaffold75SNP.18.gt";
6 open I2, "<", "scaffold1458SNP.18.gt";
7 open O, ">", "scaffold75_1458SNP.16.gt";
9 print O "#Scaffold\tPosition\tJHH001\tGZXJ03\tGZXJ05\tGZXJ26\tGZXJ27\tGZXJ28\tGZXJ29\tGZXJ30\tGZXJ33\tBHX011\tBHX019\tGZXJ04\tGZXJ06\tGZXJ31\tGZXJ32\tGZXJ38\n";
11 while (<I1>) {
12 chomp;
13 my @a = split /\t/;
14 foreach (4 .. 21) {
15 my @b = split /\//, $a[$_];
16 $a[$_] = "$a[2]/$a[2]" if (($b[0] eq 0) and ($b[1] eq 0));
17 $a[$_] = "$a[3]/$a[3]" if (($b[0] eq 1) and ($b[1] eq 1));
18 $a[$_] = "$a[2]/$a[3]" if (($b[0] eq 0) and ($b[1] eq 1));
19 $a[$_] = "$a[3]/$a[2]" if (($b[0] eq 1) and ($b[1] eq 0));
21 splice @a, -3, 2;
22 splice @a, 2, 2;
23 print O (join "\t", @a), "\n";
26 while (<I2>) {
27 chomp;
28 my @a = split /\t/;
29 $a[1] += 5658748;
30 foreach (4 .. 21) {
31 my @b = split /\//, $a[$_];
32 $a[$_] = "$a[2]/$a[2]" if (($b[0] eq 0) and ($b[1] eq 0));
33 $a[$_] = "$a[3]/$a[3]" if (($b[0] eq 1) and ($b[1] eq 1));
34 $a[$_] = "$a[2]/$a[3]" if (($b[0] eq 0) and ($b[1] eq 1));
35 $a[$_] = "$a[3]/$a[2]" if (($b[0] eq 1) and ($b[1] eq 0));
37 splice @a, -3, 2;
38 splice @a, 2, 2;
39 print O (join "\t", @a), "\n";
42 close I1;
43 close I2;
44 close O;