6 die "perl $0 <chrlen file><input file><out file><chr><width><proportion>\n";
9 open IN
,"$ARGV[0]" or die "The chrlen file can't open:$!\n";
14 if($temp[0]=~/$ARGV[3]/i)
20 open CIN
,"$ARGV[1]" or die "The input file can't open:$!\n";
23 while ($temp =~ /^#/) {
27 #chomp(my $temp=<CIN>);
29 my @name=split /\s+/,$temp;
32 #print "@name\n$samnum\n";
35 my $width=$chrlen/$ARGV[5]+$side*3;
36 my $height=$samnum*$ARGV[4]+200;
37 my $svg=SVG
->new('width',$width,'height',$height);
38 $svg->rect('x',0,'y',0,'width',$width,'height',$height,'stroke','white','fill','white');
40 my %ReFormatGT=(0=>1, 1=>2, 0.5=>3,'NA'=>0, 'N'=>-1);
41 my %FormatGT=(1=>0, 2=>1, 3=>0.5, 0=>'NA', -1=>'N');
42 #my @color=("#2A2F7F","#68BE4A","#8C63A4","#B6292B","#FCDAD5");
50 #my @label=("9311","pair64","no_decide","het","no_cov");
51 my @Label=( [1,'9311'],[2,'PA64'],[3,'Hete'],[0,'N/A'],[-1,'N Zone'] );
56 $svg->line('x1',$side,'y1',$side/2+$ARGV[4]*$i*2,'x2',$side+20,'y2',$side/2+$ARGV[4]*$i*2,'stroke',$Color{$id},'stroke-width',$ARGV[4]);
57 $svg->text('x',$side+25,'y',$side/2+$ARGV[4]*$i*2+3,'font-family','Arial','stroke-width',0.3,'font-size',12,'-cdata',$label);
61 $svg->line('x1',$side,'y1',$side,'x2',$side,'y2',$height-100,'stroke','black','stroke-width',1);
62 foreach(1..int(($height-200)/($ARGV[4]*20)))
64 $svg->line('x1',$side,'y1',$height-100-20*$_*$ARGV[4],'x2',$side-5,'y2',$height-100-20*$_*$ARGV[4],'stroke','black','stroke-width',0.7);
65 $svg->text('x',$side-30,'y',$height-100-20*$_*$ARGV[4]+5,'font-family','Arial','stroke-width',0.3,'font-size',14,'-cdata',20*$_);
67 my $sit=($height-200)/2+100+30;
68 $svg->text('x',50,'y',$sit,'font-family','Arial','stroke-width',0.5,'font-size',16,'-cdata','Individuals','transform',"rotate(270,50,$sit)");
70 $svg->line('x1',$side,'y1',$height-100,'x2',$width-$side*2,'y2',$height-100,'stroke','black','stroke-width',1);
71 my $par=int($chrlen/5000000);
72 my $len=int($chrlen/($ARGV[5]*$par));
75 $svg->line('x1',$side+$_*$len,'y1',$height-100,'x2',$side+$_*$len,'y2',$height-100+5,'stroke','black','stroke-width',0.7);
76 $svg->text('x',$side+$_*$len-5,'y',$height-100+20,'font-family','Arial','stroke-width',0.3,'font-size',14,'-cdata',5*$_);
78 $svg->text('x',($width-$side*3)/2+$side,'y',$height-100+50,'font-family','Arial','stroke-width',0.5,'font-size',16,'-cdata','Position(Mb)');
80 $svg->line('x1',$width-200,'y1',$side,'x2',$width-200,'y2',$height-100,'stroke','black','stroke-width',1);
82 foreach my $sam(1..$samnum)
84 $svg->line('x1',$width-2*$side,'y1',$height-$side-$ARGV[4]*$sam+$ARGV[4]/2,'x2',$width-2*$side+$ARGV[4]*4,'y2',$height-$side-$ARGV[4]*$sam-$ARGV[4]*2,'stroke','black','stroke-width',0.7);
87 $svg->line('x1',$width-2*$side+$ARGV[4]*4,'y1',$height-$side-$ARGV[4]*$sam-$ARGV[4]*2,'x2',$width-2*$side+$ARGV[4]*14,'y2',$height-$side-$ARGV[4]*$sam-$ARGV[4]*2,'stroke','black','stroke-width',0.7);
88 $svg->text('x',$width-2*$side+$ARGV[4]*15,'y',$height-$side-$ARGV[4]*$sam-$ARGV[4]*2+$ARGV[4]/2+2,'font-family','Arial','stroke-width',0.5,'font-size',10,'-cdata',$name[$sam-1]);
92 $svg->line('x1',$width-2*$side+$ARGV[4]*4,'y1',$height-$side-$ARGV[4]*$sam-$ARGV[4]*2,'x2',$width-2*$side+$ARGV[4]*6,'y2',$height-$side-$ARGV[4]*$sam-$ARGV[4]*2,'stroke','black','stroke-width',0.7);
93 $svg->text('x',$width-2*$side+$ARGV[4]*6,'y',$height-$side-$ARGV[4]*$sam-$ARGV[4]*2+$ARGV[4]/2+2,'font-family','Arial','stroke-width',0.5,'font-size',10,'-cdata',$name[$sam-1]);
97 $svg->line('x1',$side,'y1',$side,'x2',$width-200,'y2',$side,'stroke','black','stroke-width',1);
99 #chomp(my $line=<CIN>);
100 #my @last=split /\s+/,$line;
101 #my @color=("#2A2F7F","#00A06B");
114 foreach my $sam(1..$samnum)
120 foreach my $sam(1..$samnum)
122 if($last[$sam] ne $now[$sam])
125 my $x1=$side+$start[$sam]/$ARGV[5];
126 my $y1=$height-$side-$ARGV[4]*$sam+$ARGV[4]/2;
127 my $x2=$now[0]/$ARGV[5]+$side;
129 my $colr=$Color{$ReFormatGT{$n}};
130 # print "$x1\t$y1\n";
145 $svg->line('x1',$x1,'y1',$y1,'x2',$x2,'y2',$y2,'stroke',$colr,'stroke-width',$ARGV[4]);# unless $n =~ /^N/;
146 $last[$sam]=$now[$sam];
147 $start[$sam]=$now[0];
155 foreach my $sam(1..$samnum)
157 if($last[$sam] eq $new[$sam])
160 my $x1=$side+$start[$sam]/$ARGV[5];
161 my $y1=$height-$side-$ARGV[4]*$sam+$ARGV[4]/2;
162 my $x2=$new[0]/$ARGV[5]+$side;
164 # print "$x1\t$y1\n";
165 my $colr=$Color{$ReFormatGT{$n}};
166 $svg->line('x1',$x1,'y1',$y1,'x2',$x2,'y2',$y2,'stroke',$colr,'stroke-width',$ARGV[4]);# unless $n =~ /^N/;
170 open(OUT
,">$ARGV[2]")or die;
171 print OUT
$svg->xmlify();
175 /nas/RD_09C
/resequencing/user
/zhangxm/soft
/zijiao/new_selfing
.pl
176 perl
/nas/RD_09C
/resequencing/user
/zhangxm/soft
/zijiao/new_selfing
.pl
/nas/RD_09C
/resequencing/Genome
/Rice/Genome_9311
/chr.nfo /panf
s/POPULATION/PROJECT/Rice_RIL
/chongqiong_RIL/data
/Chr01.out.new /panf
s/POPULATION/PROJECT/Rice_RIL
/chongqiong_RIL/pic/Chr01
.out
.new
.svg Chr01
5 40000
177 cat
../9311/chrorder
|while read a
; do ./plot.pl ../9311/chr.nfo ril
.$a.rgt ril
.$a.r
.svg
$a 6 40000; done
178 find
. -name
'*.?1.svg'|perl
-lane
'$a=$_;s/\.svg$/\.png/;system "convert $a $_"'