Esempio n. 1
0
        private List <ProteinDto> ExecutePostTranslationalModificationsModule(SearchParametersDto parameters, List <ProteinDto> candidateProteins,
                                                                              MsPeaksDto massSpectrometryData, ExecutionTimeDto executionTimes)
        {
            Stopwatch         moduleTimer = Stopwatch.StartNew();
            List <ProteinDto> proteoformsList;

            if (parameters.PtmAllow == 1)
            {
                proteoformsList = _postTranslationalModificationModule.ExecutePtmModule(candidateProteins,
                                                                                        massSpectrometryData, parameters);

                _insilicoFilter.ComputeInsilicoScore(proteoformsList, massSpectrometryData.Mass, parameters.HopThreshhold);

                _molecularWeightModule.FilterModifiedProteinsByWholeProteinMass(parameters, proteoformsList,
                                                                                massSpectrometryData);
            }

            else
            {
                proteoformsList = candidateProteins;
                foreach (var protein in proteoformsList)
                {
                    protein.PtmParticulars = new List <PostTranslationModificationsSiteDto>();
                }
            }

            moduleTimer.Stop();
            executionTimes.PtmTime = moduleTimer.Elapsed.ToString();
            return(proteoformsList);
        }
Esempio n. 2
0
        public async Task <IActionResult> SearchEventAsync(string search)
        {
            this.RecordEvent("Search event- The HTTP POST call to search event details has been initiated");

            if (string.IsNullOrEmpty(search))
            {
                this.logger.LogError("Search query is either null or empty");
                return(this.BadRequest(new ErrorResponse {
                    Message = "Search query is either null or empty"
                }));
            }

            try
            {
                var searchParametersDto = new SearchParametersDto
                {
                    SearchString = search,
                    SearchScope  = EventSearchType.SearchByName,
                    UserObjectId = this.UserAadId,
                };
                var searchedEvents = await this.userEventSearchService.GetEventsAsync(searchParametersDto);

                this.RecordEvent("Search event- The HTTP POST call to search event details has been succeeded");
                return(this.Ok(searchedEvents));
            }
            catch (Exception ex)
            {
                this.RecordEvent("Search event- The HTTP POST call to search event details has been failed");
                this.logger.LogError(ex, "Error occurred while searching event");
                throw;
            }
        }
Esempio n. 3
0
        public List <PstTagList> GeneratePeptideSequenceTags(SearchParametersDto parameters, MsPeaksDto peakData)
        {
            //Converting Peak List Data into 2D List
            var peakDatalist = new List <peakData2Dlist>();  //Making a 2D list(peakDatalist) in which Mass & Intensity includes {{FARHAN!! ITS NOT AN EFFICIENT WAY}} NOt NEEDED THIS IF ONCE MsPeaksDto.cs is modified

            for (int row = 0; row <= peakData.Mass.Count - 1; row++)
            {
                var dataforpeakDatalist = new peakData2Dlist(peakData.Mass[row], peakData.Intensity[row]);
                peakDatalist.Add(dataforpeakDatalist);
            }
            var peakDatalistsort = peakDatalist.OrderBy(n => n.Mass).ToArray();

            double[] MassPeakData      = peakDatalistsort.Select(n => n.Mass).ToArray();
            double[] IntensityPeakData = peakDatalistsort.Select(n => n.Intensity).ToArray();
            var      pstList           = new List <NewPstTagsDtoGpu>();

            GeneratePstGpu(MassPeakData, pstList, parameters.HopThreshhold, IntensityPeakData);
            //if (IsFilterPstByLength(parameters))
            //    pstList = pstList.Where(t => t.AminoAcidTag.Length >= parameters.MinimumPstLength && t.AminoAcidTag.Length <= parameters.MaximumPstLength).ToList();

            //FilterTagsWithMultipleOccurences(pstList);


            ////////////var PstTagListGpu = AccomodateIsoforms(pstList, parameters);
            //AccomodateIsoforms(pstList);


            //return pstList;
            var pstList2 = new List <PstTagList>();

            return(pstList2);
        }
Esempio n. 4
0
        private static int ExecuteDenovoModuleGpu(SearchParametersDto parameters, MsPeaksDto massSpectrometryData)
        {
            var pstGenerator = new PstGeneratorGpu();
            var pstTags      = pstGenerator.GeneratePeptideSequenceTags(parameters, massSpectrometryData);

            return(pstTags.Count);
        }
Esempio n. 5
0
 public void StoreSearchFiles(SearchParametersDto param)
 {
     using (var db = new PerceptronDatabaseEntities())
     {
         db.SaveChanges();
     }
 }
Esempio n. 6
0
        private static MsPeaksDto PeakListFileReaderModuleModule(SearchParametersDto parameters, int fileNumber)
        {
            var peakListFileReader = new PeakListFileReader();
            var peakData           = peakListFileReader.PeakListReader(parameters, fileNumber);

            return(peakData);
        }
Esempio n. 7
0
        public List <ProteinDto> ExtractProteins(double mw, SearchParametersDto parameters)
        {
            var query = GetQuery(mw, parameters);

            var connectionString = GetConnectionString(parameters.ProtDb);
            List <SerializedProteinDataDto> prot;

            using (var connection = new SqlConnection(connectionString))
            {
                prot = connection.Query <SerializedProteinDataDto>(query).ToList();
            }

            var proteins = new List <ProteinDto>();

            foreach (var proteinInfo in prot)
            {
                var insilico = new InsilicoObjectDto()
                {
                    InsilicoMassLeft  = proteinInfo.Insilico.Split(',').Select(double.Parse).ToList(),
                    InsilicoMassRight = proteinInfo.Insilico.Split(',').Select(double.Parse).ToList()
                };

                var protein = new ProteinDto()
                {
                    Header          = proteinInfo.ID,
                    InsilicoDetails = insilico,
                    Mw       = proteinInfo.MW,
                    Sequence = proteinInfo.Seq
                };

                proteins.Add(protein);
            }
            return(proteins);
        }
        /// <inheritdoc/>
        public string GenerateFilterQuery(SearchParametersDto searchParametersDto)
        {
            searchParametersDto = searchParametersDto ?? throw new ArgumentNullException(nameof(searchParametersDto), "Search parameter is null");

            return($"{nameof(EventEntity.TeamId)} eq '{searchParametersDto.TeamId}' " +
                   $"and {nameof(EventEntity.Status)} eq {(int)EventStatus.Draft}");
        }
Esempio n. 9
0
        public async Task <IActionResult> GetEventsAsync(string searchString, int pageCount, int eventSearchType, string teamId)
        {
            this.RecordEvent("Get LnD Team Events- The HTTP call to GET events has been initiated");

            try
            {
                var searchParametersDto = new SearchParametersDto
                {
                    SearchString = searchString,
                    PageCount    = pageCount,
                    SearchScope  = (EventSearchType)eventSearchType,
                    TeamId       = teamId,
                };

                var events = await this.teamEventSearchService.GetEventsAsync(searchParametersDto);

                this.RecordEvent("Get LnD Team Events- The HTTP call to GET events has succeeded");

                if (events == null || !events.Any())
                {
                    this.logger.LogInformation("The LnD team events are not available");
                    return(this.Ok(new List <EventEntity>()));
                }

                await this.categoryHelper.BindCategoryNameAsync(events);

                return(this.Ok(events));
            }
            catch (Exception ex)
            {
                this.RecordEvent("Get LnD Team Events- The HTTP call to GET events has been failed");
                this.logger.LogError(ex, "Error occured while fetching LnD team events");
                throw;
            }
        }
Esempio n. 10
0
        //Peak List: Extracting from data file
        private MsPeaksDto PeakListFileReaderModuleModule(SearchParametersDto parameters, int fileNumber, ExecutionTimeDto executionTimes)
        {
            var moduleTimer = new Stopwatch();

            moduleTimer.Start();
            var peakData = _peakListFileReader.PeakListReader(parameters, fileNumber);

            double maxIntensity = peakData.Intensity.Max();

            //DEL ME////Discuss it with Sir. Because during first time reading file I am protonating (FOR MASSES) & normalizing intensities .. #DISCUSSION1(This discussion is Necessary)
            //DEL ME//Yehi data hr jagha use hona ha to ... humma hr jgha m/z or nomralized intensities he chahya...??? ---#Compare kr lo with SPECTRUM---
            ////*************m/z & normalizing for MS2*************////
            ////After reading peaks(Masses & Intensities) from data file. We converted "*"MS2"*" Masses(monoisotopic masses) into m/z.
            //Formula of m/z: m/z = (M+z)/z  where M is the monoisotopic mass & z is the mass of proton.
            //// Maximum Intensity selected from the peak data file & Intensities of "*"MS2"*" are normalized by dividing the selected maximum intensity
            for (int peakDataindex = 1; peakDataindex <= peakData.Mass.Count - 1; peakDataindex++)    //Loop will run only for MS2 so that why its starting from "1".
            {
                peakData.Mass[peakDataindex]      = peakData.Mass[peakDataindex] + 1.00727647;        //monoisotopic to m/z value
                peakData.Intensity[peakDataindex] = peakData.Intensity[peakDataindex] / maxIntensity; //Normalized by dividing the selected maximum intensity
            }

            moduleTimer.Stop();
            executionTimes.FileReadingTime = moduleTimer.Elapsed.ToString();
            return(peakData);
        }
        /// <summary>
        /// Get user events as per user search text and filters
        /// </summary>
        /// <param name="searchString">Search string entered by user.</param>
        /// <param name="pageCount">>Page count for which post needs to be fetched.</param>
        /// <param name="eventSearchType">Event search operation type. Refer <see cref="EventSearchType"/> for values.</param>
        /// <param name="userObjectId">Logged in user's AAD object identifier.</param>
        /// <param name="createdByFilter">Semicolon separated user AAD object identifier who created events.</param>
        /// <param name="categoryFilter">Semicolon separated category Ids.</param>
        /// <param name="sortBy">0 for recent and 1 for popular events. Refer <see cref="SortBy"/> for values.</param>
        /// <returns>List of user events</returns>
        public async Task <IEnumerable <EventEntity> > GetEventsAsync(string searchString, int pageCount, int eventSearchType, string userObjectId, string createdByFilter, string categoryFilter, int sortBy)
        {
            var recentCollaboratorIds = Enumerable.Empty <string>();

            if (sortBy == (int)SortBy.PopularityByRecentCollaborators)
            {
                recentCollaboratorIds = await this.GetTopRecentCollaborators();
            }

            var paramsDto = new SearchParametersDto
            {
                SearchString          = searchString,
                PageCount             = pageCount,
                SearchScope           = (EventSearchType)eventSearchType,
                UserObjectId          = userObjectId,
                CreatedByFilter       = createdByFilter,
                CategoryFilter        = categoryFilter,
                SortByFilter          = sortBy,
                RecentCollaboratorIds = recentCollaboratorIds,
            };

            var userEvents = await this.userEventSearchService.GetEventsAsync(paramsDto);

            return(userEvents);
        }
Esempio n. 12
0
        /// <inheritdoc/>
        public string GenerateFilterQuery(SearchParametersDto searchParametersDto)
        {
            searchParametersDto = searchParametersDto ?? throw new ArgumentNullException(nameof(searchParametersDto), "Search parameter is null");

            return($"({nameof(EventEntity.TeamId)} eq '{searchParametersDto.TeamId}' and {nameof(EventEntity.Status)} eq {(int)EventStatus.Active} " +
                   $"and {nameof(EventEntity.EndDate)} le {DateTime.UtcNow.ToString("O", CultureInfo.InvariantCulture)}) " +
                   $"or ({nameof(EventEntity.Status)} eq {(int)EventStatus.Cancelled} and {nameof(EventEntity.TeamId)} eq '{searchParametersDto.TeamId}')");
        }
        /// <inheritdoc/>
        public string GenerateFilterQuery(SearchParametersDto searchParametersDto)
        {
            searchParametersDto = searchParametersDto ?? throw new ArgumentNullException(nameof(searchParametersDto), "Search parameter is null");

            return($"search.ismatch('{searchParametersDto.UserObjectId}', '{nameof(EventEntity.MandatoryAttendees)}')" +
                   $" and {nameof(EventEntity.Status)} eq {(int)EventStatus.Active}" +
                   $" and {nameof(EventEntity.EndDate)} ge {DateTime.UtcNow.ToString("O", CultureInfo.InvariantCulture)}");
        }
Esempio n. 14
0
        private List <ProteinDto> GetCandidateProtein(SearchParametersDto parameters, MsPeaksDto peakData)
        {
            Stopwatch moduleTimer = Stopwatch.StartNew();

            var listOfProteins = _proteinRepository.ExtractProteins(peakData.WholeProteinMolecularWeight, parameters);

            moduleTimer.Stop();
            return(listOfProteins);
        }
        /// <summary>
        /// Get the results from Azure Search service and populate the result (card + preview).
        /// </summary>
        /// <param name="query">Query which the user had typed in Messaging Extension search field.</param>
        /// <param name="commandId">Command id to determine which tab in Messaging Extension has been invoked.</param>
        /// <param name="userObjectId">Azure Active Directory id of the user.</param>
        /// <param name="count">Number of search results to return.</param>
        /// <param name="localDateTime">Indicates local date and time of end user.</param>
        /// <returns><see cref="Task"/>Returns Messaging Extension result object, which will be used for providing the card.</returns>
        public async Task <MessagingExtensionResult> GetPostsAsync(
            string query,
            string commandId,
            string userObjectId,
            int count,
            DateTimeOffset?localDateTime)
        {
            MessagingExtensionResult composeExtensionResult = new MessagingExtensionResult
            {
                Type             = "result",
                AttachmentLayout = AttachmentLayoutTypes.List,
                Attachments      = new List <MessagingExtensionAttachment>(),
            };
            IEnumerable <EventEntity> trainingResults;

            SearchParametersDto searchParamsDto;

            // commandId should be equal to Id mentioned in Manifest file under composeExtensions section.
            switch (commandId?.ToUpperInvariant())
            {
            case BotCommands.RecentTrainingsCommandId:
                searchParamsDto = new SearchParametersDto
                {
                    SearchString       = query,
                    SearchResultsCount = count,
                    SearchScope        = EventSearchType.AllPublicPrivateEventsForUser,
                    UserObjectId       = userObjectId,
                };
                trainingResults = await this.userEventSearchService.GetEventsAsync(searchParamsDto);

                await this.BindCategoryDetails(trainingResults);

                composeExtensionResult = MessagingExtensionCard.GetCard(trainingResults, this.applicationBasePath, this.localizer, localDateTime);
                break;

            case BotCommands.PopularTrainingsCommandId:
                searchParamsDto = new SearchParametersDto
                {
                    SearchString       = query,
                    SearchResultsCount = count,
                    SearchScope        = EventSearchType.AllPublicPrivateEventsForUser,
                    UserObjectId       = userObjectId,
                    SortByFilter       = (int)SortBy.PopularityByRegisteredUsers,
                };
                trainingResults = await this.userEventSearchService.GetEventsAsync(searchParamsDto);

                await this.BindCategoryDetails(trainingResults);

                composeExtensionResult = MessagingExtensionCard.GetCard(trainingResults, this.applicationBasePath, this.localizer, localDateTime);
                break;

            default:
                break;
            }

            return(composeExtensionResult);
        }
        /// <inheritdoc/>
        public string GenerateFilterQuery(SearchParametersDto searchParametersDto)
        {
            var startDate = DateTime.UtcNow.Date.AddDays(1).Date;
            var endDate   = DateTime.UtcNow.Date.AddDays(2).Date;

            return($"{nameof(EventEntity.Status)} eq {(int)EventStatus.Active} and " +
                   $"{nameof(EventEntity.StartDate)} ge {startDate.ToString("O", CultureInfo.InvariantCulture)} and " +
                   $"{nameof(EventEntity.StartDate)} le {endDate.ToString("O", CultureInfo.InvariantCulture)} and " +
                   $"{nameof(EventEntity.RegisteredAttendeesCount)} gt 0");
        }
Esempio n. 17
0
        public static void DumpParameters(SearchParametersDto parameters)
        {
            string output = JsonConvert.SerializeObject(parameters);

            using (StreamWriter file =
                       new StreamWriter(_directory + "\\Prameters.txt", true))
            {
                file.Write(output);
            }
        }
Esempio n. 18
0
        public static void Benchnmark()
        {
            string[] fileEntries           = Directory.GetFiles(DirectoryPath);
            var      numberOfPeaklistFiles = fileEntries.Length;
            var      executionTimesGpu     = new List <string>();
            var      executionTimesCpu     = new List <string>();
            var      pstCount     = new List <int>();
            var      proteinCount = new List <int>();

            var parameters = new SearchParametersDto()
            {
                HopThreshhold    = 0.1,
                PeakListFileName = fileEntries,
                FileType         = fileEntries.Select(x => Path.GetExtension(DirectoryPath + "//" + x)).ToArray(),
                MinimumPstLength = 1,
                MaximumPstLength = 10,
                FilterDb         = 0,
                ProtDb           = "Ecoli"
            };

            for (var fileNumber = 200; fileNumber < numberOfPeaklistFiles; fileNumber += 400)
            {
                var massSpectrometryData = PeakListFileReaderModuleModule(parameters, fileNumber);

                var timer   = new Stopwatch();
                var pstTags = ExecuteDenovoModuleCpu(parameters, massSpectrometryData);


                var proteins = GetCandidateProtein(parameters, massSpectrometryData);

                for (var pro = 100; pro < proteins.Count; pro += 50)
                {
                    pstCount.Add(pstTags.Count);
                    proteinCount.Add(pro);

                    var filteredproteins = proteins.Take(pro).ToList();
                    timer.Start();
                    var pstFilterCpu = new PstFilterCpu();
                    pstFilterCpu.ScoreProteinsByPst(pstTags, filteredproteins);
                    timer.Stop();
                    executionTimesCpu.Add(timer.Elapsed.TotalMilliseconds.ToString());

                    filteredproteins = proteins.Take(pro).ToList();
                    timer.Restart();
                    timer.Start();
                    var pstFilterGpu = new PstFilterGpu();
                    pstFilterGpu.ScoreProteinsByPst(pstTags, filteredproteins);
                    timer.Stop();
                    executionTimesGpu.Add(timer.Elapsed.TotalMilliseconds.ToString());
                }
            }

            DumpResults(executionTimesGpu, executionTimesCpu, pstCount, proteinCount);
        }
Esempio n. 19
0
        public MsPeaksDto PeakListReader(SearchParametersDto parameters, int fileNumber)//EXTRACTING MASS & INTENSITY FROM FILE(s)
        {
            var intensity = new List <double>();
            var mw        = new List <double>();

            var address = Path.Combine(Path.Combine(Constants.PeakListFolder, parameters.PeakListFileName[fileNumber])); //file address with name.. ALL files uploaded at App_Data folder (C:\inetpub\wwwroot\PerceptronAPI\App_Data). And then, PerceptronLocalService starts working on user data..

            if (parameters.FileType[fileNumber] == ".mzXML")                                                             //INSERT HERE THE SUPPORT OF .mzML
            {
                Decrypt(ref address);
            }

            if (parameters.FileType[fileNumber] == ".mgf")
            {
                mgf_reader(ref address);
            }

            var    counter = 0;
            string line;

            string[] separators = { "\t", " " };
            var      file       = new StreamReader(address);

            while ((line = file.ReadLine()) != null)
            {
                if (line.Contains('\t') || line.Contains(' '))
                {
                    var token = line.Split(separators, StringSplitOptions.RemoveEmptyEntries);
                    var a     = double.Parse(token[0]);                                                     //NEW STRUCTURED LIST CREATE KR K DIRECT PEAKDATA2DLIST (peakData2Dlist) BNANI HA, FOR COMPUTATIONAL EFFICIENCY
                    var b     = double.Parse(token[1]);
                    mw.Add(a);
                    intensity.Add(b);
                }
                else
                {
                    var       a = double.Parse(line);
                    const int b = 0;
                    //mw.Add(a);

                    /////////////////Neutral mass

                    mw.Add(a + 1.0078250321);  // Why adding?? Mass of Hydrogen = 1.007825035
                                               //Because (m+z)/z

                    intensity.Add(b);
                }
                counter++;
            }
            file.Close();
            var mWeight = mw[0];

            return(new MsPeaksDto(intensity, mw, mWeight));
        }
Esempio n. 20
0
        /// <summary>
        ///  This method is called when the Microsoft.Extensions.Hosting.IHostedService starts.
        ///  The implementation should return a task that represents the lifetime of the long
        ///  running operation(s) being performed.
        /// </summary>
        /// <param name="stoppingToken">Triggered when Microsoft.Extensions.Hosting.IHostedService.StopAsync(System.Threading.CancellationToken) is called.</param>
        /// <returns>A System.Threading.Tasks.Task that represents the long running operations.</returns>
        protected async override Task ExecuteAsync(CancellationToken stoppingToken)
        {
            while (!stoppingToken.IsCancellationRequested)
            {
                try
                {
                    this.logger.LogInformation($"Notification Hosted Service is running at: {DateTimeOffset.UtcNow} UTC.");

                    var reminderSearchParametersDto = new SearchParametersDto
                    {
                        SearchString = "*",
                        PageCount    = null,
                        UserObjectId = null,
                        SearchScope  = EventSearchType.DayBeforeReminder,
                    };

                    var dailyReminderEvents = await this.userEventSearchService.GetEventsAsync(reminderSearchParametersDto);

                    if (!dailyReminderEvents.IsNullOrEmpty())
                    {
                        await this.SendReminder(dailyReminderEvents, NotificationType.Daily);
                    }

                    if (DateTimeOffset.UtcNow.DayOfWeek == DayOfWeek.Monday)
                    {
                        reminderSearchParametersDto.SearchScope = EventSearchType.WeekBeforeReminder;

                        var weeklyReminderEvents = await this.userEventSearchService.GetEventsAsync(reminderSearchParametersDto);

                        if (!weeklyReminderEvents.IsNullOrEmpty())
                        {
                            await this.SendReminder(weeklyReminderEvents, NotificationType.Weekly);
                        }
                    }
                }
                catch (CloudException ex)
                {
                    this.logger.LogError(ex, $"Error occurred while accessing search service: {ex.Message} at: {DateTimeOffset.UtcNow}");
                }
                catch (StorageException ex)
                {
                    this.logger.LogError(ex, $"Error occurred while accessing storage: {ex.Message} at: {DateTimeOffset.UtcNow}");
                }
#pragma warning disable CA1031 // Catching general exceptions that might arise during execution to avoid blocking next run.
                catch (Exception ex)
#pragma warning restore CA1031 // Catching general exceptions that might arise during execution to avoid blocking next run.
                {
                    this.logger.LogError(ex, "Error occurred while running digest notification service.");
                }

                await Task.Delay(TimeSpan.FromDays(1), stoppingToken);
            }
        }
Esempio n. 21
0
 //Store Query Parameters
 public void StoreSearchParameters(SearchParametersDto param)
 {
     using (var db = new PerceptronDatabaseEntities())
     {
         db.SearchQueries.Add(param.SearchQuerry);
         db.SearchParameters.Add(param.SearchParameters);
         db.SearchFiles.AddRange(param.SearchFiles);
         //db.PtmFixedModifications.AddRange(param.FixedMods);
         //db.PtmVariableModifications.AddRange(param.VarMods);
         db.SaveChanges();
     }
 }
Esempio n. 22
0
        private void StoreSearchResults(SearchParametersDto parameters, List <ProteinDto> candidateProteins, ExecutionTimeDto executionTimes,
                                        int fileNumber)
        {
            if (candidateProteins.Count > Constants.NumberOfResultsToStore)
            {
                candidateProteins = candidateProteins.Take(Constants.NumberOfResultsToStore).ToList <ProteinDto>();
            }

            var final = new SearchResultsDto(parameters.Queryid, candidateProteins, executionTimes);

            _dataLayer.StoreResults(final, parameters.PeakListFileName[fileNumber], fileNumber);
        }
Esempio n. 23
0
        //Mass Tunner
        private void ExecuteMassTunerModule(SearchParametersDto parameters, MsPeaksDto peakData, ExecutionTimeDto executionTimes)
        {
            Stopwatch moduleTimer = Stopwatch.StartNew();

            if (parameters.Autotune == 1)
            {
                //double a = parameters.NeutralLoss;
                _wholeProteinMassTuner.TuneWholeProteinMass(peakData, parameters.MwTolerance);
            }
            moduleTimer.Stop();
            executionTimes.TunerTime = moduleTimer.Elapsed.ToString();
        }
Esempio n. 24
0
        public async Task <IActionResult> GetFlooringBySearch(SearchParametersDto search)
        {
            var flooringResponse = await _flooringService.GetFlooring(search);

            if (flooringResponse.Success)
            {
                return(Ok(flooringResponse.Results));
            }
            else
            {
                return(BadRequest(flooringResponse.FriendlyError));
            }
        }
Esempio n. 25
0
        public async Task ValidateCategoryInUse_NotInUse()
        {
            const string categoryToTest  = "ad4b2b43-1cb5-408d-ab8a-17e28edac1ba";
            var          searchParamsDto = new SearchParametersDto();

            this.teamEventSearchService
            .Setup(t => t.GetEventsAsync(searchParamsDto))
            .Returns(Task.FromResult(EventWorkflowHelperData.eventEntities.Where(e => e.CategoryId == categoryToTest)));

            await this.categoryHelper.CheckIfCategoryIsInUseAsync(EventWorkflowHelperData.categoryList);

            Assert.AreEqual(false, EventWorkflowHelperData.categoryList.Where(e => e.CategoryId == categoryToTest).FirstOrDefault().IsInUse);
        }
Esempio n. 26
0
        public List <ProteinDto> ExtractProteins(double mw, SearchParametersDto parameters)
        {
            var fPam = new MolecularWeightServiceParametersDto()
            {
                mw         = mw,
                Parameters = parameters
            };

            SendParamters(fPam);

            var proteins = GetProteins();

            return(proteins);
        }
Esempio n. 27
0
        public async Task <FlooringServiceResponse> GetFlooring(SearchParametersDto search = null)
        {
            FlooringServiceResponse response = new FlooringServiceResponse();

            try
            {
                var AllFlooring = await _dbContext.Carpets.ToListAsync();

                // filters
                if (!search.SkipSearchParameters || search == null)
                {
                    //pets
                    AllFlooring = AllFlooring.Where(e => e.PetFriendly == search.Pets).ToList();

                    //style
                    AllFlooring = AllFlooring.Where(e => e.Style == search.Style).ToList();
                }

                response.Results = AllFlooring.Select(e => new FlooringDto()
                {
                    Id               = e.Id,
                    Name             = e.Name,
                    Description      = e.Description,
                    DurabilityFactor = e.DurabilityFactor,
                    PriceM2          = e.PriceM2,
                    Properties       = e.Propertys.Select(r => r.BulletPoint).ToList(),
                    Images           = e.Images.Select(i => new FlooringImageDto()
                    {
                        Id            = i.Id,
                        AlternateText = i.AlternateText,
                        ImageType     = i.ImageType,
                        ImageName     = i.ImageName,
                        Link          = "/Images/" + i.Link
                    }).ToList()
                }).ToList();

                response.Success = true;
            }
            catch (Exception e)
            {
                response.Success       = false;
                response.FriendlyError = e.ToString();
                _logger.LogError(e, "Error at flooring service on GetFLooring");
            }

            return(response);
        }
Esempio n. 28
0
        //Get Query
        public SearchParametersDto GetParameters(string qid)
        {
            var query = "SELECT * FROM proteomics.query where QueryId='" + qid + "';";
            var qp    = new SearchParametersDto();

            if (!OpenConnection())
            {
                return(qp);
            }
            var cmd    = new MySqlCommand(query, _connection);
            var reader = cmd.ExecuteReader();

            if (reader.Read())
            {
                qp.Queryid          = reader.GetValue(0).ToString();
                qp.UserId           = reader.GetValue(1).ToString();
                qp.Title            = reader.GetValue(2).ToString();
                qp.ProtDb           = reader.GetValue(3).ToString();
                qp.InsilicoFragType = reader.GetValue(4).ToString();
                qp.FilterDb         = Convert.ToInt32(reader.GetValue(5));
                qp.PtmTolerance     = Convert.ToDouble(reader.GetValue(6));
                qp.MwTolUnit        = reader.GetValue(7).ToString();
                qp.MwTolerance      = Convert.ToDouble(reader.GetValue(8));
                qp.HopThreshhold    = Convert.ToDouble(reader.GetValue(9));
                qp.MinimumPstLength = Convert.ToInt32(reader.GetValue(10));
                qp.MaximumPstLength = Convert.ToInt32(reader.GetValue(11));
                qp.GuiMass          = Convert.ToDouble(reader.GetValue(12));
                qp.HandleIons       = reader.GetValue(13).ToString();
                qp.Autotune         = Convert.ToInt32(reader.GetValue(14));
                qp.HopTolUnit       = reader.GetValue(15).ToString();
                qp.MwSweight        = Convert.ToDouble(reader.GetValue(16));
                qp.PstSweight       = Convert.ToDouble(reader.GetValue(17));
                qp.InsilicoSweight  = Convert.ToDouble(reader.GetValue(18));
                qp.NumberOfOutputs  = Convert.ToInt32(reader.GetValue(19));
                qp.DenovoAllow      = Convert.ToInt32(reader.GetValue(20));
                qp.PtmAllow         = Convert.ToInt32(reader.GetValue(21));
                qp.NeutralLoss      = Convert.ToDouble(reader.GetValue(22)); //#Ididntgetthis  -- {reader.GetValue(22)}
                qp.PSTTolerance     = Convert.ToDouble(reader.GetValue(23));
            }

            reader.Close();
            _connection.Close();

            GetFiles(qp);
            return(qp);
        }
Esempio n. 29
0
        public List <EmployeeDto> GetFilteredEmployee(SearchParametersDto query)
        {
            var employeeDataService = _iocContext.Resolve <IEmployeeDataService>();
            var employees           = employeeDataService.GetFilteredEmployee(query.SearchBy, query.FilterBy, query.Query, query.toDate);
            var employeeList        = employees.Select(e => new EmployeeDto
            {
                Id              = e.Employee.Id,
                BandId          = e.Employee.BandId,
                BandName        = e.EmployeeBand.Name,
                Name            = e.Employee.Name,
                DateOfJoin      = e.Employee.DateOfJoin,
                DesignationId   = e.Employee.DesignationId,
                DesignationName = e.EmployeeDesignation.Name,
                Number          = e.Employee.Number
            }).ToList();

            return(employeeList);
        }
Esempio n. 30
0
        public static string ProteinSearch1(SearchParametersDto parameters)
        {
            //var newJob = new Job
            //{
            //    Qid = parameters.Queryid,
            //    Uid = parameters.UserId,
            //    Progress = "Initiating Search!"
            ////};
            //CurrentJobs.Initialize();
            //CurrentJobs.current.Add(newJob);
            //int q = Db.QueryStore(parameters);
            //if (q == -1)
            //    return "Not ok";
            SqlDatabase p = new SqlDatabase();

            p.StoreSearchFiles(parameters);
            return("ok");
        }