/// <summary> /// Initializes a new instance of the <see cref="SubsequencesSimilarityController"/> class. /// </summary> public SubsequencesSimilarityController() : base(TaskType.SubsequencesSimilarity) { db = new LibiadaWebEntities(); subsequenceExtractor = new SubsequenceExtractor(db); characteristicTypeLinkRepository = FullCharacteristicRepository.Instance; sequenceAttributeRepository = new SequenceAttributeRepository(db); }
/// <summary> /// Retrieves attributes values of given subsequences from database. /// </summary> /// <param name="subsequenceIds"> /// Ids of subsequences which attributes values are to be retrieved. /// </param> /// <returns> /// Dictionary containing subsequences ids as keys and attributes values as values. /// </returns> private Dictionary <long, AttributeValue[]> GetSubsequencesAttributesValues(long[] subsequenceIds) { using (var db = new LibiadaWebEntities()) { var sequenceAttributeRepository = new SequenceAttributeRepository(db); return(sequenceAttributeRepository.GetAttributes(subsequenceIds)); } }
/// <summary> /// Initializes a new instance of the <see cref="SubsequenceImporter"/> class. /// </summary> /// <param name="features"> /// The features. /// </param> /// <param name="sequenceId"> /// The sequence id. /// </param> /// <exception cref="Exception"> /// thrown if length of sequence from database /// is not equal to the length of downloaded sequence. /// </exception> public SubsequenceImporter(List <FeatureItem> features, long sequenceId) { this.features = features; this.sequenceId = sequenceId; sequenceAttributeRepository = new SequenceAttributeRepository(db); allNonGenesLeafLocations = features.Where(f => f.Key != gene) .Select(f => f.Location.GetLeafLocations()) .ToArray(); int parentLength = db.GetSequenceLength(sequenceId); int sourceLength = features[0].Location.LocationEnd; positionsMap = new bool[parentLength]; if (parentLength != sourceLength) { throw new Exception($"Local and loaded sequence length are not equal. Local length: {parentLength}, loaded length: {sourceLength}"); } }