Error in spades analysis of Linux macro genome

CSDN Q & A 2022-06-24 06:45:38 阅读数:88

errorspadesanalysislinuxmacro
linux Metagenomic analysis do SPAdes analysis Report errors

because SPAdes Cannot process multiple samples at the same time , So I use bash Wrote a loop function
My code
!/bash/sh
#Generate output direction
mkdir /data/caozhr/YN/spades/output
#write funtions to run spades
runSpades () {
FILE1=${1}_R1.fastq
FILE2=${1}_R2.fastq
echo $FILE1
echo $FILE2
spades.py --pe1-1 /data/caozhr/YN/spades/R1_for_spades/${FILE1} --pe1-2 /data/caozhr/YN/spades/R2_for_spades/${FILE2} -o /data/caozhr/YN/spades/output/${1} --metaviral --isolate -t 16 --phred-offset 33 -k 21,33,55,77
}
export -f runSpades

# Multithreading
ls /data/caozhr/YN/spades/R1_for_spades/ | sed 's/_R1.fastq//g' | xargs -I {} --max-procs 10 sh -c 'runSpades {}'

There is an error :
sh: 1: runSpades: not found
sh: 1: runSpades: not found
sh: 1: runSpades: not found
sh: 1: runSpades: not found
sh: 1: runSpades: not found
sh: 1: runSpades: not found
sh: 1: runSpades: not found
sh: 1: runSpades: not found

My solution ideas and tried methods : The original runSpades The code is written directly to
ls /data/caozhr/YN/spades/R1_for_spades/ | sed 's/_R1.fastq//g' | xargs -I {} --max-procs=10 sh -c '
FILE1=${1}_R1.fastq
FILE2=${1}_R2.fastq
echo $FILE1
echo $FILE2
spades.py --pe1-1 /data/caozhr/YN/spades/R1_for_spades/${FILE1} --pe1-2 /data/caozhr/YN/spades/R2_for_spades/${FILE2} -o /data/caozhr/YN/spades/output/${1} --metaviral --isolate -t 16 --phred-offset 33 -k 21,33,55,77'

An error is reported again , as a result of ls /data/caozhr/YN/spades/R1_for_spades/ | sed 's/_R1.fastq//g' The information after this step , Unable to get | xargs -I {} pipeline Pass it to the downstream for further analysis .

What I want to achieve
1. Modify the original code to make it executable
2. Or get linux Execute in a loop spades.py Code for

copyright:author[CSDN Q & A],Please bring the original link to reprint, thank you. https://en.javamana.com/2022/175/202206171338354393.html