mirror of
https://github.com/metabarcoding/obitools4.git
synced 2025-06-29 16:20:46 +00:00
In obimultiplex, patch a bug when no tag are associated to a primer.
This commit is contained in:
@ -536,6 +536,24 @@ var library_parameter = map[string]func(library *obingslibrary.NGSLibrary, value
|
||||
},
|
||||
}
|
||||
|
||||
// ReadCSVNGSFilter reads an NGS filter configuration from a CSV file and returns
|
||||
// an NGSLibrary. The CSV file must include columns for 'experiment', 'sample',
|
||||
// 'sample_tag', 'forward_primer', and 'reverse_primer'. Additional columns are
|
||||
// used to annotate PCR samples.
|
||||
//
|
||||
// Parameters:
|
||||
// - reader: an io.Reader providing the CSV input.
|
||||
//
|
||||
// Returns:
|
||||
// - A pointer to an NGSLibrary populated with the data from the CSV file.
|
||||
// - An error if the CSV is malformed or required columns are missing.
|
||||
//
|
||||
// The function processes both data records and parameter lines starting with
|
||||
// '@param'. Parameter lines configure various aspects of the library.
|
||||
//
|
||||
// Each row in the CSV is validated to ensure it has the correct number of columns.
|
||||
// Duplicate tag pairs for the same marker result in an error. Primer unicity is
|
||||
// checked, and any unknown parameters are logged as warnings.
|
||||
func ReadCSVNGSFilter(reader io.Reader) (*obingslibrary.NGSLibrary, error) {
|
||||
ngsfilter := obingslibrary.MakeNGSLibrary()
|
||||
file := csv.NewReader(reader)
|
||||
@ -576,6 +594,7 @@ func ReadCSVNGSFilter(reader io.Reader) (*obingslibrary.NGSLibrary, error) {
|
||||
extraColumns := make([]int, 0)
|
||||
|
||||
for i, colName := range header {
|
||||
|
||||
switch colName {
|
||||
case "experiment":
|
||||
experimentColIndex = i
|
||||
|
@ -343,6 +343,10 @@ func (marker *Marker) beginTagExtractor(
|
||||
// log.Warnf("Forward : %v -> %d %c", forward, marker.Forward_spacer, marker.Forward_tag_delimiter)
|
||||
// log.Warnf("Forward : %v -> %d %c", forward, marker.Reverse_spacer, marker.Reverse_tag_delimiter)
|
||||
if forward {
|
||||
if marker.Forward_tag_length == 0 {
|
||||
return ""
|
||||
}
|
||||
|
||||
if marker.Forward_tag_delimiter == 0 {
|
||||
return marker.beginFixedTagExtractor(sequence, begin, forward)
|
||||
} else {
|
||||
@ -355,6 +359,10 @@ func (marker *Marker) beginTagExtractor(
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if marker.Reverse_tag_length == 0 {
|
||||
return ""
|
||||
}
|
||||
|
||||
if marker.Reverse_tag_delimiter == 0 {
|
||||
return marker.beginFixedTagExtractor(sequence, begin, forward)
|
||||
} else {
|
||||
@ -374,6 +382,10 @@ func (marker *Marker) endTagExtractor(
|
||||
end int,
|
||||
forward bool) string {
|
||||
if forward {
|
||||
if marker.Reverse_tag_length == 0 {
|
||||
return ""
|
||||
}
|
||||
|
||||
if marker.Reverse_tag_delimiter == 0 {
|
||||
return marker.endFixedTagExtractor(sequence, end, forward)
|
||||
} else {
|
||||
@ -386,6 +398,10 @@ func (marker *Marker) endTagExtractor(
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if marker.Forward_tag_length == 0 {
|
||||
return ""
|
||||
}
|
||||
|
||||
if marker.Forward_tag_delimiter == 0 {
|
||||
return marker.endFixedTagExtractor(sequence, end, forward)
|
||||
} else {
|
||||
|
@ -7,7 +7,7 @@ import (
|
||||
// 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
|
||||
// commited
|
||||
var _Commit = "74280e4"
|
||||
var _Commit = "9e8a7fd"
|
||||
var _Version = "Release 4.2.0"
|
||||
|
||||
// Version returns the version of the obitools package.
|
||||
|
Reference in New Issue
Block a user