Advertisement
Guest User

Untitled

a guest
Nov 19th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. #!/usr/bin/env bash
  2. #WAZNE: sprawdzic czy ten skrypt dobrze liczy gaps. mozliwe ze liczy razem z query i subject
  3. query_folder="${1}"
  4. out_folder="${2}"
  5. id="${3}"
  6. All_hspidentities=0
  7. hspidentities=0
  8. All_hspgaps=0
  9. hspgaps=0
  10. All_hsplen=0
  11. hsplen=0
  12. seq=""
  13. mkdir $out_folder
  14. printf "Name, Length, Mismatches, Deletions, Identities" > stats.csv
  15. for query_file in $query_folder/*; do
  16. hspidentities="$(xmlstarlet sel -t -v 'sum(//Hsp_identity)' $query_file)"
  17. ((All_hspidentities+=hspidentities))
  18. hspgaps="$(xmlstarlet sel -t -v 'sum(//Hsp_gaps)' $query_file)"
  19. ((All_hspgaps+=hspgaps))
  20. hsplen="$(xmlstarlet sel -t -v 'sum(//Hsp_align-len)' $query_file)"
  21. ((All_hsplen+=hsplen))
  22. ((hspmismatches=hsplen-hspidentities-hspgaps))
  23. printf "\n$query_file, $hsplen, $hspmismatches, $hspgaps, $hspidentities" >> stats.csv
  24. seq="$(xmlstarlet sel -t -v //Hsp_hseq $query_file)"
  25. printf ">$(basename $query_file .xml)\n$seq" > $out_folder/"218_$(basename $query_file .xml).fasta"
  26. done
  27. ((All_hspmismatches=All_hsplen-All_hspidentity-All_hspgaps))
  28. 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