- task ReadStats {
-
- String sample_ID
- File in_log_trimAdatper
- File in_log_readFilter
- File in_log_align_mature
-
- String cluster_config
- String disk_size
-
- command <<<
- set -o pipefail
- set -e
-
- Total_input=$(cat ${in_log_trimAdatper} | grep 'total reads' | head -n 1 | cut -d ':' -f 2 | sed 's/ //g')
-
- Pass_trimAdatper=$(cat ${in_log_trimAdatper} | grep 'reads passed filter' | tail -n 1 | cut -d ':' -f 2 | sed 's/ //g')
- Adapter_dimer=$(bc<<<$Total_input-$Pass_trimAdatper)
-
- Too_short=$(cat ${in_log_readFilter} | grep 'too short' | tail -n 1 | cut -d ':' -f 2 | sed 's/ //g')
-
- Low_quality_singleBase=$(cat ${in_log_readFilter} | grep 'low quality' | head -n 1 | cut -d ':' -f 2 | sed 's/ //g')
- Low_quality_tooManyN=$(cat ${in_log_readFilter} | grep 'too many N' | head -n 1 | cut -d ':' -f 2 | sed 's/ //g')
- Low_quality=$(bc<<<$Low_quality_singleBase+$Low_quality_tooManyN)
-
- ForAlign=$(cat ${in_log_readFilter} | grep 'reads passed filter' | head -n 1 | cut -d ':' -f 2 | sed 's/ //g')
-
- Align_miRNA_mature=$(cat ${in_log_align_mature} | grep 'at least one reported alignment' | head -n 1 | cut -d ':' -f 2 | cut -d '(' -f 1 | sed 's/ //g')
-
- echo -e "Stage\tReadCount" > ${sample_ID}.readStats
- echo -e "Total Input\t$Total_input" >> ${sample_ID}.readStats
- echo -e "Adapter Dimer\t$Adapter_dimer" >> ${sample_ID}.readStats
- echo -e "Too Short\t$Too_short" >> ${sample_ID}.readStats
- echo -e "Low Quality\t$Low_quality" >> ${sample_ID}.readStats
- echo -e "For Align\t$ForAlign" >> ${sample_ID}.readStats
- echo -e "Mature miRNA\t$Align_miRNA_mature" >> ${sample_ID}.readStats
-
- >>>
-
- runtime {
- cluster: cluster_config
- systemDisk: "cloud_ssd 40"
- dataDisk: "cloud_ssd " + disk_size + " /cromwell_root/"
- }
-
- output {
- File out="${sample_ID}.readStats"
- }
- }
|