Esempio n. 1
0
 private void DisplayLocationDetails(FeatureLocation floc)
 {
     DeactivateButton.Text = string.Format(
         "Deactivate {0} selected activation(s)",
         LocationGrid.SelectedRows.Count);
     LocationDetailsView.Items.Clear();
     if (floc == null) { return; }
     AddLocationProperty("Feature Name", floc.Feature.Name);
     AddLocationProperty("Feature Id", floc.Feature.Id.ToString());
     AddLocationProperty("Scope", floc.Location.ScopeAbbrev);
     AddLocationProperty("Location Name", floc.Location.Name);
     AddLocationProperty("Location URL", floc.Location.Url);
     AddLocationProperty("Location Id", floc.Location.Id.ToString());
     if (!string.IsNullOrEmpty(floc.Location.Template.Name))
     {
         AddLocationProperty("Template Name", floc.Location.Template.Name);
         AddLocationProperty("Template Title", floc.Location.Template.Title);
     }
     switch (floc.Location.Scope)
     {
         case SPFeatureScope.Site:
             AddSiteDetails(floc.Location);
             break;
         case SPFeatureScope.Web:
             AddWebDetails(floc.Location);
             break;
     }
 }
Esempio n. 2
0
        private void DisplayLocationDetails(FeatureLocation floc)
        {
            DeactivateButton.Text = string.Format(
                "Deactivate {0} selected activation(s)",
                LocationGrid.SelectedRows.Count);
            LocationDetailsView.Items.Clear();
            if (floc == null)
            {
                return;
            }
            AddLocationProperty("Feature Name", floc.Feature.Name);
            AddLocationProperty("Feature Id", floc.Feature.Id.ToString());
            AddLocationProperty("Scope", floc.Location.ScopeAbbrev);
            AddLocationProperty("Location Name", floc.Location.Name);
            AddLocationProperty("Location URL", floc.Location.FullUrl);
            AddLocationProperty("Location Id", floc.Location.Id.ToString());
            if (!string.IsNullOrEmpty(floc.Location.Template.Name))
            {
                AddLocationProperty("Template Name", floc.Location.Template.Name);
                AddLocationProperty("Template Title", floc.Location.Template.Title);
            }
            switch (floc.Location.Scope)
            {
            case SPFeatureScope.Site:
                AddSiteDetails(floc.Location);
                break;

            case SPFeatureScope.Web:
                AddWebDetails(floc.Location);
                break;
            }
        }
Esempio n. 3
0
        public virtual AcceptResult AcceptLocationPair(FeatureLocation floc, SAMAlignedLocation sloc)
        {
            var result = CheckNoPenaltyMutation(floc, sloc);

            if (!result.Accepted)
            {
                return(result);
            }

            result.OverlapPercentage = floc.OverlapPercentage(sloc);
            result.Accepted          = result.OverlapPercentage > 0 && result.OverlapPercentage >= Options.MinimumOverlapPercentage;

            return(result);
        }
Esempio n. 4
0
        public override AcceptResult AcceptLocationPair(FeatureLocation floc, SAMAlignedLocation sloc)
        {
            var result = base.AcceptLocationPair(floc, sloc);

            if (!result.Accepted)
            {
                return(result);
            }

            var offset = sloc.Offset(floc);

            result.Accepted = Options.Offsets.Contains(offset);

            return(result);
        }
Esempio n. 5
0
        private AcceptResult CheckNoPenaltyMutation(FeatureLocation floc, SAMAlignedLocation sloc)
        {
            if (sloc.NumberOfNoPenaltyMutation > 0)
            {
                var polys    = sloc.GetGsnapMismatches();
                var mismatch = 0;
                if (floc.Strand == sloc.Strand) //the non-penalty mutation has to be T2C
                {
                    mismatch = polys.Count(m => m.RefAllele != 'T' || m.SampleAllele != 'C');
                }
                else
                {
                    mismatch = polys.Count(m => m.RefAllele != 'A' || m.SampleAllele != 'G');
                }

                var nnpm = sloc.NumberOfMismatch + sloc.NumberOfNoPenaltyMutation - mismatch;
                if (mismatch > Options.MaximumMismatch || nnpm > Options.MaximumNoPenaltyMutationCount)
                {
                    return(new AcceptResult()
                    {
                        Accepted = false
                    });
                }

                return(new AcceptResult()
                {
                    Accepted = true,
                    NumberOfMismatch = mismatch,
                    NumberOfNoPenaltyMutation = sloc.NumberOfMismatch + sloc.NumberOfNoPenaltyMutation - mismatch
                });
            }
            else if (sloc.NumberOfMismatch > Options.MaximumMismatch)
            {
                return(new AcceptResult()
                {
                    Accepted = false
                });
            }
            else
            {
                return(new AcceptResult()
                {
                    Accepted = true,
                    NumberOfMismatch = sloc.NumberOfMismatch,
                    NumberOfNoPenaltyMutation = 0
                });
            }
        }
Esempio n. 6
0
 private void LocationGrid_SelectionChanged(object sender, EventArgs e)
 {
     if (LocationGrid.SelectedRows.Count > 0)
     {
         _selectedFeatureLocations.Clear();
         foreach (DataGridViewRow row in LocationGrid.SelectedRows)
         {
             _selectedFeatureLocations.Add(row.DataBoundItem as FeatureLocation);
         }
     }
     if (LocationGrid.CurrentRow != null)
     {
         FeatureLocation floc = LocationGrid.CurrentRow.DataBoundItem as FeatureLocation;
         DisplayLocationDetails(floc);
     }
 }
Esempio n. 7
0
        private void dataGridView1_SelectionChanged(object sender, EventArgs e)
        {
            if (dataGridView1.SelectedRows.Count <= 0)
            {
                return;
            }

            object value = dataGridView1.SelectedRows[0].Cells[Table.OIDFieldName].Value;

            if (value == null || value == DBNull.Value)
            {
                return;
            }

            if (FeatLayer != null)
            {
                FeatureLocation?.Invoke(this, new FeatureLocationEventArgs(FeatLayer, $"{Table.OIDFieldName} = {value}"));
            }
        }
Esempio n. 8
0
        private void PopulateLocationGrid()
        {
            // Create list of FeatureLocations
            List <FeatureLocation> list = new List <FeatureLocation>();

            foreach (KeyValuePair <Feature, List <FeatureParent> > pair in _FeatureLocations)
            {
                Feature feature = pair.Key;
                List <FeatureParent> locations = pair.Value;
                foreach (FeatureParent location in locations)
                {
                    FeatureLocation floc = new FeatureLocation();
                    floc.Feature  = feature;
                    floc.Location = location;
                    list.Add(floc);
                }
            }
            this.LocationGrid.DataSource = new SortableBindingList <FeatureLocation>(list);
        }
        public override AcceptResult AcceptLocationPair(FeatureLocation floc, SAMAlignedLocation sloc)
        {
            if (sloc.Parent.Sequence.Length < Options.MinimumReadLengthForLongRNA)
            {
                return(new AcceptResult()
                {
                    Accepted = false
                });
            }

            if (sloc.NumberOfMismatch > Options.MaximumMismatchForLongRNA)
            {
                return(new AcceptResult()
                {
                    Accepted = false
                });
            }

            return(base.AcceptLocationPair(floc, sloc));
        }
Esempio n. 10
0
        public void TestAsArgument()
        {
            IVariable <IFeatureLocation> a  = new Variable <IFeatureLocation>("argument");
            IVariable <double>           c1 = new Variable <double>("value");
            IVariable <string>           c2 = new Variable <string>("description");

            // f = (a, p)(h)
            IFunction f = new Function("rating curve");

            f.Arguments.Add(a);
            f.Components.Add(c1);
            f.Components.Add(c2);

            SimpleFeature    simpleFeature   = new SimpleFeature(10.0);
            IFeatureLocation featureLocation = new FeatureLocation {
                Feature = simpleFeature
            };

            // value based argument referencing.
            f[featureLocation] = new object[] { 1.0, "jemig de pemig" };

            IMultiDimensionalArray <double> c1Value = f.GetValues <double>(new ComponentFilter(f.Components[0]),
                                                                           new VariableValueFilter <IFeatureLocation>(
                                                                               f.Arguments[0],
                                                                               new FeatureLocation
            {
                Feature = simpleFeature
            }));

            Assert.AreEqual(1.0, c1Value[0], 1.0e-6);

            //IMultiDimensionalArray<string> c2Value = f.GetValues<string>(new ComponentFilter(f.Components[1]),
            //                                                             new VariableValueFilter<IFeatureLocation>(
            //                                                                 f.Arguments[0], featureLocation));

            //Assert.AreEqual("jemig de pemig", c2Value[0]);
        }
Esempio n. 11
0
 public FeatureDetail(string name, bool isEnabled, FeatureLocation location)
 {
     Name            = name;
     IsEnabled       = isEnabled;
     FeatureLocation = location;
 }
Esempio n. 12
0
 private void PopulateLocationGrid()
 {
     // Create list of FeatureLocations
     List<FeatureLocation> list = new List<FeatureLocation>();
     foreach (KeyValuePair<Feature, List<Location>> pair in _FeatureLocations)
     {
         Feature feature = pair.Key;
         List<Location> locations = pair.Value;
         foreach (Location location in locations)
         {
             FeatureLocation floc = new FeatureLocation();
             floc.Feature = feature;
             floc.Location = location;
             list.Add(floc);
         }
     }
     this.LocationGrid.DataSource = new SortableBindingList<FeatureLocation>(list);
 }
Esempio n. 13
0
        private void LocationGrid_SelectionChanged(object sender, EventArgs e)
        {
            FeatureLocation floc = LocationGrid.CurrentRow.DataBoundItem as FeatureLocation;

            DisplayLocationDetails(floc);
        }
 /// <summary>
 /// Creates feature detail
 /// </summary>
 /// <param name="name"></param>
 /// <param name="isEnabled"></param>
 /// <param name="location"></param>
 /// <returns></returns>
 private IFeatureDetail Feature(string name, bool isEnabled, FeatureLocation location)
 {
     return(new FeatureDetail(name, isEnabled, location));
 }