Procs for reading and writing DNA alignments in Phylip format
Example:
import src/bioseq/phylip import bioseq let str = """ 2 8 Sample1 ATGC Sample2 TTGC ATGC ATGC 2 8 Sample3 GTGC Sample4 CTGC ATGC ATGC """ a = parsePhylipString(str, DNA, Interleaved) echo a # Sample1 ATGCATGC # Sample2 TTGCATGC for i in iterPhylipString(str, DNA, Interleaved): echo i # Sample1 ATGCATGC # Sample2 TTGCATGC # Sample3 GTGCATGC # Sample4 CTGCATGC
let a = parsePhylipFile("input.phy", DNA, Sequential)
Types
PhylipError = object of CatchableError
- Source Edit
PhylipFormat = enum Interleaved, Sequential
- Source Edit
Procs
proc parsePhylipFile(path: string; typ: typedesc; fmt: PhylipFormat): Alignment[ typ]
- Read relaxed Phylip formatted file. Source Edit
proc parsePhylipStream(stream: Stream; typ: typedesc; fmt: PhylipFormat): Alignment[ typ]
- Read relaxed Phylip formatted stream. Source Edit
proc parsePhylipString(str: string; typ: typedesc; fmt: PhylipFormat): Alignment[ typ]
- Read relaxed Phylip formatted string. Source Edit
proc toPhylipFile[T](a: Alignment[T]; path: string; fmt: PhylipFormat; lineLength = 80; mode: FileMode = fmWrite)
- Write data to file in Phylip format. Use fmt=fmAppend to append rather than overwrite. Source Edit
proc toPhylipString[T](a: Alignment[T]; fmt: PhylipFormat; lineLength = 80): string
- Write data to string in Phylip format. Source Edit
Iterators
iterator iterPhylipFile(path: string; typ: typedesc; fmt: PhylipFormat): Alignment[ typ]
- Source Edit
iterator iterPhylipStream(stream: Stream; typ: typedesc; fmt: PhylipFormat): Alignment[ typ]
- Source Edit
iterator iterPhylipString(str: string; typ: typedesc; fmt: PhylipFormat): Alignment[ typ]
- Source Edit
iterator toPhylip[T](a: Alignment[T]; fmt: PhylipFormat; lineLength = 80): string
- Iterable yielding lines for a Phylip string or file. Source Edit