funded by 
From each karyotype, the objects for structural aberrations and for quantitative aberrations are queried. They are added into collections of structural aberrations and quantitative aberrations for all cases.
After looping through the array, from the above collections the object containing the aberrations on a per band level are queried at the requested resolution. This is quite a slow step, and hence we did not collect the data with this type of object while looping through the array, but with the considerably faster objects for structural and quantitative aberrations.
Next, the object representing aberrations on a per base level is passed into the appropriate function of the CyDASGraphics class and the bitmap returned is shown on a form in a panel.
'a bitmap which will store the result Dim oBitmap As System.Drawing.Bitmap
'the array with the textual descriptions of the (polyclonal) karyotypes Dim aKaryotypes As String() 'a Karyotypes object to be initialised with each polyclonal karyotype Dim cKaryotypes As Karyotypes 'the Karyotype object for the composite Karyotype Dim cKaryotype As Karyotype 'the QuantitativeAberrations object for the quantitative aberrations of all cases 'we can initialise it here Dim cQuantitativeAberrations As QuantitativeAberrations = New QuantitativeAberrations() 'the QualitativeAberrations object for the structural aberrations of all cases 'we can initialise it here Dim cQualitativeAberrations As QualitativeAberrations = New QualitativeAberrations() 'the GainsLossesStructs object which will contain the aberrations on a per band level 'at 400 bphs for all cases 'its initialistaion with the resolution causes an ordered set of all bands at that resolution 'to be calculated, thus enhancing later performance Dim cGainsLossesStructs as GainsLossesStructs = New GainsLossesStructs(Band.eResolutionLevel.Resolution400Bands) 'a counter variable Dim i As Integer
For i = 0 to aKaryotypes.Length - 1 'initialise a Karyotypes object cKaryotypes = New Karyotypes(aKaryotypes(i)) 'get the composite karyotype for analysis oKaryotype = cKaryotypes.getCompositeKaryotype 'get the quantitative aberrations from it and it to the collection of 'quantitative aberrations for all cases cQuantitativeAberrations.addRange(oKaryotype.getQuantitativeAberrations) 'get the qualitative aberrations from it and it to the collection of 'qualitative aberrations for all cases cQualitativeAberrations.addRange(oKaryotype.getQualitativeAberrations) Next
'get aberrations per bands from Quantitative aberration and 'add it to the collection object cGainsLossesStructs.addRange(cQuantitativeAberrations.getGainsLossesStructs(Band.eResolutionLevel.Resolution400Bands)) 'get aberrations per bands from Qualitative aberration and 'add it to the collection object cGainsLossesStructs.addRange(cQualitativeAberrations.getGainsLossesStructs(Band.eResolutionLevel.Resolution400Bands))
mBitmap = CyDASGraphics.drawGainsAndLossesForAllChromosomes(cGainsLossesStructs)
mBitmap = CyDASGraphics.drawStructsForAllChromosomes(cGainsLossesStructs)The bitmap may be bigger than the panel on which it is to be drawn, hence the size of that panel is adjusted. The form should have the Autoscroll property set to true, so the user can scroll and see all of the bitmap.
'the size of the Panel is adjusted to the size of the bitmap 'that may cause scroll bars on the form Panel1.Height = mBitmap.Height Panel1.Width = mBitmap.Width 'make the panel draw the result Panel1.Refresh()For a nice look, we have to tell the panel with the bitmap what to when it is refreshed:
Private Sub Panel1_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Panel1.Paint 'we must redraw the bitmap at the paint event, else it may be displayed wrongly If Not mBitmap Is Nothing Then Dim oGraphics As Graphics = Panel1.CreateGraphics oGraphics.DrawImage(mBitmap, 0, 0) End If End Sub