-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCube.pas
650 lines (492 loc) · 28 KB
/
Cube.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
UNIT Cube;
{==================================================================================================
Heracle BioSoft SRL
2016.11.01
Object capabilities:
+ AsmGrid capabilities (Contig, Neighbours, ContigQuality)
+ Visual capabilities (Colors)
+ QV graph
Object tree:
* CubeBase -> CubeBaseQV -> CubeBaseSNP -> CubeImporter -> Cube -> CubeStream
==================================================================================================}
INTERFACE
USES
Winapi.Windows, System.SysUtils, System.Classes, Vcl.Graphics,
ccCore, ccINIFile, CubeImporter, CubicDNA, clRamLog, ccRichLog;
TYPE
TCubeObj = class(TCubeImport)
private
FColorBkg : TColor; { Color for normal cells (cells that are neither vectors (blue), erros (red), etc. This will give the overal color of the grid }
FSolvedBkg : TColor;
FAutoContigColor : TColor;
FColorESolvedGray: TColor; { The color for solved background when it overlaps with Gray cell }
FRainbowText : TColor; { Color of the text in rainbow mode }
FRainbowBkg : Boolean;
FAsmOffset : Integer; { AsmGridOffset = Offset in AsmGrid. Indexed in 0. The TContigGrid will have to add 1 to this value, because on the position 0, it has the header. The AsmGrid don't have to add 1 because it is also indexed in 0. }
procedure setColorBkg(const Value: TColor);
procedure setSolvedBkg(const Value: TColor);
protected
function getFileName: string; override;
function getBaseColor(Base: TBase): TColor;
procedure setAsmOffset(Value: Integer);
public
{VISUAL/GRID RELATED}
ColorEErrorB : TColor;
ColorBookmarkB : TColor;
FontColor : TColor; { Font color for any text (other than ACGTN-) }
FBookmarkT : TColor;
BaseColorC : Tcolor; { bases }
BaseColorG : Tcolor; { bases }
BaseColorA : Tcolor; { bases }
BaseColorT : Tcolor; { bases }
BaseColorN : Tcolor; { bases }
BaseColorGap : Tcolor; { bases }
ColorSelectedB : Tcolor; { Selection }
HighlightLowQV : Boolean; { Color bases with low QV in orange }
HilightIUPACs : Boolean; { Highlight IUPAC bases in Pink }
HilightMismat : Boolean; { Show mismatches in red in contig and in deep purple in reference. The input sequences will not be affected }
{ASM RELATED}
IsContig : Boolean; { True if this Cube is the output (contig) of the assembly process. False for all input sequences. }
IsReference : Boolean; { True if this cube is a reference seq (need for: highlight reference in special color) }
{VECINI}
VeciniList : TList;
VeciniDepleated : Boolean; { arata daca am clasat toti vecinii acestui obiect } { used by TAsmJobAbst.ClassifyObjectsRecursiv }
ContigClass : TBase; { arata din ce contig face parte aceasta secventa }
Assembled : Boolean; { True if this sequence was incorpored/assembled into the contig }
{INIT}
constructor Create(aLog: TRamLog);
destructor Destroy; override;
procedure Clear; override;
procedure ClearSampleForReasembly;
function GetDirection (CONST DirectionChrPos: Integer): Char; { Determines the orientation of the sequence (Forward/Rev) based on its file name }
{VECINI}
function vGetAllNeighbors: string; { intoarce toti vecinii acestui obiect, ca sir, separati cu virgula }
function vGetShortNameOf(VecinPoz: integer): string;
procedure vAddVecin (Vecin: TCubeObj);
procedure vDeleteVecin (PozVecinuluiInLista: integer);
function vGetPtr2Vecin (IndexInLista: integer): TCubeObj; { pointer catre un cub }
{COLORS}
procedure ComputeColors; { Compute all colors for this object }
procedure ComputeColorB(CONST BasePos: Integer);
procedure ComputeColorT(CONST BasePos: Integer);
property ColorBkg : TColor read FColorBkg write setColorBkg; { Color for normal cells (cells that are neither vectors (blue), erros (red), etc. This will give the overal color of the grid }
property ColorSolvedBkg: TColor read FSolvedBkg write setSolvedBkg; { Background color for 'solved' mismatches }
function CellHasLowQV(CONST BasePos: integer): Boolean; { Returns true if the base has the QV under the 'EngTrim1.GoodQVTresh' threshold }
property RainbowTextClr : TColor read FRainbowText Write FRainbowText default clOrange; { Color of the text in rainbow mode }
property RainbowBkg : Boolean read FRainbowBkg Write FRainbowBkg default FALSE; { Cell background is colorful (it represents the ACGT colors) or it represents useful information (errors, mismatch points, low QV bases, etc) }
property ColorBookmarkT : TColor read FBookmarkT Write FBookmarkT default clWhite;
function BuildQVGraph(ChromaWidth, ChromaHeight: Integer): TBitmap; { QV graph. Shows the quality of the sequence }
{CONTIG RELATED}
function ContigNrOfBases: Integer; { The contig may contain dots. This count the bases without dots }
function ContigCount : Integer; { Returns the number of subcontigs (if the contig contains multiple subcontigs) }
function ContigStarts : Integer; { The contig may contain dots. Returns the position of the first base that is not dot }
function ContigEnds : Integer; { The contig may contain dots. Returns the position of the last base that is not dot }
function ContigBases(InsertAds: Boolean) : BaseString; { Returns the bases from which the contig is made, without the dots itmay hace at its ends. The dots in the middle (in case of multicontig) are not removed! }
function MismatchesPercent: Extended;
function MismatchesTotal: Integer; { Returns number of mismatches. The mismatches in the gray area (low quality ends) ARE ALSO counted. }
function Mismatches : Integer; { Returns number of mismatches. The mismatches in the gray area (low quality ends) ARE NOT counted. }
{ASM RELATED}
function AsmEnd : Integer; { GridEnd= Grid.AsmOffset + NrOfBases. It refers to position in AsmJob; so the numeber returned represents an AsmGrid value not a Cub value }
property AsmOffset : Integer read FAsmOffset Write setAsmOffset default 0; { AsmGridOffset = Offset of this seq in the assembly grid/display. Indexed in 0. The TContigGrid will have to add 1 to this value, because on the position 0, it has the header. The AsmGrid don't have to add 1 because it is also indexed in 0. }
end;
IMPLEMENTATION
uses CubeBase, cmMath, cGraphUtil, VectorProcessing;
{===============================================================================
CONSTRUCTOR / DESTRUCTOR
===============================================================================}
constructor TCubeObj.Create(alog: TRamLog);
begin
inherited Create(aLog); { about inherited: https://forums.codegear.com/thread.jspa?threadID=10046 } { Should I call "inherited" in the constructor of a class derived from TObject or TPersistent? Yes. It does nothing, true, but it's harmless. I think there is value in being consistent about always calling the inherited constructor, without checking to see if there is, in fact, an implementation. Some will say that it's worth calling inherited Create because Embarcadero might add an implementation for TObject.Create in the future, but I doubt this is true; it would break existing code which does not call inherited Create. Still, I think it is a good idea to call it for the reason of consistency alNone. }
VeciniList := TList.Create;
FRainbowText := clOrange; { Color of the text in rainbow mode }
BaseColorC := CubicDNA.BaseColorC; {BASE COLOR}
BaseColorG := CubicDNA.BaseColorG;
BaseColorA := CubicDNA.BaseColorA;
BaseColorT := CubicDNA.BaseColorT;
BaseColorN := CubicDNA.BaseColorN;
BaseColorGap := CubicDNA.BaseColorGap;
ColorEErrorB := CellColorErrorB; { Error Color Bkg }
ColorSolvedBkg := CellColorSolvedB; { Error Color Bkg }
ColorSelectedB := CellColorSelectedB; { Selected }
ColorBookmarkB := CellColorBookmarkB;
ColorBookmarkT := CellColorBookmarkT;
ColorBkg := CellColorBkg; { or is better clBtnFace ? } { Color for normal cells (cells that are neither vectors (blue), erros (red), etc. This will give the overal color of the grid }
FontColor := CellFontColor; { Font color for any text (other than ACGTN-) }
FRainbowBkg := FALSE;
IsReference := FALSE;
IsContig := FALSE;
{OTHER COLORS}
HighlightLowQV := TRUE; { Color bases with low QV in orange }
HilightMismat := TRUE;
HilightIUPACs := TRUE;
end;
{ Apelez Clear cand:
* creez un cub abstract (TCubeBase, TCubeImport, TCubObj), atunci apelez Clear imediat dupa Create.
* creez un cubpersistent (TCubObjEx), atunci apelez Clear cand dau LoadFromFile sau Assign (daca o sa implementez vreodata Assign). }
destructor TCubeObj.Destroy;
begin
FreeAndNil(VeciniList);
inherited;
end;
procedure TCubeObj.Clear;
begin
inherited Clear;
{ FOR GRID }
FAsmOffset := 0; { deplasamentul in Grid }
IsReference := FALSE;
{ VECINI }
Assembled := FALSE;
VeciniList.Clear;
VeciniDepleated := FALSE; { arata daca am clasat toti vecinii acestui obiect }
ContigClass := '?'; { arata din ce contig face parte aceasta secventa }
end;
procedure TCubeObj.ClearSampleForReasembly; {Nu pot sa apelez pru si simple 'Clear' caci asta ar face secventa invalida. Numai unele campuri trebuiesc resetate }
begin
AsmOffset:= 0;
VeciniDepleated:= FALSE;
VeciniList.Clear;
ContigClass:= '?';
Assembled:= FALSE;
{ REMOVE ALL GAPS } { Cris a zis ca trebuie sa scoata si GAP-urile inainte sa bage secventele din nou in asamblare din cauza ca gap-ul fute algoritmul de asamblare }
RemoveAllGaps;
end;
function TCubeObj.getFileName: string; { The contig does not have a 'FileName' because it is not an input file (it is not loaded from disk) }
begin
Result:= inherited;
{del Verification
if IsContig then RAISE Exception.Create('Contig name cannot be accessed via FileName! Use AsmJob.ContigFullName instead.'); }
end;
function TCubeObj.GetDirection(CONST DirectionChrPos: Integer): Char; { Determines the orientation of the sequence (Forward/Rev) based on its file name }
begin
if DirectionChrPos= 0
then raise Exception.Create('Invalid orientation parameters!');
if DirectionChrPos <= Length(ScreenName)
then
begin
Result:= upcase(ScreenName[DirectionChrPos]);
if (Result<> 'F') AND (Result<> 'R')
then Result:= '?';
end
else Result:= '?';
end;
{===============================================================================
- VECINI -
================================================================================}
procedure TCubeObj.vAddVecin(Vecin: TCubeObj);
Begin
VeciniList.Add(Vecin); { ADD VECIN }
// Assembled:= (VeciniList.Count <= 0); { RAHAT !!!! Mai trebuie asta? se pare ca nu }
end;
procedure TCubeObj.vDeleteVecin(PozVecinuluiInLista: integer);
Begin
VeciniList.Delete(PozVecinuluiInLista);
// Assembled:= (VeciniList.Count <= 0);
end;
function TCubeObj.vGetPtr2Vecin(IndexInLista: integer): TCubeObj;
Begin
Result:= VeciniList[IndexInLista];
end;
function TCubeObj.vGetShortNameOf(VecinPoz: integer): string; { Screen name }
begin
Result:= TCubeObj(VeciniList[VecinPoz]).ScreenName;
end;
function TCubeObj.vGetAllNeighbors: string;
VAR i: Integer;
begin
Result:= '';
for i:= 0 TO VeciniList.Count-1 DO
Result:= Result+ TCubeObj(VeciniList[i]).ScreenName+ ', ';
if Length(Result)> 1
then Result:= system.COPY(Result, 1, Length(Result)-2); { Remove the last character (which is ', ') }
end;
{--------------------------------------------------------------------------------------------------
COMPUTE COLOR
--------------------------------------------------------------------------------------------------}
procedure TCubeObj.computeColorB(CONST BasePos: Integer); { Background color }
begin
if RainbowBkg
then CellColorB[BasePos]:= GetBaseColor(Base[BasePos])
else
{ BOOKMARK }
if CellBookmark[BasePos] { PRIORITATE MAXIMA }
then CellColorB[BasePos]:= ColorBookmarkB
else
{ VECTOR }
if CellHasVector[BasePos] AND VectorShow
then
if CellTrimmed[BasePos]
then CellColorB[BasePos]:= MixColors(VectorColor, CellColorDisabled, 90) { mix between vector and gray areas }
else CellColorB[BasePos]:= VectorColor
else
{ MISMATCH }
if HilightMismat AND (CellMism[BasePos]= msMisSolved)
then
if CellTrimmed[BasePos]
then CellColorB[BasePos]:= FColorESolvedGray { combinatie intre solved si zone gri }
else CellColorB[BasePos]:= ColorSolvedBkg
else
{ MISMATCH UNSOLVED }
if HilightMismat AND (CellMism[BasePos]= msMisUnsolved)
then
if isReference { error in Reference }
then CellColorB[BasePos]:= ReferenceSnpMims { REFERENCE MUTATION ! }
else CellColorB[BasePos]:= ColorEErrorB
else
{ GRAY ENDS }
if CellTrimmed[BasePos]
then
if isReference
then CellColorB[BasePos]:= ReferenceLowQV { combinatie intre referinta si zone gri }
else CellColorB[BasePos]:= CellColorDisabled
else
{ MUTATION SNP }
if HilightIUPACs
AND CellIsIUPAC(BasePos)
then CellColorB[BasePos]:= CellColorSNP
else
{ MUTATION CONTIG INDEL }
if HilightIUPACs
AND CellIsMutIndel(BasePos)
then CellColorB[BasePos]:= CellClrMutIndel
else
{ MUTATION CONTIG DIFFERENCE }
if HilightIUPACs AND CellIsMutDiff(BasePos)
then CellColorB[BasePos]:= CellClrMutDiff
else
{ LOW QV }
if CellHasLowQV(BasePos) AND HighlightLowQV
then CellColorB[BasePos]:= CellColorLowQv
else
{ REFERENCE }
if IsReference
then CellColorB[BasePos]:= ReferenceCol
else
{ CONTIG }
if IsContig { CONTIG }
then CellColorB[BasePos]:= FAutoContigColor
else CellColorB[BasePos]:= ColorBkg; { Fundal } { Culoarea celulei = culoarea Grid-ului }
end;
{ FONT COLOR }
procedure TCubeObj.computeColorT(CONST BasePos: Integer);
begin
if CellBookmark[BasePos]
then CellColorT[BasePos]:= ColorBookmarkT
else
if RainbowBkg
then CellColorT[BasePos]:= RainbowTextClr
else
if HilightIUPACs
AND CellIsMutant(BasePos)
then CellColorT[BasePos]:= clBlack { Print SNP in black so it will be more visible on the pink background }
else CellColorT[BasePos]:= GetBaseColor(Base[BasePos]); { Normal colors }
end;
procedure TCubeObj.ComputeColors; { Compute all colors for this object. Used in: TContigGrid.AssignCub, TContigGrid.ReLoadCub }
VAR cl: Integer;
begin
for cl:= 1 to NoOfBases DO
begin
ComputeColorB(cl); { COMPUTE BKG COLOR }
ComputeColorT(cl); { COMPUTE FONT COLOR }
end;
end;
procedure TCubeObj.setColorBkg(const Value: TColor);
VAR
R,G,B: byte;
begin
FColorBkg:= Value;
{ Make contig bkg color a bit bluish than standard color } { This makes sense only if this cube is a contig }
SplitColor2RGB(FColorBkg, R,G,B);
if R < 12
then R:= 0
else R:= R- 12;
if G < 12
then G:= 0
else G:= G- 12;
if B > 243
then B:= 255
else B:= B+ 18;
FAutoContigColor:= RGB(R,G,B); {Culoare liniei contigului. E obtinuta automat din culoarea backgroundului Grid-ului }
end;
procedure TCubeObj.setSolvedBkg(const Value: TColor);
begin
FSolvedBkg := Value;
FColorESolvedGray:= DarkenColor(FSolvedBkg, 80); {set this al 80% of FSolvedBkg }
end;
function TCubeObj.GetBaseColor(Base: TBase): TColor; {Return the corresponding color for the A, C, G, T and N bases }
begin
case UpCase(Base) of
'C': Result:= BaseColorC;
'G': Result:= BaseColorG;
'A': Result:= BaseColorA;
'T': Result:= BaseColorT;
'N': Result:= BaseColorN;
Gap: Result:= BaseColorGap;
else
Result:= clGray; {orice alta baza care nu e C,G,A,T,GAP - de exemplu bazele ambigue cum ar fi W,S,M... }
end;
end;
{--------------------------------------------------------------------------------------------------
OTHERS
--------------------------------------------------------------------------------------------------}
function TCubeObj.CellHasLowQV(CONST BasePos: integer): Boolean; { Returns true if the base has the QV under the 'EngTrim1.GoodQVTresh' threshold }
begin
Result:=
((Base[BasePos]= 'N') AND NOT CellTrimmed[BasePos])
OR
(QVExist
AND (CellQV[BasePos] < EngTrim1.GoodQVTresh)
AND (NOT CellTrimmed[BasePos])); { daca celula asta e deja in zona Gri atunci nu are ros sa o mai pun cu rosu }
end;
function TCubeObj.AsmEnd: Integer; { Returns the position of the last base in AsmJob. It refers to position in AsmJob; so the number returned represents an AsmGrid value not a Cub value }
begin
Result:= AsmOffset+ NoOfBases- 1; { -1 because in cub bases are indexed in 1 but in AsmGrid they are indexed in 0 }
end;
procedure TCubeObj.setAsmOffset(Value: Integer); { AsmGridOffset = Offset in AsmGrid. Indexed in 0. The TContigGrid will have to add 1 to this value, because on the position 0, it has the header. The AsmGrid i don't have to add 1 because it is also indexed in 0. }
begin
FAsmOffset:= Value;
end;
{--------------------------------------------------------------------------------------------------
CONTIG
--------------------------------------------------------------------------------------------------}
function TCubeObj.ContigCount: Integer; { Returns the number of subcontigs (if the contig contains multiple subcontigs) }
VAR
sBases, AllBases: BaseString;
i: Integer;
begin
Result:= 0;
sBases:= '';
AllBases:= Bases;
for i:= 1 to Length(AllBases) DO
begin
{ Build sub-contig }
if AllBases[i]<> noCntgBase
then sBases:= sBases+ AllBases[i];
{ Save sub-contig }
if (sBases> '')
AND ((AllBases[i]= noCntgBase) OR (i= Length(AllBases)))
then
begin
sBases:= '';
inc(Result);
end;
end;
end;
{ Returns the contig.
Gaps : removed
Recognition sequences : removed (based on project settings)
Dots at the end : removed
Dots in the middle : not removed (multi contig case)
Ads : inserted as specified }
function TCubeObj.ContigBases(InsertAds: Boolean): BaseString;
VAR i: Integer;
begin
Assert(IsContig);
Result:= '';
for i:= ContigStarts to ContigEnds
DO Result:= Result+ Base[i];
{ We remove the vectors }
if Vectors.Detector<> NIL
then Result:= TVectorDetector(Vectors.Detector).CleanVectors(Result);
Result:= RemoveGaps(Result);
{ Ads }
if InsertAds
then Result:= InsertAdsOverBases(Result); { Insert ads if in DEMO mode }
end;
function TCubeObj.ContigNrOfBases: Integer; { The contig may contain dots. This count the bases without dots }
VAR i: Integer;
begin
Assert(IsContig);
Result:= 0;
for i:= 1 to NoOfBases DO
if base[i]<> noCntgBase
then inc(Result);
end;
function TCubeObj.ContigStarts: Integer; { The contig may contain dots. Returns the position of the first base that is not dot }
VAR i: Integer;
begin
Assert(IsContig);
Result:= 0;
for i:= 1 to NoOfBases DO
if base[i]<> noCntgBase then
begin
Result:= i;
Break;
end;
Assert(Result> 0);
end;
function TCubeObj.ContigEnds: Integer; { Returns the position of the last base that is not noCntgBase (dot). Indexed in 1. }
VAR i: Integer;
begin
Assert(IsContig);
Result:= 0;
for i:= NoOfBases downto 1 DO
if Base[i]<> noCntgBase then
begin
Result:= i;
Break;
end;
Assert(Result> 0);
end;
function TCubeObj.MismatchesPercent: Extended; { Percent between number of good bases and ambiguities }
begin
Result:= ProcentRepresent(Mismatches, NoOfBases);
end;
function TCubeObj.MismatchesTotal: Integer; { Returns number of mismatches. The mismatches in the gray area (low quality ends) ARE ALSO counted. }
VAR i: Integer;
begin
Result:= 0;
for i:= 1 to NoOfBases DO
if CellMism[i]= msMisUnsolved
then inc(Result);
end;
function TCubeObj.Mismatches: Integer; { Returns number of unsolved mismatches. The mismatches in the gray area (low quality ends) ARE NOT counted. }
VAR BasePos: Integer;
begin
Result:= 0;
for BasePos:= 1 TO NoOfBases-1 DO
if NOT CellTrimmed[BasePos] { nu calculez pentru cell-urile 'disabled/gri' }
AND (CellMism[BasePos]= msMisUnsolved) { ErrorBkg }
then inc(Result);
end;
{--------------------------------------------------------------------------------------------------
QV Graph
--------------------------------------------------------------------------------------------------}
function TCubeObj.BuildQVGraph(ChromaWidth, ChromaHeight: Integer): TBitmap;
VAR x: Integer;
CurBase, ScaleFactorX, ScaleFactorY: real;
begin
Assert(HasChroma, 'TCubeObjEx.BuildQVGraph - Object has no chroma');
Result:= TBitmap.Create;
ScaleFactorX:= NoOfBases / ChromaWidth;
ScaleFactorY:= 100 / ChromaHeight;
Result.Width := ChromaWidth;
Result.Height:= ChromaHeight;
{ BACKGROUND }
Result.Canvas.Brush.Color:= TColor($D0FFD0); { lime } { ChromaPasiveBkg; }
Result.Canvas.FillRect(Rect(0, 0, ChromaWidth, ChromaHeight));
{ DRAW BAD QV BACKGROUND }
Result.Canvas.Brush.Color:= BadEndsColor;
Result.Canvas.FillRect(Rect(0, 0, round(GoodQVStart / ScaleFactorX), ChromaHeight));
Result.Canvas.FillRect(Rect(round(LastGoodBase / ScaleFactorX), ChromaHeight, ChromaWidth, 0));
{ DRAW QV line }
Result.Canvas.Pen.Color:= clNavy;
Result.Canvas.MoveTo(0, ChromaHeight);
x:= 0;
CurBase:= 1;
REPEAT
Result.Canvas.LineTo(x, round(ChromaHeight- CellQV[round(CurBase)]/ScaleFactorY));
inc(x);
CurBase:= CurBase+ ScaleFactorX;
UNTIL CurBase>= NoOfBases;
end;
END.(*==========================================================================
TO IMPLEMENT IT:
verific cazul Caroline in care ultimele 2 baze erau #0 si punctau catre sample-ul 0 }
iPointer:= SCF.BaseArray[BasePos].Ptr2Smpl;
if iPointer< 1 { verific cazul Caroline in care ulimile doau baze erau #0 si punctau catre sample-ul 0 }
then if (BasePos-1> NoneAssigned)
AND (SCF.BaseArray[BasePos-1].Ptr2Smpl+1< SCF.H.NrOfSamples) { point to the next sample after the last used sample }
then iPointer:= SCF.BaseArray[BasePos-1].Ptr2Smpl+1
else iPointer:= SCF.BaseArray[BasePos-1].Ptr2Smpl;
-----------
*)