I am submitting a slurm job to iterate through 6 samples and do a function 'cellranger count' on them. My job file looks like this:

####other sbatch options
#SBATCH --array=1-6                                                                                                                                                                          
echo "### Starting at: $(date) ###"

sample=$(head -n $SLURM_ARRAY_TASK_ID ~/data/samples_nh.csv | tail -n 1)
cellranger count \
        --id=${sample} \
        --fastqs=~/data/raw_fastqs \
        --sample=${sample} \
        --transcriptome=~/data/refdata-gex-GRCh38-2020-A \
        #... other options
echo "### Ending at: $(date) ###"

the samples_nh.csv consists of 6 rows and 1 column with sample names like MU100, MU150, etc., no header

I get this error:

error: Invalid value for '--id ': must contain only letters, digits, underscores, and dashes

except for the last array, where it gives me the error connected with another option, so I guess --id passes it.

when I check the head -n $SLURM_ARRAY_TASK_ID ~/data/samples_nh.csv | tail -n 1 with numbers from 1 to 6, the first 5 commands give me my sample names on a separate row each, the $SLURM_ARRAY_TASK_ID=6 gives the last sample number with no new line in the end. It looks like this:

[xxx@xxxxxx data]$ head -n 6 ~/data/samples_nh.csv | tail -n 1
MU384[xxx@xxxxxx data]$

So maybe the issue is in a 'newline' character in the end? Does anyone know how to fix this?

New contributor
Yulia Kentieva is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

Your Answer

Yulia Kentieva is a new contributor. Be nice, and check out our Code of Conduct.

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.