120 likes | 265 Views
Software Designing. Interface – user friendly (think about MSoffice) using menu, form, toolbars … as simple as possible using default setting, but allow advanced user to change the settings. language: Visual Basic, VC++, Web-Based (Microsoft .net, JavaScript), Visual Basic for Application….
E N D
Software Designing • Interface – user friendly (think about MSoffice) • using menu, form, toolbars … • as simple as possible • using default setting, but allow advanced user to change the settings. • language: Visual Basic, VC++, Web-Based (Microsoft .net, JavaScript), Visual Basic for Application…
Software Designing • Program Design • Understand your problem and get all the formulas • Try to make it extendable • Try to make it more functional • Split the job into small, independent pieces, each can be tested separately • Write each functions • Testing, Revised it, Testing …
Interval Mapping and Composite Interval Mapping Program • Language: VBA built in PowerPoint • Program Design • Interface • Simulation data • Analysis (IM, CIM) • Permutation Test • Using graphics to display profiles • Save results
IM and CIM – Interface Design • Design user forms • Drag and Drop controls into the form • Write code corresponding the controls
IM and CIM – Simulate Data • Simulate Markers • Joint probability give one marker • Random number of polynomial distribution • Simulate Trait • Joint probability of a QTL allele given two markers • Normal random number
Joint Probability Public Sub SetJointProb1(GeneticDesign As Integer) ' Set Jopint Probablity for One Point Analysis If GeneticDesign = 2 Then 'backcross jprob1(1) = 1 / 2 ‘Qq jprob1(2) = 1 / 2 ‘qq cumprob1(1) = 1 / 2 ‘cumulate probability cumprob1(2) = 1 End If If GeneticDesign = 3 Then 'F2 jprob1(1) = 1 / 4 ‘QQ jprob1(2) = 1 / 2 ‘Qq jprob1(3) = 1 / 4 ‘qq cumprob1(1) = 1 / 4 ‘cumulate probability cumprob1(2) = 3 / 4 cumprob1(3) = 1 End If End Sub
Joint Probability Public Sub SetJointProb2(r, GeneticDesign) ' Set Jopint Probablity for Two Point Analysis ' r is recomenant fraction between the two marker If GeneticDesign = 2 Then 'backcross jprob2(1, 1) = (1 - r) / 2 'Prob(Qq | Mm ) jprob2(1, 2) = r / 2 'Prob(qq | Mm ) jprob2(2, 1) = r / 2 'Prob(Qq | mm ) jprob2(2, 2) = (1 - r) / 2 'Prob(qq | mm ) cprob2(1, 1) = (1 - r) ‘cumulative probability cprob2(1, 2) = r cprob2(2, 1) = r cprob2(2, 2) = (1 - r) End If
Joint Probability Public Sub SetJointProb3(a, b, GeneticDesign As Integer) ' Set Jopint Probablity for Three Point Analysis ' a is recomenant fraction between marker1 and qtl ' b is recomenant fraction between qtl and marker2 If GeneticDesign = 2 Then 'backcross jprob3(1, 1) = (1 - a) * (1 - b) / 2 'Prob(Qq | Mm, Nn ) 2*0+0+1=1 jprob3(1, 2) = a * b / 2 'Prob(qq | Mm, Nn ) mrk=(0,0) jprob3(2, 1) = (1 - a) * b / 2 'Prob(Qq | Mm, nn )2*0+1+1=2 jprob3(2, 2) = a * (1 - b) / 2 'Prob(qq | Mm, nn ) mrk=(0,1) jprob3(3, 1) = a * (1 - b) / 2 'Prob(Qq | mm, Nn ) 2*1+0+1=3 jprob3(3, 2) = (1 - a) * b / 2 'Prob(qq | mm, Nn ) mrk=(1,0) jprob3(4, 1) = a * b / 2 'Prob(Qq | mm, nn ) 2*1+1+1=4 jprob3(4, 2) = (1 - a) * (1 - b) / 2 'Prob(qq | mm, nn ) mrk=(1,1)
Simulate Markers Public Sub simulatemarkerandtrait(ByVal N, ByVal cumdist As String, ByVal smu As String, ByVal s2, ByVal qtl, ByVal GeneticDesign As Integer, ByVal MapFunction As Integer) chrom = Split(trimemptyline(cumdist), VBA.Chr(13) + VBA.Chr(10)) qtls = Split(trimemptyline(qtl), VBA.Chr(13) + VBA.Chr(10)) numofchroms = UBound(chrom) + 1 ………………. Subroutines called in this simulation program • trimemptyline • SetJointProb1, SetJointProb2, SetJointProb3 • splitmutoeffect • SGNC: random normal See the real code.
Analysis - CIM Subroutines used: • trimemptyline • SetJointProb1, SetJointProb2, SetJointProb3 • formXmatrix: form control matrix X based on ControlMethod • matrixprod: A’*B • truematrixprod: A*B • SAMIDS: inverse of A and determinant of A See the real code.
L(y,M|) = i=1n k=1g [k|ifk(yi)] log L(y,M|) = i=1n log[k=1gk|ifk(yi)] g=2 for BC, 3 for F2 fk(yi) = 1/[(2)½]exp[-½(y-k)2], k= gk+XiB k=1,…,g k|i= k|if1(yi)/[k=1gk|if1(yi)] (1) B = k=1gk(X´X)-1X´(Y- gk) (2) gk = i=1nk|i(yi-XiB)/ i=1nk|i (3) 2 = 1/n i=1n k=1gk|i(yi-XiB - gk )2 (4) Y = {yi}nx1, k= {k|i}nx1
Save to Word File Private Sub CommandButton3_Click() Dim tmp As Long Dim wap As Word.Application Set wap = New Word.Application wap.Visible = False wap.Documents.Open VBA.CurDir$ + "\CIMRes.doc" tmp = wap.Documents("CIMRes.doc").Range().End wap.Documents("CIMRes.doc").Range(tmp - 1, tmp - 1).InsertBreak (wdPageBreak) tmp = wap.Documents("CIMRes.doc").Range().End wap.Documents("CIMRes.doc").Range(tmp - 1, tmp - 1) = gettruepars Slide24.Shapes("Object 6").OLEFormat.Object.Application.Chart.ChartArea.Copy tmp = wap.Documents("CIMRes.doc").Range().End wap.Documents("CIMRes.doc").Range(tmp - 1, tmp - 1).Paste wap.Documents("CIMRes.doc").Save wap.Documents("CIMRes.doc").Close Set wap = Nothing End Sub