/// <summary> /// This method renders the single line report for BLAST hits. /// </summary> /// <param name="results">BLAST hits</param> private void RenderSingleLineReport(IList <BlastResult> results, IBlastWebHandler 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> /// This method displays BLAST hits on the UI. /// </summary> /// <param name="results">BLAST hits</param> public void DisplayWebServiceOutput(IList <BlastResult> results, IBlastWebHandler blastService, string databaseName) { if (results != null && results.Count >= 1) { this.RenderSingleLineReport(results, blastService, databaseName); this.blastResult = results[0]; this.txtDate.Text = DateTime.Now.Date.ToString(CultureInfo.CurrentCulture); this.txtDataBaseName.Text = this.blastResult.Metadata.Database; this.txtVersion.Text = this.blastResult.Metadata.Version; } }
/// <summary> /// Get the url for a blast hit /// </summary> /// <param name="hitID">Blast hit id</param> /// <param name="blastService">Instance of the blast service</param> /// <param name="databaseName">Database name used in the blast query</param> /// <returns>A url if resolved, else null</returns> public static string ResolveUrl(string hitID, IBlastWebHandler blastService, string databaseName) { // NCBI if (blastService.Name == WebServices.NcbiBlast.Name) { string[] idSplit = hitID.Split('|'); if (idSplit.Length < 2) { return(null); } string id = idSplit[1]; return(string.Format("http://www.ncbi.nlm.nih.gov/protein/{0}", id)); } // TODO: /* * // EBI * else if (blastService.Name == WebServices.EbiBlast.Name) * { * string[] idSplit = hitID.Split(':', ';'); * if (idSplit.Length < 2) * return null; * * string id = idSplit[1]; * * switch(databaseName) * { * case "em_rel": * return string.Format("http://www.ebi.ac.uk/ena/data/view/{0}", id); * * case "uniprot": * return string.Format("http://www.uniprot.org/uniprot/{0}.html", id); * * default: * return null; * } * } */ // Return null if url was not resolved return(null); }