Ejemplo n.º 1
0
        /// <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);
                }
            }
        }
Ejemplo n.º 2
0
        /// <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.");
            }
        }
Ejemplo n.º 3
0
        /// <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.");
            }
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Closes the formatter.
 /// </summary>
 /// <param name="formatter">Formatter.</param>
 public static void Close(this WiggleFormatter formatter)
 {
     ParserFormatterExtensions <WiggleFormatter> .Close(formatter);
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Open a file and parse it with the sequence formatter.
 /// </summary>
 /// <param name="formatter">Formatter</param>
 /// <param name="filename">Filename</param>
 /// <returns>IDisposable to close stream.</returns>
 public static IDisposable Open(this WiggleFormatter formatter, string filename)
 {
     return(ParserFormatterExtensions <WiggleFormatter>
            .Open(formatter, filename));
 }