add extensions fq in directory scanning

This commit is contained in:
Eric Coissac
2025-02-04 20:34:58 +01:00
parent b9bee5f426
commit ceca33998b
2 changed files with 17 additions and 12 deletions

View File

@ -8,7 +8,7 @@ import (
// corresponds to the last commit, and not the one when the file will be
// commited
var _Commit = "c10df07"
var _Commit = "b9bee5f"
var _Version = "Release 4.2.0"
// Version returns the version of the obitools package.

View File

@ -55,6 +55,8 @@ func ExpandListOfFiles(check_ext bool, filenames ...string) ([]string, error) {
strings.HasSuffix(path, "fasta.gz") ||
strings.HasSuffix(path, "fastq") ||
strings.HasSuffix(path, "fastq.gz") ||
strings.HasSuffix(path, "fq") ||
strings.HasSuffix(path, "fq.gz") ||
strings.HasSuffix(path, "seq") ||
strings.HasSuffix(path, "seq.gz") ||
strings.HasSuffix(path, "gb") ||
@ -140,7 +142,7 @@ func CLIReadBioSequences(filenames ...string) (obiiter.IBioSequence, error) {
}
switch CLIInputFormat() {
case "fastq":
case "fastq", "fq":
reader = obiformats.ReadFastqFromFile
case "fasta":
reader = obiformats.ReadFastaFromFile
@ -168,22 +170,25 @@ func CLIReadBioSequences(filenames ...string) (obiiter.IBioSequence, error) {
opts...,
)
} else {
iterator, err = reader(list_of_files[0], opts...)
if err != nil {
return obiiter.NilIBioSequence, err
}
if CLIPairedFileName() != "" {
ip, err := reader(CLIPairedFileName(), opts...)
if len(list_of_files) > 0 {
iterator, err = reader(list_of_files[0], opts...)
if err != nil {
return obiiter.NilIBioSequence, err
}
iterator = iterator.PairTo(ip)
}
if CLIPairedFileName() != "" {
ip, err := reader(CLIPairedFileName(), opts...)
if err != nil {
return obiiter.NilIBioSequence, err
}
iterator = iterator.PairTo(ip)
}
} else {
iterator = obiiter.NilIBioSequence
}
}
}