2022-01-18 13:09:32 +01:00
|
|
|
package main
|
|
|
|
|
|
|
|
|
|
import (
|
2024-05-31 11:34:06 +02:00
|
|
|
"fmt"
|
2022-01-18 13:09:32 +01:00
|
|
|
"os"
|
2023-11-29 12:14:37 +01:00
|
|
|
|
2023-03-07 17:34:25 +07:00
|
|
|
log "github.com/sirupsen/logrus"
|
2022-11-16 17:13:03 +01:00
|
|
|
|
2023-11-29 12:14:37 +01:00
|
|
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obioptions"
|
|
|
|
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obiconvert"
|
|
|
|
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obitools/obimultiplex"
|
2025-01-24 18:09:59 +01:00
|
|
|
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiutils"
|
2022-01-18 13:09:32 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
|
|
2023-01-31 22:39:34 +01:00
|
|
|
// f, err := os.Create("cpu.pprof")
|
|
|
|
|
// if err != nil {
|
|
|
|
|
// log.Fatal(err)
|
|
|
|
|
// }
|
|
|
|
|
// pprof.StartCPUProfile(f)
|
|
|
|
|
// defer pprof.StopCPUProfile()
|
2022-01-18 13:09:32 +01:00
|
|
|
|
|
|
|
|
// ftrace, err := os.Create("cpu.trace")
|
|
|
|
|
// if err != nil {
|
|
|
|
|
// log.Fatal(err)
|
|
|
|
|
// }
|
|
|
|
|
// trace.Start(ftrace)
|
|
|
|
|
// defer trace.Stop()
|
|
|
|
|
|
2025-03-12 14:40:42 +01:00
|
|
|
optionParser := obioptions.GenerateOptionParser(
|
|
|
|
|
"obimultiplex",
|
|
|
|
|
"demultiplex amplicons",
|
|
|
|
|
obimultiplex.OptionSet)
|
2022-01-18 13:09:32 +01:00
|
|
|
|
2023-03-07 11:06:08 +07:00
|
|
|
_, args := optionParser(os.Args)
|
2022-01-18 13:09:32 +01:00
|
|
|
|
2024-05-31 11:34:06 +02:00
|
|
|
if obimultiplex.CLIAskConfigTemplate() {
|
|
|
|
|
fmt.Print(obimultiplex.CLIConfigTemplate())
|
|
|
|
|
os.Exit(0)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if !obimultiplex.CLIHasNGSFilterFile() {
|
|
|
|
|
log.Error("You must provide a tag list file following the NGSFilter format")
|
|
|
|
|
os.Exit(1)
|
|
|
|
|
}
|
|
|
|
|
|
2023-03-07 17:34:25 +07:00
|
|
|
sequences, err := obiconvert.CLIReadBioSequences(args...)
|
2024-08-13 09:45:28 +02:00
|
|
|
obiconvert.OpenSequenceDataErrorMessage(args, err)
|
2023-03-07 17:34:25 +07:00
|
|
|
|
2022-11-16 17:13:03 +01:00
|
|
|
amplicons, _ := obimultiplex.IExtractBarcode(sequences)
|
2023-02-16 13:31:49 +01:00
|
|
|
obiconvert.CLIWriteBioSequences(amplicons, true)
|
2022-02-01 23:25:19 +01:00
|
|
|
amplicons.Wait()
|
2025-01-24 18:09:59 +01:00
|
|
|
obiutils.WaitForLastPipe()
|
2023-02-08 13:14:26 +01:00
|
|
|
|
2022-01-18 13:09:32 +01:00
|
|
|
}
|