Commit 81790e1e authored by TomKellyGenetics's avatar TomKellyGenetics
Browse files

adjust UMI while preserving R1 for 5' chemistry

parent 4233dcf7
Loading
Loading
Loading
Loading
+11 −5
Original line number Diff line number Diff line
@@ -2414,12 +2414,18 @@ else
            echo " handling $convFile ..."
            toS=`printf '%0.sA' $(seq 1 $(($umiadjust * -1)))`
            toQ=`printf '%0.sI' $(seq 1 $(($umiadjust * -1)))`
            if [[ $chemistry == "SC5P"* ]] || [[ $chemistry == "five"* ]]; then
            #compute length of adjusted barcode + original UMI
            keeplength=`echo $((${barcode_default}+${umi_default}-($umiadjust * -1)))`
                sed -i "2~2s/^\(.\{${keeplength}\}\).*/\1/" $convFile #Trim off everything beyond what is needed
            if [[ $chemistry != "SC5P"* ]] && [[ $chemistry != "five"* ]]; then
                echo "UMI trimming disabled"
                #sed -i "2~2s/^\(.\{${keeplength}\}\).*/\1/" $convFile #Trim off everything beyond what is needed
            fi
            sed -i "2~4s/$/$toS/" $convFile #Add n characters to the end of the sequence
            sed -i "4~4s/$/$toQ/" $convFile #Add n characters to the end of the quality
            #Add n characters to the end of the sequence
            sed -E "2~4s/(.{$keeplength})(.*)/\1$toS\2/"  $convFile > ${crIN}/.temp
            mv ${crIN}/.temp $convFile
            #Add n characters to the end of the quality
            sed -E "4~4s/(.{$keeplength})(.*)/\1$toQ\2/"  $convFile > ${crIN}/.temp
            mv ${crIN}/.temp $convFile
            echo "  ${convFile} adjusted"
        done
    fi