用于miRNA-seq二代测序数据分析
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

105 lines
4.8KB

  1. task ReadStats {
  2. String sample_id
  3. File in_log_trimAdatper
  4. File in_log_readFilter
  5. File in_log_align_miRNA
  6. File in_log_align_preMiRNA
  7. File in_log_align_piRNA
  8. File in_log_align_tRNA
  9. File in_log_align_RNA
  10. File in_log_align_hg38
  11. File in_sam_align_RNA
  12. String cluster_config
  13. String disk_size
  14. command <<<
  15. set -o pipefail
  16. set -e
  17. n_Total_Sequence=$(cat ${in_log_trimAdatper} | grep 'total reads' | head -n 1 | cut -d ':' -f 2 | sed 's/ //g')
  18. echo "Pass1"
  19. n_AdapterNotFound=$(cat ${in_log_trimAdatper} | grep 'reads failed due to too long' | cut -d ':' -f 2 | sed 's/ //g')
  20. n_Total_forCount=$(bc<<<$n_Total_Sequence-$n_AdapterNotFound)
  21. n_Pass_trimAdatper=$(cat ${in_log_trimAdatper} | grep 'reads passed filter' | tail -n 1 | cut -d ':' -f 2 | sed 's/ //g')
  22. n_Adapter_dimer=$(bc<<<$n_Total_Sequence-$n_AdapterNotFound-$n_Pass_trimAdatper)
  23. n_Too_short=$(cat ${in_log_readFilter} | grep 'too short' | tail -n 1 | cut -d ':' -f 2 | sed 's/ //g')
  24. n_Low_quality_singleBase=$(cat ${in_log_readFilter} | grep 'low quality' | head -n 1 | cut -d ':' -f 2 | sed 's/ //g')
  25. n_Low_quality_tooManyN=$(cat ${in_log_readFilter} | grep 'too many N' | head -n 1 | cut -d ':' -f 2 | sed 's/ //g')
  26. n_Low_quality=$(bc<<<$n_Low_quality_singleBase+$n_Low_quality_tooManyN)
  27. n_ForAlign=$(cat ${in_log_readFilter} | grep 'reads passed filter' | head -n 1 | cut -d ':' -f 2 | sed 's/ //g')
  28. echo "Pass2"
  29. n_miRNA_mature=$(cat ${in_log_align_miRNA} | grep 'at least one reported alignment' | head -n 1 | cut -d ':' -f 2 | cut -d '(' -f 1 | sed 's/ //g')
  30. n_miRNA_hairpin=$(cat ${in_log_align_preMiRNA} | grep 'at least one reported alignment' | head -n 1 | cut -d ':' -f 2 | cut -d '(' -f 1 | sed 's/ //g')
  31. n_piRNA=$(cat ${in_log_align_piRNA} | grep 'at least one reported alignment' | head -n 1 | cut -d ':' -f 2 | cut -d '(' -f 1 | sed 's/ //g')
  32. n_tRNA=$(cat ${in_log_align_tRNA} | grep 'at least one reported alignment' | head -n 1 | cut -d ':' -f 2 | cut -d '(' -f 1 | sed 's/ //g')
  33. n_RNA=$(cat ${in_log_align_RNA} | grep 'at least one reported alignment' | head -n 1 | cut -d ':' -f 2 | cut -d '(' -f 1 | sed 's/ //g')
  34. n_otGenomic=$(cat ${in_log_align_hg38} | grep 'at least one reported alignment' | head -n 1 | cut -d ':' -f 2 | cut -d '(' -f 1 | sed 's/ //g')
  35. n_notGenomic=$(cat ${in_log_align_hg38} | grep 'reads that failed to align' | head -n 1 | cut -d ':' -f 2 | cut -d '(' -f 1 | sed 's/ //g' )
  36. echo "Pass3"
  37. # mkdir -p /cromwell_root/tmp
  38. echo "Pass3.1"
  39. groupedReadCount=/cromwell_root/tmp/${sample_id}.trimAdapt.filter.align2RNA.grouped.readCount
  40. echo "Pass3.2"
  41. # cat ${in_sam_align_RNA} | head -n 4
  42. echo "Pass3.3"
  43. # cat ${in_sam_align_RNA} | grep -v '@' | awk '($2!=4)' | cut -f 3 | sed 's/.*;//g' | awk '{a[$1]++}END{for(i in a){printf "%s\t%d\n",i,a[i]}}' > $groupedReadCount
  44. echo "Pass4"
  45. # n_mRNA=$(cat $groupedReadCount | grep '^mRNA' | cut -f 2 )
  46. # n_lncRNA=$(cat $groupedReadCount | grep '^long_non-coding_RNA' | cut -f 2 )
  47. # n_rRNA=$(cat $groupedReadCount | grep '^ribosomal_RNA' | cut -f 2 )
  48. # n_YRNA=$(cat $groupedReadCount | grep '^Y_RNA' | cut -f 2 )
  49. # n_otsmall=$(cat $groupedReadCount | grep -E '^misc_RNA|small|guide_RNA|vault_RNA' | cut -f 2 | awk '{sum+=$1}END{print sum}')
  50. # n_otTranscript=$(bc<<<$n_RNA-$n_mRNA-$n_lncRNA-$n_rRNA-$n_YRNA-$n_otsmall)
  51. echo "Pass5"
  52. file_output=${sample_id}.readStats
  53. echo -e "Stage\tReadCount" > $file_output
  54. echo -e "adapter not found\t$n_AdapterNotFound" >> $file_output
  55. echo -e "adapter dimer\t$n_Adapter_dimer" >> $file_output
  56. echo -e "too short\t$n_Too_short" >> $file_output
  57. echo -e "low sequencing quality\t$n_Low_quality" >> $file_output
  58. echo -e "mature miRNA\t$n_miRNA_mature" >> $file_output
  59. echo -e "hairpin miRNA\t$n_miRNA_hairpin" >> $file_output
  60. echo -e "piRNA\t$n_piRNA" >> $file_output
  61. echo -e "tRNA\t$n_tRNA" >> $file_output
  62. # echo -e "mRNA\t$n_mRNA" >> $file_output
  63. # echo -e "lncRNA\t$n_lncRNA" >> $file_output
  64. # echo -e "rRNA\t$n_rRNA" >> $file_output
  65. # echo -e "YRNA\t$n_YRNA" >> $file_output
  66. # echo -e "other small RNA\t$n_otsmall" >> $file_output
  67. # echo -e "other from transcriptome\t$n_otTranscript" >> $file_output
  68. echo -e "other from human genome\t$n_otGenomic" >> $file_output
  69. echo -e "not from human genome\t$n_notGenomic" >> $file_output
  70. echo "Pass6"
  71. >>>
  72. runtime {
  73. cluster: cluster_config
  74. systemDisk: "cloud_ssd 40"
  75. dataDisk: "cloud_ssd " + disk_size + " /cromwell_root/"
  76. }
  77. output {
  78. File out="${sample_id}.readStats"
  79. }
  80. }