Individual 301 302 303 304
2003 a b c d a b c d a b c d a b c d
2004 a b c d a b c d a b c d a b c d
2005 a b c d a b c d a b c d a b c d
####
Individual 301A 301B 302A 302B 303A 303B 304A 304B
2003 c d c d c d c d
and similary in the other ones as well
####
#!/usr/local/bin/perl
use strict;
use Getopt::Long;
my ($sfile, $lfile, $ofile);
my (@sampleids);
my($loga, $logb, $x, $y)
&GetOptions("sfile=s" =>\$sfile,
);
unless(open SFILE , $sfile ) {die "cannot open small file: $!\n"};
print "Individual\t";
while(){
chomp;
my $line = $_;
my @columns = split(/\n/, $line);
foreach my $col (@columns) {
my @array = split (/\t/, $col);
foreach my $a (@array) {
next if $a =~ /^Individual/;
if ($a =~ /^000\d+/){
print "$a" . "A", "\t", "$a" . "B", "\t";
}
}
print "\n";
foreach my $b (@array) {
next if $b =~ /^Individual/;
next if $b =~ /^000\d+/;
if($b =~ /^\w+/){
#$b =~ s/^\t//;
# $b =~ s/\t$//;
print "$b";
}
}
foreach my $c (@array) {
next if $b =~ /^Individual/;
next if $b =~ /^000\d+/;
next if $b =~ /^\w+/ ;
($loga, $logb, $x, $y) = split (/ /,$c);
#$x =~ s/^\t+//;
#$x =~s/\t$//;
print "$x\t$y\t";
}
}
}