new file: cell2loc.py
[GalaxyCodeBases.git] / perl / etc / WoodyMiaoLin / Tiger / generate_input_step2.pl
blobd98626f45b0d14bdc8be1121836fed1aa72a62cc
1 #!/usr/bin/perl
2 use strict;
3 use warnings;
5 open I, "<", "scaffold75_1458SNP.16.gt";
6 open O, ">", "scaffold75_1458.16.inp";
8 my $id = <I>;
9 chomp $id;
10 my @id = split /\t/, $id;
11 my (@pos, @gt);
12 while (<I>) {
13 chomp;
14 my @a = split /\t/;
15 push @pos, $a[1];
16 foreach (2 .. 17) {
17 my @b = split /\//, $a[$_];
18 $gt[$_][0] .= $b[0];
19 $gt[$_][1] .= $b[1];
22 close I;
24 my $num_indi = @id-2;
25 my $num_loci = @pos;
26 print O "$num_indi\n";
27 print O "$num_loci\n";
28 print O (join " ", "P", @pos), "\n";
29 print O ("S" x $num_loci), "\n";
30 foreach (2 .. 17) {
31 print O $id[$_], "\n";
32 print O $gt[$_][0], "\n";
33 print O $gt[$_][1], "\n";
35 close O;