static public String FusionHmmScan(String title, String seq1, String seq2) { String ret = ""; seq1 = FastaConverter.ConvertString(seq1); seq2 = FastaConverter.ConvertString(seq2); List <String> seqs = new List <string>(); for (int i = 0; i < 5; i++) { seqs.Add(seq1 + seq2); // + + seqs.Add(seq1 + Sequencer.InvCompl(seq2)); // + - seqs.Add(Sequencer.InvCompl(seq1) + seq2); // - + // 20% deletieren int cut1 = (int)Math.Round(seq1.Length * 0.2); int cut2 = (int)Math.Round(seq2.Length * 0.2); seq1 = seq1.Substring(0, seq1.Length - cut1); seq2 = seq2.Substring(cut2); } List <String> orfs = new List <string>(); foreach (String seq in seqs) // 6-frame ORFs { orfs.Add(seq.Substring(0)); orfs.Add(seq.Substring(1)); orfs.Add(seq.Substring(2)); String seqInv = Sequencer.InvCompl(seq); orfs.Add(seqInv.Substring(0)); orfs.Add(seqInv.Substring(1)); orfs.Add(seqInv.Substring(2)); } Hmmer hmmer = new Hmmer(); Hmmer.SetDatabase("PFam-A"); Hmmer.Debug = true; int c = 0; foreach (String orf in orfs) { String peptide = Sequencer.Translate(orf, true); // Translatieren ohne Stop-Codon hmmer.AddSequence(peptide, title + " #" + c.ToString()); c++; } hmmer.DoScan(); List <Hmmer.Result> results = hmmer.GetResults(); List <string> resultsUnique = new List <string>(); ret += "> " + title + Environment.NewLine; foreach (Hmmer.Result result in results) { if (result.Evalue >= 1) { continue; } string res = result.Accession + ": " + result.Name; if (!resultsUnique.Contains(res)) { resultsUnique.Add(res); ret += res + Environment.NewLine; } } ret += Environment.NewLine; return(ret); }
protected void OnFusionEvent(Range fragment1, Range fragment2) { Exon ex1 = Source.WithinExon(fragment1.End); Exon ex2 = Source.WithinExon(fragment2.Start); // 10371808 // 103718617 if ((ex1 != null) && (ex2 != null)) { // Both sides of the cut are within exons if (ex1.Strand == ex2.Strand) { // Both exons are on same strand int bpExon1 = (int)(fragment1.End - ex1.Start); int bpExon2 = (int)(ex2.End - fragment2.Start); int percentExon1 = (int)(((double)bpExon1 / ex1.Length) * 100); int percentExon2 = (int)(((double)bpExon2 / ex2.Length) * 100); if ((bpExon1 > 100) && (bpExon2 > 100)) { String seqFusion, seq1, seq2; Range rangeLeft = new Range(ex1.Start, fragment1.End); Range rangeRight = new Range(fragment2.Start, ex2.End); seq1 = Source.Read(rangeLeft.Start, (int)rangeLeft.Length); seq2 = Source.Read(rangeRight.Start, (int)rangeRight.Length); seqFusion = seq1 + seq2; Dictionary <String, String> orfs = new Dictionary <string, string>(); orfs.Add("Forward 0", Sequencer.GetORF(seqFusion, 0)); orfs.Add("Forward 1", Sequencer.GetORF(seqFusion, 1)); orfs.Add("Forward 2", Sequencer.GetORF(seqFusion, 2)); String seqInv = Sequencer.Invert(Sequencer.Complement(seqFusion)); orfs.Add("Reverse 0", Sequencer.GetORF(seqInv, 0)); orfs.Add("Reverse 1", Sequencer.GetORF(seqInv, 1)); orfs.Add("Reverse 2", Sequencer.GetORF(seqInv, 2)); Dictionary <String, String> peptides = new Dictionary <string, string>(); bool bSignificantPeptides = false; foreach (String key in orfs.Keys) { if (orfs[key].Length >= 120) { String pep = Sequencer.Translate(orfs[key]); peptides.Add(key, pep); bSignificantPeptides = true; } } if (bSignificantPeptides) { NumGenes++; String htmlEx1 = "<a href='http://www.ensembl.org/Homo_sapiens/Search/Details?species=Homo_sapiens;idx=Transcript;end=1;q=" + ex1.Name + "' target='_blank'>" + ex1.Name + "</a> " + bpExon1.ToString() + "bp (" + percentExon1.ToString() + "%)"; String htmlEx2 = "<a href='http://www.ensembl.org/Homo_sapiens/Search/Details?species=Homo_sapiens;idx=Transcript;end=1;q=" + ex2.Name + "' target='_blank'>" + ex2.Name + "</a> " + bpExon2.ToString() + "bp (" + percentExon2.ToString() + "%)"; if (ExtendedOutput) { App.Log("<b>Found Fusion Gene #" + NumGenes + ": </b>" + htmlEx1 + " <b>&</b> " + htmlEx2 + ""); } // App.Log("Fusion Sequence: " + seqFusion); foreach (String key in peptides.Keys) { String pep = peptides[key]; if (ExtendedOutput) { App.Log(key + ": " + pep); } FusionSequence fs = new FusionSequence(); fs.SequenceId = NumOrf.ToString(); fs.IsHit = false; fs.Exon1 = ex1; fs.Exon2 = ex2; fs.OrfName = key; fs.Range1 = rangeLeft; fs.Range2 = rangeRight; fs.Sequence = pep; FusionSequences.Insert(NumOrf, fs); Hmmer.AddSequence(pep, fs.SequenceId); //String sequenceName = "#" + NumGenes+" "+ex1.Name + " " + percentExon1.ToString() + "% & " + ex2.Name + " " + percentExon2.ToString() + "% ORF " + key; NumOrf++; } } // if (bSignificantPeptides) } // if ((bpExon1 > 100) && (bpExon2 > 100)) } // if (ex1.Strand == ex2.Strand) } // if ((ex1 != null) && (ex2 != null)) else { //App.Log("No Fusion Gene :("); } }