annotate PsiCLASS-1.0.2/samtools-0.1.19/misc/plot-bamcheck @ 0:903fc43d6227 draft default tip

Uploaded
author lsong10
date Fri, 26 Mar 2021 16:52:45 +0000
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
1 #!/usr/bin/env perl
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
2 #
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
3 # Author: petr.danecek@sanger
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
4 #
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
5
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
6 use strict;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
7 use warnings;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
8 use Carp;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
9
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
10 my $opts = parse_params();
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
11 parse_bamcheck($opts);
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
12 plot_qualities($opts);
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
13 plot_acgt_cycles($opts);
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
14 plot_gc($opts);
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
15 plot_gc_depth($opts);
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
16 plot_isize($opts);
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
17 plot_coverage($opts);
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
18 plot_mismatches_per_cycle($opts);
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
19 plot_indel_dist($opts);
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
20 plot_indel_cycles($opts);
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
21
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
22 exit;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
23
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
24 #--------------------------------
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
25
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
26 sub error
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
27 {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
28 my (@msg) = @_;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
29 if ( scalar @msg ) { confess @msg; }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
30 die
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
31 "Usage: plot-bamcheck [OPTIONS] file.bam.bc\n",
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
32 " plot-bamcheck -p outdir/ file.bam.bc\n",
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
33 "Options:\n",
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
34 " -k, --keep-files Do not remove temporary files.\n",
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
35 " -p, --prefix <path> The output files prefix, add a slash to create new directory.\n",
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
36 " -r, --ref-stats <file.fa.gc> Optional reference stats file with expected GC content (created with -s).\n",
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
37 " -s, --do-ref-stats <file.fa> Calculate reference sequence GC for later use with -r\n",
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
38 " -t, --targets <file.tab> Restrict -s to the listed regions (tab-delimited chr,from,to. 1-based, inclusive)\n",
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
39 " -h, -?, --help This help message.\n",
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
40 "\n";
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
41 }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
42
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
43
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
44 sub parse_params
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
45 {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
46 $0 =~ s{^.+/}{};
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
47 my $opts = { args=>join(' ',$0,@ARGV) };
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
48 while (defined(my $arg=shift(@ARGV)))
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
49 {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
50 if ( $arg eq '-k' || $arg eq '--keep-files' ) { $$opts{keep_files}=1; next; }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
51 if ( $arg eq '-r' || $arg eq '--ref-stats' ) { $$opts{ref_stats}=shift(@ARGV); next; }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
52 if ( $arg eq '-s' || $arg eq '--do-ref-stats' ) { $$opts{do_ref_stats}=shift(@ARGV); next; }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
53 if ( $arg eq '-t' || $arg eq '--targets' ) { $$opts{targets}=shift(@ARGV); next; }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
54 if ( $arg eq '-p' || $arg eq '--prefix' ) { $$opts{prefix}=shift(@ARGV); next; }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
55 if ( $arg eq '-?' || $arg eq '-h' || $arg eq '--help' ) { error(); }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
56 if ( -e $arg ) { $$opts{bamcheck}=$arg; next; }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
57 error("Unknown parameter or non-existent file \"$arg\". Run -h for help.\n");
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
58 }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
59 if ( exists($$opts{do_ref_stats }) ) { do_ref_stats($opts); exit; }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
60 if ( !exists($$opts{bamcheck}) ) { error("No bamcheck file?\n") }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
61 if ( !exists($$opts{prefix}) ) { error("Expected -p parameter.\n") }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
62 if ( $$opts{prefix}=~m{/$} ) { `mkdir -p $$opts{prefix}`; }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
63 elsif ( !($$opts{prefix}=~/-$/) ) { $$opts{prefix} .= '-'; }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
64 return $opts;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
65 }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
66
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
67
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
68 # Creates GC stats for either the whole reference or only on target regions for exome QC
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
69 sub do_ref_stats
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
70 {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
71 my ($opts) = @_;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
72
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
73
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
74 my %targets = ();
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
75 if ( exists($$opts{targets}) )
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
76 {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
77 my ($prev_chr,$prev_pos);
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
78 open(my $fh,'<',$$opts{targets}) or error("$$opts{targets}: $!");
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
79 while (my $line=<$fh>)
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
80 {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
81 if ( $line=~/^#/ ) { next; }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
82 my ($chr,$from,$to) = split(/\s+/,$line);
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
83 chomp($to);
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
84 push @{$targets{$chr}}, $from,$to;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
85 if ( !defined $prev_chr or $chr ne $prev_chr ) { $prev_chr=$chr; $prev_pos=$from }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
86 if ( $prev_pos > $from ) { error("The file must be sorted: $$opts{targets}\n"); }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
87 $prev_pos = $from;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
88 }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
89 close($fh);
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
90 }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
91
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
92 my $_len = 60; # for now do only standard fasta's with 60 bases per line
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
93 my %gc_counts = ();
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
94 my ($skip_chr,$pos,$ireg,$regions);
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
95 open(my $fh,'<',$$opts{do_ref_stats}) or error("$$opts{do_ref_stats}: $!");
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
96 while (my $line=<$fh>)
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
97 {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
98 if ( $line=~/^>/ )
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
99 {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
100 if ( !scalar %targets ) { next; }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
101
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
102 if ( !($line=~/>(\S+)/) ) { error("FIXME: could not determine chromosome name: $line"); }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
103 if ( !exists($targets{$1}) ) { $skip_chr=$1; next; }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
104 undef $skip_chr;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
105 $pos = 0;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
106 $ireg = 0;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
107 $regions = $targets{$1};
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
108 }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
109 if ( defined $skip_chr ) { next; }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
110
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
111 # Only $_len sized lines are considered and no chopping for target regions.
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
112 chomp($line);
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
113 my $len = length($line);
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
114 if ( $len ne $_len ) { next; }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
115
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
116 if ( scalar %targets )
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
117 {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
118 while ( $ireg<@$regions && $$regions[$ireg+1]<=$pos ) { $ireg += 2; }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
119 $pos += $len;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
120 if ( $ireg==@$regions ) { next; }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
121 if ( $pos < $$regions[$ireg] ) { next; }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
122 }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
123
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
124 my $gc_count = 0;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
125 for (my $i=0; $i<$len; $i++)
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
126 {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
127 my $base = substr($line,$i,1);
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
128 if ( $base eq 'g' || $base eq 'G' || $base eq 'c' || $base eq 'C' ) { $gc_count++; }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
129 }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
130 $gc_counts{$gc_count}++;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
131 }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
132
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
133 print "# Generated by $$opts{args}\n";
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
134 print "# The columns are: GC content bin, normalized frequency\n";
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
135 my $max;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
136 for my $count (values %gc_counts)
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
137 {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
138 if ( !defined $max or $count>$max ) { $max=$count; }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
139 }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
140 for my $gc (sort {$a<=>$b} keys %gc_counts)
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
141 {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
142 if ( $gc==0 ) { next; }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
143 printf "%f\t%f\n", $gc*100./$_len, $gc_counts{$gc}/$max;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
144 }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
145 }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
146
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
147 sub plot
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
148 {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
149 my ($cmdfile) = @_;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
150 my $cmd = "gnuplot $cmdfile";
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
151 system($cmd);
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
152 if ( $? ) { error("The command exited with non-zero status $?:\n\t$cmd\n\n"); }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
153 }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
154
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
155
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
156 sub parse_bamcheck
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
157 {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
158 my ($opts) = @_;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
159 open(my $fh,'<',$$opts{bamcheck}) or error("$$opts{bamcheck}: $!");
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
160 my $line = <$fh>;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
161 if ( !($line=~/^# This file was produced by bamcheck (\S+)/) ) { error("Sanity check failed: was this file generated by bamcheck?"); }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
162 $$opts{dat}{version} = $1;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
163 while ($line=<$fh>)
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
164 {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
165 if ( $line=~/^#/ ) { next; }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
166 my @items = split(/\t/,$line);
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
167 chomp($items[-1]);
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
168 if ( $items[0] eq 'SN' )
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
169 {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
170 $$opts{dat}{$items[1]} = splice(@items,2);
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
171 next;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
172 }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
173 push @{$$opts{dat}{$items[0]}}, [splice(@items,1)];
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
174 }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
175 close($fh);
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
176
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
177 # Check sanity
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
178 if ( !exists($$opts{dat}{'sequences:'}) or !$$opts{dat}{'sequences:'} )
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
179 {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
180 error("Sanity check failed: no sequences found by bamcheck??\n");
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
181 }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
182 }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
183
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
184 sub older_than
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
185 {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
186 my ($opts,$version) = @_;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
187 my ($year,$month,$day) = split(/-/,$version);
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
188 $version = $$opts{dat}{version};
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
189 if ( !($version=~/\((\d+)-(\d+)-(\d+)\)$/) ) { return 1; }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
190 if ( $1<$year ) { return 1; }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
191 elsif ( $1>$year ) { return 0; }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
192 if ( $2<$month ) { return 1; }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
193 elsif ( $2>$month ) { return 0; }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
194 if ( $3<$day ) { return 1; }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
195 return 0;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
196 }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
197
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
198 sub get_defaults
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
199 {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
200 my ($opts,$img_fname,%args) = @_;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
201
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
202 if ( !($img_fname=~/\.png$/i) ) { error("FIXME: currently only PNG supported. (Easy to extend.)\n"); }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
203
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
204 # Determine the gnuplot script file name
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
205 my $gp_file = $img_fname;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
206 $gp_file =~ s{\.[^.]+$}{.gp};
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
207 if ( !($gp_file=~/.gp$/) ) { $gp_file .= '.gp'; }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
208
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
209 # Determine the default title:
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
210 # 5446_6/5446_6.bam.bc.gp -> 5446_6
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
211 # test.aaa.png -> test.aaa
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
212 if ( !($$opts{bamcheck}=~m{([^/]+?)(?:\.bam)?(?:\.bc)?$}i) ) { error("FIXME: Could not determine the title from [$img_fname]\n"); }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
213 my $title = $1;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
214
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
215 my $dir = $gp_file;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
216 $dir =~ s{/[^/]+$}{};
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
217 if ( $dir && $dir ne $gp_file ) { `mkdir -p $dir`; }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
218
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
219 my $wh = exists($args{wh}) ? $args{wh} : '600,400';
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
220
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
221 open(my $fh,'>',$gp_file) or error("$gp_file: $!");
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
222 return {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
223 title => $title,
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
224 gp => $gp_file,
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
225 img => $img_fname,
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
226 fh => $fh,
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
227 terminal => qq[set terminal png size $wh truecolor],
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
228 grid => 'set grid xtics ytics y2tics back lc rgb "#cccccc"',
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
229 };
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
230 }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
231
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
232 sub percentile
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
233 {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
234 my ($p,@vals) = @_;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
235 my $N = 0;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
236 for my $val (@vals) { $N += $val; }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
237 my $n = $p*($N+1)/100.;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
238 my $k = int($n);
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
239 my $d = $n-$k;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
240 if ( $k<=0 ) { return 0; }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
241 if ( $k>=$N ) { return scalar @vals-1; }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
242 my $cnt;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
243 for (my $i=0; $i<@vals; $i++)
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
244 {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
245 $cnt += $vals[$i];
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
246 if ( $cnt>=$k ) { return $i; }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
247 }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
248 error("FIXME: this should not happen [percentile]\n");
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
249 }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
250
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
251 sub plot_qualities
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
252 {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
253 my ($opts) = @_;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
254
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
255 if ( !exists($$opts{dat}{FFQ}) or !@{$$opts{dat}{FFQ}} ) { return; }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
256
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
257 my $yrange = @{$$opts{dat}{FFQ}[0]} > 50 ? @{$$opts{dat}{FFQ}[0]} : 50;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
258 my $is_paired = $$opts{dat}{'is paired:'};
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
259
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
260 # Average quality per cycle, forward and reverse reads in one plot
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
261 my $args = get_defaults($opts,"$$opts{prefix}quals.png");
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
262 my $fh = $$args{fh};
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
263 print $fh qq[
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
264 $$args{terminal}
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
265 set output "$$args{img}"
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
266 $$args{grid}
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
267 set ylabel "Average Quality"
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
268 set xlabel "Cycle"
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
269 set yrange [0:$yrange]
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
270 set title "$$args{title}"
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
271 plot '-' using 1:2 with lines title 'Forward reads' ] . ($is_paired ? q[, '-' using 1:2 with lines title 'Reverse reads'] : '') . q[
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
272 ];
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
273 my (@fp75,@fp50,@fmean);
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
274 my (@lp75,@lp50,@lmean);
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
275 my ($fmax,$fmax_qual,$fmax_cycle);
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
276 my ($lmax,$lmax_qual,$lmax_cycle);
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
277 for my $cycle (@{$$opts{dat}{FFQ}})
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
278 {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
279 my $sum=0; my $n=0;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
280 for (my $iqual=1; $iqual<@$cycle; $iqual++)
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
281 {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
282 $sum += $$cycle[$iqual]*$iqual;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
283 $n += $$cycle[$iqual];
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
284 if ( !defined $fmax or $fmax<$$cycle[$iqual] ) { $fmax=$$cycle[$iqual]; $fmax_qual=$iqual; $fmax_cycle=$$cycle[0]; }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
285 }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
286 my $p25 = percentile(25,(@$cycle)[1..$#$cycle]);
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
287 my $p50 = percentile(50,(@$cycle)[1..$#$cycle]);
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
288 my $p75 = percentile(75,(@$cycle)[1..$#$cycle]);
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
289 if ( !$n ) { next; }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
290 push @fp75, "$$cycle[0]\t$p25\t$p75\n";
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
291 push @fp50, "$$cycle[0]\t$p50\n";
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
292 push @fmean, sprintf "%d\t%.2f\n", $$cycle[0],$sum/$n;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
293 printf $fh $fmean[-1];
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
294 }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
295 print $fh "end\n";
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
296 if ( $is_paired )
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
297 {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
298 for my $cycle (@{$$opts{dat}{LFQ}})
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
299 {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
300 my $sum=0; my $n=0;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
301 for (my $iqual=1; $iqual<@$cycle; $iqual++)
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
302 {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
303 $sum += $$cycle[$iqual]*$iqual;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
304 $n += $$cycle[$iqual];
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
305 if ( !defined $lmax or $lmax<$$cycle[$iqual] ) { $lmax=$$cycle[$iqual]; $lmax_qual=$iqual; $lmax_cycle=$$cycle[0]; }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
306 }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
307 my $p25 = percentile(25,(@$cycle)[1..$#$cycle]);
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
308 my $p50 = percentile(50,(@$cycle)[1..$#$cycle]);
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
309 my $p75 = percentile(75,(@$cycle)[1..$#$cycle]);
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
310 if ( !$n ) { next; }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
311 push @lp75, "$$cycle[0]\t$p25\t$p75\n";
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
312 push @lp50, "$$cycle[0]\t$p50\n";
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
313 push @lmean, sprintf "%d\t%.2f\n", $$cycle[0],$sum/$n;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
314 printf $fh $lmean[-1];
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
315 }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
316 print $fh "end\n";
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
317 }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
318 close($fh);
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
319 plot($$args{gp});
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
320
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
321
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
322
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
323 # Average, mean and quality percentiles per cycle, forward and reverse reads in separate plots
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
324 $args = get_defaults($opts,"$$opts{prefix}quals2.png",wh=>'700,500');
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
325 $fh = $$args{fh};
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
326 print $fh qq[
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
327 $$args{terminal}
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
328 set output "$$args{img}"
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
329 $$args{grid}
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
330 set multiplot
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
331 set rmargin 0
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
332 set lmargin 0
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
333 set tmargin 0
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
334 set bmargin 0
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
335 set origin 0.1,0.1
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
336 set size 0.4,0.8
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
337 set yrange [0:$yrange]
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
338 set ylabel "Quality"
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
339 set xlabel "Cycle (fwd reads)"
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
340 plot '-' using 1:2:3 with filledcurve lt 1 lc rgb "#cccccc" t '25-75th percentile' , '-' using 1:2 with lines lc rgb "#000000" t 'Median', '-' using 1:2 with lines lt 1 t 'Mean'
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
341 ];
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
342 print $fh join('',@fp75),"end\n";
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
343 print $fh join('',@fp50),"end\n";
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
344 print $fh join('',@fmean),"end\n";
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
345 if ( $is_paired )
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
346 {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
347 print $fh qq[
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
348 set origin 0.55,0.1
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
349 set size 0.4,0.8
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
350 unset ytics
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
351 set y2tics mirror
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
352 set yrange [0:$yrange]
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
353 unset ylabel
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
354 set xlabel "Cycle (rev reads)"
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
355 set label "$$args{title}" at screen 0.5,0.95 center
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
356 plot '-' using 1:2:3 with filledcurve lt 1 lc rgb "#cccccc" t '25-75th percentile' , '-' using 1:2 with lines lc rgb "#000000" t 'Median', '-' using 1:2 with lines lt 2 t 'Mean'
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
357 ];
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
358 print $fh join('',@lp75),"end\n";
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
359 print $fh join('',@lp50),"end\n";
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
360 print $fh join('',@lmean),"end\n";
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
361 }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
362 close($fh);
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
363 plot($$args{gp});
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
364
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
365
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
366
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
367 # Quality distribution per cycle, the distribution is for each cycle plotted as a separate curve
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
368 $args = get_defaults($opts,"$$opts{prefix}quals3.png",wh=>'600,600');
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
369 $fh = $$args{fh};
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
370 my $nquals = @{$$opts{dat}{FFQ}[0]}-1;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
371 my $ncycles = @{$$opts{dat}{FFQ}};
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
372 print $fh qq[
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
373 $$args{terminal}
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
374 set output "$$args{img}"
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
375 $$args{grid}
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
376 set multiplot
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
377 set rmargin 0
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
378 set lmargin 0
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
379 set tmargin 0
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
380 set bmargin 0
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
381 set origin 0.15,0.52
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
382 set size 0.8,0.4
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
383 set title "$$args{title}"
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
384 set ylabel "Frequency (fwd reads)"
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
385 set label "Cycle $fmax_cycle" at $fmax_qual+1,$fmax
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
386 unset xlabel
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
387 set xrange [0:$nquals]
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
388 set format x ""
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
389 ];
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
390 my @plots;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
391 for (my $i=0; $i<$ncycles; $i++) { push @plots, q['-' using 1:2 with lines t ''] }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
392 print $fh "plot ", join(",", @plots), "\n";
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
393 for my $cycle (@{$$opts{dat}{FFQ}})
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
394 {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
395 for (my $iqual=1; $iqual<$nquals; $iqual++) { print $fh "$iqual\t$$cycle[$iqual]\n"; }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
396 print $fh "end\n";
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
397 }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
398 if ( $is_paired )
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
399 {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
400 print $fh qq[
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
401 set origin 0.15,0.1
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
402 set size 0.8,0.4
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
403 unset title
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
404 unset format
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
405 set xtics
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
406 set xlabel "Quality"
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
407 unset label
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
408 set label "Cycle $lmax_cycle" at $lmax_qual+1,$lmax
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
409 set ylabel "Frequency (rev reads)"
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
410 ];
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
411 print $fh "plot ", join(",", @plots), "\n";
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
412 for my $cycle (@{$$opts{dat}{LFQ}})
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
413 {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
414 for (my $iqual=1; $iqual<$nquals; $iqual++)
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
415 {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
416 print $fh "$iqual\t$$cycle[$iqual]\n";
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
417 }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
418 print $fh "end\n";
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
419 }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
420 }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
421 close($fh);
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
422 plot($$args{gp});
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
423
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
424
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
425 # Heatmap qualitites
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
426 $args = get_defaults($opts,"$$opts{prefix}quals-hm.png", wh=>'600,500');
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
427 $fh = $$args{fh};
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
428 my $max = defined $lmax && $lmax > $fmax ? $lmax : $fmax;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
429 my @ytics;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
430 for my $cycle (@{$$opts{dat}{FFQ}}) { if ( $$cycle[0]%10==0 ) { push @ytics,qq["$$cycle[0]" $$cycle[0]]; } }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
431 my $ytics = join(',', @ytics);
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
432 print $fh qq[
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
433 $$args{terminal}
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
434 set output "$$args{img}"
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
435 unset key
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
436 unset colorbox
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
437 set palette defined (0 0 0 0, 1 0 0 1, 3 0 1 0, 4 1 0 0, 6 1 1 1)
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
438 set cbrange [0:$max]
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
439 set yrange [0:$ncycles]
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
440 set xrange [0:$nquals]
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
441 set view map
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
442 set multiplot
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
443 set rmargin 0
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
444 set lmargin 0
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
445 set tmargin 0
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
446 set bmargin 0
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
447 set origin 0,0.46
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
448 set size 0.95,0.6
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
449 set obj 1 rectangle behind from first 0,0 to first $nquals,$ncycles
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
450 set obj 1 fillstyle solid 1.0 fillcolor rgbcolor "black"
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
451 set ylabel "Cycle (fwd reads)" offset character -1,0
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
452 unset ytics
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
453 set ytics ($ytics)
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
454 unset xtics
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
455 set title "$$args{title}"
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
456 splot '-' matrix with image
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
457 ];
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
458 for my $cycle (@{$$opts{dat}{FFQ}})
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
459 {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
460 for (my $iqual=1; $iqual<@$cycle; $iqual++) { print $fh "\t$$cycle[$iqual]"; }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
461 print $fh "\n";
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
462 }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
463 print $fh "end\nend\n";
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
464 @ytics = ();
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
465 for my $cycle (@{$$opts{dat}{LFQ}}) { if ( $$cycle[0]%10==0 ) { push @ytics,qq["$$cycle[0]" $$cycle[0]]; } }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
466 $ytics = join(',', @ytics);
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
467 print $fh qq[
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
468 set origin 0,0.03
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
469 set size 0.95,0.6
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
470 set ylabel "Cycle (rev reads)" offset character -1,0
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
471 set xlabel "Base Quality"
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
472 unset title
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
473 unset ytics
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
474 set ytics ($ytics)
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
475 set xrange [0:$nquals]
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
476 set xtics
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
477 set colorbox vertical user origin first ($nquals+1),0 size screen 0.025,0.812
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
478 set cblabel "Number of bases"
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
479 splot '-' matrix with image
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
480 ];
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
481 for my $cycle (@{$$opts{dat}{LFQ}})
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
482 {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
483 for (my $iqual=1; $iqual<@$cycle; $iqual++) { print $fh "\t$$cycle[$iqual]"; }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
484 print $fh "\n";
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
485 }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
486 print $fh "end\nend\n";
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
487 close($fh);
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
488 plot($$args{gp});
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
489 }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
490
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
491
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
492 sub plot_acgt_cycles
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
493 {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
494 my ($opts) = @_;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
495
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
496 if ( !exists($$opts{dat}{GCC}) or !@{$$opts{dat}{GCC}} ) { return; }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
497
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
498 my $args = get_defaults($opts,"$$opts{prefix}acgt-cycles.png");
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
499 my $fh = $$args{fh};
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
500 print $fh qq[
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
501 $$args{terminal}
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
502 set output "$$args{img}"
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
503 $$args{grid}
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
504 set style line 1 linecolor rgb "green"
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
505 set style line 2 linecolor rgb "red"
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
506 set style line 3 linecolor rgb "black"
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
507 set style line 4 linecolor rgb "blue"
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
508 set style increment user
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
509 set ylabel "Base content [%]"
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
510 set xlabel "Read Cycle"
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
511 set yrange [0:100]
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
512 set title "$$args{title}"
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
513 plot '-' w l ti 'A', '-' w l ti 'C', '-' w l ti 'G', '-' w l ti 'T'
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
514 ];
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
515 for my $base (1..4)
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
516 {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
517 for my $cycle (@{$$opts{dat}{GCC}})
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
518 {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
519 print $fh $$cycle[0]+1,"\t",$$cycle[$base],"\n";
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
520 }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
521 print $fh "end\n";
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
522 }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
523 close($fh);
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
524 plot($$args{gp});
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
525 }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
526
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
527
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
528 sub plot_gc
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
529 {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
530 my ($opts) = @_;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
531
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
532 my $is_paired = $$opts{dat}{'is paired:'};
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
533 my $args = get_defaults($opts,"$$opts{prefix}gc-content.png");
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
534 my $fh = $$args{fh};
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
535 my ($gcl_max,$gcf_max,$lmax,$fmax);
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
536 for my $gc (@{$$opts{dat}{GCF}}) { if ( !defined $gcf_max or $gcf_max<$$gc[1] ) { $gcf_max=$$gc[1]; $fmax=$$gc[0]; } }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
537 for my $gc (@{$$opts{dat}{GCL}}) { if ( !defined $gcl_max or $gcl_max<$$gc[1] ) { $gcl_max=$$gc[1]; $lmax=$$gc[0]; } }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
538 my $gcmax = $is_paired && $gcl_max > $gcf_max ? $lmax : $fmax;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
539 print $fh qq[
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
540 $$args{terminal}
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
541 set output "$$args{img}"
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
542 $$args{grid}
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
543 set title "$$args{title}"
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
544 set ylabel "Normalized Frequency"
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
545 set xlabel "GC Content [%]"
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
546 set yrange [0:1.1]
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
547 set label sprintf("%.1f",$gcmax) at $gcmax,1 front offset 1,0
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
548 plot ]
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
549 . (exists($$opts{ref_stats}) ? q['-' smooth csplines with lines lt 0 title 'Reference', ] : '')
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
550 . q['-' smooth csplines with lines lc 1 title 'First fragments' ]
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
551 . ($is_paired ? q[, '-' smooth csplines with lines lc 2 title 'Last fragments'] : '')
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
552 . q[
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
553 ];
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
554 if ( exists($$opts{ref_stats}) )
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
555 {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
556 open(my $ref,'<',$$opts{ref_stats}) or error("$$opts{ref_stats}: $!");
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
557 while (my $line=<$ref>) { print $fh $line }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
558 close($ref);
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
559 print $fh "end\n";
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
560 }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
561 for my $cycle (@{$$opts{dat}{GCF}}) { printf $fh "%d\t%f\n", $$cycle[0],$$cycle[1]/$gcf_max; }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
562 print $fh "end\n";
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
563 if ( $is_paired )
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
564 {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
565 for my $cycle (@{$$opts{dat}{GCL}}) { printf $fh "%d\t%f\n", $$cycle[0],$$cycle[1]/$gcl_max; }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
566 print $fh "end\n";
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
567 }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
568 close($fh);
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
569 plot($$args{gp});
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
570 }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
571
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
572
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
573 sub plot_gc_depth
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
574 {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
575 my ($opts) = @_;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
576
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
577 if ( !exists($$opts{dat}{GCD}) or !@{$$opts{dat}{GCD}} ) { return; }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
578
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
579 # Find unique sequence percentiles for 30,40, and 50% GC content, just to draw x2tics.
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
580 my @tics = ( {gc=>30},{gc=>40},{gc=>50} );
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
581 for my $gc (@{$$opts{dat}{GCD}})
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
582 {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
583 for my $tic (@tics)
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
584 {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
585 my $diff = abs($$gc[0]-$$tic{gc});
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
586 if ( !exists($$tic{pr}) or $diff<$$tic{diff} ) { $$tic{pr}=$$gc[1]; $$tic{diff}=$diff; }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
587 }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
588 }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
589
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
590 my @x2tics;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
591 for my $tic (@tics) { push @x2tics, qq["$$tic{gc}" $$tic{pr}]; }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
592 my $x2tics = join(',',@x2tics);
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
593
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
594 my $args = get_defaults($opts,"$$opts{prefix}gc-depth.png", wh=>'600,500');
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
595 my $fh = $$args{fh};
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
596 print $fh qq[
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
597 $$args{terminal}
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
598 set output "$$args{img}"
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
599 $$args{grid}
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
600 set ylabel "Mapped depth"
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
601 set xlabel "Percentile of mapped sequence ordered by GC content"
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
602 set x2label "GC Content [%]"
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
603 set title "$$args{title}"
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
604 set x2tics ($x2tics)
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
605 set xtics nomirror
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
606 set xrange [0.1:99.9]
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
607
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
608 plot '-' using 1:2:3 with filledcurve lt 1 lc rgb "#dedede" t '10-90th percentile' , \\
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
609 '-' using 1:2:3 with filledcurve lt 1 lc rgb "#bbdeff" t '25-75th percentile' , \\
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
610 '-' using 1:2 with lines lc rgb "#0084ff" t 'Median'
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
611 ];
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
612 for my $gc (@{$$opts{dat}{GCD}}) { print $fh "$$gc[1]\t$$gc[2]\t$$gc[6]\n"; } print $fh "end\n";
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
613 for my $gc (@{$$opts{dat}{GCD}}) { print $fh "$$gc[1]\t$$gc[3]\t$$gc[5]\n"; } print $fh "end\n";
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
614 for my $gc (@{$$opts{dat}{GCD}}) { print $fh "$$gc[1]\t$$gc[4]\n"; } print $fh "end\n";
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
615 close($fh);
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
616 plot($$args{gp});
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
617 }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
618
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
619
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
620 sub plot_isize
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
621 {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
622 my ($opts) = @_;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
623
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
624 if ( !$$opts{dat}{'is paired:'} or !exists($$opts{dat}{IS}) or !@{$$opts{dat}{IS}} ) { return; }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
625
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
626 my ($isize_max,$isize_cnt);
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
627 for my $isize (@{$$opts{dat}{IS}})
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
628 {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
629 if ( !defined $isize_max or $isize_cnt<$$isize[1] ) { $isize_cnt=$$isize[1]; $isize_max=$$isize[0]; }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
630 }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
631
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
632 my $args = get_defaults($opts,"$$opts{prefix}insert-size.png");
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
633 my $fh = $$args{fh};
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
634 print $fh qq[
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
635 $$args{terminal}
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
636 set output "$$args{img}"
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
637 $$args{grid}
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
638 set rmargin 5
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
639 set label sprintf("%d",$isize_max) at $isize_max+10,$isize_cnt
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
640 set ylabel "Number of pairs"
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
641 set xlabel "Insert Size"
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
642 set title "$$args{title}"
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
643 plot \\
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
644 '-' with lines lc rgb 'black' title 'All pairs', \\
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
645 '-' with lines title 'Inward', \\
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
646 '-' with lines title 'Outward', \\
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
647 '-' with lines title 'Other'
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
648 ];
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
649 for my $isize (@{$$opts{dat}{IS}}) { print $fh "$$isize[0]\t$$isize[1]\n"; } print $fh "end\n";
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
650 for my $isize (@{$$opts{dat}{IS}}) { print $fh "$$isize[0]\t$$isize[2]\n"; } print $fh "end\n";
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
651 for my $isize (@{$$opts{dat}{IS}}) { print $fh "$$isize[0]\t$$isize[3]\n"; } print $fh "end\n";
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
652 for my $isize (@{$$opts{dat}{IS}}) { print $fh "$$isize[0]\t$$isize[4]\n"; } print $fh "end\n";
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
653 close($fh);
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
654 plot($$args{gp});
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
655 }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
656
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
657
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
658 sub plot_coverage
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
659 {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
660 my ($opts) = @_;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
661
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
662 if ( !exists($$opts{dat}{COV}) or !@{$$opts{dat}{COV}} ) { return; }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
663
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
664 my @vals;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
665 for my $cov (@{$$opts{dat}{COV}}) { push @vals,$$cov[2]; }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
666 my $i = percentile(99.8,@vals);
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
667 my $p99 = $$opts{dat}{COV}[$i][1];
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
668
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
669 my $args = get_defaults($opts,"$$opts{prefix}coverage.png");
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
670 my $fh = $$args{fh};
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
671 print $fh qq[
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
672 $$args{terminal}
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
673 set output "$$args{img}"
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
674 $$args{grid}
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
675 set ylabel "Number of mapped bases"
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
676 set xlabel "Coverage"
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
677 set style fill solid border -1
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
678 set title "$$args{title}"
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
679 set xrange [:$p99]
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
680 plot '-' with lines notitle
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
681 ];
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
682 for my $cov (@{$$opts{dat}{COV}})
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
683 {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
684 if ( $$cov[2]==0 ) { next; }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
685 print $fh "$$cov[1]\t$$cov[2]\n";
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
686 }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
687 print $fh "end\n";
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
688 close($fh);
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
689 plot($$args{gp});
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
690 }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
691
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
692
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
693 sub plot_mismatches_per_cycle
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
694 {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
695 my ($opts) = @_;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
696
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
697 if ( !exists($$opts{dat}{MPC}) or !@{$$opts{dat}{MPC}} ) { return; }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
698 if ( older_than($opts,'2012-02-06') ) { plot_mismatches_per_cycle_old($opts); }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
699
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
700 my $nquals = @{$$opts{dat}{MPC}[0]} - 2;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
701 my $ncycles = @{$$opts{dat}{MPC}};
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
702 my ($style,$with);
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
703 if ( $ncycles>100 ) { $style = ''; $with = 'w l'; }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
704 else { $style = 'set style data histogram; set style histogram rowstacked'; $with = ''; }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
705
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
706 my $args = get_defaults($opts,"$$opts{prefix}mism-per-cycle.png");
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
707 my $fh = $$args{fh};
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
708 print $fh qq[
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
709 $$args{terminal}
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
710 set output "$$args{img}"
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
711 $$args{grid}
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
712 set style line 1 linecolor rgb "#e40000"
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
713 set style line 2 linecolor rgb "#ff9f00"
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
714 set style line 3 linecolor rgb "#eeee00"
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
715 set style line 4 linecolor rgb "#4ebd68"
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
716 set style line 5 linecolor rgb "#0061ff"
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
717 set style increment user
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
718 set key left top
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
719 $style
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
720 set ylabel "Number of mismatches"
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
721 set xlabel "Read Cycle"
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
722 set style fill solid border -1
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
723 set title "$$args{title}"
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
724 set xrange [-1:$ncycles]
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
725 plot '-' $with ti 'Base Quality>30', \\
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
726 '-' $with ti '30>=Q>20', \\
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
727 '-' $with ti '20>=Q>10', \\
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
728 '-' $with ti '10>=Q', \\
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
729 '-' $with ti "N's"
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
730 ];
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
731 for my $cycle (@{$$opts{dat}{MPC}})
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
732 {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
733 my $sum; for my $idx (31..$#$cycle) { $sum += $$cycle[$idx]; }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
734 print $fh "$sum\n";
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
735 }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
736 print $fh "end\n";
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
737 for my $cycle (@{$$opts{dat}{MPC}})
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
738 {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
739 my $sum; for my $idx (22..31) { $sum += $$cycle[$idx]; }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
740 print $fh "$sum\n";
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
741 }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
742 print $fh "end\n";
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
743 for my $cycle (@{$$opts{dat}{MPC}})
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
744 {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
745 my $sum; for my $idx (12..21) { $sum += $$cycle[$idx]; }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
746 print $fh "$sum\n";
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
747 }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
748 print $fh "end\n";
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
749 for my $cycle (@{$$opts{dat}{MPC}})
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
750 {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
751 my $sum; for my $idx (2..11) { $sum += $$cycle[$idx]; }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
752 print $fh "$sum\n";
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
753 }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
754 print $fh "end\n";
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
755 for my $cycle (@{$$opts{dat}{MPC}}) { print $fh "$$cycle[1]\n"; }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
756 print $fh "end\n";
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
757 close($fh);
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
758 plot($$args{gp});
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
759 }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
760
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
761 sub plot_indel_dist
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
762 {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
763 my ($opts) = @_;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
764
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
765 if ( !exists($$opts{dat}{ID}) or !@{$$opts{dat}{ID}} ) { return; }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
766
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
767 my $args = get_defaults($opts,"$$opts{prefix}indel-dist.png");
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
768 my $fh = $$args{fh};
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
769 print $fh qq[
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
770 $$args{terminal}
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
771 set output "$$args{img}"
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
772 $$args{grid}
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
773 set style line 1 linetype 1 linecolor rgb "red"
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
774 set style line 2 linetype 2 linecolor rgb "black"
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
775 set style line 3 linetype 3 linecolor rgb "green"
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
776 set style increment user
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
777 set ylabel "Indel count [log]"
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
778 set xlabel "Indel length"
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
779 set y2label "Insertions/Deletions ratio"
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
780 set log y
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
781 set y2tics nomirror
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
782 set ytics nomirror
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
783 set title "$$args{title}"
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
784 plot '-' w l ti 'Insertions', '-' w l ti 'Deletions', '-' axes x1y2 w l ti "Ins/Dels ratio"
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
785 ];
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
786 for my $len (@{$$opts{dat}{ID}}) { print $fh "$$len[0]\t$$len[1]\n"; } print $fh "end\n";
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
787 for my $len (@{$$opts{dat}{ID}}) { print $fh "$$len[0]\t$$len[2]\n"; } print $fh "end\n";
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
788 for my $len (@{$$opts{dat}{ID}}) { printf $fh "%d\t%f\n", $$len[0],$$len[2]?$$len[1]/$$len[2]:0; } print $fh "end\n";
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
789 close($fh);
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
790 plot($$args{gp});
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
791 }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
792
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
793 sub plot_indel_cycles
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
794 {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
795 my ($opts) = @_;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
796
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
797 if ( !exists($$opts{dat}{IC}) or !@{$$opts{dat}{IC}} ) { return; }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
798
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
799 my $args = get_defaults($opts,"$$opts{prefix}indel-cycles.png");
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
800 my $fh = $$args{fh};
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
801 print $fh qq[
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
802 $$args{terminal}
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
803 set output "$$args{img}"
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
804 $$args{grid}
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
805 set style line 1 linetype 1 linecolor rgb "red"
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
806 set style line 2 linetype 2 linecolor rgb "black"
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
807 set style line 3 linetype 3 linecolor rgb "green"
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
808 set style line 4 linetype 4 linecolor rgb "blue"
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
809 set style increment user
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
810 set ylabel "Indel count"
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
811 set xlabel "Read Cycle"
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
812 set title "$$args{title}"
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
813 plot '-' w l ti 'Insertions (fwd)', '' w l ti 'Insertions (rev)', '' w l ti 'Deletions (fwd)', '' w l ti 'Deletions (rev)'
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
814 ];
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
815 for my $len (@{$$opts{dat}{IC}}) { print $fh "$$len[0]\t$$len[1]\n"; } print $fh "end\n";
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
816 for my $len (@{$$opts{dat}{IC}}) { print $fh "$$len[0]\t$$len[2]\n"; } print $fh "end\n";
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
817 for my $len (@{$$opts{dat}{IC}}) { print $fh "$$len[0]\t$$len[3]\n"; } print $fh "end\n";
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
818 for my $len (@{$$opts{dat}{IC}}) { print $fh "$$len[0]\t$$len[4]\n"; } print $fh "end\n";
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
819 close($fh);
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
820 plot($$args{gp});
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
821 }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
822
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
823
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
824
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
825
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
826
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
827
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
828
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
829 sub has_values
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
830 {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
831 my ($opts,@tags) = @_;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
832 for my $tag (@tags)
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
833 {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
834 my (@lines) = `cat $$opts{bamcheck} | grep ^$tag | wc -l`;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
835 chomp($lines[0]);
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
836 if ( $lines[0]<2 ) { return 0; }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
837 }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
838 return 1;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
839 }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
840
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
841 sub plot_mismatches_per_cycle_old
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
842 {
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
843 my ($opts) = @_;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
844
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
845 my $args = get_defaults($opts,"$$opts{prefix}mism-per-cycle.png");
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
846 my ($nquals) = `grep ^MPC $$opts{bamcheck} | awk '\$2==1' | sed 's,\\t,\\n,g' | wc -l`;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
847 my ($ncycles) = `grep ^MPC $$opts{bamcheck} | wc -l`;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
848 chomp($nquals);
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
849 chomp($ncycles);
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
850 $nquals--;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
851 $ncycles--;
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
852 my @gr0_15 = (2..17);
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
853 my @gr16_30 = (18..32);
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
854 my @gr31_n = (33..$nquals);
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
855 my $gr0_15 = '$'. join('+$',@gr0_15);
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
856 my $gr16_30 = '$'. join('+$',@gr16_30);
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
857 my $gr31_n = '$'. join('+$',@gr31_n);
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
858
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
859 open(my $fh,'>',$$args{gp}) or error("$$args{gp}: $!");
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
860 print $fh q[
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
861 set terminal png size 600,400 truecolor font "DejaVuSansMono,9"
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
862 set output "] . $$args{img} . q["
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
863
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
864 set key left top
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
865 set style data histogram
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
866 set style histogram rowstacked
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
867
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
868 set grid back lc rgb "#aaaaaa"
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
869 set ylabel "Number of mismatches"
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
870 set xlabel "Read Cycle"
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
871 set style fill solid border -1
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
872 set title "] . $$args{title} . qq["
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
873 set xrange [-1:$ncycles]
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
874
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
875 plot '< grep ^MPC $$opts{bamcheck} | cut -f 2-' using ($gr31_n) ti 'Base Quality>30', '' using ($gr16_30) ti '30>=Q>15', '' using ($gr0_15) ti '15>=Q'
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
876 ];
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
877 close($fh);
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
878
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
879 plot($$args{gp});
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
880 }
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
881
903fc43d6227 Uploaded
lsong10
parents:
diff changeset
882