mirror of
https://github.com/metabarcoding/obitools4.git
synced 2025-06-29 16:20:46 +00:00
Patch a small bug on json write
This commit is contained in:
@ -7,6 +7,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
"sync/atomic"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/goccy/go-json"
|
"github.com/goccy/go-json"
|
||||||
@ -84,6 +85,7 @@ func FormatJSONBatch(batch obiiter.BioSequenceBatch) *bytes.Buffer {
|
|||||||
func WriteJSON(iterator obiiter.IBioSequence,
|
func WriteJSON(iterator obiiter.IBioSequence,
|
||||||
file io.WriteCloser,
|
file io.WriteCloser,
|
||||||
options ...WithOption) (obiiter.IBioSequence, error) {
|
options ...WithOption) (obiiter.IBioSequence, error) {
|
||||||
|
var latestChunk atomic.Int64
|
||||||
|
|
||||||
opt := MakeOptions(options)
|
opt := MakeOptions(options)
|
||||||
|
|
||||||
@ -97,6 +99,12 @@ func WriteJSON(iterator obiiter.IBioSequence,
|
|||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
newIter.WaitAndClose()
|
newIter.WaitAndClose()
|
||||||
|
|
||||||
|
chunkchan <- FileChunk{
|
||||||
|
Source: "end",
|
||||||
|
Raw: bytes.NewBuffer([]byte("\n]\n")),
|
||||||
|
Order: int(latestChunk.Load()) + 1,
|
||||||
|
}
|
||||||
for len(chunkchan) > 0 {
|
for len(chunkchan) > 0 {
|
||||||
time.Sleep(time.Millisecond)
|
time.Sleep(time.Millisecond)
|
||||||
}
|
}
|
||||||
@ -115,6 +123,7 @@ func WriteJSON(iterator obiiter.IBioSequence,
|
|||||||
}
|
}
|
||||||
|
|
||||||
chunkchan <- ss
|
chunkchan <- ss
|
||||||
|
latestChunk.Store(int64(batch.Order()))
|
||||||
newIter.Push(batch)
|
newIter.Push(batch)
|
||||||
}
|
}
|
||||||
newIter.Done()
|
newIter.Done()
|
||||||
|
@ -7,7 +7,7 @@ import (
|
|||||||
// TODO: The version number is extracted from git. This induces that the version
|
// TODO: The version number is extracted from git. This induces that the version
|
||||||
// corresponds to the last commit, and not the one when the file will be
|
// corresponds to the last commit, and not the one when the file will be
|
||||||
// commited
|
// commited
|
||||||
var _Commit = "69ef175"
|
var _Commit = "00b0edc"
|
||||||
var _Version = "Release 4.2.0"
|
var _Version = "Release 4.2.0"
|
||||||
|
|
||||||
// Version returns the version of the obitools package.
|
// Version returns the version of the obitools package.
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
==> db_v05_idx_ori.fasta <==
|
|
||||||
>AY189646 {"count":1,"obitag_ref_index":{"0":"9606@Homo sapiens@species","10":"9526@Catarrhini@parvorder","12":"1437010@Boreoeutheria@clade","16":"9347@Eutheria@clade","17":"40674@Mammalia@class","2":"207598@Homininae@subfamily","22":"117571@Euteleostomi@clade","25":"7776@Gnathostomata@clade","29":"33213@Bilateria@clade","3":"9604@Hominidae@family","30":"6072@Eumetazoa@clade","8":"314295@Hominoidea@superfamily"},"species_name":"Homo sapiens","taxid":9606} Homo sapiens clone arCan119 12S ribosomal RNA gene, partial sequence; mitochondrial gene for mitochondrial product.
|
>AY189646 {"count":1,"obitag_ref_index":{"0":"9606@Homo sapiens@species","10":"9526@Catarrhini@parvorder","12":"1437010@Boreoeutheria@clade","16":"9347@Eutheria@clade","17":"40674@Mammalia@class","2":"207598@Homininae@subfamily","22":"117571@Euteleostomi@clade","25":"7776@Gnathostomata@clade","29":"33213@Bilateria@clade","3":"9604@Hominidae@family","30":"6072@Eumetazoa@clade","8":"314295@Hominoidea@superfamily"},"species_name":"Homo sapiens","taxid":9606} Homo sapiens clone arCan119 12S ribosomal RNA gene, partial sequence; mitochondrial gene for mitochondrial product.
|
||||||
ttagccctaaacctcaacagttaaatcaacaaaactgctcgccagaacactacgrgccac
|
ttagccctaaacctcaacagttaaatcaacaaaactgctcgccagaacactacgrgccac
|
||||||
agcttaaaactcaaaggacctggcggtgcttcatatccct
|
agcttaaaactcaaaggacctggcggtgcttcatatccct
|
||||||
@ -9,3 +8,5 @@ cagcttaaaactcaaaggacctggcggtgcttcatatccct
|
|||||||
ttagccctaaacttcaacagttaaattaacaaaactgctcgccagaacactacgagccac
|
ttagccctaaacttcaacagttaaattaacaaaactgctcgccagaacactacgagccac
|
||||||
agcttaaaactcaaaggacctggcggtgcttcatatccct
|
agcttaaaactcaaaggacctggcggtgcttcatatccct
|
||||||
>AC008512 {"count":5,"obitag_ref_index":{"0":"9606@Homo sapiens@species","10":"1437010@Boreoeutheria@clade","14":"40674@Mammalia@class","18":"117571@Euteleostomi@clade","2":"207598@Homininae@subfamily","22":"7776@Gnathostomata@clade","26":"33213@Bilateria@clade","28":"6072@Eumetazoa@clade","7":"9526@Catarrhini@parvorder"},"species_name":"Homo sapiens","taxid":9606} Homo sapiens chromosome 5 clone CTC-454K8, complete sequence.
|
>AC008512 {"count":5,"obitag_ref_index":{"0":"9606@Homo sapiens@species","10":"1437010@Boreoeutheria@clade","14":"40674@Mammalia@class","18":"117571@Euteleostomi@clade","2":"207598@Homininae@subfamily","22":"7776@Gnathostomata@clade","26":"33213@Bilateria@clade","28":"6072@Eumetazoa@clade","7":"9526@Catarrhini@parvorder"},"species_name":"Homo sapiens","taxid":9606} Homo sapiens chromosome 5 clone CTC-454K8, complete sequence.
|
||||||
|
ttagccctaaacttcaacagttaaattaacaaaactgctcgccagaacactacgagccac
|
||||||
|
agcttaaaactcaaaggacctggcggtgcttcatatccct
|
||||||
|
Reference in New Issue
Block a user