static public void ConvertFasta() { int counter = 0; string line; string sFile = @"data\Homo_sapiens.GRCh37.hg19.dna.chromosome.4.fa"; String sFileNew = @"data\chr4.hg19.fac"; FastaConverter fastaConverter = new FastaConverter(App.Path + sFile); bool b = fastaConverter.Convert(App.Path + sFileNew); if (b) { App.Log("Conversion to " + sFileNew + " was successful"); } else { App.Log("Conversion failed"); } // Read the file and display it line by line. StreamReader file = new StreamReader(App.Path + sFile); App.Log("Opening " + sFile); while ((line = file.ReadLine()) != null) { App.Log(line); counter++; if (counter > 30) { break; } } file.Close(); }
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); }