mirror of
https://github.com/metabarcoding/obitools4.git
synced 2025-06-29 16:20:46 +00:00
Prevens errors on FASTA formating an empty sequence
This commit is contained in:
@ -30,15 +30,21 @@ func FormatFasta(seq *obiseq.BioSequence, formater FormatHeader) string {
|
||||
s := seq.Sequence()
|
||||
l := len(s)
|
||||
|
||||
fragments.Grow(l + int(l/60) + 10)
|
||||
folded := ""
|
||||
if l == 0 {
|
||||
log.Println("Writing a BioSequence of length zero")
|
||||
} else {
|
||||
fragments.Grow(l + int(l/60)*2 + 100)
|
||||
|
||||
for i := 0; i < l; i += 60 {
|
||||
to := min(i+60, l)
|
||||
fmt.Fprintf(&fragments, "%s\n", string(s[i:to]))
|
||||
}
|
||||
|
||||
folded := fragments.String()
|
||||
folded = fragments.String()
|
||||
folded = folded[:fragments.Len()-1]
|
||||
}
|
||||
|
||||
info := formater(seq)
|
||||
return fmt.Sprintf(">%s %s %s\n%s",
|
||||
seq.Id(), info,
|
||||
|
Reference in New Issue
Block a user