/// <summary> /// Parses the sequences from the open file. /// </summary> /// <param name="parser">Sequence Parser</param> /// <returns>Set of parsed sequences.</returns> public static IEnumerable <WiggleAnnotation> Parse(this WiggleParser parser) { var fs = ParserFormatterExtensions <WiggleParser> .GetOpenStream(parser, false); if (fs != null) { foreach (var item in parser.Parse(fs)) { yield return(item); } } }
/// <summary> /// Writes a single sequence to the formatter. /// </summary> /// <param name="formatter">Formatter</param> /// <param name="annotation">Wiggle Annotation</param> public static void Format(this WiggleFormatter formatter, WiggleAnnotation annotation) { var fs = ParserFormatterExtensions <WiggleFormatter> .GetOpenStream(formatter, true); if (fs != null) { formatter.Format(fs, annotation); } else { throw new Exception("You must open a formatter before calling Write."); } }
/// <summary> /// Write out a set of contigs to the given file. /// </summary> /// <param name="formatter">Formatter</param> /// <param name="contig">Contig to write</param> public static void Format(this XsvContigFormatter formatter, Contig contig) { if (formatter == null) { throw new ArgumentNullException("formatter"); } if (contig == null) { throw new ArgumentNullException("contig"); } var fs = ParserFormatterExtensions <ISequenceFormatter> .GetOpenStream(formatter, true); if (fs != null) { formatter.Write(fs, contig); } else { throw new Exception("You must open a formatter before calling Write."); } }