Changeset 921
- Timestamp:
- Apr 14, 2020 5:24:36 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/User Procedures/Irena/IRB1_bioSAXS.ipf
r920 r921 133 133 ING2_AddScrollControl() 134 134 IR1_UpdatePanelVersionNumber("IRB1_PDDFInterfacePanel", IRB1_PDDFInterfaceVersion,1) 135 IRB1_PDDFResetValuesToPreventStale() 135 136 endif 136 137 end … … 1561 1562 Button CalcRgAndMolecularWeight,pos={310,180},size={170,20}, proc=IRB1_PDDFButtonProc,title="Fit Rg and calculate MW", help={"Calculate Dmax on these data"} 1562 1563 TitleBox PDDFInstructions1 title="\Zr120SAXSMoW2 & Rambo-Tainer Qmax : ",size={230,15},pos={270,220},frame=0,fColor=(0,0,65535),labelBack=0 1563 checkbox RamboTainerQmax8overRg, pos={270,250}, title="Qmax 8/Rg?", size={76,14},proc=IRB1_PDDFCheckProc, variable=root:Packages:Irena:PDDFInterface:RamboTainerQmax8overRg, mode=0, help={"Set Qmax to 8/Rg automatically"}1564 checkbox RamboTainerQmaxLog225, pos={400,250}, title="Qmax I(0)/200?", size={76,14},proc=IRB1_PDDFCheckProc, variable=root:Packages:Irena:PDDFInterface:RamboTainerQmaxLog225, mode=0, help={"Set Qmax to Q when I(0)/200"}1565 SetVariable RamboTainerQmax,pos={270,275},size={250,18}, bodyWidth=90, proc=IRB1_PDDFSetVarProc,title="Qmax = ", variable=root:Packages:Irena:PDDFInterface:RamboTainerQmax, limits={0.01,1,0.1},frame=1,bodyWidth=90, help={"Qmax to use"}, format="%4.2f"1564 checkbox InvariantCalcQmax8overRg, pos={270,250}, title="Qmax 8/Rg?", size={76,14},proc=IRB1_PDDFCheckProc, variable=root:Packages:Irena:PDDFInterface:InvariantCalcQmax8overRg, mode=0, help={"Set Qmax to 8/Rg automatically"} 1565 checkbox InvariantCalcQmaxLog225, pos={400,250}, title="Qmax I(0)/200?", size={76,14},proc=IRB1_PDDFCheckProc, variable=root:Packages:Irena:PDDFInterface:InvariantCalcQmaxLog225, mode=0, help={"Set Qmax to Q when I(0)/200"} 1566 SetVariable InvariantCalcQmax,pos={270,275},size={250,18}, bodyWidth=90, proc=IRB1_PDDFSetVarProc,title="Qmax = ", variable=root:Packages:Irena:PDDFInterface:InvariantCalcQmax, limits={0.01,1,0.01},frame=1,bodyWidth=90, help={"Qmax to use"}, format="%4.2f" 1566 1567 1567 1568 TitleBox PDDFInstructions11 title="\Zr120Rambo-Tainer Background : ",size={230,15},pos={270,310},frame=0,fColor=(0,0,65535),labelBack=0 … … 1574 1575 TitleBox PDDFInstructions2 title="\Zr100Remember - this Estimate requires Absolute Intensity!",size={330,15},pos={270,435},frame=0,fColor=(0,0,65535),labelBack=0 1575 1576 1576 1577 1577 //Below, at the end... 1578 1579 //GNOM calculated results 1580 TitleBox PDDFInstructions21 title="\Zr120Results :",size={330,15},pos={270,475},frame=0,fColor=(0,0,65535),labelBack=0 1581 SetVariable MWTrueVolumeA3,pos={400,475},size={250,15}, noproc,title="Porod Volume [A^3] = ", variable=root:Packages:Irena:PDDFInterface:MWTrueVolumeA3, noedit=1,limits={0,inf,0},frame=0, help={"True Volume of protein in [cm3] "} 1582 1583 SetVariable ReciprocalSpaceI0,pos={260,500},size={200,15}, noproc,title="Reciprocal Space I0 = ", variable=root:Packages:Irena:PDDFInterface:ReciprocalSpaceI0, noedit=1,limits={0,inf,0},frame=0,size={180,17}, bodyWidth=70, help={"Porod Invariant calcualtion result"}, format="%4.2f" 1584 SetVariable ReciprocalSpaceRg,pos={470,500},size={120,17},bodyWidth=70, noproc,title="Rg [A] = ", variable=root:Packages:Irena:PDDFInterface:ReciprocalSpaceRg, noedit=1,limits={0,inf,0},frame=0, help={"Density of protein, user changeable, in g/cm3"}, format="%4.2f" 1578 TitleBox PDDFInstructions21 title="\Zr140Mol Weight results:",size={250,15},pos={350,460},frame=0,fColor=(0,0,65535),labelBack=0 1579 TitleBox PDDFInstructions23 title="\Zr110Reciprocal space (Guinier fit):",size={330,15},pos={270,480},frame=0,fColor=(0,0,65535),labelBack=0 1580 SetVariable ReciprocalPorodVolumeA3,pos={290,500},size={100,15}, format="%4.0f",bodyWidth=50, noproc,title="Vol [A^3] = ", variable=root:Packages:Irena:PDDFInterface:ReciprocalPorodVolumeA3, noedit=1,limits={0,inf,0},frame=0, help={"True Volume of protein in [cm3] "} 1581 SetVariable ReciprocalSpaceI0,pos={350,500},size={120,15},bodyWidth=50, noproc,title="I0 = ", variable=root:Packages:Irena:PDDFInterface:ReciprocalSpaceI0, noedit=1,limits={0,inf,0},frame=0,size={180,17}, bodyWidth=70, help={"Porod Invariant calcualtion result"}, format="%4.2f" 1582 SetVariable ReciprocalSpaceRg,pos={480,500},size={120,17},bodyWidth=50, noproc,title="Rg [A] = ", variable=root:Packages:Irena:PDDFInterface:ReciprocalSpaceRg, noedit=1,limits={0,inf,0},frame=0, help={"Density of protein, user changeable, in g/cm3"}, format="%4.2f" 1585 1583 SetVariable SAXSMoW2MWRecSpacekDa,pos={300,520},size={250,15},bodyWidth=70, noproc,title="SAXSMoW2 MW [kDa] = ", variable=root:Packages:Irena:PDDFInterface:SAXSMoW2MWRecSpacekDa, noedit=1,fstyle=1, fsize=13, limits={0,inf,0},frame=0, help={"Molecular weight calculated from SAXSMoW2 method in kDa"}, fColor=(52428,1,1), format="%8.2f" 1586 SetVariable RamboTainerMW,pos={300,545},size={250,15},bodyWidth=70, noproc,title="Rambo-Tainer MW [kDa] = ",variable=root:Packages:Irena:PDDFInterface:RamboTainerMW, disable=0, noedit=1,limits={0,inf,0},frame=0,fstyle=1, fsize=13, fColor=(52428,1,1), help={"Molecular weight calculated from Rambo-Tainer method in kDa"}, format="%8.2f" 1587 1588 SetVariable RealSpaceI0,pos={260,580},size={200,15}, noproc,title="Real Space (GNOM) I0 = ",variable=root:Packages:Irena:PDDFInterface:RealSpaceI0, disable=0, noedit=1,limits={0,inf,0},frame=0, size={180,17}, bodyWidth=70, help={"Porod Invariant calcualtion result"}, format="%4.2f" 1589 SetVariable RealSpaceRg,pos={470,580},size={120,17},bodyWidth=70, noproc,title="Rg [A] = ",variable=root:Packages:Irena:PDDFInterface:RealSpaceRg, disable=0, noedit=1,limits={0,inf,0},frame=0, format="%4.2f" 1590 SetVariable SAXSMoW2MWRealSpacekDa,pos={300,605},size={250,15},bodyWidth=70, noproc,title="SAXSMoW2 MW [kDa] = ", variable=root:Packages:Irena:PDDFInterface:SAXSMoW2MWRealSpacekDa, noedit=1,fstyle=1, fsize=13, limits={0,inf,0},frame=0, help={"Molecular weight calculated from SAXSMoW2 method in kDa"}, fColor=(52428,1,1), format="%8.2f" 1591 SetVariable PDDFCalculatedMW,pos={300,630},size={250,15},bodyWidth=70, noproc,title="Abs. Int. Est. MW [kDa] = ",variable=root:Packages:Irena:PDDFInterface:PDDFCalculatedMW, disable=0, noedit=1,limits={0,inf,0},frame=0,fstyle=1, fsize=13, fColor=(52428,1,1), help={"Molecular weight calculated from PDDF method in kDa"}, format="%8.2f" 1592 1593 1584 SetVariable RamboTainerMW,pos={300,540},size={250,15},bodyWidth=70, noproc,title="Rambo-Tainer MW [kDa] = ",variable=root:Packages:Irena:PDDFInterface:RamboTainerMW, disable=0, noedit=1,limits={0,inf,0},frame=0,fstyle=1, fsize=13, fColor=(52428,1,1), help={"Molecular weight calculated from Rambo-Tainer method in kDa"}, format="%8.2f" 1585 1586 TitleBox PDDFInstructions22 title="\Zr110Real space (GNOM+abs. Int.+conc.):",size={330,15},pos={270,570},frame=0,fColor=(0,0,65535),labelBack=0 1587 SetVariable RealSpacePorodVolumeA3,pos={290,590},size={100,15},bodyWidth=50, format="%4.0f", noproc,title="Vol [A^3] = ", variable=root:Packages:Irena:PDDFInterface:RealSpacePorodVolumeA3, noedit=1,limits={0,inf,0},frame=0, help={"True Volume of protein in [A^3] "} 1588 SetVariable RealSpaceI0,pos={350,590},size={120,15},bodyWidth=50, noproc,title="I0 = ",variable=root:Packages:Irena:PDDFInterface:RealSpaceI0, disable=0, noedit=1,limits={0,inf,0},frame=0, size={180,17}, bodyWidth=70, help={"Porod Invariant calcualtion result"}, format="%4.2f" 1589 SetVariable RealSpaceRg,pos={480,590},size={120,17},bodyWidth=50, noproc,title="Rg [A] = ",variable=root:Packages:Irena:PDDFInterface:RealSpaceRg, disable=0, noedit=1,limits={0,inf,0},frame=0, format="%4.2f" 1590 SetVariable SAXSMoW2MWRealSpacekDa,pos={300,612},size={250,15},bodyWidth=70, noproc,title="SAXSMoW2 MW [kDa] = ", variable=root:Packages:Irena:PDDFInterface:SAXSMoW2MWRealSpacekDa, noedit=1,fstyle=1, fsize=13, limits={0,inf,0},frame=0, help={"Molecular weight calculated from SAXSMoW2 method in kDa"}, fColor=(52428,1,1), format="%8.2f" 1591 SetVariable PDDFCalculatedMW,pos={300,635},size={250,15},bodyWidth=70, noproc,title="Abs. Int. Est. MW [kDa] = ",variable=root:Packages:Irena:PDDFInterface:PDDFCalculatedMW, disable=0, noedit=1,limits={0,inf,0},frame=0,fstyle=1, fsize=13, fColor=(52428,1,1), help={"Molecular weight calculated from PDDF method in kDa"}, format="%8.2f" 1592 1593 // 1594 1594 //Controls for results 1595 TitleBox PDDFInstructions3 title="\Zr110Save results controls : ",size={200,15},pos={300,6 55},frame=0,fColor=(0,0,65535),labelBack=01596 TitleBox PDDFInstructions4 title="\Zr100Where? : ",size={120,15},pos={4 65,655},frame=0,fColor=(0,0,65535),labelBack=01595 TitleBox PDDFInstructions3 title="\Zr110Save results controls : ",size={200,15},pos={300,660},frame=0,fColor=(0,0,65535),labelBack=0 1596 TitleBox PDDFInstructions4 title="\Zr100Where? : ",size={120,15},pos={485,660},frame=0,fColor=(0,0,65535),labelBack=0 1597 1597 checkbox SaveToFolder, pos={495,679}, title="Folder", size={76,14},noproc, variable=root:Packages:Irena:PDDFInterface:SaveToFolder, mode=0, help={"Save to folder"} 1598 1598 checkbox SaveToNotebook, pos={495,697}, title="Notebook", size={76,14},noproc, variable=root:Packages:Irena:PDDFInterface:SaveToNotebook, mode=0, help={"Save to notebook"} … … 1601 1601 1602 1602 //results presentation for all methods... 1603 Button SavePDDFresults,pos={300,68 0},size={180,20}, proc=IRB1_PDDFButtonProc,title="Save PDDF results", help={"Save PDDF results to folder"}1603 Button SavePDDFresults,pos={300,685},size={180,20}, proc=IRB1_PDDFButtonProc,title="Save PDDF results", help={"Save PDDF results to folder"} 1604 1604 Button OpenResultsAndTable,pos={300,710},size={180,15}, proc=IRB1_PDDFButtonProc,title="Open Table and Notebook", help={"Open Table and Notebook with results"} 1605 1605 Button DeleteResultsAndTable,pos={230,735},size={130,15}, proc=IRB1_PDDFButtonProc,title="Delete results waves", help={"Delete waves with results, this will clean the records!"} … … 1635 1635 //********************************************************************************************************** 1636 1636 1637 staticFunction IRB1_PDDFRecalculareQmax()1638 1639 NVAR RamboTainerQmax8overRg = root:Packages:Irena:PDDFInterface:RamboTainerQmax8overRg1640 NVAR RamboTainerQmaxLog225 = root:Packages:Irena:PDDFInterface:RamboTainerQmaxLog2251637 Function IRB1_PDDFRecalculareQmax() 1638 1639 NVAR InvariantCalcQmax8overRg = root:Packages:Irena:PDDFInterface:InvariantCalcQmax8overRg 1640 NVAR InvariantCalcQmaxLog225 = root:Packages:Irena:PDDFInterface:InvariantCalcQmaxLog225 1641 1641 1642 NVAR RamboTainerQmax = root:Packages:Irena:PDDFInterface:RamboTainerQmax1642 NVAR InvariantCalcQmax = root:Packages:Irena:PDDFInterface:InvariantCalcQmax 1643 1643 NVAR ReciprocalSpaceRg = root:Packages:Irena:PDDFInterface:ReciprocalSpaceRg 1644 1644 NVAR ReciprocalSpaceI0=root:Packages:Irena:PDDFInterface:ReciprocalSpaceI0 … … 1646 1646 Wave Qvector=root:Packages:Irena:PDDFInterface:Q_vec 1647 1647 1648 if( RamboTainerQmax8overRg && ReciprocalSpaceRg>0)1649 RamboTainerQmax = 8/ReciprocalSpaceRg1650 elseif( RamboTainerQmaxLog225 && ReciprocalSpaceI0>0)1648 if(InvariantCalcQmax8overRg && ReciprocalSpaceRg>0) 1649 InvariantCalcQmax = 8/ReciprocalSpaceRg 1650 elseif(InvariantCalcQmaxLog225 && ReciprocalSpaceI0>0) 1651 1651 variable IntToFind = ReciprocalSpaceI0/200 1652 1652 FindLevel/P/Q Intensity, IntToFind 1653 1653 if(V_Flag==0) //level found... 1654 RamboTainerQmax = Qvector[V_LevelX]1654 InvariantCalcQmax = Qvector[V_LevelX] 1655 1655 else //now found... 1656 RamboTainerQmax = Qvector[numpnts(Qvector)-2]1656 InvariantCalcQmax = Qvector[numpnts(Qvector)-2] 1657 1657 endif 1658 1658 else 1659 if( RamboTainerQmax<0.05)1660 RamboTainerQmax = 0.31659 if(InvariantCalcQmax<0.05) 1660 InvariantCalcQmax = 0.3 1661 1661 endif 1662 1662 endif … … 1700 1700 endif 1701 1701 1702 if(stringmatch(sva.ctrlName," RamboTainerQmax"))1703 NVAR RamboTainerQmax8overRg = root:Packages:Irena:PDDFInterface:RamboTainerQmax8overRg1704 NVAR RamboTainerQmaxLog225 = root:Packages:Irena:PDDFInterface:RamboTainerQmaxLog2251705 RamboTainerQmax8overRg = 01706 RamboTainerQmaxLog225 = 01702 if(stringmatch(sva.ctrlName,"InvariantCalcQmax")) 1703 NVAR InvariantCalcQmax8overRg = root:Packages:Irena:PDDFInterface:InvariantCalcQmax8overRg 1704 NVAR InvariantCalcQmaxLog225 = root:Packages:Irena:PDDFInterface:InvariantCalcQmaxLog225 1705 InvariantCalcQmax8overRg = 0 1706 InvariantCalcQmaxLog225 = 0 1707 1707 endif 1708 1708 if(stringmatch(sva.ctrlName,"RamboTainerFlatBackground")) 1709 1709 NVAR RamboTainerAutoSetBckg = root:Packages:Irena:PDDFInterface:RamboTainerAutoSetBckg 1710 1710 RamboTainerAutoSetBckg = 0 1711 IRB1_PDDFFitAndCalculateMW() 1712 endif 1713 if(stringmatch(sva.ctrlName,"RamboTainerQmax")) 1714 IRB1_PDDFFitAndCalculateMW() 1711 //IRB1_PDDFFitRgAndG() 1712 IRB1_PDDFCalcRamboTainer() 1713 endif 1714 if(stringmatch(sva.ctrlName,"InvariantCalcQmax")) 1715 //IRB1_PDDFFitRgAndG() 1716 IRB1_PDDFCalcSAXSMoW2() 1717 IRB1_PDDFCalcRamboTainer() 1715 1718 endif 1716 1719 … … 1772 1775 TitleBox PDDFInstructions1, win=IRB1_PDDFInterfacePanel, disable = (whichTab!=1) 1773 1776 Button CalcRgAndMolecularWeight, win=IRB1_PDDFInterfacePanel, disable = (whichTab!=1) 1774 //SetVariable MWTrueVolumeA3, win=IRB1_PDDFInterfacePanel, disable = (whichTab!=1)1777 //SetVariable ReciprocalPorodVolumeA3, win=IRB1_PDDFInterfacePanel, disable = (whichTab!=1) 1775 1778 checkbox RamboTainerAutoSetBckg, disable = (whichTab!=1) 1776 checkbox RamboTainerQmax8overRg, disable = (whichTab!=1)1777 checkbox RamboTainerQmaxLog225, disable = (whichTab!=1)1778 SetVariable RamboTainerQmax, disable = (whichTab!=1)1779 checkbox InvariantCalcQmax8overRg, disable = (whichTab!=1) 1780 checkbox InvariantCalcQmaxLog225, disable = (whichTab!=1) 1781 SetVariable InvariantCalcQmax, disable = (whichTab!=1) 1779 1782 checkbox RamboTainerSubtractFlatBackground, disable = (whichTab!=1) 1780 1783 SetVariable RamboTainerFlatBackground, disable = (whichTab!=1) … … 1826 1829 NVAR PDDFUseProtein = root:Packages:Irena:PDDFInterface:PDDFUseProtein 1827 1830 NVAR PDDFUseNucleicAcid = root:Packages:Irena:PDDFInterface:PDDFUseNucleicAcid 1828 NVAR RamboTainerQmax8overRg = root:Packages:Irena:PDDFInterface:RamboTainerQmax8overRg1829 NVAR RamboTainerQmaxLog225 = root:Packages:Irena:PDDFInterface:RamboTainerQmaxLog2251831 NVAR InvariantCalcQmax8overRg = root:Packages:Irena:PDDFInterface:InvariantCalcQmax8overRg 1832 NVAR InvariantCalcQmaxLog225 = root:Packages:Irena:PDDFInterface:InvariantCalcQmaxLog225 1830 1833 1831 1834 if(stringmatch(cba.ctrlname,"RamboTainerAutoSetBckg")) 1832 IRB1_PDDFFitAndCalculateMW() 1835 //IRB1_PDDFFitRgAndG() 1836 //IRB1_PDDFCalcSAXSMoW2() 1837 IRB1_PDDFCalcRamboTainer() 1833 1838 endif 1834 1839 if(stringmatch(cba.ctrlname,"RamboTainerSubtractFlatBackground")) 1835 IRB1_PDDFFitAndCalculateMW() 1836 endif 1837 if(stringmatch(cba.ctrlname,"RamboTainerQmax8overRg")) 1840 //IRB1_PDDFFitRgAndG() 1841 //IRB1_PDDFCalcSAXSMoW2() 1842 IRB1_PDDFCalcRamboTainer() 1843 endif 1844 if(stringmatch(cba.ctrlname,"InvariantCalcQmax8overRg")) 1838 1845 if(checked) 1839 // RamboTainerQmax8overRg = 01840 RamboTainerQmaxLog225 = 01846 //InvariantCalcQmax8overRg = 0 1847 InvariantCalcQmaxLog225 = 0 1841 1848 endif 1842 IRB1_PDDFRecalculareQmax() 1843 IRB1_PDDFFitAndCalculateMW() 1844 endif 1845 if(stringmatch(cba.ctrlname,"RamboTainerQmaxLog225")) 1849 //IRB1_PDDFRecalculareQmax() 1850 //IRB1_PDDFFitRgAndG() 1851 IRB1_PDDFCalcSAXSMoW2() 1852 IRB1_PDDFCalcRamboTainer() 1853 endif 1854 if(stringmatch(cba.ctrlname,"InvariantCalcQmaxLog225")) 1846 1855 if(checked) 1847 RamboTainerQmax8overRg = 01848 // RamboTainerQmaxLog225 = 01856 InvariantCalcQmax8overRg = 0 1857 //InvariantCalcQmaxLog225 = 0 1849 1858 endif 1850 IRB1_PDDFRecalculareQmax() 1851 IRB1_PDDFFitAndCalculateMW() 1859 //IRB1_PDDFRecalculareQmax() 1860 //IRB1_PDDFFitRgAndG() 1861 IRB1_PDDFCalcSAXSMoW2() 1862 IRB1_PDDFCalcRamboTainer() 1852 1863 endif 1853 1864 … … 1891 1902 if(stringmatch(cba.ctrlname,"PDDFUseProtein")) 1892 1903 PDDFUseNucleicAcid=!PDDFUseProtein 1893 IRB1_ SetDensitySLD()1894 IRB1_ ResetValuesToPreventStale()1904 IRB1_PDDFSetDensitySLD() 1905 IRB1_PDDFResetValuesToPreventStale() 1895 1906 endif 1896 1907 if(stringmatch(cba.ctrlname,"PDDFUseNucleicAcid")) 1897 1908 PDDFUseProtein=!PDDFUseNucleicAcid 1898 IRB1_ SetDensitySLD()1899 IRB1_ ResetValuesToPreventStale()1909 IRB1_PDDFSetDensitySLD() 1910 IRB1_PDDFResetValuesToPreventStale() 1900 1911 endif 1901 1912 break … … 1960 1971 endif 1961 1972 if(stringMatch(ba.ctrlName,"CalcRgAndMolecularWeight")) 1962 IRB1_PDDFFitAndCalculateMW() 1973 IRB1_PDDFFitRgAndG() 1974 IRB1_PDDFCalcSAXSMoW2() 1975 IRB1_PDDFCalcRamboTainer() 1963 1976 endif 1964 1977 if(stringMatch(ba.ctrlName,"OpenResultsAndTable")) … … 2030 2043 end 2031 2044 //********************************************************************************************************** 2032 2045 // 2033 2046 Function IRB1_PDDFCalculateRgI0() 2034 2035 NVAR CalcRg=root:Packages:Irena:PDDFInterface:RealSpaceRg 2036 NVAR CalcI0=root:Packages:Irena:PDDFInterface:RealSpaceI0 2037 Wave Radius = root:Packages:Irena:PDDFInterface:pddfRadius 2038 Wave Pr = root:Packages:Irena:PDDFInterface:pddfPr 2047 print "IRB1_PDDFCalculateRgI0 does nothing, it needs to be used when using Irena PDDF calculations." 2048 // 2049 // NVAR CalcRg=root:Packages:Irena:PDDFInterface:RealSpaceRg 2050 // NVAR CalcI0=root:Packages:Irena:PDDFInterface:RealSpaceI0 2051 // Wave Radius = root:Packages:Irena:PDDFInterface:pddfRadius 2052 // Wave Pr = root:Packages:Irena:PDDFInterface:pddfPr 2053 // NVAR ConcentrationForCals=root:Packages:Irena:PDDFInterface:ConcentrationForCals 2054 // NVAR ScattLengthDensDifference=root:Packages:Irena:PDDFInterface:ScattLengthDensDifference 2055 // NVAR PDDFCalculatedMW=root:Packages:Irena:PDDFInterface:PDDFCalculatedMW 2056 // 2057 // Duplicate/Free Pr, R2Pr 2058 // R2Pr = Radius^2 * Pr 2059 // 2060 // //CalcI0 = 4*pi*areaXY(Radius, Pr ) 2061 // 2062 // //CalcRg = sqrt(areaXY(Radius, R2Pr )/areaXY(Radius, Pr )) 2063 // 2064 // PDDFCalculatedMW = 6.023e23*CalcI0/(ConcentrationForCals*(ScattLengthDensDifference*1e10)^2) 2065 // 2066 end 2067 //********************************************************************************************************** 2068 //********************************************************************************************************** 2069 //********************************************************************************************************** 2070 //********************************************************************************************************** 2071 2072 2073 Function IRB1_PDDFCalcSAXSMoW2() 2074 2075 Wave OriginalIntensity=root:Packages:Irena:PDDFInterface:Intensity 2076 Wave OriginalQvector=root:Packages:Irena:PDDFInterface:Q_vec 2077 Wave OriginalError=root:Packages:Irena:PDDFInterface:Errors 2078 //now method 1 how to calcualet MW: 2079 //calculate Molecular weight using SAXSMol2 method... 2080 //now, calculate invariant. 2081 //In this case we follow manuscript for SAXSMoW 2.0, DOI: 10.1002/pro.3528 2082 //Vassili Piadov, Evandro Ares de Araújo, Mario Oliveira Neto, Aldo Felix Craievich, and Igor Polikarpov 2083 //PROTEIN SCIENCE 2019 | VOL 28:454–463 2084 //use Model data below ~ 0.6*pi/Rg and real data above this as needed... 2085 NVAR MWPorodInvariant=root:Packages:Irena:PDDFInterface:MWPorodInvariant 2086 NVAR ReciprocalPorodVolumeA3=root:Packages:Irena:PDDFInterface:ReciprocalPorodVolumeA3 2087 NVAR RealSpacePorodVolumeA3=root:Packages:Irena:PDDFInterface:RealSpacePorodVolumeA3 2088 NVAR MWMassDensityProtein=root:Packages:Irena:PDDFInterface:MWMassDensityProtein //g/cm3, see line after formula 11 2089 NVAR SAXSMoW2MWRecSpacekDa=root:Packages:Irena:PDDFInterface:SAXSMoW2MWRecSpacekDa 2090 NVAR SAXSMoW2MWRealSpacekDa=root:Packages:Irena:PDDFInterface:SAXSMoW2MWRealSpacekDa 2091 NVAR InvariantCalcQmax8overRg = root:Packages:Irena:PDDFInterface:InvariantCalcQmax8overRg 2092 NVAR InvariantCalcQmaxLog225 = root:Packages:Irena:PDDFInterface:InvariantCalcQmaxLog225 2093 NVAR InvariantCalcQmax = root:Packages:Irena:PDDFInterface:InvariantCalcQmax 2094 IRB1_PDDFRecalculareQmax() //this will set Qmax as needed... //formula 7 or 8 or user choice 2095 //alternative is to pick InvariantCalcQmax based on Formula 8, so log(I(o)/I(gmax) ~ 2.25 2096 NVAR ReciprocalSpaceI0=root:Packages:Irena:PDDFInterface:ReciprocalSpaceI0 2097 NVAR ReciprocalSpaceRg=root:Packages:Irena:PDDFInterface:ReciprocalSpaceRg 2098 NVAR ReciprocalSpaceB=root:Packages:Irena:PDDFInterface:ReciprocalSpaceB 2099 NVAR ReciprocalSpacePorodSlope=root:Packages:Irena:PDDFInterface:ReciprocalSpacePorodSlope 2100 variable TempNumPoints=2000 2101 Make/Free/N=(TempNumPoints) InvariantIntWv, InvariantQWv, InvarQstar, InvarIntQ2 2102 variable Bval, Aval 2103 variable Vprime 2104 variable ChangeToRealIntP, QValueToChange 2105 if(ReciprocalSpaceI0>0 && ReciprocalSpaceRg>1) //prevent crash when user did not run the Guinier fit... 2106 InvariantQWv = p*(InvariantCalcQmax/(numpnts(InvariantQWv)-1))+0.00002 //this creates Q wave between 0.00002 and qmax 2107 InvarQstar = InvariantQWv / (erf(InvariantQWv*ReciprocalSpaceRg/sqrt(6)))^3 //Q* for Unified level 2108 InvariantIntWv = ReciprocalSpaceI0*exp(-InvariantQWv^2*ReciprocalSpaceRg^2/3)+(ReciprocalSpaceB/InvarQstar^ReciprocalSpacePorodSlope) //no background Unified intensity 2109 //now we need to replace intensity from somethign around 0.6*pi/Rg with experimental intensity 2110 QValueToChange = 0.4*pi/ReciprocalSpaceRg 2111 ChangeToRealIntP = BinarySearch(InvariantQWv,QValueToChange ) 2112 InvariantIntWv[ChangeToRealIntP, ] = OriginalIntensity[BinarySearchInterp(OriginalQvector, InvariantQWv[p])] 2113 //done, this shoudl now have attached tail of real data... 2114 InvarIntQ2 = InvariantIntWv * InvariantQWv^2 //I * Q^2 2115 MWPorodInvariant = areaXY(InvariantQWv, InvarIntQ2) //this is from Q=0 to Q=InvariantCalcQmax 2116 Vprime = 2*pi^2*ReciprocalSpaceI0/MWPorodInvariant //this is formula 5 2117 //setup the weird approximation of missing tail correction for invariant... 2118 //this is formula 10 2119 Aval = -2.114e6 * InvariantCalcQmax^4 + 2.920e6 * InvariantCalcQmax^3 - 1.472e6*InvariantCalcQmax^2 + 3.349e5*InvariantCalcQmax - 3.577e4 2120 Bval = 12.09*InvariantCalcQmax^3 - 9.39*InvariantCalcQmax^2 + 3.03*InvariantCalcQmax + 0.29 2121 ReciprocalPorodVolumeA3 = Aval + Bval*Vprime //this is in A^3 2122 //formula 11 2123 SAXSMoW2MWRecSpacekDa = MWMassDensityProtein*ReciprocalPorodVolumeA3* 1e-24 /1.662e-21 2124 else 2125 SAXSMoW2MWRecSpacekDa = 0 2126 ReciprocalPorodVolumeA3 = 0 2127 endif 2128 // and if we have Intensity from GNOM, here is real space SAXSMoW2 calculation: 2129 NVAR RealSpaceRg = root:Packages:Irena:PDDFInterface:RealSpaceRg 2130 NVAR RealSpaceI0 = root:Packages:Irena:PDDFInterface:RealSpaceI0 2131 NVAR PDDFCalculatedMW=root:Packages:Irena:PDDFInterface:PDDFCalculatedMW 2039 2132 NVAR ConcentrationForCals=root:Packages:Irena:PDDFInterface:ConcentrationForCals 2040 2133 NVAR ScattLengthDensDifference=root:Packages:Irena:PDDFInterface:ScattLengthDensDifference 2041 NVAR PDDFCalculatedMW=root:Packages:Irena:PDDFInterface:PDDFCalculatedMW 2042 2043 Duplicate/Free Pr, R2Pr 2044 R2Pr = Radius^2 * Pr 2045 2046 //CalcI0 = 4*pi*areaXY(Radius, Pr ) 2047 2048 //CalcRg = sqrt(areaXY(Radius, R2Pr )/areaXY(Radius, Pr )) 2049 2050 PDDFCalculatedMW = 6.023e23*CalcI0/(ConcentrationForCals*(ScattLengthDensDifference*1e10)^2) 2051 2052 end 2053 //********************************************************************************************************** 2054 //********************************************************************************************************** 2055 2056 static Function IRB1_PDDFFitAndCalculateMW() 2057 //copy of IR2Pr_EstimateDmax 2134 Wave/Z pddfModelIntExtrap = root:Packages:Irena:PDDFInterface:pddfModelIntExtrap 2135 Wave/Z pddfQvecExtrap = root:Packages:Irena:PDDFInterface:pddfQvecExtrap 2136 if(RealSpaceI0>0 && WaveExists(pddfModelIntExtrap) && WaveExists(pddfQvecExtrap)) //GNOM generated data exist... 2137 Duplicate/Free pddfModelIntExtrap, InvarIntQ2GNOM 2138 InvarIntQ2GNOM = pddfModelIntExtrap * pddfQvecExtrap^2 2139 MWPorodInvariant = areaXY(pddfQvecExtrap, InvarIntQ2GNOM) 2140 Vprime = 2*pi^2*RealSpaceI0/MWPorodInvariant //this is formula 5 2141 variable GNOMQmax=pddfQvecExtrap[numpnts(pddfQvecExtrap)-1] 2142 Aval = -2.114e6 * GNOMQmax^4 + 2.920e6 * GNOMQmax^3 - 1.472e6*GNOMQmax^2 + 3.349e5*GNOMQmax - 3.577e4 2143 Bval = 12.09*GNOMQmax^3 - 9.39*GNOMQmax^2 + 3.03*GNOMQmax + 0.29 2144 RealSpacePorodVolumeA3 = Aval + Bval*Vprime 2145 SAXSMoW2MWRealSpacekDa = MWMassDensityProtein*RealSpacePorodVolumeA3* 1e-24 /1.662e-21 2146 //and this is calculation from absolute intensity 2147 PDDFCalculatedMW = 6.023e23*RealSpaceI0/(ConcentrationForCals*(ScattLengthDensDifference*1e10)^2) 2148 else 2149 SAXSMoW2MWRealSpacekDa = 0 2150 PDDFCalculatedMW = 0 2151 RealSpacePorodVolumeA3 = 0 2152 endif 2153 //this ends calculations for SAXSMoW2 ... 2154 Wave/Z FitScatteringProfile=root:Packages:Irena:PDDFInterface:FitScatteringProfile 2155 if(WaveExists(FitScatteringProfile)) 2156 CheckDisplayed /W=IRB1_PDDFInterfacePanel#DataDisplay FitScatteringProfile 2157 if(V_Flag) 2158 string Tagtext="\\F"+IN2G_LkUpDfltStr("FontType")+"\\Z"+IN2G_LkUpDfltVar("TagSize")+"SAXSMoW2 Rg [A] = "+num2str(ReciprocalSpaceRg)+"\r" 2159 Tagtext+="\\F"+IN2G_LkUpDfltStr("FontType")+"\\Z"+IN2G_LkUpDfltVar("TagSize")+"I0 = "+num2str(ReciprocalSpaceI0) 2160 //Tagtext+="\\F"+IN2G_LkUpDfltStr("FontType")+"\\Z"+IN2G_LkUpDfltVar("TagSize")+"Protein Vol [cm3] = "+num2str(ReciprocalPorodVolumeA3)+"\r" 2161 Tagtext+="\\F"+IN2G_LkUpDfltStr("FontType")+"\\Z"+IN2G_LkUpDfltVar("TagSize")+" MW [kDa] = "+num2str(SAXSMoW2MWRecSpacekDa) 2162 Tag/C/N=GuessRg/A=LT/L=0/TL=0/W=IRB1_PDDFInterfacePanel#DataDisplay FitScatteringProfile, numpnts(FitScatteringProfile)/10,Tagtext 2163 endif 2164 endif 2165 2166 //*** 2167 2168 end 2169 //********************************************************************************************************** 2170 //********************************************************************************************************** 2171 //********************************************************************************************************** 2172 //********************************************************************************************************** 2173 //********************************************************************************************************** 2174 2175 2176 Function IRB1_PDDFCalcRamboTainer() 2177 2178 Wave OriginalIntensity=root:Packages:Irena:PDDFInterface:Intensity 2179 Wave OriginalQvector=root:Packages:Irena:PDDFInterface:Q_vec 2180 Wave OriginalError=root:Packages:Irena:PDDFInterface:Errors 2181 2182 /// 2183 2184 //now method from Rambo-Tainer, doi:10.1038/nature12070, Nature 2013, vol. 496, pg 477 2185 //Accurate assessment of mass, models and resolution by small-angle scattering 2186 //here is what this does: 2187 //1. Calculate Vc = I(0)/2*pi*Lc= I(0)/IntgQ*I(Q)dQ 2188 //calculate Qr (really, do we really have to use Q in some many meanings???) Qr=Vc^2/Rg [A^3] 2189 //and now they plotted for Proteins and Nucelic acis separate dependnecies... Got approximately linar depency 2190 // ln(Q) = a* ln(MW) + b 2191 // protein MW= (Qr/0.1231)^1.0 2192 //Nucelic acid MW= (Qr/0.00934)^0.808 2193 //but first , we need to fit data with background also: 2194 NVAR InvariantCalcQmax8overRg = root:Packages:Irena:PDDFInterface:InvariantCalcQmax8overRg 2195 NVAR InvariantCalcQmaxLog225 = root:Packages:Irena:PDDFInterface:InvariantCalcQmaxLog225 2196 NVAR InvariantCalcQmax = root:Packages:Irena:PDDFInterface:InvariantCalcQmax 2197 NVAR RamboTainerSubtractFlatBackground = root:Packages:Irena:PDDFInterface:RamboTainerSubtractFlatBackground 2198 NVAR RamboTainerFlatBackground = root:Packages:Irena:PDDFInterface:RamboTainerFlatBackground 2199 NVAR RamboTainerAutoSetBckg = root:Packages:Irena:PDDFInterface:RamboTainerAutoSetBckg 2200 IRB1_PDDFRecalculareQmax() //this will set Qmax as needed... 2201 //QstarVector = OriginalQvector / (erf(OriginalQvector*w_coef[1]/sqrt(6)))^3 2202 //FitScatteringProfile = w_coef[0]*exp(-OriginalQvector^2*w_coef[1]^2/3)+(w_coef[2]/QstarVector^w_coef[3]) + w_coef[4] 2203 variable TempNumPoints=2000 2204 NVAR RamboTainerMW=root:Packages:Irena:PDDFInterface:RamboTainerMW 2205 NVAR PDDFUseNucleicAcid=root:Packages:Irena:PDDFInterface:PDDFUseNucleicAcid 2206 NVAR PDDFUseProtein=root:Packages:Irena:PDDFInterface:PDDFUseProtein 2207 NVAR ReciprocalSpaceI0=root:Packages:Irena:PDDFInterface:ReciprocalSpaceI0 2208 NVAR ReciprocalSpaceRg=root:Packages:Irena:PDDFInterface:ReciprocalSpaceRg 2209 NVAR ReciprocalSpaceB=root:Packages:Irena:PDDFInterface:ReciprocalSpaceB 2210 NVAR ReciprocalSpacePorodSlope=root:Packages:Irena:PDDFInterface:ReciprocalSpacePorodSlope 2211 if(ReciprocalSpaceRg<1 || ReciprocalSpacePorodSlope<1) 2212 return 0 2213 endif 2214 2215 Make/Free/N=(TempNumPoints) RamboTainerIntQ, RamboTainerQ, RamboTainerInt, RamboTainerQstar 2216 variable Qmaxmeasured=OriginalQvector[numpnts(OriginalQvector)-3] 2217 RamboTainerQ = p*(Qmaxmeasured/(numpnts(RamboTainerQ)-1))+0.00002 //this creates Q wave between 0.00002 and qmax measured 2218 RamboTainerQstar = RamboTainerQ / (erf(RamboTainerQ*ReciprocalSpaceRg/sqrt(6)))^3 2219 RamboTainerInt = ReciprocalSpaceI0*exp(-RamboTainerQ^2*ReciprocalSpaceRg^2/3)+(ReciprocalSpaceB/RamboTainerQstar^ReciprocalSpacePorodSlope) 2220 variable QValueToChange = 0.4*pi/ReciprocalSpaceRg 2221 variable ChangeToRealIntP=BinarySearch(RamboTainerQ,QValueToChange) 2222 RamboTainerInt[ChangeToRealIntP, ] = OriginalIntensity[BinarySearchInterp(OriginalQvector, RamboTainerQ[p])] 2223 if(RamboTainerSubtractFlatBackground) 2224 RamboTainerInt -= RamboTainerFlatBackground //this subtract approximate background from the data. 2225 endif 2226 RamboTainerIntQ = RamboTainerInt*RamboTainerQ 2227 //*** Qmax for integration of Q*I(Q) is challenge... 2228 variable IntgQIQ=areaXY(RamboTainerQ, RamboTainerIntQ, 0, InvariantCalcQmax ) 2229 // now calculate I*Q vs Q to display in DataDisplay plot... 2230 Duplicate/O RamboTainerInt, TotalScatteredInt, IntgQIntensity 2231 Duplicate/O RamboTainerQ, TotalScatteredQ 2232 TotalScatteredInt = RamboTainerInt*RamboTainerQ 2233 multithread IntgQIntensity = areaXY(TotalScatteredQ, TotalScatteredInt, 0, TotalScatteredQ[p] ) 2234 IN2G_RemoveDataFromGraph(topGraphStr = "IRB1_PDDFInterfacePanel#PDFDisplay") 2235 AppendToGraph /W=IRB1_PDDFInterfacePanel#PDFDisplay TotalScatteredInt vs TotalScatteredQ 2236 AppendToGraph /W=IRB1_PDDFInterfacePanel#PDFDisplay/R IntgQIntensity vs TotalScatteredQ 2237 ModifyGraph/W=IRB1_PDDFInterfacePanel#PDFDisplay mirror(bottom)=1 2238 ModifyGraph/W=IRB1_PDDFInterfacePanel#PDFDisplay lstyle(IntgQIntensity)=3,rgb(IntgQIntensity)=(0,0,65535) 2239 // SetAxis/W=IRB1_PDDFInterfacePanel#PDFDisplay/A/E=1 left 2240 2241 Label/W=IRB1_PDDFInterfacePanel#PDFDisplay left "Q * I(Q)" 2242 Label/W=IRB1_PDDFInterfacePanel#PDFDisplay right "sum(Q * I(Q)) to Qmax" 2243 Label/W=IRB1_PDDFInterfacePanel#PDFDisplay bottom "Q [1/A]" 2244 variable RTVc = ReciprocalSpaceI0/IntgQIQ 2245 variable RTQr = (RTVc)^2 / ReciprocalSpaceRg 2246 if(PDDFUseProtein) 2247 RamboTainerMW = (RTQr/0.1231)^1.0 2248 RamboTainerMW /= 1000 //convert to kDA from DA 2249 elseif(PDDFUseNucleicAcid) 2250 //Update tag result... 2251 RamboTainerMW = (RTQr/0.00934)^0.808 2252 RamboTainerMW /= 1000 //convert to kDA from DA 2253 endif 2254 2255 end 2256 //********************************************************************************************************** 2257 //********************************************************************************************************** 2258 //********************************************************************************************************** 2259 //********************************************************************************************************** 2260 2261 Function IRB1_PDDFFitRgAndG() 2058 2262 2059 2263 DFref oldDf= GetDataFolderDFR() … … 2070 2274 AcsrPnt = tempV 2071 2275 endif 2072 2073 variable TempNumPoints=20002276 //Fit Data to I(0) and Rg 2277 //First fit is between cursors and without bacground, this is equivalent to linearization fit 2074 2278 variable Rg 2075 2279 Variable G … … 2107 2311 NVAR ReciprocalSpaceI0=root:Packages:Irena:PDDFInterface:ReciprocalSpaceI0 2108 2312 NVAR ReciprocalSpaceRg=root:Packages:Irena:PDDFInterface:ReciprocalSpaceRg 2313 NVAR ReciprocalSpaceB=root:Packages:Irena:PDDFInterface:ReciprocalSpaceB 2314 NVAR ReciprocalSpacePorodSlope=root:Packages:Irena:PDDFInterface:ReciprocalSpacePorodSlope 2315 2109 2316 ReciprocalSpaceI0 = G 2110 2317 ReciprocalSpaceRg = Rg 2318 ReciprocalSpaceB = B 2319 ReciprocalSpacePorodSlope = PorodSLope 2111 2320 //calculate Intensity to display 2112 2321 Duplicate/O OriginalIntensity, QstarVector, FitScatteringProfile … … 2121 2330 endif 2122 2331 SetAxis/W=IRB1_PDDFInterfacePanel#DataDisplay/A left 2123 //set Dmax for the future... 2124 //NVAR Dmax=root:Packages:Irena:PDDFInterface:DmaxEstimate 2125 //Dmax=2.5*abs(W_coef[1]) 2126 //now method 1 how to calcualet MW: 2127 //calculate Molecular weight using SAXSMol2 method... 2128 //now, calculate invariant. 2129 //In this case we follow manuscript for SAXSMoW 2.0, DOI: 10.1002/pro.3528 2130 //Vassili Piadov, Evandro Ares de Araújo, Mario Oliveira Neto, Aldo Felix Craievich, and Igor Polikarpov 2131 //PROTEIN SCIENCE 2019 | VOL 28:454–463 2132 //use Model data below ~ 0.6*pi/Rg and real data above this as needed... 2133 NVAR MWPorodInvariant=root:Packages:Irena:PDDFInterface:MWPorodInvariant 2134 NVAR MWTrueVolumeA3=root:Packages:Irena:PDDFInterface:MWTrueVolumeA3 2135 NVAR MWMassDensityProtein=root:Packages:Irena:PDDFInterface:MWMassDensityProtein //g/cm3, see line after formula 11 2136 NVAR SAXSMoW2MWRecSpacekDa=root:Packages:Irena:PDDFInterface:SAXSMoW2MWRecSpacekDa 2137 variable changeOverQmax = 8/Rg //formula 7 2138 //alternative is to pick changeOverQmax based on Formula 8, so log(I(o)/I(gmax) ~ 2.25, formula 7 is easier, keep for now... 2139 Make/Free/N=(TempNumPoints) InvariantIntWv, InvariantQWv, InvarQstar, InvarIntQ2 2140 InvariantQWv = p*(changeOverQmax/(numpnts(InvariantQWv)-1))+0.00002 //this creates Q wave between 0.00002 and qmax 2141 InvarQstar = InvariantQWv / (erf(InvariantQWv*Rg/sqrt(6)))^3 //Q* for Unified level 2142 InvariantIntWv = G*exp(-InvariantQWv^2*Rg^2/3)+(B/InvarQstar^PorodSLope) //no background Unified intensity 2143 //now we need to replace intensity from somethign around 0.6*pi/Rg with experimental intensity 2144 variable QValueToChange = 0.4*pi/Rg 2145 variable ChangeToRealIntP = BinarySearch(InvariantQWv,QValueToChange ) 2146 InvariantIntWv[ChangeToRealIntP, ] = OriginalIntensity[BinarySearchInterp(OriginalQvector, InvariantQWv[p])] 2147 //done, this shoudl now have attached tail of real data... 2148 InvarIntQ2 = InvariantIntWv * InvariantQWv^2 //I * Q^2 2149 MWPorodInvariant = areaXY(InvariantQWv, InvarIntQ2) //this is from Q=0 to Q=changeOverQmax 2150 variable Vprime = 2*pi^2*G/MWPorodInvariant //this is formula 5 2151 //setup the weird approximation of missing tail correction for invariant... 2152 //this is formula 10 2153 variable Aval = -2.114e6 * changeOverQmax^4 + 2.920e6 * changeOverQmax^3 - 1.472e6*changeOverQmax^2 + 3.349e5*changeOverQmax - 3.577e4 2154 variable Bval = 12.09*changeOverQmax^3 - 9.39*changeOverQmax^2 + 3.03*changeOverQmax + 0.29 2155 MWTrueVolumeA3 = Aval + Bval*Vprime //this is in A^3 2156 //formula 11 2157 SAXSMoW2MWRecSpacekDa = MWMassDensityProtein*MWTrueVolumeA3* 1e-24 /1.662e-21 2158 //this ends calculations for SAXSMoW2 ... 2159 //*** 2160 //now method from Rambo-Tainer, doi:10.1038/nature12070, Nature 2013, vol. 496, pg 477 2161 //Accurate assessment of mass, models and resolution by small-angle scattering 2162 //here is what this does: 2163 //1. Calculate Vc = I(0)/2*pi*Lc= I(0)/IntgQ*I(Q)dQ 2164 //calculate Qr (really, do we really have to use Q in some many meanings???) Qr=Vc^2/Rg [A^3] 2165 //and now they plotted for Proteins and Nucelic acis separate dependnecies... Got approximately linar depency 2166 // ln(Q) = a* ln(MW) + b 2167 // protein MW= (Qr/0.1231)^1.0 2168 //Nucelic acid MW= (Qr/0.00934)^0.808 2169 //but first , we need to fit data with background also: 2170 NVAR RamboTainerQmax8overRg = root:Packages:Irena:PDDFInterface:RamboTainerQmax8overRg 2171 NVAR RamboTainerQmaxLog225 = root:Packages:Irena:PDDFInterface:RamboTainerQmaxLog225 2172 NVAR RamboTainerQmax = root:Packages:Irena:PDDFInterface:RamboTainerQmax 2173 NVAR RamboTainerSubtractFlatBackground = root:Packages:Irena:PDDFInterface:RamboTainerSubtractFlatBackground 2174 NVAR RamboTainerFlatBackground = root:Packages:Irena:PDDFInterface:RamboTainerFlatBackground 2175 NVAR RamboTainerAutoSetBckg = root:Packages:Irena:PDDFInterface:RamboTainerAutoSetBckg 2176 IRB1_PDDFRecalculareQmax() //this will set Qmax as needed... 2332 2333 //Second fit is from A cursor tomax Q and with bacground, this is For Rambo-Tainer to have background, if needed... 2177 2334 Make /N=5/O W_coef, LocalEwave 2178 2335 Make/N=5/T/O T_Constraints … … 2211 2368 ModifyGraph /W=IRB1_PDDFInterfacePanel#DataDisplay rgb(FitScatteringProfileBckg)=(3,52428,1) 2212 2369 endif 2370 NVAR RamboTainerAutoSetBckg=root:Packages:Irena:PDDFInterface:RamboTainerAutoSetBckg 2371 NVAR RamboTainerFlatBackground=root:Packages:Irena:PDDFInterface:RamboTainerFlatBackground 2213 2372 if(RamboTainerAutoSetBckg) 2214 2373 RamboTainerFlatBackground = RTBackground 2215 2374 endif 2216 //QstarVector = OriginalQvector / (erf(OriginalQvector*w_coef[1]/sqrt(6)))^3 2217 //FitScatteringProfile = w_coef[0]*exp(-OriginalQvector^2*w_coef[1]^2/3)+(w_coef[2]/QstarVector^w_coef[3]) + w_coef[4] 2218 2219 //now, fron this excersize we really need only the background... 2220 NVAR RamboTainerMW=root:Packages:Irena:PDDFInterface:RamboTainerMW 2221 NVAR PDDFUseNucleicAcid=root:Packages:Irena:PDDFInterface:PDDFUseNucleicAcid 2222 NVAR PDDFUseProtein=root:Packages:Irena:PDDFInterface:PDDFUseProtein 2223 Make/Free/N=(TempNumPoints) RamboTainerIntQ, RamboTainerQ, RamboTainerInt, RamboTainerQstar 2224 variable Qmaxmeasured=OriginalQvector[numpnts(OriginalQvector)-3] 2225 RamboTainerQ = p*(Qmaxmeasured/(numpnts(InvariantQWv)-1))+0.00002 //this creates Q wave between 0.00002 and qmax measured 2226 RamboTainerQstar = RamboTainerQ / (erf(RamboTainerQ*Rg/sqrt(6)))^3 2227 RamboTainerInt = G*exp(-RamboTainerQ^2*Rg^2/3)+(B/RamboTainerQstar^PorodSLope) 2228 ChangeToRealIntP=BinarySearch(RamboTainerQ,QValueToChange ) 2229 RamboTainerInt[ChangeToRealIntP, ] = OriginalIntensity[BinarySearchInterp(OriginalQvector, RamboTainerQ[p])] 2230 if(RamboTainerSubtractFlatBackground) 2231 RamboTainerInt -= RamboTainerFlatBackground //this subtract approximate background from the data. 2232 endif 2233 RamboTainerIntQ = RamboTainerInt*RamboTainerQ 2234 //*** Qmax for integration of Q*I(Q) is challenge... 2235 variable IntgQIQ=areaXY(RamboTainerQ, RamboTainerIntQ, 0, RamboTainerQmax ) 2236 //variable i 2237 //for(i=0.1;i<1;i+=0.1) 2238 // print " Qmax = "+num2str(i)+" Intg(QI(Q) = "+num2str(areaXY(RamboTainerQ, RamboTainerIntQ, 0, i )) 2239 //endfor 2240 // now calculate I*Q vs Q to display in DataDisplay plot... 2241 Duplicate/O RamboTainerInt, TotalScatteredInt, IntgQIntensity 2242 Duplicate/O RamboTainerQ, TotalScatteredQ 2243 TotalScatteredInt = RamboTainerInt*RamboTainerQ 2244 multithread IntgQIntensity = areaXY(TotalScatteredQ, TotalScatteredInt, 0, TotalScatteredQ[p] ) 2245 IN2G_RemoveDataFromGraph(topGraphStr = "IRB1_PDDFInterfacePanel#PDFDisplay") 2246 AppendToGraph /W=IRB1_PDDFInterfacePanel#PDFDisplay TotalScatteredInt vs TotalScatteredQ 2247 AppendToGraph /W=IRB1_PDDFInterfacePanel#PDFDisplay/R IntgQIntensity vs TotalScatteredQ 2248 ModifyGraph/W=IRB1_PDDFInterfacePanel#PDFDisplay mirror(bottom)=1 2249 ModifyGraph/W=IRB1_PDDFInterfacePanel#PDFDisplay lstyle(IntgQIntensity)=3,rgb(IntgQIntensity)=(0,0,65535) 2250 // SetAxis/W=IRB1_PDDFInterfacePanel#PDFDisplay/A/E=1 left 2251 2252 Label/W=IRB1_PDDFInterfacePanel#PDFDisplay left "Q * I(Q)" 2253 Label/W=IRB1_PDDFInterfacePanel#PDFDisplay right "sum(Q * I(Q)) to Qmax" 2254 Label/W=IRB1_PDDFInterfacePanel#PDFDisplay bottom "Q [1/A]" 2255 2256 2257 2258 variable RTVc = ReciprocalSpaceI0/IntgQIQ 2259 variable RTQr = (RTVc)^2 / ReciprocalSpaceRg 2260 if(PDDFUseProtein) 2261 RamboTainerMW = (RTQr/0.1231)^1.0 2262 RamboTainerMW /= 1000 //convert to kDA from DA 2263 elseif(PDDFUseNucleicAcid) 2264 //Update tag result... 2265 RamboTainerMW = (RTQr/0.00934)^0.808 2266 RamboTainerMW /= 1000 //convert to kDA from DA 2267 endif 2268 string Tagtext="\\F"+IN2G_LkUpDfltStr("FontType")+"\\Z"+IN2G_LkUpDfltVar("TagSize")+"SAXSMoW2 Rg [A] = "+num2str(Rg)+"\r" 2269 Tagtext+="\\F"+IN2G_LkUpDfltStr("FontType")+"\\Z"+IN2G_LkUpDfltVar("TagSize")+"I0 = "+num2str(G) 2270 //Tagtext+="\\F"+IN2G_LkUpDfltStr("FontType")+"\\Z"+IN2G_LkUpDfltVar("TagSize")+"Protein Vol [cm3] = "+num2str(MWTrueVolumeA3)+"\r" 2271 Tagtext+="\\F"+IN2G_LkUpDfltStr("FontType")+"\\Z"+IN2G_LkUpDfltVar("TagSize")+" MW [kDa] = "+num2str(SAXSMoW2MWRecSpacekDa) 2272 Tag/C/N=GuessRg/A=LT/L=0/TL=0/W=IRB1_PDDFInterfacePanel#DataDisplay FitScatteringProfile, numpnts(FitScatteringProfile)/10,Tagtext 2375 2376 2273 2377 2274 2378 KillWaves/Z LocalEwave, W_coef, T_constraints, QstarVector … … 2631 2735 KillPath/Z ATSASWorkPath 2632 2736 //print "Delete following folder from your desktop : "+PathToATSASWorkPath 2737 //update calculations... 2738 IRB1_PDDFCalcSAXSMoW2() 2633 2739 setDataFolder OldDf 2634 2740 end … … 2800 2906 endif 2801 2907 ModifyGraph/W=IRB1_PDDFInterfacePanel#PDFDisplay mirror=1 2802 SetAxis/W=IRB1_PDDFInterfacePanel#PDFDisplay/A/E= 1left2908 SetAxis/W=IRB1_PDDFInterfacePanel#PDFDisplay/A/E=0 left 2803 2909 else 2804 2910 DoAlert /T="Did not find GNOM data" 0, "Something went wrong, did not find PDDF data" … … 2827 2933 NVAR UseIndra2Data=root:Packages:Irena:PDDFInterface:UseIndra2Data 2828 2934 NVAR UseQRSdata=root:Packages:Irena:PDDFInterface:UseQRSdata 2829 //zero old values 2830 NVAR MWPorodInvariant = root:Packages:Irena:PDDFInterface:MWPorodInvariant 2831 NVAR MWTrueVolumeA3 = root:Packages:Irena:PDDFInterface:MWTrueVolumeA3 2832 NVAR MWMassDensityProtein = root:Packages:Irena:PDDFInterface:MWMassDensityProtein 2833 NVAR SAXSMoW2MWRecSpacekDa = root:Packages:Irena:PDDFInterface:SAXSMoW2MWRecSpacekDa 2834 NVAR ReciprocalSpaceI0 = root:Packages:Irena:PDDFInterface:ReciprocalSpaceI0 2835 NVAR ReciprocalSpaceRg = root:Packages:Irena:PDDFInterface:ReciprocalSpaceRg 2836 MWPorodInvariant = 0 2837 MWTrueVolumeA3 = 0 2838 SAXSMoW2MWRecSpacekDa = 0 2839 ReciprocalSpaceI0 = 0 2840 ReciprocalSpaceRg = 0 2841 2842 NVAR CalcRg=root:Packages:Irena:PDDFInterface:RealSpaceRg 2843 NVAR CalcI0=root:Packages:Irena:PDDFInterface:RealSpaceI0 2844 NVAR ConcentrationForCals=root:Packages:Irena:PDDFInterface:ConcentrationForCals 2845 NVAR ScattLengthDensDifference=root:Packages:Irena:PDDFInterface:ScattLengthDensDifference 2846 NVAR PDDFCalculatedMW=root:Packages:Irena:PDDFInterface:PDDFCalculatedMW 2847 NVAR GNOMAlfaResult = root:Packages:Irena:PDDFInterface:GNOMAlfaResult 2848 CalcRg = 0 2849 CalcI0 = 0 2850 PDDFCalculatedMW = 0 2851 GNOMAlfaResult = 0 2852 //these are variables used by the control procedure 2853 NVAR UseResults= root:Packages:Irena:PDDFInterface:UseResults 2854 NVAR UseUserDefinedData= root:Packages:Irena:PDDFInterface:UseUserDefinedData 2855 NVAR UseModelData = root:Packages:Irena:PDDFInterface:UseModelData 2856 UseResults = 0 2857 UseUserDefinedData = 0 2858 UseModelData = 0 2859 //delete GNOM out file, if exists... 2860 Wave/Z GNOMOutFileTextWave = root:Packages:Irena:PDDFInterface:GNOMOutFileTextWave 2861 KillWaves /Z GNOMOutFileTextWave 2935 //zero old values to prevent stale. 2936 IRB1_PDDFResetValuesToPreventStale () 2862 2937 //get the names of waves, assume this tool actually works. May not under some conditions. In that case this tool will not work. 2863 2938 IR3C_SelectWaveNamesData("Irena:PDDFInterface", FolderNameStr) //this routine will preset names in strings as needed, DataFolderName = DataStartFolder+FolderNameStr … … 2907 2982 NVAR DisplayErrorBars = root:Packages:Irena:PDDFInterface:DisplayErrorBars 2908 2983 IN2G_ShowHideErrorBars(DisplayErrorBars, topGraphStr="IRB1_PDDFInterfacePanel#DataDisplay") 2909 //and caluclate Dmax if user wants:2910 NVAR CalcDmax = root:Packages:Irena:PDDFInterface:CalculateDmaxEstOnImport2911 if(CalcDmax)2912 IRB1_PDDFFitAndCalculateMW()2913 endif2914 2984 2915 2985 … … 3011 3081 ListOfVariables += "DmaxEstimate;CalculateDmaxEstOnImport;GnomForceRmin0;GnomForceRmax0;NumBinsInR;GnomAlfaValue;" 3012 3082 ListOfVariables += "MooreNumFunctions;MooreDetNumFunctions;MooreFitMaxSize;" 3013 ListOfVariables += "RealSpaceRg;RealSpaceI0;ConcentrationForCals;ScattLengthDensDifference;PDDFCalculatedMW; "3014 ListOfVariables += "RamboTainerMW; RamboTainerQmax8overRg;RamboTainerQmax;RamboTainerQmaxLog225;"3083 ListOfVariables += "RealSpaceRg;RealSpaceI0;ConcentrationForCals;ScattLengthDensDifference;PDDFCalculatedMW;RealSpacePorodVolumeA3;" 3084 ListOfVariables += "RamboTainerMW;InvariantCalcQmax8overRg;InvariantCalcQmax;InvariantCalcQmaxLog225;" 3015 3085 ListOfVariables += "RamboTainerSubtractFlatBackground;RamboTainerFlatBackground;RamboTainerAutoSetBckg;" 3016 3086 ListOfVariables += "SaveToFolder;SaveToNotebook;SaveToWaves;SaveToGNOMOut;" 3017 ListOfVariables += "MWPorodInvariant; MWTrueVolumeA3;MWMassDensityProtein;SAXSMoW2MWRecSpacekDa;SAXSMoW2MWRealSpacekDa;"3018 ListOfVariables += "GNOMAlfaResult;ReciprocalSpaceI0;ReciprocalSpaceRg;PDDFUseProtein;PDDFUseNucleicAcid; "3087 ListOfVariables += "MWPorodInvariant;ReciprocalPorodVolumeA3;MWMassDensityProtein;SAXSMoW2MWRecSpacekDa;SAXSMoW2MWRealSpacekDa;" 3088 ListOfVariables += "GNOMAlfaResult;ReciprocalSpaceI0;ReciprocalSpaceRg;PDDFUseProtein;PDDFUseNucleicAcid;ReciprocalSpaceB;ReciprocalSpacePorodSlope;" 3019 3089 3020 3090 //and here we create them … … 3060 3130 NVAR ConcentrationForCals 3061 3131 if(ConcentrationForCals<0.0001) 3062 GnomAlfaValue=13132 ConcentrationForCals=1 3063 3133 endif 3064 3134 NVAR MooreNumFunctions … … 3077 3147 PDDFUseNucleicAcid = 0 3078 3148 endif 3079 IRB1_ SetDensitySLD()3080 IRB1_ ResetValuesToPreventStale()3149 IRB1_PDDFSetDensitySLD() 3150 IRB1_PDDFResetValuesToPreventStale() 3081 3151 3082 3152 NVAR SaveToFolder … … 3092 3162 end 3093 3163 //********************************************************************************************************** 3094 static Function IRB1_ResetValuesToPreventStale() 3095 3164 static Function IRB1_PDDFResetValuesToPreventStale() 3165 //zero old values to prevent stale. 3166 DFRef OldDF=GetDataFolderDFR() 3167 setDataFolder root:Packages:Irena:PDDFInterface 3168 3096 3169 NVAR MWPorodInvariant = root:Packages:Irena:PDDFInterface:MWPorodInvariant 3097 NVAR MWTrueVolumeA3 = root:Packages:Irena:PDDFInterface:MWTrueVolumeA33170 NVAR ReciprocalPorodVolumeA3 = root:Packages:Irena:PDDFInterface:ReciprocalPorodVolumeA3 3098 3171 NVAR MWMassDensityProtein = root:Packages:Irena:PDDFInterface:MWMassDensityProtein 3099 3172 NVAR SAXSMoW2MWRecSpacekDa = root:Packages:Irena:PDDFInterface:SAXSMoW2MWRecSpacekDa 3100 NVAR ReciprocalSpaceI0 = root:Packages:Irena:PDDFInterface:ReciprocalSpaceI0 3101 NVAR ReciprocalSpaceRg = root:Packages:Irena:PDDFInterface:ReciprocalSpaceRg 3173 NVAR ReciprocalSpaceI0=root:Packages:Irena:PDDFInterface:ReciprocalSpaceI0 3174 NVAR ReciprocalSpaceRg=root:Packages:Irena:PDDFInterface:ReciprocalSpaceRg 3175 NVAR ReciprocalSpaceB=root:Packages:Irena:PDDFInterface:ReciprocalSpaceB 3176 NVAR ReciprocalSpacePorodSlope=root:Packages:Irena:PDDFInterface:ReciprocalSpacePorodSlope 3102 3177 NVAR RealSpaceRg = root:Packages:Irena:PDDFInterface:RealSpaceRg 3103 3178 NVAR RealSpaceI0 = root:Packages:Irena:PDDFInterface:RealSpaceI0 … … 3105 3180 NVAR GNOMAlfaResult=root:Packages:Irena:PDDFInterface:GNOMAlfaResult 3106 3181 NVAR RamboTainerMW = root:Packages:Irena:PDDFInterface:RamboTainerMW 3107 3182 NVAR CalcRg=root:Packages:Irena:PDDFInterface:RealSpaceRg 3183 NVAR CalcI0=root:Packages:Irena:PDDFInterface:RealSpaceI0 3184 NVAR ConcentrationForCals=root:Packages:Irena:PDDFInterface:ConcentrationForCals 3185 NVAR ScattLengthDensDifference=root:Packages:Irena:PDDFInterface:ScattLengthDensDifference 3186 NVAR PDDFCalculatedMW=root:Packages:Irena:PDDFInterface:PDDFCalculatedMW 3187 NVAR GNOMAlfaResult = root:Packages:Irena:PDDFInterface:GNOMAlfaResult 3188 NVAR SAXSMoW2MWRealSpacekDa = root:Packages:Irena:PDDFInterface:SAXSMoW2MWRealSpacekDa 3189 NVAR RealSpacePorodVolumeA3=root:Packages:Irena:PDDFInterface:RealSpacePorodVolumeA3 3190 //these are variables used by the control procedure 3191 NVAR UseResults= root:Packages:Irena:PDDFInterface:UseResults 3192 NVAR UseUserDefinedData= root:Packages:Irena:PDDFInterface:UseUserDefinedData 3193 NVAR UseModelData = root:Packages:Irena:PDDFInterface:UseModelData 3194 SAXSMoW2MWRealSpacekDa = 0 3195 RealSpacePorodVolumeA3 = 0 3196 UseResults = 0 3197 UseUserDefinedData = 0 3198 UseModelData = 0 3199 //delete GNOM out file, if exists... 3200 //Wave/Z GNOMOutFileTextWave = root:Packages:Irena:PDDFInterface:GNOMOutFileTextWave 3201 KillWaves /Z GNOMOutFileTextWave 3202 CalcRg = 0 3203 CalcI0 = 0 3204 PDDFCalculatedMW = 0 3205 GNOMAlfaResult = 0 3206 //delete old waves 3207 KillWaves/Z pddfInputQVector, pddfInputIntensity, pddfInputError, pddfModelQvector, PDDFModelIntensity, pddfRadius, pddfPr, pddfPrError, pddfQvecExtrap, pddfModelIntExtrap 3208 //zero parameetrs 3209 MWPorodInvariant = 0 3210 ReciprocalPorodVolumeA3 = 0 3211 SAXSMoW2MWRecSpacekDa = 0 3212 ReciprocalSpaceI0 = 0 3213 ReciprocalSpaceRg = 0 3214 ReciprocalSpaceB = 0 3215 ReciprocalSpacePorodSlope = 0 3108 3216 RamboTainerMW = 0 3109 3217 MWPorodInvariant = 0 3110 MWTrueVolumeA3 = 03218 ReciprocalPorodVolumeA3 = 0 3111 3219 SAXSMoW2MWRecSpacekDa = 0 3112 3220 ReciprocalSpaceI0 = 0 … … 3116 3224 PDDFCalculatedMW=0 3117 3225 GNOMAlfaResult = 0 3118 end 3119 //********************************************************************************************************** 3120 3121 static Function IRB1_SetDensitySLD() 3226 setDataFolder OldDF 3227 end 3228 //********************************************************************************************************** 3229 3230 static Function IRB1_PDDFSetDensitySLD() 3122 3231 3123 3232 NVAR PDDFUseProtein =root:Packages:Irena:PDDFInterface:PDDFUseProtein … … 3166 3275 3167 3276 NVAR MWPorodInvariant = root:Packages:Irena:PDDFInterface:MWPorodInvariant 3168 NVAR MWTrueVolumeA3 = root:Packages:Irena:PDDFInterface:MWTrueVolumeA33277 NVAR ReciprocalPorodVolumeA3 = root:Packages:Irena:PDDFInterface:ReciprocalPorodVolumeA3 3169 3278 NVAR MWMassDensityProtein = root:Packages:Irena:PDDFInterface:MWMassDensityProtein 3170 3279 NVAR SAXSMoW2MWRecSpacekDa = root:Packages:Irena:PDDFInterface:SAXSMoW2MWRecSpacekDa … … 3207 3316 3208 3317 IR1_AppendAnyText("\rPorod MW [kDa] = \t"+num2str(SAXSMoW2MWRecSpacekDa),0) 3209 IR1_AppendAnyText("Porod Volume [cm3] = \t"+num2str( MWTrueVolumeA3),0)3318 IR1_AppendAnyText("Porod Volume [cm3] = \t"+num2str(ReciprocalPorodVolumeA3),0) 3210 3319 IR1_AppendAnyText("Porod Density prot [g/cm3] = \t"+num2str(MWMassDensityProtein),0) 3211 3320 IR1_AppendAnyText("\rGNOM resulting alfa = \t"+num2str(GNOMAlfaResult),0) … … 3254 3363 3255 3364 NVAR MWPorodInvariant = root:Packages:Irena:PDDFInterface:MWPorodInvariant 3256 NVAR MWTrueVolumeA3 = root:Packages:Irena:PDDFInterface:MWTrueVolumeA33365 NVAR ReciprocalPorodVolumeA3 = root:Packages:Irena:PDDFInterface:ReciprocalPorodVolumeA3 3257 3366 NVAR MWMassDensityProtein = root:Packages:Irena:PDDFInterface:MWMassDensityProtein 3258 3367 NVAR SAXSMoW2MWRecSpacekDa = root:Packages:Irena:PDDFInterface:SAXSMoW2MWRecSpacekDa … … 3298 3407 PDDF_SLD[curlength] = ScattLengthDensDifference 3299 3408 PorodInvariant[curlength] = MWPorodInvariant 3300 PorodTrueVolume[curlength] = MWTrueVolumeA33409 PorodTrueVolume[curlength] = ReciprocalPorodVolumeA3 3301 3410 MassDensityProtein[curlength] = MWMassDensityProtein 3302 3411 InvariantPDDFCalculatedMW[curlength] = SAXSMoW2MWRecSpacekDa … … 3379 3488 //additional Porod results... 3380 3489 NVAR MWPorodInvariant = root:Packages:Irena:PDDFInterface:MWPorodInvariant 3381 NVAR MWTrueVolumeA3 = root:Packages:Irena:PDDFInterface:MWTrueVolumeA33490 NVAR ReciprocalPorodVolumeA3 = root:Packages:Irena:PDDFInterface:ReciprocalPorodVolumeA3 3382 3491 NVAR MWMassDensityProtein = root:Packages:Irena:PDDFInterface:MWMassDensityProtein 3383 3492 NVAR SAXSMoW2MWRecSpacekDa = root:Packages:Irena:PDDFInterface:SAXSMoW2MWRecSpacekDa … … 3416 3525 ResultsComment="PorodMW="+num2str(SAXSMoW2MWRecSpacekDa)+";" 3417 3526 ResultsComment="PorodInvariant="+num2str(MWPorodInvariant)+";" 3418 ResultsComment="PorodVolume="+num2str( MWTrueVolumeA3)+";"3527 ResultsComment="PorodVolume="+num2str(ReciprocalPorodVolumeA3)+";" 3419 3528 ResultsComment="PorodMassDensityProtein="+num2str(MWMassDensityProtein)+";" 3420 3529 String NewWaveNote="PDDF analysis;"+date()+";"+time()+ResultsComment
Note: See TracChangeset
for help on using the changeset viewer.