Meu objetivo é aumentar o número de novas tentativas para esta validação fastq que às vezes falha devido a problemas de rede, embora haja dados para o ID NCBI SRA fornecido, mas falha. Portanto, preciso aumentar a repetição pelo menos 5 vezes antes de abortar.
Como faço o mesmo?
set -x
PS4='[\\d \\t] '
# Check parameter for error
check=0
# Print fastq-dump executable path
echo \$(which fastq-dump)
# Loop through all parameters to check validity
for file in \$@;
do
cp \${file} .
# Extract filename for sampleID
file_basename=\$(basename \${file})
id=\${file_basename%".id"}
# Start validation
echo "Checking \${id}..."
# Download start of fastq
fastq-dump $(get_ngc()) -X 1 -Z --split-spot \${id} > \${id}.test.fastq 2> \${id}.test.log
# Get number of lines downloaded to valildate for error
numLines=\$(cat \${id}.test.fastq | wc -l)
if [ \$numLines -gt 0 ]; then
echo "\${id} has data... OK"
else
echo "\${id} does not have data... ERROR"
check=1
fi
done
# Exit with error if some fastqs not accessible
if [ \$check -gt 0 ]; then
echo "ERROR: One or more samples have inaccessible fastqs.. exiting"
exit 1
fi
############ ATUALIZAR ###############
#!/usr/bin/env cwl-runner
cwlVersion: cwl:v1.0
class: CommandLineTool
requirements:
- class: DockerRequirement
dockerPull: kcm1400/validate_fastq_ncbi_sra:v1
- class: InlineJavascriptRequirement
expressionLib:
- var get_ngc= function(){ if(inputs["ngc_file"]==null){ return " "; }else{ return
"--ngc "+inputs["ngc_file"].path+" "; } }
- class: InitialWorkDirRequirement
listing:
- entry: |-
set -x
PS4='[\\d \\t] '
# Check parameter for error
check=0
# Print fastq-dump executable path
echo \$(which fastq-dump)
# Loop through all parameters to check validity
for file in \$@;
do
cp \${file} .
# Extract filename for sampleID
file_basename=\$(basename \${file})
id=\${file_basename%".id"}
# Start validation
echo "Checking \${id}..."
# Download start of fastq
fastq-dump $(get_ngc()) -X 1 -Z --split-spot \${id} > \${id}.test.fastq 2> \${id}.test.log
# Get number of lines downloaded to valildate for error
numLines=\$(cat \${id}.test.fastq | wc -l)
if [ \$numLines -gt 0 ]; then
echo "\${id} has data... OK"
else
echo "\${id} does not have data... ERROR"
check=1
fi
done
# Exit with error if some fastqs not accessible
if [ \$check -gt 0 ]; then
echo "ERROR: One or more samples have inaccessible fastqs.. exiting"
exit 1
fi
entryname: validate_fastq.sh
writable: false
label: validate_fastq_ncbi_sra
stdout: validate_fastq.log.txt
inputs:
sra_ID:
type:
- type: array
items: string
- 'null'
inputBinding:
position: 1
id_file:
type:
- type: array
items: File
- 'null'
inputBinding:
position: 2
ngc_file:
type:
- File
- 'null'
inputBinding:
position: 3
outputs:
output_log:
type: stdout
label: output log file
ncbi_ids:
type:
type: array
items: File
outputBinding:
glob:
- '*.id'
baseCommand:
- sh
- validate_fastq.sh
O arquivo CWL para o mesmo