Fix dotplot crash for sorting by sequence length
authorMartin C. Frith
Mon Mar 05 12:06:48 2018 +0900 (2018-03-05)
changeset 925e1861f956f60
parent 924 e7d7cb7db0a7
child 926 bc08832db1a1
Fix dotplot crash for sorting by sequence length
scripts/last-dotplot
test/last-dotplot-test.out
test/last-dotplot-test.sh
     1.1 --- a/scripts/last-dotplot	Mon Feb 26 08:12:10 2018 +0900
     1.2 +++ b/scripts/last-dotplot	Mon Mar 05 12:06:48 2018 +0900
     1.3 @@ -285,7 +285,7 @@
     1.4      return natural_sort_key(oneSeqRanges[0][0])
     1.5  
     1.6  def sizeKey(oneSeqRanges):
     1.7 -    return sum(b - e for n, b, e in oneSeqRanges), nameKey(oneSeqRanges)
     1.8 +    return sum(b - e for n, b, e, s in oneSeqRanges), nameKey(oneSeqRanges)
     1.9  
    1.10  def alignmentKey(seqNamesToLists, oneSeqRanges):
    1.11      seqName = oneSeqRanges[0][0]
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/test/last-dotplot-test.out	Mon Mar 05 12:06:48 2018 +0900
     2.3 @@ -0,0 +1,335 @@
     2.4 +TEST 102.maf
     2.5 +3396982345 3177
     2.6 +
     2.7 +TEST -v -x600 -c orange -r teal --sort1=2 --border-color=brown 102.maf
     2.8 +last-dotplot: font: /usr/share/fonts/liberation/LiberationSans-Regular.ttf
     2.9 +last-dotplot: reading alignments...
    2.10 +last-dotplot: cutting...
    2.11 +last-dotplot: reading secondary alignments...
    2.12 +last-dotplot: cutting...
    2.13 +last-dotplot: sorting...
    2.14 +last-dotplot: chr19	1383883	1383969
    2.15 +last-dotplot: chr19	1387780	1388965
    2.16 +last-dotplot: chr19	1390828	1391190
    2.17 +last-dotplot: chr19	1393213	1393358
    2.18 +last-dotplot: chr19	1395360	1395511
    2.19 +last-dotplot: chr19	17615403	17615478
    2.20 +last-dotplot: chr19	18430532	18430615
    2.21 +last-dotplot: chr19	47072174	47072264
    2.22 +last-dotplot: chr3	23607529	23607606
    2.23 +last-dotplot: chr3	33026597	33026675
    2.24 +last-dotplot: chr3	37588349	37588441
    2.25 +last-dotplot: chr3	89815452	89815525
    2.26 +last-dotplot: chr3	127741348	127741429
    2.27 +last-dotplot: chr3	130609381	130609461
    2.28 +last-dotplot: chr3	152862866	152862947
    2.29 +last-dotplot: chr3	186865624	186865699
    2.30 +last-dotplot: chr5	4867398	4867471
    2.31 +last-dotplot: chr5	74376550	74376623
    2.32 +last-dotplot: chr5	93489515	93489591
    2.33 +last-dotplot: chr5	169763588	169763671
    2.34 +last-dotplot: chr5	171574427	171574500
    2.35 +last-dotplot: chr5	173701172	173701249
    2.36 +last-dotplot: chr5	177958514	177958591
    2.37 +last-dotplot: chr17	19079582	19079655
    2.38 +last-dotplot: chr17	19172423	19172496
    2.39 +last-dotplot: chr17	19205764	19205837
    2.40 +last-dotplot: chr17	27793612	27793685
    2.41 +last-dotplot: chr17	28925902	28925982
    2.42 +last-dotplot: chr17	29190042	29190115
    2.43 +last-dotplot: chr17	58670463	58670536
    2.44 +last-dotplot: chr7	65260279	65260354
    2.45 +last-dotplot: chr7	100370569	100370642
    2.46 +last-dotplot: chr7	101590352	101590447
    2.47 +last-dotplot: chr7	101723218	101723313
    2.48 +last-dotplot: chr7	157969496	157969572
    2.49 +last-dotplot: chr1	21590603	21590709
    2.50 +last-dotplot: chr1	145869990	145870063
    2.51 +last-dotplot: chr1	155997846	155997940
    2.52 +last-dotplot: chr1	161050878	161050970
    2.53 +last-dotplot: chr10	122813007	122813087
    2.54 +last-dotplot: chr10	124281367	124281441
    2.55 +last-dotplot: chr10	126932842	126932937
    2.56 +last-dotplot: chr22	20726561	20726644
    2.57 +last-dotplot: chr22	23657463	23657536
    2.58 +last-dotplot: chr22	46458773	46458849
    2.59 +last-dotplot: chr6	1842804	1842877
    2.60 +last-dotplot: chr6	65786074	65786151
    2.61 +last-dotplot: chr6	170257674	170257754
    2.62 +last-dotplot: chr8	76840831	76840936
    2.63 +last-dotplot: chr8	98433234	98433318
    2.64 +last-dotplot: chr12	19357508	19357581
    2.65 +last-dotplot: chr12	71544959	71545052
    2.66 +last-dotplot: chr14	80332102	80332183
    2.67 +last-dotplot: chr14	104715645	104715730
    2.68 +last-dotplot: chr18	8561181	8561272
    2.69 +last-dotplot: chr18	55335065	55335140
    2.70 +last-dotplot: chr4	3839035	3839110
    2.71 +last-dotplot: chr4	54783677	54783767
    2.72 +last-dotplot: chr2	192414435	192414516
    2.73 +last-dotplot: chr2	240456604	240456683
    2.74 +last-dotplot: chr15	45614722	45614800
    2.75 +last-dotplot: chr15	78230458	78230537
    2.76 +last-dotplot: chr21	14291153	14291236
    2.77 +last-dotplot: chr21	43027907	43027980
    2.78 +last-dotplot: chr20	4034120	4034195
    2.79 +last-dotplot: chr20	17684717	17684790
    2.80 +last-dotplot: chrX	39928389	39928462
    2.81 +last-dotplot: chrX	83302574	83302647
    2.82 +last-dotplot: chr16	722456	722540
    2.83 +last-dotplot: chr11	67464119	67464196
    2.84 +last-dotplot: chr13	113342188	113342261
    2.85 +last-dotplot: 
    2.86 +last-dotplot: 102	0	699
    2.87 +last-dotplot: 
    2.88 +last-dotplot: choosing bp per pixel...
    2.89 +last-dotplot: choosing bp per pixel...
    2.90 +last-dotplot: bp per pixel = 15
    2.91 +last-dotplot: width:  581
    2.92 +last-dotplot: height: 47
    2.93 +last-dotplot: processing alignments...
    2.94 +last-dotplot: reading annotations...
    2.95 +last-dotplot: drawing...
    2.96 +2981739013 1818
    2.97 +
    2.98 +TEST -v -y30 --max-gap1=0 --pad=0.08 --border-pixels=2 --sort1=3 102.maf
    2.99 +last-dotplot: font: /usr/share/fonts/liberation/LiberationSans-Regular.ttf
   2.100 +last-dotplot: reading alignments...
   2.101 +last-dotplot: cutting...
   2.102 +last-dotplot: reading secondary alignments...
   2.103 +last-dotplot: cutting...
   2.104 +last-dotplot: sorting...
   2.105 +last-dotplot: chr16	722428	722568
   2.106 +last-dotplot: chr19	1383855	1383997
   2.107 +last-dotplot: chr19	1387752	1387902
   2.108 +last-dotplot: chr19	1388468	1388648
   2.109 +last-dotplot: chr19	1388774	1388993
   2.110 +last-dotplot: chr19	1390800	1391218
   2.111 +last-dotplot: chr19	1393185	1393386
   2.112 +last-dotplot: chr19	1395332	1395539
   2.113 +last-dotplot: chr19	17615375	17615506
   2.114 +last-dotplot: chr19	18430504	18430643
   2.115 +last-dotplot: chr19	47072146	47072292
   2.116 +last-dotplot: chr8	76840803	76840964
   2.117 +last-dotplot: chr8	98433206	98433346
   2.118 +last-dotplot: chr20	4034092	4034223
   2.119 +last-dotplot: chr20	17684689	17684818
   2.120 +last-dotplot: chr4	3839007	3839138
   2.121 +last-dotplot: chr4	54783649	54783795
   2.122 +last-dotplot: chr12	19357480	19357609
   2.123 +last-dotplot: chr12	71544931	71545080
   2.124 +last-dotplot: chr18	8561153	8561300
   2.125 +last-dotplot: chr18	55335037	55335168
   2.126 +last-dotplot: chr7	65260251	65260382
   2.127 +last-dotplot: chr7	100370541	100370670
   2.128 +last-dotplot: chr7	101590324	101590475
   2.129 +last-dotplot: chr7	101723190	101723341
   2.130 +last-dotplot: chr7	157969468	157969600
   2.131 +last-dotplot: chr13	113342160	113342289
   2.132 +last-dotplot: chr17	19079554	19079683
   2.133 +last-dotplot: chr17	19172395	19172524
   2.134 +last-dotplot: chr17	19205736	19205865
   2.135 +last-dotplot: chr17	27793584	27793713
   2.136 +last-dotplot: chr17	28925874	28926010
   2.137 +last-dotplot: chr17	29190014	29190143
   2.138 +last-dotplot: chr17	58670435	58670564
   2.139 +last-dotplot: chr22	20726533	20726672
   2.140 +last-dotplot: chr22	23657435	23657564
   2.141 +last-dotplot: chr22	46458745	46458877
   2.142 +last-dotplot: chr6	1842776	1842905
   2.143 +last-dotplot: chr6	65786046	65786179
   2.144 +last-dotplot: chr6	170257646	170257782
   2.145 +last-dotplot: chr5	4867370	4867499
   2.146 +last-dotplot: chr5	74376522	74376651
   2.147 +last-dotplot: chr5	93489487	93489619
   2.148 +last-dotplot: chr5	169763560	169763699
   2.149 +last-dotplot: chr5	171574399	171574528
   2.150 +last-dotplot: chr5	173701144	173701277
   2.151 +last-dotplot: chr5	177958486	177958619
   2.152 +last-dotplot: chr1	21590575	21590737
   2.153 +last-dotplot: chr1	145869962	145870091
   2.154 +last-dotplot: chr1	155997818	155997968
   2.155 +last-dotplot: chr1	161050850	161050998
   2.156 +last-dotplot: chr11	67464091	67464224
   2.157 +last-dotplot: chr14	80332074	80332211
   2.158 +last-dotplot: chr14	104715617	104715758
   2.159 +last-dotplot: chr3	23607501	23607634
   2.160 +last-dotplot: chr3	33026569	33026703
   2.161 +last-dotplot: chr3	37588321	37588469
   2.162 +last-dotplot: chr3	89815424	89815553
   2.163 +last-dotplot: chr3	127741320	127741457
   2.164 +last-dotplot: chr3	130609353	130609489
   2.165 +last-dotplot: chr3	152862838	152862975
   2.166 +last-dotplot: chr3	186865596	186865727
   2.167 +last-dotplot: chr2	192414407	192414544
   2.168 +last-dotplot: chr2	240456576	240456711
   2.169 +last-dotplot: chr15	45614694	45614828
   2.170 +last-dotplot: chr15	78230430	78230565
   2.171 +last-dotplot: chr10	122812979	122813115
   2.172 +last-dotplot: chr10	124281339	124281469
   2.173 +last-dotplot: chr10	126932814	126932965
   2.174 +last-dotplot: chr21	14291125	14291264
   2.175 +last-dotplot: chr21	43027879	43028008
   2.176 +last-dotplot: chrX	39928361	39928490
   2.177 +last-dotplot: chrX	83302546	83302675
   2.178 +last-dotplot: 
   2.179 +last-dotplot: 102	0	699
   2.180 +last-dotplot: 
   2.181 +last-dotplot: choosing bp per pixel...
   2.182 +last-dotplot: choosing bp per pixel...
   2.183 +last-dotplot: bp per pixel = 24
   2.184 +last-dotplot: width:  619
   2.185 +last-dotplot: height: 30
   2.186 +last-dotplot: processing alignments...
   2.187 +last-dotplot: reading annotations...
   2.188 +last-dotplot: drawing...
   2.189 +3953352818 1272
   2.190 +
   2.191 +TEST -v --sort2=3 bs100.maf
   2.192 +last-dotplot: font: /usr/share/fonts/liberation/LiberationSans-Regular.ttf
   2.193 +last-dotplot: reading alignments...
   2.194 +last-dotplot: cutting...
   2.195 +last-dotplot: reading secondary alignments...
   2.196 +last-dotplot: cutting...
   2.197 +last-dotplot: sorting...
   2.198 +last-dotplot: chrM	0	16571
   2.199 +last-dotplot: 
   2.200 +last-dotplot: 55	0	87
   2.201 +last-dotplot: 21	0	87
   2.202 +last-dotplot: 95	0	87
   2.203 +last-dotplot: 7	0	87
   2.204 +last-dotplot: 16	0	87
   2.205 +last-dotplot: 97	0	87
   2.206 +last-dotplot: 88	0	87
   2.207 +last-dotplot: 28	0	87
   2.208 +last-dotplot: 25	0	87
   2.209 +last-dotplot: 13	0	87
   2.210 +last-dotplot: 1	0	87
   2.211 +last-dotplot: 90	0	87
   2.212 +last-dotplot: 83	0	87
   2.213 +last-dotplot: 31	0	87
   2.214 +last-dotplot: 23	0	87
   2.215 +last-dotplot: 12	0	87
   2.216 +last-dotplot: 34	0	87
   2.217 +last-dotplot: 10	0	87
   2.218 +last-dotplot: 38	0	87
   2.219 +last-dotplot: 91	0	87
   2.220 +last-dotplot: 93	0	87
   2.221 +last-dotplot: 96	0	87
   2.222 +last-dotplot: 76	0	87
   2.223 +last-dotplot: 74	0	87
   2.224 +last-dotplot: 26	0	87
   2.225 +last-dotplot: 29	0	87
   2.226 +last-dotplot: 35	0	87
   2.227 +last-dotplot: 8	0	87
   2.228 +last-dotplot: 40	0	87
   2.229 +last-dotplot: 42	0	87
   2.230 +last-dotplot: 69	0	87
   2.231 +last-dotplot: 4	0	87
   2.232 +last-dotplot: 20	0	87
   2.233 +last-dotplot: 92	0	87
   2.234 +last-dotplot: 50	0	87
   2.235 +last-dotplot: 30	0	87
   2.236 +last-dotplot: 5	0	87
   2.237 +last-dotplot: 48	0	87
   2.238 +last-dotplot: 47	0	87
   2.239 +last-dotplot: 75	0	87
   2.240 +last-dotplot: 54	0	87
   2.241 +last-dotplot: 44	0	87
   2.242 +last-dotplot: 14	0	87
   2.243 +last-dotplot: 98	0	87
   2.244 +last-dotplot: 70	0	87
   2.245 +last-dotplot: 39	0	87
   2.246 +last-dotplot: 9	0	87
   2.247 +last-dotplot: 32	0	87
   2.248 +last-dotplot: 81	0	87
   2.249 +last-dotplot: 89	0	87
   2.250 +last-dotplot: 99	0	87
   2.251 +last-dotplot: 86	0	87
   2.252 +last-dotplot: 67	0	87
   2.253 +last-dotplot: 56	0	87
   2.254 +last-dotplot: 51	0	87
   2.255 +last-dotplot: 45	0	87
   2.256 +last-dotplot: 82	0	87
   2.257 +last-dotplot: 59	0	87
   2.258 +last-dotplot: 24	0	87
   2.259 +last-dotplot: 37	0	87
   2.260 +last-dotplot: 41	0	87
   2.261 +last-dotplot: 52	0	87
   2.262 +last-dotplot: 18	0	87
   2.263 +last-dotplot: 77	0	87
   2.264 +last-dotplot: 79	0	87
   2.265 +last-dotplot: 72	0	87
   2.266 +last-dotplot: 6	0	87
   2.267 +last-dotplot: 57	0	87
   2.268 +last-dotplot: 85	0	87
   2.269 +last-dotplot: 78	0	87
   2.270 +last-dotplot: 65	0	87
   2.271 +last-dotplot: 94	0	87
   2.272 +last-dotplot: 2	0	87
   2.273 +last-dotplot: 3	0	87
   2.274 +last-dotplot: 46	0	87
   2.275 +last-dotplot: 60	0	87
   2.276 +last-dotplot: 58	0	87
   2.277 +last-dotplot: 33	0	87
   2.278 +last-dotplot: 15	0	87
   2.279 +last-dotplot: 49	0	87
   2.280 +last-dotplot: 64	0	87
   2.281 +last-dotplot: 0	0	87
   2.282 +last-dotplot: 27	0	87
   2.283 +last-dotplot: 19	0	87
   2.284 +last-dotplot: 43	0	87
   2.285 +last-dotplot: 53	0	87
   2.286 +last-dotplot: 36	0	87
   2.287 +last-dotplot: 73	0	87
   2.288 +last-dotplot: 66	0	87
   2.289 +last-dotplot: 87	0	87
   2.290 +last-dotplot: 22	0	87
   2.291 +last-dotplot: 71	0	87
   2.292 +last-dotplot: 68	0	87
   2.293 +last-dotplot: 11	0	87
   2.294 +last-dotplot: 63	0	87
   2.295 +last-dotplot: 
   2.296 +last-dotplot: choosing bp per pixel...
   2.297 +last-dotplot: choosing bp per pixel...
   2.298 +last-dotplot: bp per pixel = 17
   2.299 +last-dotplot: width:  975
   2.300 +last-dotplot: height: 664
   2.301 +last-dotplot: processing alignments...
   2.302 +last-dotplot: reading annotations...
   2.303 +last-dotplot: drawing...
   2.304 +833292477 18662
   2.305 +
   2.306 +TEST -v -2? --sort2=0 --strands2=1 bs100.maf
   2.307 +last-dotplot: font: /usr/share/fonts/liberation/LiberationSans-Regular.ttf
   2.308 +last-dotplot: reading alignments...
   2.309 +last-dotplot: cutting...
   2.310 +last-dotplot: reading secondary alignments...
   2.311 +last-dotplot: cutting...
   2.312 +last-dotplot: sorting...
   2.313 +last-dotplot: chrM	0	1663
   2.314 +last-dotplot: chrM	4973	6206
   2.315 +last-dotplot: chrM	7868	8021
   2.316 +last-dotplot: chrM	11073	14033
   2.317 +last-dotplot: 
   2.318 +last-dotplot: 0	0	87	-
   2.319 +last-dotplot: 1	0	87	+
   2.320 +last-dotplot: 2	0	87	+
   2.321 +last-dotplot: 3	0	87	-
   2.322 +last-dotplot: 4	0	87	+
   2.323 +last-dotplot: 5	0	87	-
   2.324 +last-dotplot: 6	0	87	+
   2.325 +last-dotplot: 7	0	87	-
   2.326 +last-dotplot: 8	0	87	+
   2.327 +last-dotplot: 9	0	87	+
   2.328 +last-dotplot: 
   2.329 +last-dotplot: choosing bp per pixel...
   2.330 +last-dotplot: choosing bp per pixel...
   2.331 +last-dotplot: bp per pixel = 7
   2.332 +last-dotplot: width:  863
   2.333 +last-dotplot: height: 139
   2.334 +last-dotplot: processing alignments...
   2.335 +last-dotplot: reading annotations...
   2.336 +last-dotplot: drawing...
   2.337 +2996486939 3971
   2.338 +
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/test/last-dotplot-test.sh	Mon Mar 05 12:06:48 2018 +0900
     3.3 @@ -0,0 +1,25 @@
     3.4 +#! /bin/sh
     3.5 +
     3.6 +cd $(dirname $0)
     3.7 +
     3.8 +PATH=../scripts:$PATH
     3.9 +
    3.10 +png=/tmp/$$.png
    3.11 +
    3.12 +trap 'rm -f "$png"' EXIT
    3.13 +
    3.14 +plotSum () {
    3.15 +    echo TEST "$@"
    3.16 +    last-dotplot -s0 "$@" "$png"
    3.17 +    cksum < "$png"
    3.18 +    echo
    3.19 +}
    3.20 +
    3.21 +{
    3.22 +    plotSum 102.maf
    3.23 +    plotSum -v -x600 -c orange -r teal --sort1=2 --border-color=brown 102.maf
    3.24 +    plotSum -v -y30 --max-gap1=0 --pad=0.08 --border-pixels=2 --sort1=3 102.maf
    3.25 +    plotSum -v --sort2=3 bs100.maf
    3.26 +    plotSum -v -2'?' --sort2=0 --strands2=1 bs100.maf
    3.27 +} 2>&1 |
    3.28 +diff -u $(basename $0 .sh).out -