介绍:使用基因区域的SNP,绘制不同群体中基因的haplotypes
输入文件格式:
Index R210 R077 R207 R204 R005 R038 R208 18Q0087 R205 R206 R065 R217 R216 R068 18Q0164 R089 R081 R153 18Q0050
ICF32654 CC CC CC CC NA NA CC CC CC CC NA CC CC CC CC CG CC CC
ICF29002 GG GG GG GG GG GG GG GG GG GG GG GG GG GG GG GG GG GG
ICF28260 GG GG GG GG GG NA GG GG GG GG GG GG GG GG GG GG GG GG
DCF15177 CC CC CC CC CC CC CC CC CC CC CC CC CC CG CC CC CC CC
DCF16046 CC CC CC CC CC CG CC CG CC CC CC CC CC CC CC CC CC CC
ICF48804 GG GG GG GG GG GG GG GG GG GG GG CG GG GG GG GG GG GG
DCF2829 CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC
DCF3113 CC CC CC CC NA NA CC CC CC NA CC CC CC CC CC CC CC CC CC
DCF37409 GG GG GG GG CC NA CC CC GG CC CC GG CG CC CC CC CC CC
DCF23525 CC CC CC CG NA CC CC CC CC CC CC CC CC CC CC CC CC CC
ICF49621 GG GG GG GG GG CG GG GG GG GG GG CG GG GG GG GG GG GG
脚本:plot_haplotypes.pl
#!/usr/bin/perl -w
use strict;
use SVG;
my $in0 = $ARGV[0]; ##- pos genotype
my $out = $ARGV[1];
my $width = 575;
my $height = 300;
my $svg = SVG->new(width => $width, height => $height);
my $xstart = 30;
my $ystart = 20;
my @color = ("#d9d6c3", "#fe4365", "#014d67", "#563624"); ##- NA:CC:GG:CG
my $high = 5;
my $widLen = 1;
$svg -> rect(x => $xstart+480, y => 10, width => $widLen, height => $high, stroke => '#dbcfca', fill => $color[0], 'stroke-opacity' => 1, 'fill-opacity' => 1, 'stroke-width' => 0.1);
$svg -> text(x => $xstart+480, y => 7, 'font-family' => 'Arial', 'font-size' => 5, 'font-weight' => 'normal', stroke => 'black', 'stroke-width' => 0.2, 'text-anchor' => 'middle', -cdata => "NA");
$svg -> rect(x => $xstart+490, y => 10, width => $widLen, height => $high, stroke => '#dbcfca', fill => $color[1], 'stroke-opacity' => 1, 'fill-opacity' => 1, 'stroke-width' => 0.1);
$svg -> text(x => $xstart+490, y => 7, 'font-family' => 'Arial', 'font-size' => 5, 'font-weight' => 'normal', stroke => 'black', 'stroke-width' => 0.2, 'text-anchor' => 'middle', -cdata => "CC");
$svg -> rect(x => $xstart+500, y => 10, width => $widLen, height => $high, stroke => '#dbcfca', fill => $color[2], 'stroke-opacity' => 1, 'fill-opacity' => 1, 'stroke-width' => 0.1);
$svg -> text(x => $xstart+500, y => 7, 'font-family' => 'Arial', 'font-size' => 5, 'font-weight' => 'normal', stroke => 'black', 'stroke-width' => 0.2, 'text-anchor' => 'middle', -cdata => "GG");
$svg -> rect(x => $xstart+510, y => 10, width => $widLen, height => $high, stroke => '#dbcfca', fill => $color[3], 'stroke-opacity' => 1, 'fill-opacity' => 1, 'stroke-width' => 0.1);
$svg -> text(x => $xstart+510, y => 7, 'font-family' => 'Arial', 'font-size' => 5, 'font-weight' => 'normal', stroke => 'black', 'stroke-width' => 0.2, 'text-anchor' => 'middle', -cdata => "CG");
my $count = 0;
open IN0, $in0;
<IN0>;
while(<IN0>){
chomp;
my @temp = split(/\t/, $_);
$svg -> text(x => 15, y => $ystart+$high*$count+4, 'font-family' => 'Arial', 'font-size' => 3, 'font-weight' => 'normal', stroke => 'black', 'stroke-width' => 0.2, 'text-anchor' => 'middle', -cdata => "$temp[0]");
for(my $m=1; $m<=$#temp; $m++){
my $color = "white";
$color = $color[0], if($temp[$m] eq "NA");
$color = $color[1], if($temp[$m] eq "CC");
$color = $color[2], if($temp[$m] eq "GG");
$color = $color[3], if($temp[$m] eq "CG");
$svg -> rect(x => $xstart+$widLen*($m-1), y => $ystart+$high*$count, width => $widLen, height => $high,
stroke => '#dbcfca', fill => $color, 'stroke-opacity' => 1, 'fill-opacity' => 1, 'stroke-width' => 0.1);
}
$count += 1;
}
close IN0;
open OUT,">$out.svg";
print OUT $svg->xmlify;
system ("/10t/caix/bin/distributing_svg_4.74/svg2xxx_release/svg2xxx $out.svg -t png -dpi 500");