#! /bin/bash

salmon_path="/public/workspace/liyan/rna_data/clean_data/salmon-0.11.3-linux_x86_64/bin/salmon"

index_path="/public/workspace/liyan/rna_data/clean_data/salmon-0.11.3-linux_x86_64/bin/Mm.GRCm39.Hs.GRCh38.ensembl.cdna_salmon_index"

data_dir="/public/workspace/liyan/rna_data/clean_data2/RNAseq_H_J"

output_dir="/public/workspace/liyan/rna_data/clean_data3/HJ"

sample_list=("H1" "H2" "H3" "H4" "H5" "H6" "H7" "H8" "G2" "G3" "G4" "G7" "G8" "G10" "G11" "G12" "G15" "G16")



#salmon
for ((i=0; i<${#sample_list[@]}; i++))
do
    # check the value of i
    echo "Current sample is "${sample_list[$i]}
    cd $data_dir

            ls $data_dir"/"${sample_list[$i]}"_1_val_1.fq.gz" >1
            ls $data_dir"/"${sample_list[$i]}"_2_val_2.fq.gz" >2
        paste 1 2 > input.config

# run salmon
        cat $data_dir"/input.config" | while read id
        do
            arr=(${id})
            fq1=${arr[0]}
            fq2=${arr[1]}

            $salmon_path \
                quant \
                -i $index_path \
                -l A \
                -1 $fq1 \
                -2 $fq2 \
                -p 16 \
                -o $output_dir"/"${sample_list[$i]}

    done
done
