# HG changeset patch # User nikos # Date 1415208889 18000 # Node ID 37d00e22959b864115a688a7cfe4fb8e84dad5da # Parent 52ff42c859944ce418fe4a9ee2e4243d1243fbbe Fixed major bug in barcode length calculation. diff -r 52ff42c85994 -r 37d00e22959b summarize_unique_barcodes.sh --- a/summarize_unique_barcodes.sh Wed Nov 05 11:44:47 2014 -0500 +++ b/summarize_unique_barcodes.sh Wed Nov 05 12:34:49 2014 -0500 @@ -155,7 +155,7 @@ #Computing barcode length (Use the first line and compute the string length of the second column) if [ "$barcodes" != "None" ]; then - TMP=`head -1 $barcodes | awk '{print $2}'` + TMP=$(for line in `cut -f 2 $barcodes`; do if [ ! -z "$line" ]; then echo $line; break; fi; done) BAR_LEN=`echo ${#TMP}` #Remove "@" from barcodes and sort them @@ -218,9 +218,8 @@ #Produce k2n file if [ "$k2n" == "True" ]; then - bar_length=$(head -n 1 $barcodes | cut -f 2 | xargs expr length) - Rscript $R_SCRIPT_PATH/k2n.R merged_temp.gz $output_dir/read_counts.txt ${max_observed_barcodes} $bar_length $output_dir/k2n.txt + Rscript $R_SCRIPT_PATH/k2n.R merged_temp.gz $output_dir/read_counts.txt ${max_observed_barcodes} $BAR_LEN $output_dir/k2n.txt fi #Remove temp files -rm paired merged_temp.gz positions_temp_sorted.gz +rm merged_temp2 merged_temp.gz positions_temp_sorted.gz paired