mirror of
https://github.com/metabarcoding/obitools4.git
synced 2025-06-29 16:20:46 +00:00
Simplify code of the JSON header formater
This commit is contained in:
@ -48,13 +48,13 @@ func _parse_json_header_(header string, annotations obiseq.Annotation) string {
|
|||||||
|
|
||||||
for k, v := range annotations {
|
for k, v := range annotations {
|
||||||
switch vt := v.(type) {
|
switch vt := v.(type) {
|
||||||
case float64 :
|
case float64:
|
||||||
if vt == math.Floor(vt) {
|
if vt == math.Floor(vt) {
|
||||||
annotations[k] = int(vt)
|
annotations[k] = int(vt)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("annotation parsing error on %s : %v\n", header, err)
|
log.Fatalf("annotation parsing error on %s : %v\n", header, err)
|
||||||
}
|
}
|
||||||
@ -70,7 +70,7 @@ func ParseFastSeqJsonHeader(sequence *obiseq.BioSequence) {
|
|||||||
func FormatFastSeqJsonHeader(sequence *obiseq.BioSequence) string {
|
func FormatFastSeqJsonHeader(sequence *obiseq.BioSequence) string {
|
||||||
annotations := sequence.Annotations()
|
annotations := sequence.Annotations()
|
||||||
|
|
||||||
if annotations != nil && len(annotations) > 0 {
|
if len(annotations) > 0 {
|
||||||
text, err := goutils.JsonMarshal(sequence.Annotations())
|
text, err := goutils.JsonMarshal(sequence.Annotations())
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Reference in New Issue
Block a user