public clsAlignmentFunction GetAlignment(List <TargetBase> massTagList, List <TargetedResultDTO> featuresToAlign) { var multialignMassTagDB = new clsMassTagDB(); //TODO: I might be able to dynamically update these values. Take my foundFeatures and calculate their avg PPMDiff. Then use that info here. var alignmentOptions = new clsAlignmentOptions(); alignmentOptions.MassCalibrationWindow = this.AlignerParameters.MassCalibrationWindow; //note - it seems that 50 ppm is used as a default setting in VIPER. alignmentOptions.ContractionFactor = this.AlignerParameters.ContractionFactor; alignmentOptions.IsAlignmentBaselineAMasstagDB = this.AlignerParameters.IsAlignmentBaselineAMassTagDB; alignmentOptions.MassBinSize = this.AlignerParameters.MassBinSize; alignmentOptions.MassCalibrationLSQNumKnots = this.AlignerParameters.MassCalibrationLSQNumKnots; alignmentOptions.MassCalibrationLSQZScore = this.AlignerParameters.MassCalibrationLSQZScore; alignmentOptions.MassCalibrationMaxJump = this.AlignerParameters.MassCalibrationMaxJump; alignmentOptions.MassCalibrationMaxZScore = this.AlignerParameters.MassCalibrationMaxZScore; alignmentOptions.MassCalibrationNumMassDeltaBins = this.AlignerParameters.MassCalibrationNumMassDeltaBins; alignmentOptions.MassCalibrationNumXSlices = this.AlignerParameters.MassCalibrationNumXSlices; alignmentOptions.MassCalibrationUseLSQ = this.AlignerParameters.MassCalibrationUseLSQ; alignmentOptions.MassCalibrationWindow = this.AlignerParameters.MassCalibrationWindow; alignmentOptions.MassTolerance = this.AlignerParameters.MassToleranceForNETAlignment; alignmentOptions.MaxPromiscuity = this.AlignerParameters.MaxPromiscuity; alignmentOptions.MaxTimeJump = this.AlignerParameters.MaxTimeJump; alignmentOptions.NETBinSize = this.AlignerParameters.NETBinSize; alignmentOptions.NETTolerance = this.AlignerParameters.NETTolerance; alignmentOptions.NumTimeSections = this.AlignerParameters.NumTimeSections; alignmentOptions.UsePromiscuousPoints = this.AlignerParameters.UsePromiscuousPoints; var processor = new clsAlignmentProcessor(); processor.AlignmentOptions = alignmentOptions; var multiAlignMassTags = convertDeconToolsMassTagsToMultialignMassTags(massTagList); multialignMassTagDB.AddMassTags(multiAlignMassTags); processor.SetReferenceDatasetFeatures(multialignMassTagDB); var multialignUMCs = convertDeconToolsLCMSFeaturesToMultialignFeatures(featuresToAlign); processor.SetAligneeDatasetFeatures(multialignUMCs, alignmentOptions.MZBoundaries[0]); processor.PerformAlignmentToMSFeatures(); this.Result = getResultsForAlignment(processor); return(processor.GetAlignmentFunction()); }
public clsAlignmentFunction GetAlignment(List <MassTag> massTagList, List <TargetedResult> featuresToAlign) { clsMassTagDB multialignMassTagDB = new clsMassTagDB(); //TODO: figure out which options I need to parameterize in this class. For now, use defaults clsAlignmentOptions alignmentOptions = new clsAlignmentOptions(); clsAlignmentProcessor processor = new clsAlignmentProcessor(); clsMassTag[] multiAlignMassTags = convertDeconToolsMassTagsToMultialignMassTags(massTagList); multialignMassTagDB.AddMassTags(multiAlignMassTags); processor.SetReferenceDatasetFeatures(multialignMassTagDB); List <clsUMC> multialignUMCs = convertDeconToolsLCMSFeaturesToMultialignFeatures(featuresToAlign); processor.SetAligneeDatasetFeatures(multialignUMCs, alignmentOptions.MZBoundaries[0]); processor.PerformAlignmentToMSFeatures(); return(processor.GetAlignmentFunction()); }
/// <summary> /// Reads the XAMT file. /// </summary> /// <param name="filepath">Path of XAMT in flat file form.</param> /// <returns>Mass Tag Database. Null if file does not exist.</returns> public clsMassTagDB ReadXAMTDatabase(string filepath) { if (System.IO.File.Exists(filepath) == false) return null; /// /// Create a new database. /// clsMassTagDB xamt = new clsMassTagDB(); /// /// Read the file - We could use a read line by line /// method here, but the files are small. /// string[] lines = System.IO.File.ReadAllLines(filepath); /// /// Read the column headers /// string header = lines[0]; ConstructHeaderMapping(header); /// /// Parse the rest of the file now. /// List<clsMassTag> massTags = new List<clsMassTag>(); for(int i = 1; i < lines.Length; i++) { string line = lines[i]; massTags.Add(ParseLine(line)); } /// /// Transfer the data to the XAMT. /// clsMassTag[] tags = new clsMassTag[massTags.Count]; massTags.CopyTo(tags); xamt.AddMassTags(tags); return xamt; }