/// <summary> /// This method renders the single line report for BLAST hits. /// </summary> /// <param name="results">BLAST hits</param> private void RenderSingleLineReport(IList <BlastResult> results, IBlastServiceHandler blastService, string databaseName) { this.lstSingleLineReport.ItemsSource = null; this.lstSingleLineReport.Items.Clear(); this.blastResultCollator.Clear(); this.Focus(); foreach (BlastResult result in results) { foreach (BlastSearchRecord record in result.Records) { if (null != record.Hits && 0 < record.Hits.Count) { foreach (Hit hit in record.Hits) { if (null != hit.Hsps && 0 < hit.Hsps.Count) { foreach (Hsp hsp in hit.Hsps) { BlastResultCollator blast = new BlastResultCollator(); blast.Uri = BlastHitUrlResolver.ResolveUrl(hit.Id, blastService, databaseName); blast.Alignment = hsp.AlignmentLength; blast.Bit = hsp.BitScore; blast.EValue = hsp.EValue; blast.Identity = hsp.IdentitiesCount; blast.Length = hit.Length; blast.QEnd = hsp.QueryEnd; blast.QStart = hsp.QueryStart; blast.QueryId = record.IterationQueryId; blast.SEnd = hsp.HitEnd; blast.SStart = hsp.HitStart; blast.SubjectId = hit.Id; blast.Positives = hsp.PositivesCount; blast.QueryString = hsp.QuerySequence; blast.SubjectString = hsp.HitSequence; blast.Accession = hit.Accession; blast.Description = hit.Def; blast.Gaps = hsp.Gaps; this.blastResultCollator.Add(blast); } } } } } } this.lstSingleLineReport.ItemsSource = this.blastResultCollator; // Invoke the Silvermap if (this.blastResultCollator.Count > 0 || this.webServiceReportTab.SelectedIndex == 1) { this.silverMapControl.InvokeSilverMap(this.blastResultCollator); } }
/// <summary> /// Initializes a new instance of the PairwiseSequenceAlignment class. /// </summary> /// <param name="blastResult"> /// Blast result for which we are displaying Pairwise sequence alignment report. /// </param> public PairwiseSequenceAlignment(BlastResultCollator blastResult) { this.InitializeComponent(); // Hnadkes the "Esc" key event and closes the dialog. this.PreviewKeyUp += new System.Windows.Input.KeyEventHandler(this.OnDialogKeyUp); this.Owner = Application.Current.MainWindow; if (blastResult != null) { this.blastResult = blastResult; this.Display(); } }
/// <summary> /// This method listens to the key down on the ListViewItem and if thekey pressed is the "Enter Key" /// , then it displays the Pairwise sequence alignment report. /// </summary> /// <param name="sender">ListView instance.</param> /// <param name="e">Event Data.</param> private void OnListViewKeyUp(object sender, KeyEventArgs e) { if (e.Key == Key.Enter) { DependencyObject dep = (DependencyObject)e.OriginalSource; if (dep != null) { BlastResultCollator item = this.lstSingleLineReport.ItemContainerGenerator.ItemFromContainer(dep) as BlastResultCollator; if (item != null) { BlastPane.RenderPairwiseSequenceAlignment(item); } } } }
/// <summary> /// This method listens to the double click on the List view /// and if the a ListView item has been clicked, then it displays /// the Pairwise sequence alignment report. /// </summary> /// <param name="sender">ListView instance</param> /// <param name="e"> Event data.</param> private void OnListViewDoubleClick(object sender, MouseButtonEventArgs e) { DependencyObject dep = (DependencyObject)e.OriginalSource; while ((dep != null) && !(dep is ListViewItem)) { dep = VisualTreeHelper.GetParent(dep); } if (dep == null) { return; } BlastResultCollator item = this.lstSingleLineReport.ItemContainerGenerator.ItemFromContainer(dep) as BlastResultCollator; if (item != null) { BlastPane.RenderPairwiseSequenceAlignment(item); } }
/// <summary> /// This method renders the multiple line report for BLAST hits. /// </summary> /// <param name="blastResult">BLAST hits</param> private static void RenderPairwiseSequenceAlignment(BlastResultCollator blastResult) { PairwiseSequenceAlignment alignment = new PairwiseSequenceAlignment(blastResult); alignment.ShowDialog(); }