Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env bash
- #WAZNE: sprawdzic czy ten skrypt dobrze liczy gaps. mozliwe ze liczy razem z query i subject
- query_folder="${1}"
- out_folder="${2}"
- id="${3}"
- All_hspidentities=0
- hspidentities=0
- All_hspgaps=0
- hspgaps=0
- All_hsplen=0
- hsplen=0
- seq=""
- mkdir $out_folder
- printf "Name, Length, Mismatches, Deletions, Identities" > stats.csv
- for query_file in $query_folder/*; do
- hspidentities="$(xmlstarlet sel -t -v 'sum(//Hsp_identity)' $query_file)"
- ((All_hspidentities+=hspidentities))
- hspgaps="$(xmlstarlet sel -t -v 'sum(//Hsp_gaps)' $query_file)"
- ((All_hspgaps+=hspgaps))
- hsplen="$(xmlstarlet sel -t -v 'sum(//Hsp_align-len)' $query_file)"
- ((All_hsplen+=hsplen))
- ((hspmismatches=hsplen-hspidentities-hspgaps))
- printf "\n$query_file, $hsplen, $hspmismatches, $hspgaps, $hspidentities" >> stats.csv
- seq="$(xmlstarlet sel -t -v //Hsp_hseq $query_file)"
- printf ">$(basename $query_file .xml)\n$seq" > $out_folder/"218_$(basename $query_file .xml).fasta"
- done
- ((All_hspmismatches=All_hsplen-All_hspidentity-All_hspgaps))
- printf "\n,Total length $All_hsplen, Mismatches $All_hspmismatches, Deletions $All_hspgaps, Identities $All_hspidentities" >> stats.csv
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement