Commit 0967c432 authored by TomKellyGenetics's avatar TomKellyGenetics
Browse files

refactor cloupe preprocess suppression

parent 0fa2f881
Loading
Loading
Loading
Loading
+21 −18
Original line number Diff line number Diff line
@@ -1564,27 +1564,30 @@ if [[ $lock -eq 0 ]]; then
    elif [[ $lastcall_p == "default:10x" ]] || [[ ! -f $lastcallfile ]]; then
        #disable cloupe generation
        if [[ $verbose  ]]; then
           echo "diasble cloupe"
            echo "disable cloupe"
        fi
#        sed -i '/output_for_cloupe/s/^#*#//g' ${cellrangerpath}-cs/${cellrangerversion}/mro/*mro
#        sed -i '/out cloupe cloupe/ {s/^#*#//g}' ${cellrangerpath}-cs/${cellrangerversion}/mro/*mro #
        sed -i 's/@include "_cloupe_stages.mro"/#@include "_cloupe_stages.mro"g' ${cellrangerpath}-cs/${cellrangerversion}/mro/*mro
        ## list cloupe output as null
        sed -i '/output_for_cloupe/s/CLOUPE_PREPROCESS\.output_for_cloupe/null/g' ${cellrangerpath}-cs/${cellrangerversion}/mro/*mro 
        sed -i '/output_for_cloupe/s/s/^/#/g' ${cellrangerpath}-cs/${cellrangerversion}/mro/*mro 
        ## remove cloupe from outputs
        sed -i '/out cloupe cloupe/ {s/^/#/g}' ${cellrangerpath}-cs/${cellrangerversion}/mro/*mro

#remove 11 lines for cloupe preprocess call
        #remove 11 lines for cloupe preprocess call (all folowing steps are needed to be suppressed together or call will break)
        ## remove defining CLOUPE_PREPROCESS
        sed -i 's/@include "_cloupe_stages.mro"/#@include "_cloupe_stages.mro"g' ${cellrangerpath}-cs/${cellrangerversion}/mro/*mro
        ## remove listing CLOUPE in output
        sed -i '/output_for_cloupe/s/s/^/#/g' ${cellrangerpath}-cs/${cellrangerversion}/mro/*mro 
        ## remove calling CLOUPE_PREPROCESS
        ### iterate over all files calling CLOUPE_PREPROCESS
        for file in $(grep -l  "call CLOUPE_PREPROCES"  /home/tom/local/bin/cellranger-3.0.2/cellranger-cs/3.0.2/mro/*.mro )
        do
            #find  start of CLOUPE_PREPROCESS call
            num=$(grep -n "call CLOUPE_PREPROCESS" $file |  head -n 1 | cut -d":" -f1)
            #find end of CLOUPE_PREPROCESS call
            num2=$(($num +$(tail -n $(echo $(($(wc -l $file | cut -f1 -d " ") - $num))) $file | grep -n ")" | head -n 1 | cut -d":" -f1)))
            if [[ $verbose ]]; then
               echo "lines ${num}-${num2} commented out of $file"
            fi
            eval "sed -i '$(echo "${num},${num2}s/^/#/g")' $file"
        done


    fi
    echo " ${cellrangerpath} set for $technology"