private static IList <Resume> GetResumes(ResumesDataContext dc, IEnumerable <Guid> ids) { var resumeIds = new SplitList <Guid>(ids).ToString(); var resumes = GetAllResumesQuery(dc, resumeIds).ToList(); var allJobs = (from e in GetAllJobsQuery(dc, resumeIds) group e by e.Item1).ToDictionary(g => g.Key, g => (from e in g select e.Item2).ToList()); var allSchools = (from e in GetAllSchoolsQuery(dc, resumeIds) group e by e.Item1).ToDictionary(g => g.Key, g => (from e in g select e.Item2).ToList()); foreach (var resume in resumes) { List <Job> jobs; if (allJobs.TryGetValue(resume.Id, out jobs)) { resume.Jobs = jobs; } List <School> schools; if (allSchools.TryGetValue(resume.Id, out schools)) { resume.Schools = schools; } } return(resumes.ToList()); }
public SampleProcessingParam(SplitList<Lib.Model.Param>[] steps, CVLookUp cv) : base(null) { _cv = cv; _count = steps.Length; Value = steps; Default = steps; }
public SampleProcessingPanel(SplitList<Lib.Model.Param>[] steps, CVLookUp cv) { _cv = cv; _count = steps.Length; InitializeComponent(); Value = steps; }
private IList <Candidate> GetCandidates(CandidatesDataContext dc, IEnumerable <Guid> ids) { var candidateIds = new SplitList <Guid>(ids).ToString(); var candidates = GetCandidatesQuery(dc, candidateIds, _industriesQuery).ToList(); GetRelocationLocations(dc, candidateIds, candidates); GetIndustries(dc, candidateIds, candidates); return(candidates); }
protected void lnkRemove_Click(object sender, EventArgs e) { SplitList = GetSplitsFromRepeater(); int myindex = Convert.ToInt32(((LinkButton)sender).Attributes[DataIndex]); SplitList.RemoveAt(myindex); SplitList = SplitList; RebindSplitList(); }
JobAdTotalsReport IJobAdReportsRepository.GetJobAdTotalsReport(IEnumerable <Guid> jobAdIds) { using (var dc = CreateDataContext(true)) { var jobAdIdList = new SplitList <Guid>(jobAdIds).ToString(); return(new JobAdTotalsReport { Views = GetViewedJobAds(dc, jobAdIdList), Applications = GetApplications(dc, jobAdIdList), }); } }
public void Build(Scene scene) { foreach (Primitive p in scene.Primitives) { Root.Add(p); } int prims = scene.Primitives.Count; AxisAlignedBox sBox = scene.Extends; _list = null; _sortedList = null; Subdivide(Root, sBox, 0, prims); }
public void AddUpdate(IEnumerable <DeviceConnection> existingConnections, List <DeviceConnection> connections) { var splitList = new SplitList <DeviceConnection>(); splitList.Process(existingConnections, connections, (source, target) => target.Id = source.Id); using (Db.Open()) { Add(splitList.New, Db); Update(splitList.Existing, Db); Db.Commit(); } }
public (ServerFrame ServerFrame, List <UnitFrame> UnitFrame) GetServerData(Player player) { float viewRange = Math.Max(player.ViewZone.ViewRange + 2f, _config.MaxViewRange); bool FilterRect(Vector2 pos) => (pos.X > player.ViewZone.MinX - 1f && pos.X < player.ViewZone.MaxX + 1f) && (pos.Y > player.ViewZone.MinY - 1f && pos.Y < player.ViewZone.MaxY + 1f); var visiblePlayers = _players.Where((p) => p.Value == player || (p.Value.IsAlive && (p.Value.UnitsEffect?.StatsChange.UnitVisible ?? true) && (p.Value.AvgPosition - player.AvgPosition).SqrLength() < viewRange * viewRange) && FilterRect(p.Value.AvgPosition)) .Select((p) => p.Value.GetPlayerCameraInfo()).ToArray(); var visibleUnits = OverlapUnits(player.AvgPosition, viewRange) .Where((u) => (u.CurrentStats.UnitVisible || u.Owner == player) && FilterRect(u.Position)); var visibleUnitsData = visibleUnits.Select((u) => u.GetUnitInfo(this, player)).ToList(); int[] visibleUnitsMap = new int[_units.Length / 32 + 1]; foreach (var unit in visibleUnitsData) { visibleUnitsMap.SetBit(unit.UnitId); } var visibleRunes = _runesTree.Overlap <Rune>(player.AvgPosition, viewRange) .Select((r) => r.GetRuneInfo()).ToArray(); var sFrame = new ServerFrame() { State = _worldState, PlayTime = _timeToEnd, ZoneSize = ZoneRadius, AlivePlayers = _alivePlayers, Cooldown = player.GetCooldown(), VisualEffect = player.UnitsEffect?.VisualEffect ?? VisualEffect.None, VisualEffectTime = (float)((player.UnitsEffect?.EndTime ?? DateTime.Now) - DateTime.Now).TotalSeconds, PlayerCameras = visiblePlayers, EnabledUnits = visibleUnitsMap, UnitKill = player.PlayerStatus.UnitKill, PlayerUnitCount = player.Units.Count, Runes = visibleRunes }; var unitFrames = SplitList.Split(visibleUnitsData, visibleUnitsData.Count < 45 ? 12 : 24) .Select((lst) => new UnitFrame() { Units = lst.ToArray(), PacketId = UnitFrame.UnitsPacketId++ }).ToList(); return(sFrame, unitFrames); }
public static SplitList<double> ParseDoubleList(string target) { SplitList<string> list = ParseStringList(MZTabConstants.BAR, target); SplitList<double> valueList = new SplitList<double>(MZTabConstants.BAR); foreach (string listItem in list){ double value = ParseDouble(listItem); if (value.Equals(double.MinValue)){ valueList.Clear(); break; } valueList.Add(value); } return valueList; }
JobAdReport IJobAdReportsRepository.GetJobAdReport(IEnumerable <Guid> posterIds, DateRange dateRange) { using (var dc = CreateDataContext(true)) { var posterIdList = new SplitList <Guid>(posterIds).ToString(); return(new JobAdReport { OpenedJobAds = GetOpenedJobAds(dc, posterIdList, dateRange).ToList(), ClosedJobAds = GetClosedJobAds(dc, posterIdList, dateRange).ToList(), Totals = new JobAdTotalsReport { Views = GetViewedJobAdsByPosters(dc, posterIdList, dateRange), Applications = GetApplicationsByPosters(dc, posterIdList, dateRange), }, }); } }
/** * A list of '|' separated parameters */ public static SplitList<Param> ParseParamList(string target) { SplitList<string> list = ParseStringList(MZTabConstants.BAR, target); SplitList<Param> paramList = new SplitList<Param>(MZTabConstants.BAR); foreach (string item in list){ Param param = ParseParam(item); if (param == null){ paramList.Clear(); return paramList; } paramList.Add(param); } return paramList; }
/** * A publication on this unit. PubMed ids must be prefixed by “pubmed:”, * DOIs by “doi:”. Multiple identifiers MUST be separated by “|”. */ public static SplitList<PublicationItem> ParsePublicationItems(string target) { SplitList<string> list = ParseStringList(MZTabConstants.BAR, target); SplitList<PublicationItem> itemList = new SplitList<PublicationItem>(MZTabConstants.BAR); foreach (string pubList in list){ var pub = ParseString(pubList); if (pub == null){ itemList.Clear(); break; } string[] items = pub.Split(new[]{"" + MZTabConstants.COLON}, StringSplitOptions.None); PublicationType type; if (items.Length != 2 || (type = PublicationItem.FindType(items[0].Trim())) == null){ itemList.Clear(); break; } string accession = items[1].Trim(); PublicationItem item = new PublicationItem(type, accession); itemList.Add(item); } return itemList; }
/** * A '|' delimited list of GO accessions */ public static SplitList<string> ParseGoTermList(string target) { SplitList<string> list = ParseStringList(MZTabConstants.COMMA, target); SplitList<string> goList = new SplitList<string>(MZTabConstants.COMMA); foreach (string listitem in list){ var item = ParseString(listitem); if (item.StartsWith("GO:")){ goList.Add(item); } else{ goList.Clear(); break; } } return goList; }
public static SplitList<Modification> ParseModificationList(Section section, string target) { target = ParseString(target); if (target == null){ return null; } SplitList<Modification> modList = new SplitList<Modification>(MZTabConstants.COMMA); if (target.Equals("0")){ modList.Add(Modification.CreateNoModification(section)); return modList; } target = translateCommaToTab(target); SplitList<string> list = ParseStringList(MZTabConstants.COMMA, target); foreach (string item in list){ Modification mod = ParseModification(section, item.Trim()); if (mod == null){ modList.Clear(); break; } modList.Add(mod); } return modList; }
public bool AddSearchEngineScore(MsRun msRun, CVParam param) { if (param == null){ return false; } SplitList<Param> searchparams = getSearchEngineScore(msRun); if (searchparams == null){ searchparams = new SplitList<Param>(MZTabConstants.BAR); SetSearchEngineScore(msRun, searchparams); } searchparams.Add(param); return true; }
public void SetSearchEngineScore(MsRun msRun, SplitList<Param> searchEngineScore) { SetSearchEngineScore(getPosition(PeptideColumn.SEARCH_ENGINE_SCORE, msRun), searchEngineScore); }
public void setSearchEngineScore(MsRun msRun, SplitList<Param> searchEngineScore) { setValue(getPosition(SmallMoleculeColumn.SEARCH_ENGINE_SCORE, msRun), searchEngineScore); }
public Metadata CreateMetadataDefault(IMatrixData parameters, IMatrixData experiment, IMatrixData search) { Metadata mtd = new Metadata(new MZTabDescription(MzTabMode.Complete, MzTabType.Quantification)); List<MsRunImpl> runs = null; List<StudyVariable> studyvariables = null; List<Assay> assays = null; List<Sample> samples = null; List<Instrument> instruments = null; GetExperminetValues(null, null, experiment, search, ref runs, ref studyvariables, ref assays, ref samples, ref instruments); foreach (var msRun in runs){ mtd.MsRunMap.Add(msRun.Id, msRun); } foreach (var studyvariable in studyvariables){ mtd.StudyVariableMap.Add(studyvariable.Id, studyvariable); } foreach (var sample in samples){ mtd.SampleMap.Add(sample.Id, sample); } foreach (var assay in assays){ mtd.AssayMap.Add(assay.Id, assay); } foreach (var instrument in instruments){ mtd.InstrumentMap.Add(instrument.Id, instrument); } SplitList<Lib.Model.Param> sampleProcessing = new SplitList<Lib.Model.Param>{ cv.GetParam("enzyme digestion", "SEP"), cv.GetParam("reversed-phase chromatography", "SEP") }; //sampleProcessing.Add(_cv.GetParam("ion-exchange chromatography", "SEP")); mtd.SampleProcessingMap.Add(1, sampleProcessing); var paramDict = MzTabMatrixUtils.ConvertToParamDict(parameters); string key = Constants.GetKeywordName(Utils.parameters.fixedMod, paramDict.Keys.ToArray()); if (key != null){ string[] values = paramDict[key].Split(';'); foreach (var mod in values.Select(x => BaseLib.Mol.Tables.Modifications[x])){ int id = mtd.FixedModMap.Count + 1; mtd.AddFixedModParam(id, cv.GetModificationParam(mod)); mtd.AddFixedModPosition(id, mod.Position.ToString()); mtd.AddFixedModSite(id, StringUtils.Concat(", ", mod.GetSiteArray())); } } key = Constants.GetKeywordName(Utils.parameters.variableMod, paramDict.Keys.ToArray()); if (key != null){ string[] values = paramDict[key].Split(';'); foreach (var mod in values.Select(x => BaseLib.Mol.Tables.Modifications[x])){ int id = mtd.VariableModMap.Count + 1; mtd.AddVariableModParam(id, cv.GetModificationParam(mod)); mtd.AddVariableModPosition(id, mod.Position.ToString()); mtd.AddVariableModSite(id, StringUtils.Concat(", ", mod.GetSiteArray())); } } string version = Constants.GetKeywordName(Utils.parameters.version, paramDict.Keys.ToArray()); Software software = new Software(1){ Param = cv.GetParam("MaxQuant", "MS", GetParameterString(parameters, version, null)) }; mtd.SoftwareMap.Add(software.Id, software); software = new Software(2){ Param = cv.GetParam("Andromeda", "MS", GetParameterString(parameters, version, null)) }; mtd.SoftwareMap.Add(software.Id, software); if (assays.Count > 0){ var tmp = ArrayUtils.UniqueValues(assays.Select(x => x.QuantificationReagent.Name).ToArray()); if (tmp.Length == 1 && tmp.First().Equals("Unlabeled sample")){ mtd.QuantificationMethod = cv.GetParam("label-free proteingroup level quantitation", "MS"); } else if (tmp.Any(x => x.Contains("SILAC"))){ mtd.QuantificationMethod = cv.GetParam("SILAC quantitation analysis", "MS"); } } return mtd; }
public bool addRetentionTime(double rt) { if (rt.Equals(double.MinValue)){ return false; } SplitList<double> rtList = RetentionTime; if (rtList == null){ rtList = new SplitList<double>(MZTabConstants.BAR); RetentionTime = rtList; } rtList.Add(rt); return true; }
public bool addSearchEngineScore(MsRun msRun, CVParam param) { if (param == null){ return false; } SplitList<Param> paramList = getSearchEngineScore(msRun); if (paramList == null){ paramList = new SplitList<Param>(MZTabConstants.BAR); setSearchEngineScore(msRun, paramList); } paramList.Add(param); return true; }
public void addIdentifier(string identifier) { if (string.IsNullOrEmpty(identifier)){ return; } SplitList<string> identifierList = Identifier; if (identifierList == null){ identifierList = new SplitList<string>(MZTabConstants.BAR); Identifier = identifierList; } identifierList.Add(identifier); }
public override void Clear() { Value = new SplitList<Lib.Model.Param>[_count]; }
public override void ResetDefault() { Default = Value; }
public static SplitList<SpectraRef> ParseSpectraRefList(Metadata metadata, string target) { SplitList<string> list = ParseStringList(MZTabConstants.BAR, target); SplitList<SpectraRef> refList = new SplitList<SpectraRef>(MZTabConstants.BAR); Regex regex = new Regex("ms_run\\[(\\d+)\\]:(.*)"); foreach (string item in list){ if (regex.IsMatch(item.Trim())){ int ms_file_id = int.Parse(regex.Match(item.Trim()).Groups[1].Value); string reference = regex.Match(item.Trim()).Groups[2].Value; MsRun msRun = metadata.MsRunMap[ms_file_id]; SpectraRef sref = msRun == null ? null : new SpectraRef(msRun, reference); if (sref == null){ refList.Clear(); break; } refList.Add(sref); } } return refList; }
public bool addAmbiguityMembers(string member) { if (string.IsNullOrEmpty(member)){ return false; } SplitList<string> ambiguityMembers = AmbiguityMembers; if (ambiguityMembers == null){ ambiguityMembers = new SplitList<string>(MZTabConstants.COMMA); AmbiguityMembers = ambiguityMembers; } ambiguityMembers.Add(member); return true; }
/** * Multiple identifiers MUST be separated by splitChar. */ public static SplitList<string> ParseStringList(char splitChar, string target) { SplitList<string> list = new SplitList<string>(splitChar); target = ParseString(target); if (target == null){ return list; } // regular express reserved keywords escape IList<char> chars = new List<char>(); switch (splitChar){ case '.': case '$': case '^': case '{': case '}': case '[': case ']': case '(': case ')': case '|': case '*': case '+': case '?': case '\\': chars.Add(splitChar); break; default: chars.Add(splitChar); break; } string[] items = target.Split(chars.ToArray()); list.AddRange(items); return list; }
/** * @return tab split column header string list. */ public SplitList<string> GetHeaderList() { SplitList<string> headerList = new SplitList<string>(MZTabConstants.TAB); foreach (MZTabColumn mzTabColumn in columnMapping.Values){ headerList.Add(mzTabColumn.Header); } return headerList; }
public static void Release(SplitList toRelease) => s_Pool.Release(toRelease);
public bool AddSampleProcessing(int id, SplitList<Param> sampleProcessing) { if (_sampleProcessingMap.ContainsKey(id)){ return false; } sampleProcessing.Separator = MZTabConstants.BAR; _sampleProcessingMap.Add(id, sampleProcessing); return true; }
public bool addModification(Modification modification) { if (modification == null){ return false; } SplitList<Modification> modList = Modifications; if (modList == null){ modList = new SplitList<Modification>(MZTabConstants.COMMA); Modifications = modList; } modList.Add(modification); return true; }
public bool AddBestSearchEngineScore(Param param) { if (param == null){ return false; } SplitList<Param> searchparams = BestSearchEngineScore; if (searchparams == null){ searchparams = new SplitList<Param>(MZTabConstants.BAR); BestSearchEngineScore = (searchparams); } searchparams.Add(param); return true; }
public bool addSearchEngineParam(Param param) { if (param == null){ return false; } SplitList<Param> paramList = SearchEngine; if (paramList == null){ paramList = new SplitList<Param>(MZTabConstants.BAR); SearchEngine = paramList; } paramList.Add(param); return true; }
public bool AddModification(Modification modification) { if (modification == null){ return false; } if (Modifications == null){ Modifications = new SplitList<Modification>(MZTabConstants.COMMA); } if (Modifications.All(x => x.Accession != modification.Accession)){ Modifications.Add(modification); } else{ var m = Modifications.First(x => x.Accession == modification.Accession); foreach (int key in modification.PositionMap.Keys){ if (m.PositionMap.ContainsKey(key)){ continue; } m.AddPosition(key, modification.PositionMap[key]); } } return true; }
public bool addSpectraRef(SpectraRef specRef) { if (specRef == null){ return false; } SplitList<SpectraRef> specRefs = SpectraRef; if (specRefs == null){ specRefs = new SplitList<SpectraRef>(MZTabConstants.BAR); SpectraRef = specRefs; } specRefs.Add(specRef); return true; }
public bool AddRetentionTimeWindow(double rtw) { SplitList<double> rtwList = RetentionTimeWindow; if (rtwList == null){ rtwList = new SplitList<double>(MZTabConstants.BAR); RetentionTimeWindow = rtwList; } if (rtw.Equals(double.MinValue) || rtwList.Contains(rtw)){ return false; } rtwList.Add(rtw); return true; }
public void setSearchEngineScore(string logicalPosition, SplitList<Param> searchEngineScore) { setValue(logicalPosition, searchEngineScore); }
public bool AddSearchEngine(Param param) { if (param == null){ return false; } SplitList<Param> searchParams = SearchEngine; if (searchParams == null){ searchParams = new SplitList<Param>(MZTabConstants.BAR); SearchEngine = searchParams; searchParams.Add(param); } else if (! searchParams.Contains(param)){ searchParams.Add(param); } return true; }