torognes/swarm

Invalid numeric argument for option -t or --threads

Gian77 opened this issue · 8 comments

Hello,

I am tried to dereplicate reads using the last version of swarm. I am running swarm on a cluster computer using 128 cores/threads and I am getting this erroor message

Invalid numeric argument for option -t or --threads

This is how I tried to run the dereplciation for each file I have

swarm \
    -threads $cores \
    --differences 0 \
    -w $file \
    -o /dev/null ${file}_linear.temp

Thanks a lot!
Gian

You need to write either -t $cores (single dash) or --threads $cores (double dash), not -threads $cores.

commit e832af4 tries to address that issue by outputting additional hints.

# missing space
swarm --threads 1-f

# or missing dash
swarm -threads 1

now produce the following error message:

Error: Invalid numeric argument for option -t or --threads.

Frequent causes are:
 - a missing space between an argument and the next option,
 - a long option name not starting with a double dash
   (swarm accepts '--help' or '-h', but not '-help')

Please see 'swarm --help' for more details.

I've pushed basic tests to cover that issue. Let me know what you think of this error message. In the meantime, I am going to close that issue.

I like it!

Hello @frederic-mahe @torognes,

Thanks for the fast reply. Oops... my bad, I misse the - ... Sorry!

More informative error messages are alwasy helpful, but I know it is hard to implement these details... You are forgiven :P

So, I also linearized the sequences before running swarm as below and it worked.

for file in *.fasta
do
	echo $file	
	awk '/^>/ {printf("%s%s\t",(N>0?"\n":""),$0);N++;next;} {printf("%s",$0);} END {printf("\n");}' < \
	$file | tr "\t" "\n" | sed -e 's/\( \).*\(;.\)/\1\2/' | sed 's/ //' | sed 's/.$//' > \
	$project_dir/outputs/10_dereplicateReads_usearch/${file%.*}_linear.temp

and then

for file in *.temp
do
	conda activate swarm3
	swarm \
	--threads $cores \
	--differences 0 \
	-w $project_dir/outputs/10_dereplicateReads_usearch/${file//.temp/.fasta} \
	-z \
	-o /dev/null $file
	conda deactivate
done

Thansk a lot!
Gian

hello @Gian77 sequence linearization is not strictly necessary for swarm, so I should remove that section from the README file. What is important is dereplication. Swarm expects an abundance value in each sequence header of your fasta file. You'll get an error message if it is not the case.

@frederic-mahe , good to know that linearization isn't needed, I needed to change the headers a little, anyways.... And, yes, I noticed that swarm has a stricter dereplication compared to USEARCH (we have a license here, I have to use it - sorry :P).
I think you can close this if it isn't yet.
Best,
Gian

@frederic-mahe Awesome, thanks again for explanation - and for including the more interpretable error message.