Push tklvqnrqtzpo #10
@@ -10,8 +10,9 @@ use obikseq::RoutableSuperKmer;
|
|||||||
|
|
||||||
#[derive(Args)]
|
#[derive(Args)]
|
||||||
pub struct CommonArgs {
|
pub struct CommonArgs {
|
||||||
/// Input files or directories (FASTA/FASTQ, optionally gzip-compressed)
|
/// Input files or directories (FASTA/FASTQ, optionally gzip-compressed).
|
||||||
#[arg(num_args = 1..)]
|
/// If omitted, reads from stdin.
|
||||||
|
#[arg(num_args = 0..)]
|
||||||
pub inputs: Vec<String>,
|
pub inputs: Vec<String>,
|
||||||
|
|
||||||
/// k-mer size
|
/// k-mer size
|
||||||
@@ -63,7 +64,11 @@ pub fn block_size_to_bits(n: usize) -> u8 {
|
|||||||
|
|
||||||
impl CommonArgs {
|
impl CommonArgs {
|
||||||
pub fn seqfile_paths(&self) -> obiread::PathIter {
|
pub fn seqfile_paths(&self) -> obiread::PathIter {
|
||||||
let paths = self.inputs.iter().map(PathBuf::from).collect();
|
let paths: Vec<PathBuf> = if self.inputs.is_empty() {
|
||||||
|
vec![PathBuf::from("-")]
|
||||||
|
} else {
|
||||||
|
self.inputs.iter().map(PathBuf::from).collect()
|
||||||
|
};
|
||||||
obiread::PathIter::new(paths)
|
obiread::PathIter::new(paths)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,12 +19,13 @@ impl PathIter {
|
|||||||
file_buffer: Vec::new(),
|
file_buffer: Vec::new(),
|
||||||
};
|
};
|
||||||
for path in paths {
|
for path in paths {
|
||||||
// Avoid stat() at construction time on network filesystems (Lustre, NFS)
|
// "-" is the stdin sentinel — pass it through without any extension
|
||||||
// where metadata operations can be 100s of milliseconds each.
|
// check or directory expansion.
|
||||||
// Paths that look like sequence files are assumed to be files.
|
if path.as_os_str() == "-" {
|
||||||
// Anything else is treated as a potential directory and expanded lazily
|
iter.file_buffer.push(path);
|
||||||
// in next(); read_dir errors are silently skipped.
|
} else if is_fasta_or_fastq(&path) {
|
||||||
if is_fasta_or_fastq(&path) {
|
// Avoid stat() at construction time on network filesystems (Lustre, NFS)
|
||||||
|
// where metadata operations can be 100s of milliseconds each.
|
||||||
iter.file_buffer.push(path);
|
iter.file_buffer.push(path);
|
||||||
} else {
|
} else {
|
||||||
iter.dir_stack.push(path);
|
iter.dir_stack.push(path);
|
||||||
|
|||||||
Reference in New Issue
Block a user