public List<SequenceContract> ParseFastaFile(string fastaContent) { StringReader sr = new StringReader(fastaContent); List<SequenceContract> sequences = new List<SequenceContract>(); SequenceList bioSeqList = null; using (ReaderBase reader = new BioFastaReader()) { bioSeqList = reader.Read(sr); } foreach (Sequence seq in bioSeqList) sequences.Add (new SequenceContract() { Name = seq.Annotations("SequenceName").AnnotationValue as string, AlphabetName = seq.Alphabet.Name, Characters = seq.Letters() } ); return sequences; }
public void LoadFasta ( FileInfo file ) { foreach ( var wrapper in sequences ) { if ( file.ToString().Equals( wrapper.FileInfo.ToString() ) ) return; } using ( Stream stream = file.OpenRead() ) { string content = string.Empty; using ( StreamReader streamReader = new StreamReader( stream ) ) { BioFastaReader reader = new BioFastaReader(); ReadSequences( file, streamReader, reader ); } } }