This is a test version of Biostars. For the public version, visit https://www.biostars.org.
plink2 cannot identify options when looping the chromosomes

I want to loop the quality check of all 23 chromosomes, Below is my code:

for chr in {1..22};
do
 plink2 \
  --bed /mnt/stsi/stsi3/External/UKBB/genomic_data/geneotypes/chr$chr/*.bed \
  --bim /mnt/stsi/stsi3/External/UKBB/genomic_data/geneotypes/chr$chr/*.bim \
  --fam /mnt/stsi/stsi3/External/UKBB/genomic_data/geneotypes/chr$chr/*.fam \
  --maf 0.01 --mac 100 --geno 0.01 --hwe 1e-15 \
  --mind 0.1 \
  --indep-pairwise 1000 100 0.9 \
  --exclude regions.exclude \
  --threads 16 \
  --memory 91260 \
  --write-snplist --write-samples --no-id-header \
  --out qc_pass_$chr

done

However, the output files is not named by the prefix specified in --out, it is still using the default name. Besides that , the options of--memory 91260 and --write-snplist --write-samples --no-id-header also wasn't effective. The .log file looks like below, clearly not all the options were running.

PLINK v2.00a3LM 64-bit Intel (20 Apr 2021)     www.cog-genomics.org/plink/2.0/
(C) 2005-2021 Shaun Purcell, Christopher Chang   GNU General Public License v3
Logging to plink2.log.
Options in effect:
  --exclude regions.exclude
  --geno 0.01
  --hwe 1e-15
  --indep-pairwise 1000 100 0.9
  --mac 100
  --maf 0.01
  --mind 0.1
  --pgen /mnt/stsi/stsi3/External/UKBB/genomic_data/geneotypes/chr1/ukb_cal_chr1_v2.bed
  --psam /mnt/stsi/stsi3/External/UKBB/genomic_data/geneotypes/chr1/ukb41999_cal_chr1_v2_s488264.fam
  --pvar /mnt/stsi/stsi3/External/UKBB/genomic_data/geneotypes/chr1/ukb_snp_chr1_v2.bim
  --threads 16

Does anyone have the same issue before? I'm grateful for your advice

plink2 plink

add echo before plink and show us the output

for chr in {1..22};
do
 echo plink2 (...)

Thank you! I figured out that I got extra space ...

1 answer

Check your script file right after --threads 16 and see if there's a white space behind \

You are right the problem is extra space! Thank you so much!!

Log in to answer this question.