mirror of
https://github.com/metabarcoding/obitools4.git
synced 2025-12-08 16:50:27 +00:00
Adds the command obimultiplex
This commit is contained in:
65
pkg/obingslibrary/ngslibrary.go
Normal file
65
pkg/obingslibrary/ngslibrary.go
Normal file
@@ -0,0 +1,65 @@
|
||||
package obingslibrary
|
||||
|
||||
import (
|
||||
"git.metabarcoding.org/lecasofts/go/obitools/pkg/obiapat"
|
||||
"git.metabarcoding.org/lecasofts/go/obitools/pkg/obiseq"
|
||||
)
|
||||
|
||||
type PrimerPair struct {
|
||||
Forward string
|
||||
Reverse string
|
||||
}
|
||||
|
||||
type TagPair struct {
|
||||
Forward string
|
||||
Reverse string
|
||||
}
|
||||
|
||||
type PCR struct {
|
||||
Experiment string
|
||||
Sample string
|
||||
Partial bool
|
||||
Annotations obiseq.Annotation
|
||||
}
|
||||
|
||||
type Marker struct {
|
||||
forward obiapat.ApatPattern
|
||||
cforward obiapat.ApatPattern
|
||||
reverse obiapat.ApatPattern
|
||||
creverse obiapat.ApatPattern
|
||||
taglength int
|
||||
samples map[TagPair]*PCR
|
||||
}
|
||||
type NGSLibrary map[PrimerPair]*Marker
|
||||
|
||||
func MakeNGSLibrary() NGSLibrary {
|
||||
return make(NGSLibrary, 10)
|
||||
}
|
||||
|
||||
func (library *NGSLibrary) GetMarker(forward, reverse string) (*Marker, bool) {
|
||||
pair := PrimerPair{forward, reverse}
|
||||
marker, ok := (*library)[pair]
|
||||
|
||||
if ok {
|
||||
return marker, true
|
||||
}
|
||||
|
||||
m := Marker{samples: make(map[TagPair]*PCR, 1000)}
|
||||
(*library)[pair] = &m
|
||||
|
||||
return &m, false
|
||||
}
|
||||
|
||||
func (marker *Marker) GetPCR(forward, reverse string) (*PCR, bool) {
|
||||
pair := TagPair{forward, reverse}
|
||||
pcr, ok := marker.samples[pair]
|
||||
|
||||
if ok {
|
||||
return pcr, ok
|
||||
}
|
||||
|
||||
ipcr := PCR{}
|
||||
marker.samples[pair] = &ipcr
|
||||
|
||||
return &ipcr, false
|
||||
}
|
||||
Reference in New Issue
Block a user