5 die "Usage: $0 <gene> <SNP> <output>\n" if @ARGV<3;
10 open I1
, "<", $in1 or die "Error opening $in1 : $!\n";
11 open I2
, "<", $in2 or die "Error opening $in2 : $!\n";
12 open O
, ">", $out or die "Error opening $out : $!\n";
17 my $yScale = 0.0002; # y轴方向的缩放系数,等于基因的高度除以DNA碱基数
18 my $genWid = 10; # 基因矩形宽度的一半
19 my $spaChr = 200; # 染色体间距
23 for my $a (0..$nSpeci) {
24 for my $b (0..$nGene) {
27 @
{$yCoo[$a][$b]} = split /\t/, $c;
37 $SNPcoo{$a[0]} = $a[1];
41 print O
"<?xml version=\"1.0\"?>\n\n<svg xmlns=\"http://www.w3.org/2000/svg\">\n\n";
43 # 画染色体 Scaffold75长5658748
47 my $y2 = 9302904*$yScale;
48 print O
"<line x1=\"$x\" y1=\"$y1\" x2=\"$x\" y2=\"$y2\" stroke=\"black\" stroke-width=\"5\"/>\n";
50 print O
"<line x1=\"$spaChr\" y1=\"0\" x2=\"$spaChr\" y2=\"", 5658748*$yScale, "\" stroke=\"black\" stroke-width=\"5\"/>\n";
51 print O
"<line x1=\"$spaChr\" y1=\"", 5758748*$yScale, "\" x2=\"$spaChr\" y2=\"", 9302904*$yScale, "\" stroke=\"black\" stroke-width=\"5\"/>\n";
54 for my $a (1..$nSpeci) {
55 for my $b (1..$nGene) {
56 my $x = $spaChr*$a - $genWid;
57 my $y = $yScale*$yCoo[$a][$b][0];
59 my $h = $yScale*($yCoo[$a][$b][1]-$yCoo[$a][$b][0]);
60 print O
"<rect x=\"$x\" y=\"$y\" width=\"$w\" height=\"$h\" fill=\"black\"/>\n";
65 for my $b (1..$nGene) {
66 for my $a (1..$nSpeci-1) {
68 my $x1 = $spaChr*$a + $genWid;
69 my $y1 = $yScale*$yCoo[$a][$b][$c];
70 my $x2 = $spaChr*($a+1) - $genWid;
71 my $y2 = $yScale*$yCoo[$a+1][$b][$c];
72 print O
"<line x1=\"$x1\" y1=\"$y1\" x2=\"$x2\" y2=\"$y2\" stroke=\"black\" stroke-width=\"0.5\"/>\n";
79 my $x = $nSpeci*$spaChr + 2*$genWid;
80 my $y = 0.5*$yScale*($yCoo[$nSpeci][$_][0] + $yCoo[$nSpeci][$_][1]) + 2;
81 my $gene = $yCoo[0][$_][0];
82 print O
"<text x=\"$x\" y=\"$y\" font-family=\"Courier\" font-size=\"8\" fill=\"black\">$gene</text>\n";
87 my $x = ($_-0.4)*$spaChr;
88 my $scaffold = $yCoo[$_][0][0];
89 print O
"<text x=\"$x\" y=\"-10\" font-family=\"Courier\" font-size=\"12\" fill=\"black\">$scaffold</text>\n";
93 for (sort {$a <=> $b} keys %SNPcoo) {
94 my $x1 = $spaChr - 3*$genWid;
97 print O
"<line x1=\"$x1\" y1=\"$y\" x2=\"$x2\" y2=\"$y\" stroke=\"black\" stroke-width=\"1\"/>\n";
98 my $SNP = "$_($SNPcoo{$_})";
99 my $ty = $yScale*$_ + 2;
100 print O
"<text x=\"120\" y=\"$ty\" font-family=\"Courier\" font-size=\"8\" fill=\"black\">$SNP</text>\n";
103 print O
"\n</svg>\n";