Edit detail for AllCaluaScripts revision 69 of 69

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
Editor: damberger
Time: 2021/07/21 12:49:34 GMT+2
Note:

added:
    * **UPDATE** 21. July. 2021 - Updated to support writing out in BMRB NMRSTAR 3.1 format - thanks to Alvar Gossert!"

Return to Main CALUA page

User Scripts:

These Scripts have been provided by CARA users for other CARA users "as is" with no guarantees. Always back-up your repository before running a script. . Some of them may require some editing of the script to apply them to your project. After Importing the LUA script, Open it and read the header.

The scripts are organized into catagories according to what they do:

Catagories of scripts

Scripts to Globally modify repository:

  • ResidueTypes:
    • CorrectAtomMagnitudes.lua : Adjusts all methyl group atom magnitudes to 3 (this fixes an error in the standard template Start1.2.cara)
    • LoadBmrbStats.lua : Updates ResidueType Ave,Dev values from a BMRB statistics file. See header of script for details.
      • UPDATE Aug.29 2016: BMRB changed their datestamp format from MO-DAY-YEAR to MO/DAY/YEAR, updated script to read this. Also added check for IUPAC nomenclature and script now stores the value of SDmult as Attribute of each modified ResidueType. See header for details.

Scripts to write Analysis Reports to Script Window or to File:

  • AssignmentReport.lua : Writes out a report of chemical shift assignments to either terminal window or to a file. Identifies unusual shifts. It is possible to filter for only missing assignments (H atoms only or also heteroatoms).
  • CalcMassOfLabeledMolecule.lua : Calculates the molecular weight of a sequence in a project assuming the isotope-enrichment and percent d2o entered by the user. 2H, 13C, and 15N are available by default. Other nuclei can be accessed by commenting in an option at the top of the script.
    • UPDATED includes a checkbox to calculate the expected mass for mass-spectrometry and can also calculate the mass in solution for a given pH.
  • ChemShiftDeviationsFile.lua : Writes a file containing Chemical Shift Deviations from the average values stored in the repository library. See also ChemShiftDeviationsPlot.lua
  • ChemShiftMapFromTwoPeakLists.lua : Writes combined chemical shift changes to script terminal window using two peaklists as input. The two peaklists should have the same peak Ids for same peaks and ideally peaks should be numbered by residue (You can use PeakListNumberedByResidue.lua to generate them). Combined chemical shift differences are calculated using the difference in chemical shift of the peaks with same Id in the two peaklists. Script also outputs atom selections in MOLMOL format for those residues having shifts larger that StdevThreshold x standard deviation of the dataset as well as a MOLMOL selection corresponding to all peaks with color = PeakColor in PeakList1.
  • CompareProjects.lua : Compares the assigned resonances and shift values in two projects - reports assignments unique to one project and shift values that differ signficantly. See also CopyAssignmentsToProject.lua
  • ExportAllSpins.lua : Writes a file containing an atom list in XEASY format. All spins in the selected project are included (also CA-1 etc)
  • GetLineWidthsFromPeakLists.lua : Writes out a file with one line for each peak in a peaklist reporting peaknumber and linewidth at half height along a one dimension of a 2D spectrum (see header for details)
  • HetNoe.lua : Uses a batchlist consisting of two spectra (noe & ref) to calculate the heteronuclear nOe (ratio of peaks) and stores the result in the Peak attribute HetNoe. It also writes the results to a file in format suitable for excel. See the beginning of the script for instructions.
    • UPDATE (ver.2): Improved User interface, output format and introduced the option to write out the spectrum-dependent parameter (e.g. MixTime, ExchTime)
    • UPDATE 3.Jan.18 (ver.3): Added features to user interface, different options to identify overlapped peaks, color them, filter them from output file
  • ReportSpinsWithColorNinPeakList.lua : Writes out a text file containing spins which occur more than N times in a peak with color C in peaklist P. (User enters N,C & P).
  • ShiftDiffBetweenTwoProjects.lua : Writes out a report of the combined chemical shift differences between two projects from each residue. Optionally the alias shifts of two spectra can be used. This can be useful for chemical shift mapping.
  • SideChainDeviations.lua : Writes out a report of average deviation of chemical shifts from each residue normalized to the standard deviation of the database versus residue number (H atoms only or also heteroatoms).
  • WriteShiftsInColumns.lua : Writes out shifts for selected atoms into columns, one line per residue. The user can edit a table at the beginning of the script to define which atoms shifts are written out. Currently: "H", "HA", "CA", "CB".

Scripts to Plot Data:

  • graphDemo.lua : plots amide exchange data for a given peak and peaklist. It assumes a batchlist setup as described in BatchIntegration. Basically reproduces the function Show Peakcurve in MonoScope Integrator menu.
  • ChemShiftDeviationsPlot.lua : Plots deviations from random coil shifts for a particular atom (like CA). See ChemShiftDeviationsPlot for details and some screenshots.
  • multiplespectrumview.lua : overlay contour plots for any number of 2D spectra and a peaklist, colors are fully customizable. Use Shift-Ctrl Click drag to Zoom and Home key to restore to full ppm range.

    This script reproduces the overlay contours function in PolyScope - see Release 1.1.4. This script is kept here as a demonstration of how to use LUA to build custom scopes. See MultipleSpectrumView for details and some screenshots.

  • ProposeAndShow.lua : Displays contours for proposed SpinLinks in the transposed positions in up to three 3D NOESY spectra (15N-resolved, 13Cali-resolved, 13Caro-resolved: Spectrum IDs are provide by user). This allows th user to check whether the proposed SpinLink shows a peak in both the transposed positions: e.g. HA -(NOE)- HN(N) and HN -(NOE)- HA(CA). Thanks to A. Severin for this script.
  • Display1DSlice.lua : Generates a 1D slice plot of Dim2 from a 3D for a given residue with HN(Dim1) and N(Dim3). Makes use of Slice Buffers.
  • GetSliceFrom1D.lua : Gets a slice from a 1D spectrum. You can plot the slice, send the ppm,intensity values to the terminal, or send the ppm,intensity values to a file for plotting in external programs.

Scripts to Export Data:

  • Analysis Reports to Script Window or to File:
    • AssignmentReport.lua : Writes out a report of chemical shift assignments to either terminal window or to a file. Identifies unusual shifts. It is possible to filter for only missing assignments (H atoms only or also heteroatoms).
    • CalcMassOfLabeledMolecule.lua : Calculates the molecular weight of a sequence in a project assuming the isotope-enrichment and percent d2o entered by the user. 2H, 13C, and 15N are available by default. Other nuclei can be accessed by commenting in an option at the top of the script.
    • ChemShiftDeviationsFile.lua : Writes a file containing Chemical Shift Deviations from the average values stored in the repository library. See also ChemShiftDeviationsPlot.lua
    • ExportAllSpins.lua : Writes a file containing an atom list in XEASY format. All spins in the selected project are included (also CA-1 etc)
    • ReportSpinsWithColorNinPeakList.lua : Writes out a text file containing spins which occur more than N times in a peak with color C in peaklist P. (User enters N,C & P).
    • SideChainDeviations.lua : Writes out a report of average deviation of chemical shifts from each residue normalized to the standard deviation of the database versus residue number (H atoms only or also heteroatoms).
    • WriteAssignments.lua : Writes out assignments for BMRB, DYANA, CYANA or CARA (see entry for WriteAssignments.lua script in section "Export File for a Program" below for details)
      • WriteShiftsInColumns.lua : Writes out shifts for selected atoms into columns, one line per residue. The user can edit a table at the beginning of the script to define which atoms shifts are written out. Currently: "H", "HA", "CA", "CB".
  • Export File for a Program:
    • ATNOS/CANDID, DYANA, CYANA
      • ExportSpinLinksToUpls.lua : Writes a UPL file in CYANA format containing one UPL for each spinlink connecting the atoms corresponding to the linked spins. The upper distance limits are all set to 5.0 Angstroms. This script can be used together with UplsToSpinLinks.lua in order to transfer spinlinks from one project to another. Thanks to D. Frueh for this contribution.
      • WriteAssignments.lua : Writes out assignments in a nomenclature consistent for structure calculations using ATNOS/CANDID together with DYANA or CYANA (seq and prot files). Can also write out assignments for submission to BMRB, or in CARA format for transfer of assignments between projects or repositories.
        • UPDATED 20.Sept.2016:
          • can write out RNA/DNA assignments
          • write in CARA format (see above)
          • insert CYANA linker residues into sequence file for projects with multiple chains
          • chemical shift errors input by user are nolonger ignored
        • UPDATED 25. Apr. 2017 - fixed bug "attempt to perform arithmetic on global NumAssignedAtoms (a nil value)"
        • UPDATE 07. Oct. 2019 - fixed issue when BMRB format is written out using alias shifts (it wrote global shifts or gave the error: "[string "WriteAssignments"]:856: calling getShift on bad self (Lua::LuaSpectrum? expected, got table)"
        • UPDATE 21. July. 2021 - Updated to support writing out in BMRB NMRSTAR 3.1 format - thanks to Alvar Gossert!"
    • EXCEL
      • WriteBatchTable.lua : Write out a table from a batch integration into a text file (for EXCEL).
      • HetNoe.lua: Uses a batchlist consisting of two spectra (noe & ref) to calculate the heteronuclear nOe (ratio of peaks) and stores the result in the Peak attribute HetNoe. It also writes the results to a file in format suitable for excel. See the beginning of the script for instructions. See the beginning of the script for instructions.
        • UPDATE (ver.2): Improved User interface, output format and introduced the option to write out the spectrum-dependent parameter (e.g. MixTime, ExchTime)
        • UPDATE 3.Jan.18 (ver.3): Added features to user interface, different options to identify overlapped peaks, color them, filter them from output file
      • WriteTitrationCurveDataToFile.lua : Writes chemical shift values of spins with a user-selected label for a series of spectra into a spreadsheet file. (shifts are taken from the alias values in each spectrum). See header for details.
        • UPDATE 2.Jan.05: Fixed an error in line "t.Line = LineTable..." and added dialog for Project selection and entry of ProtonListName
    • MARS
    • MOLMOL
      • ShowNoesInMolmol.lua : Writes out a molmol macro which highlights a selected target atom in cyan and all candidate atoms within a tolerance range of a user-determined chemical shift. Useful for NOE assignment during structure refinement. See header for details
    • PACES
      • ExportToPaces.lua : Writes out a comma-separated list of HN,N,CA,CB chemical shifts for import into Excel and use with PACES.
        • UPDATE 20. May 05: Adjusted formatting to more closely adhere to PACES. Included CO, CO-1, HA, HA-1.
    • SPARKY
      • WriteSparkyPeakList.lua : Writes out a peaklist in sparky format from a Peaklist in a CARA project.
        • UPDATED (Ver. 2) Script now writes out sparky format for 2D, 3D and 4D peaklists.
    • TALOS+
    • Topspin
      • Write15NHSQC2DPeaksToXml.lua : Writes out a 2D 15N HSQC peaklist in Topspin XML format from a selected projects assignments. Thanks to G.Courtade.
      • Write13CaliHSQC2DPeaksToXml.lua : Writes out a 2D 13Cali HSQC peaklist in Topspin XML format from a selected projects assignments. Thanks to G.Courtade for original script and A. Gossert for modification to generate 2D peaklists.
    • XEASY
      • WriteProtonList.lua : Writes out an xeasy-formatted proton list for a project (no unassigned "999.000" atoms included)
      • PeakListNumberedByResidue.lua : Write out a peaklist where the peaknumber corresponds to the residue number for a specific atom in each dimension. E.g. you want to write out a peaklist for an HSQC15N where each residue gives rise to a peak (HN/N) whose peaknumber corresponds to the residue number. This is useful for plotting the results of NH dynamics or exchange vs. sequence.
    • X-PLOR
      • ExportToXplor.lua : Converts spinlinks from a project into upper distance limits with the maximum distance (5.5A) Thanks to S. Ilin for this contribution.
      • PeakListToXplorConstraints.lua : Generates a XPLOR-NIH constraints file from an integrated 2D NOESY PeakList? in a project. The intensities are divided into four categories and converted into distance constraints which are written to an external file. Thanks to C. Hilty for this contribution.
        • UPDATED * fixed an error in sorting of NOE volumes causing incorrect pairing of NOE/constraint with the assignment
          • fixed errors occuring when residue assignments could not be found for peaks, or the residue/atom name of the assigned spins were not found in the IUPAC to X-PLOR conversion table.
          • now sorts constraints by assignment
          • summarizes number of NOE constraints in each category

Scripts to convert external files:

  • OneLetterFileToSeqFile.lua : Converts a file containing an amino acid sequence in one letter code to an XEASY seq file for easy read in to CARA. It ignores case and all characters which do not code for one of the 20 standard amino acids. Copy-paste from ExPASy? or NCBI website directly into a .aa file and convert to .seq file!
  • XeasySeqToThreeLetter.lua : Converts an xeasy .seq file including the charges like ARG+,GLU- to a file with simple three letter code which can be read into the standard template Start1.2.cara to create a new project with sequence.
  • XeasyToBmrBLabelsInProtonList.lua : Converts a protonlist using Xeasy nomenclature into one using the Bmrb nomenclature so that the converted file can used to import the shifts into a repository derived from the standard template Start1.2.cara. Use this together with "XeasySeqToThreeLetter.lua" to import Xeasy projects

Scripts to modify Projects (always back-up Repository before running these scripts - there is no undo!)

  • Scripts to globally modify projects:
    • CopyAssignmentsToProject.lua : Copies systems, spins and assignments from a source project to a target project. Can be used for merging information from two projects.The spins from a system assigned to a given residue in the source project are copied into the system assigned to the same residue in the target project. Spins that are in systems with no residue assignment can be copied into the system with the same ID in the target project (when it exists and is not assigned to a residue) or into a newly created system in the target project. Selection options allow the set of copied spins to be restricted by AtomType and type of Label.
      • NOTE This script used to be called CopySpinSystemsAndAssignmentsToAnotherProject.lua
      • NOTE Use the menu item duplicate projects to backup the target project BEFORE running script. There is no UNDO!
  • Aliases:
    • CopyAliasesAndInterpolate.lua : Copies Spin Aliases from one spectrum to another.
      • UPDATE added option to interpolate alias positions using two source spectra to a target spectrum. - see header for details
    • IsotopeShiftAliases.lua : Creates spin aliases for heavy atoms in a selected spectrum which are adjusted for the secondary isotope shift of the attatched deuterium atoms. This is useful for including spectra measured with perdeuterated and nondeuterated protein in the same project. Thanks to N. Keller for entering values into isotope shifts table.
    • PeakListToAliases.lua : Creates Spin Aliases for a selected spectrum based on an external peaklist. Intended as a workaround for the "Peaks-Import Alias Shifts" in MonoScope when the error message "Cannot import: There are ambiguous shifts" appears. See header for details.
    • RemoveAliases.lua : Removes Spin Aliases from one spectrum or from all spectra of a project. (This updated version includes a menu interface so that editing the script is no longer necessary. It replaces RemoveAllAlliases.lua (see below).
    • ShiftSpinsAndAliases.lua : Shift a subset of selected spins and their aliases by a fixed ppm value. Can also be applied to all spins. You must edit the script header to define which project, which spins, and what the size of the ppm shift is.
    • LoadProtonListOntoResidues.lua : Defines expected shifts for each residue in a sequence from the proton list. User can enter the deviation from expected 1H shift (H or Q) and deviation from expected HeteroAtom shift (C or N). This is meant to support the assignment of homologous proteins or proteins where predicted assignments are available.
  • Peaks:
    • ChangePeakColorCodes.lua : changes the color code of a range of peak ids.
    • CopyPeakAmpToVol.lua : Copies Peak Amplitudes to Volumes.
    • DeleteAssignedPeaks.lua : Deletes all Assigned Peaks from a chosen Peaklist (peaks with label "?" in one or more dimensions remain)
    • HetNoe.lua : Uses a batchlist consisting of two spectra (noe & ref) to calculate the heteronuclear nOe (ratio of peaks) and stores the result in the Peak attribute HetNoe. It also writes the results to a file in format suitable for excel. It is recommended to use a peaklist generated by PeakListNumberedByResidue?.lua. See the beginning of the script for instructions.
      • UPDATE (ver.2): Improved User interface, output format and introduced the option to write out the spectrum-dependent parameter (e.g. MixTime, ExchTime)
      • UPDATE 3.01.2018 Added menu interface, options to change color of overlapped peaks and filter them out of output file's table of HetNoes?
    • ReadCyanaPeakList.lua : reads CYANA peaklist into a project. NEW

      Note: unlike the standard "read peaklist" menu of MonoScope, this script can read peaklists with ambiguous (multiple) assignments. The ambiguous assignments are represented by AssignmentGuesses?. Peaks are assigned color according to whether they have zero, one, or many assignments. They also have a peaklabel representing the assignment with the largest volume (VC parameter in the CYANA peaklist).

    • UPDATE 3.10.2017 Modified to be able to read AtnosCandid peaklists (sometimes, created peaklist was empty after reading in, this should be fixed too)
    • UPDATE 22.9.2016
    • IMPORTANT 22.9.2016 CARA 1.9.1.4 (and earlier) has a bug causing assignments to be read into the wrong dimension, this was fixed in CARA 1.9.1.6 beta release
    • IMPORTANT CARA 1.8.4 gives an error message (does not run)
  • ResidueTypes:

    Please see script catagory Scripts to modify repository globally

  • Spectra:
    • RecalibrateSpectra.lua : Recalibrates all spectrum dimensions with a shift range and atom type matching the selected values by a fixed amount. E.g. To shift all alpihatic carbon dimensions by 2.5 ppm. Often used in combination with ShiftSpinsInCatagory.lua or ShiftSpinsAndAliases.lua.
      • UPDATED Aug 26 2016 version 4 introduces a checkbox option to correct all dimensions of a selected AtomType if any one of them is involved in an INEPT to the selected NeighbourAtom? (e.g. 15N-3D NOESY can be selected based on AtomType=H and NeighbourAtom=N. If checkbox is selected, then both 1H of the experiment will be corrected by the same amount. This accounts for the fact that often all dimensions of a given AtomType within a given spectrum are calibrated the same.
    • ReportAllSpectrumParameters.lua : Reports all spectrum parameters for every spectrum in a project in a table written to the CARA Terminal window.
  • Spins:
    • CorrectShiftsForFoldErrorInCaraBelow155.lua : Corrects an error in the position of folded spins resulting from an error in the contour display for CARA versions < 1.5.5. After running this script, spins should have correct shifts in folded regions using CARA versions 1.5.5 or higher. This script should be used before exporting shifts from projects for structure calculations if the assignment were obtained using CARA versions prior to 1.5.5. See the script header for details.
    • CreateProjectedSpins.lua : Creates spins with nonzero offset (e.g CA-1 in res.2 from CA in res.1).
      • Updated June 29, 2004. Fixed a mistake & removed Project Selection if only one Project in repository.
    • CopyProjectedSpinsToOriginSystem.lua : Creates spins with zero offset from offset spins (e.g. CA in res.1 from CA-1 in res.2)
      • UPDATED 29.Aug. 2016: to fix bug "then expected near end".
    • Pick_2D_Peaks.lua : Finds local maxima in an HSQC15N and creates H/N spins with unique labels obtained from SpectrumType (usually "H"/"N") with the corresponding chemical shifts (contributed by Jimm Masse 3.29.2005)
    • Pick_3D_Peaks.lua : Finds local maxima along the strip axis of a 3D at the anchor positions H/N derived from an HSQC15N (see Pick_2D_Peaks.lua above) and creates spins with the corresponding chemical shifts (contributed by Jimm Masse 3.29.2005)
      • NOTE You must define labels in the SpectrumTypes? so that the script can match the corresponding dimensions of the 2D and 3D. See the script header for details.
    • RenameSpins.lua : Renames all spins with Old Label to a New Label. E.g. to rename the amide proton spins with label "H" generated by importing a project from a BMRB file to "HN".
    • RemoveSpins.lua : Removes all spins with a specified Label. One can also remove ALL spins by leaving the LABEL field empty.
    • ReplaceDegenerateSpinsByGroup.lua : Removes degenerate spins and replaces them by a Group (pseudoatom). E.g. After importing from BMRB, you have PHE HE1 7.05 HE2 7.05 and would like to replace these two spins by a single pseudoatom HE 7.05. See script header for details.
    • ShiftSpins.lua : Shift a subset of selected spins by a fixed ppm value Can also be applied to all spins. You must edit the script header to define which project, which spins, and what the size of the ppm shift is.
    • ShiftSpinsInCatagory.lua : Shift a subset of selected spins by a fixed ppm value Can also be applied to all spins. Uses a persistent menu. Select AtomType and Catagory (e.g. all aromatics, aliphatics, amides... etc.)
      • UPDATED Aug. 26 2016 version 5 also shifts spins with offsets (e.g. CA-1) as long as the target systems ResidueType can be determined. Also shifts spins in Systems that are not assigned to a residue as long as a SystemType? is defined and the spins label matches a AtomName? in the SystemType?.
    • ShiftSpinsAndAliases.lua : Shift a subset of selected spins and their aliases by a fixed ppm value. Can also be applied to all spins. You must edit the script header to define which project, which spins, and what the size of the ppm shift is.
    • SparkyAssignmentsToCara.lua : Imports the chemical shift assignments from a Sparky assignment list file into a CARA project.
  • SpinLinks:
    • CreateLinksToSuccessor.lua : Create Spinlinks between Spins with a certain Label in a System and a Spin with another Label in the Successor System. See Header for Details.
    • DeleteAllSpinLinks.lua : Deletes all Spinlinks in selected Project.
      • Updated June 24, 2004.
    • ImportLinksFromPeakList.lua : Creates Spinlinks in a Project from a NOESY Peaklist.
    • HideLinksInSpectrum.lua : Hides spinlinks in a selected spectrum. (Turns visibility off for this spectrum).
    • UplsToSpinLinks.lua : Reads UPL file due to a specific NOESY spectrum and creates Spin Links visible in that NOESY Spectrum. Spin Link Parameters are modified so that Spin Link Rating = Constraint Distance, Code = Peak Number (peak used to derive UPL). Intended to support the analysis of structure calculations with Cara.
      • UPDATED June 17, 2015.
        • Expands pseudoatoms in cases of imcompatible assignments (pseudoatom vs real atom) in UPLfile? and project.
        • Converts cyana pseudoatom nomeclature (QQ and Q atoms) automatically to IUPAC (no need to manually edit UPL files)
        • Allows setting of SpinLink color for created SpinLinks.
    • DeleteSpinLinksWithinSequenceFragment.lua : Script to delete all spinlinks within a defined sequence fragment. E.g. I want to delete all the spinlinks within the fragment from residue 1 to residue 50.
  • Systems:
    • ChangeSystemTypes.lua : Change the System Type for a selected range of Systems. Uses a nice Menu dialog.
    • CreateOriginSystemsFromProjectedSpins.lua : Creates new spin systems using the projected spins of existing spin-systems in a selected project. E.g. you picked the spins in the (H)CCONH experiment like CA-1, CB-1, CG-1 etc. in systems i and want to create the predecessor systems i-1 containing these spins with label CA, CB, CG etc. This script will create the new spin systems i-1, fill them with spins from system i but with zero offset, and link systems i-1 as predecessors to systems i. There is an option to create only new spin-systems if they are Prolines. If the origin spin system has spins with tentative labels (?CA), these will be renamed to "?" and before copying projected spins with final labels (e.g. CA-1).
      • UPDATE 29.Aug 2016 *Version 3 fixes a couple of bugs in the first two releases. This one works.
    • ImportUnassignedPeaksToNewSystems.lua : Import unassigned peaks from a 3D peaklist (two H dimensions and one HeteroAtom dimension) to new Systems. This script creates a spinsystem for each unassigned peak with a spinlink between the 1H spins. Intended for use during Structure Refinement to inspect unassigned NOESY peaks from structure calculations.
    • RemoveSelectedSystems.lua : Removes selected spin systems from project.

Miscellaneous:

  • DefineInfo.lua : After executing this script once, the command "Info( ObjectClass)" in the LUA terminal prints all available functions of a given object class.
  • printkeycode.lua : returns the code of the pressed key (trivial).