File tree Expand file tree Collapse file tree 1 file changed +22
-17
lines changed
src/pipecraft-core/service_scripts/submodules Expand file tree Collapse file tree 1 file changed +22
-17
lines changed Original file line number Diff line number Diff line change 539539# ## Compile a track reads summary file (seq_count_summary.txt)
540540output_dir_for_sed=$( echo $output_dir | sed -e " s/\//\\\\ \//g" )
541541sed -e " s/$output_dir_for_sed \///" < tempdir2/seq_count_after.txt > tempdir2/seq_count_after.temp
542- printf " File\tReads_in\tReads_out\n" > $output_dir /seq_count_summary.txt
543- while read LINE; do
544- file1=$( echo $LINE | awk ' {print $1}' )
545- count1=$( echo $LINE | awk ' {print $2}' )
546- while read LINE2; do
547- file2=$( echo $LINE2 | awk ' {print $1}' )
548- count2=$( echo $LINE2 | awk ' {print $2}' )
549- if [[ " $file1 " == " $file2 " ]]; then
550- printf " $file1 \t$count1 \t$count2 \n" >> $output_dir /seq_count_summary.txt
551- fi
552- done < tempdir2/seq_count_after.temp
553- # Report file where no sequences were reoriented (i.e. the output was 0)
554- grep -Fq $file1 tempdir2/seq_count_after.temp
555- if [[ $? != 0 ]]; then
556- printf " $file1 \t$count1 \t0\n" >> $output_dir /seq_count_summary.txt
557- fi
558- done < tempdir2/seq_count_before.txt
542+
543+ # Compile seq_count_summary.txt
544+ awk '
545+ BEGIN { print "File\tReads_in\tReads_out" }
546+ NR==FNR {
547+ before[$1] = $2;
548+ next
549+ }
550+ {
551+ file = $1;
552+ count_after = $2;
553+ if (file in before) {
554+ print file "\t" before[file] "\t" count_after;
555+ delete before[file];
556+ }
557+ }
558+ END {
559+ # Print files with 0 output
560+ for (file in before) {
561+ print file "\t" before[file] "\t0";
562+ }
563+ }' tempdir2/seq_count_before.txt tempdir2/seq_count_after.temp > $output_dir /seq_count_summary.txt
559564
560565# Delete decompressed files if original set of files were compressed
561566if [[ $check_compress == " gz" ]] || [[ $check_compress == " zip" ]]; then
You can’t perform that action at this time.
0 commit comments