src/bioseq/fasta

  Source   Edit

An iterator for reading the headers and sequence data from a fasta file.

Example:

import src/bioseq/fasta
import bioseq
import std/strutils
var str = """
  >Sample1
  ATGCATGC
  
  >Sample2
  TTGCATGC
  """.dedent
for i in iterFastaString(str, DNA):
  echo i
# Sample1 ATGCATGC
# Sample2 TTGCATGC

Types

FastaError = object of CatchableError
  Source   Edit

Procs

proc toFastaFile[T](s: seq[SeqRecord[T]]; path: string;
                    mode: FileMode = fmWrite; lineLength = 80)
Writes data to file in Fasta format. Use fmAppend to append rather than overwrite.   Source   Edit
proc toFastaFile[T](s: SeqRecord[T]; path: string; mode: FileMode = fmWrite;
                    lineLength = 80)
Writes data to file in Fasta format. Use fmAppend to append rather than overwrite.   Source   Edit
proc toFastaString[T](s: seq[SeqRecord[T]]; lineLength = 80): string
Returns string in Fasta format   Source   Edit
proc toFastaString[T](s: SeqRecord[T]; lineLength = 80): string
Returns string in Fasta format   Source   Edit

Iterators

iterator iterFastaFile(path: string; typ: typedesc): SeqRecord[typ]
Iterate over records in a Fasta file   Source   Edit
iterator iterFastaStream(stream: Stream; typ: typedesc): SeqRecord[typ]
  Source   Edit
iterator iterFastaString(str: string; typ: typedesc): SeqRecord[typ]
Iterate over records in a Fasta string   Source   Edit