Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /bin/bash
- # Check if the format is correct
- if [[ $1 != *.fasta ]]; then
- echo "The input file $1 it's not in fasta format!"
- echo ""
- echo "Usage: ./nomescript.sh NO_HIT.fasta"
- exit 1
- fi
- read -p "Enter k-mer last value: " KMER
- read -p "Enter read lenght: " READLENGHT
- # calculate the coefficient used to convert coverage. Final is Y
- K=$(($READLENGHT - $KMER + 1))
- Y=$(echo "scale=4; $K / $READLENGHT" | bc)
- while read odd; do
- echo -n"cov_" ; echo "scale=2;$Y*${odd##*_}" | bc -q
- read even
- ACOUNT=$( grep -c "A")
- GCOUNT=$( grep -c "G")
- CCOUNT=$( grep -c "C")
- TCOUNT=$( grep -c "T")
- TOTALBASES=$(($ACOUNT+$CCOUNT+$GCOUNT+$TCOUNT))
- GC_CONTENT=$(($GCOUNT+$CCOUNT))
- echo "DNA seq:"
- echo "scale=2;$GC_CONTENT / $TOTALBASES*100" | bc
- done < "$1"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement