I wrote a program to automate SNP calling process, but not sure if it works since I am new to shell scricpts. If I can get some review for the scripts, I would highly appreciate your help. The below is scripts,
cd ~/results
genome=~/home/administrator/GlycinMaxNew.fasta
mkdir -p bwa sam bam vcf
for fq in ~/Tilling-by-seq/*.fastq
do
echo "working with file $fq"
base=$(basename $fq .fastq)
echo "base name is $base"
fq=~/home/administrator/Tilling-by-seq/${base}.3L_F.fastq
fq=~/home/administrator/Tilling-by-seq/${base}.3L_R.fastq
bwa=~/home/administrator/results/bwa/${base}_F.bwa
bwa=~/home/administrator/results/bwa/${base}_R.bwa
sam=~/home/administratorresults/sam/${base}_sam
bam=~/home/administrator/results/bam/${base}_bam
sorted_bam=~/home/administrator/results/bam/${base}_sorted.bam
vcf=~/home/administrator/results/vcf/${base}_vcf
bwa aln -t 4 GlycinMaxNewbwaidx $3L_F_fq > $F_bwa
bwa aln -t 4 GlycinMaxNewbwaidx $3L_R_fq > $R_bwa
bwa sampe GlycinMaxNewbwaidx $F_bwa $R_bwa $3L_F_fq $3L_R_fq > $sam
samtools view -S -b $sam > $bam
samtools sort $bam -o $sorted_bam
samtools index $sorted_bam
freebayes -f $genome -p 24 --use-best-n-alleles 4 --pooled-discrete $sorted_bam > $vcf
done
I think you should run what you wrote and put the result/errors here besides the code, so people can help. But first; You are here overwrite the variable fq
same here;
I would like also to introduce you to workflow management, like snakemake. Also, there is other workflow management tools/language that will help you to be more productive.