Current section
Files
Jump to
Current section
Files
lib/exfasta.ex
defmodule Exfasta do
@moduledoc """
`Exfasta` is a simple but not very efficient (because it works on regular expressions)
module for reading and writing FASTA-formatted strings.
See https://en.wikipedia.org/wiki/FASTA_format for more details.
"""
@doc """
Parses the given FASTA-formatted string into a list of `Exfasta.FASTA` structs.
"""
@spec parse!(String.t) :: list(Exfasta.FASTA.t)
def parse!(string), do: Exfasta.Reader.parse!(string)
@doc """
Reads the contents of the file from given path into a list of `Exfasta.FASTA` structs.
"""
@spec read!(Path.t) :: list(Exfasta.FASTA.t)
def read!(path), do: Exfasta.Reader.read!(path)
@doc """
Writes given `Exfasta.FASTA` struct or a list of such structs into a file located at given path.
Allows you to specify a list of [write modes](https://hexdocs.pm/elixir/File.html#t:mode/0) if needed.
"""
@spec write!(Path.t, Exfasta.FASTA.t | list(Exfasta.FASTA.t), File.mode) :: :ok
def write!(path, contents, modes \\ []), do: Exfasta.Writer.write!(path, contents, modes)
end