I have done something in bash, the script takes up three file names and processes them and stores the final result in third file.
The script is:
#!/bin/bash
#clear
echo -n " Bam File "
read BamFile
echo -n " Region File "
read BedFile
echo -n " Output File "
read OutFile
awk '{print $1 "\t" $2 "\t" $3 "\t" $3-$2}' < $BedFile >Temp
coverageBed -abam $BamFile -b $BedFile -counts > bases
awk '{print $4 }' <bases >tempbases
paste -d "\t" Temp tempbases >TtTemp
samtools view -c -F 260 $BamFile > totalNumReads
cat totalNumReads | awk '{print $1}'>tags
tag=`cat tags`
echo " Number of tags present in file = $tag"
awk '{print $1 "\t" $2 "\t" $3 "\t" $4 "\t" $5 "\t" $5/($4/1000* "'$tag'"/1000000) } '<TtTemp > $OutFile
This script works well.
However, I would like to make the following adjustment to the script.
Instead of asking file names one by one,, I would like to provide them at the start
something like this:
process.bash -bam BamFile.bam -region RegFile -Out OutFile
where process.bash is my script and the three files are provided right at the start.
Could anyone please help me in doing this.
Thank you