public IChromosomeStream GetChromosome(string chromosomeId) { IList<IGene> genes = new List<IGene>(); string prefix = chromosomeId.Substring(chromosomeId.Length > 3 ? chromosomeId.Length - 3 : 0); int totalGenes = 100; int namedGeneInterval = 10; int geneLength = 800; int geneMargin = 200; string sequence = "gattacagattacagattacagattacagattacagattacagattacagattacagattacagattacagattacagattacagattacagattacagattacagattaca"; string translation = "LSASTDUGQWEJHRHWGESBDFKJGHSUIDTDHFGJWHEGRTWEHJDGVFJHSDGBFNMWEBRIYTQTWUWERUOUSDPFSYOZSDJKFHOIUER"; for (int i = 0; i < totalGenes; i++) { String name = (i % namedGeneInterval == 0) ? ("kR" + i.ToString()) : null; IGene gene = new GeneImplementation(); gene.LocusTag = prefix + i.ToString(); gene.LeftBasePair = (geneLength + geneMargin) * i + geneMargin; gene.RightBasePair = gene.LeftBasePair + geneLength; gene.Sequence = sequence; gene.Name = name; gene.Translation = translation; genes.Add(gene); IGene reverseGene = new GeneImplementation(); reverseGene.LocusTag = prefix + i.ToString(); reverseGene.LeftBasePair = (geneLength + geneMargin) * i + geneMargin; reverseGene.RightBasePair = gene.LeftBasePair + geneLength; reverseGene.IsForward = false; reverseGene.Sequence = sequence; reverseGene.Name = name; reverseGene.Translation = translation; genes.Add(reverseGene); } IChromosomeStream stream = new ChromosomeStreamImplementation(); stream.GeneList = genes; stream.TotalBasePairs = totalGenes * (geneLength + geneMargin) + geneMargin; return stream; }
private void addGene() { IGene gene = new GeneImplementation(); state = 2; #region Start, Stop, and Direction words = words[1].Split(' '); gene.LeftBasePair = Int32.Parse(words[0]); gene.RightBasePair = Int32.Parse(words[1]); index++; line = features[index]; words = line.Split('='); gene.IsForward = !Boolean.Parse(words[1].ToLower()); #endregion index++; while (state == 2 && index < features.Length) { line = features[index]; words = line.Split(delimiters, StringSplitOptions.RemoveEmptyEntries); switch (words[0]) { case "DNA": gene.Sequence = words[1]; break; case "GENE": gene.Name = words[1]; break; case "LOCUS_TAG": gene.LocusTag = words[1]; break; case "NOTE": gene.Note = words[1]; break; case "PRODUCT": gene.Product = words[1]; if (gene.Product == "hypothetical protein") { gene.IsHypothetical = true; } break; case "PROTEIN_ID": gene.ProteinID = words[1]; break; case "TRANSLATION": gene.Translation = words[1]; state = 1; break; default: state = 1; break; } index++; } _chromosome.GeneList.Add(gene); }