Commit efa7f0ca authored by TomKellyGenetics's avatar TomKellyGenetics
Browse files

migrate index, mock UMI, and leading UMI to perl

parent d74f9ce8
Loading
Loading
Loading
Loading
+9 −13
Original line number Diff line number Diff line
@@ -1651,7 +1651,7 @@ if [[ "$technology" == "indrop-v3" ]] || [[ "$technology" == "icell8-full-lengt
             if [[ $verbose ]]; then
                 echo index of length $indexlength gives quality score $qualscores
             fi
            perl -pni -e "4~4s/^.*$/${qualscores}/g" $I1_file
            perl -pni -e "s/^.*$/${qualscores}/g if ($. % 4 == 0)" $I1_file
            #copies index 2 to next line (1st to 2nd) and deletes 3rd line
            cat $R1_file | sed -E "s/ (.):(.):(.):(.*)\+(.*)$/ \1:\2:\3:\4+\5\n\5/g" | perl -pn -e "3~5d" >  $I2_file
            index2length=$(($(head $I2_file -n 2 | tail -n 1 | wc -c) - 1))
@@ -1659,7 +1659,7 @@ if [[ "$technology" == "indrop-v3" ]] || [[ "$technology" == "icell8-full-lengt
            if [[ $verbose ]]; then
                echo index2 of length $index2length gives quality score $qualscores2
            fi
            perl -pni -e "4~4s/^.*$/${qualscores2}/g" $I2_file
            perl -pni -e "s/^.*$/${qualscores2}/g if ($. % 4 == 0)" $I2_file
            index1+=("$I1_file")
            index2+=("$I2_file")
        done
@@ -1701,7 +1701,7 @@ if [[ "$technology" == "quartz-seq" ]] || [[ "$technology" == "ramda-seq" ]] ||
            if [[ $verbose ]]; then
                echo index of length $indexlength gives quality score $qualscores
            fi
            perl -pni -e "4~4s/^.*$/${qualscores}/g" $I1_file
            perl -pni -e "s/^.*$/${qualscores}/g if ($. % 4 == 0)" $I1_file
            index1+=("$I1_file")
        done
        if [[ $verbose ]]; then
@@ -2946,7 +2946,7 @@ else
        echo "  ... barcode and UMI swapped for ${technology}"
        for convFile in "${convFiles[@]}"; do
            #swap UMI and barcode
            sed -E '2~2s/(.{6})(.{6})/\2\1/' $convFile > ${crIN}/.temp
            perl -pni -e "s/(.{6})(.{6})/\1\2/' if ($. % 2 == 0)" $convFile
            mv ${crIN}/.temp $convFile
        done
    fi
@@ -3257,8 +3257,7 @@ else
             mv ${crIN}/.temp $convFile
             #swap barcode and UMI
            echo "  ... barcode and UMI swapped for ${technology}"
            sed -E '2~2s/(.{8})(.{10})/\2\1/' $convFile > ${crIN}/.temp
            mv ${crIN}/.temp $convFile
            perl -pni -e "s/(.{8})(.{10})/\1\2/' if ($. % 2 == 0)" $convFile
            
            read=$convFile
            convR1=$read
@@ -3309,8 +3308,7 @@ else
            mv ${crIN}/.temp $convFile
            #swap barcode and UMI
            echo "  ... barcode and UMI swapped for ${technology}"
            sed -E '2~2s/(.{10})(.{8})(.{10})/\1\3\2/' $convFile > ${crIN}/.temp
            mv ${crIN}/.temp $convFile
            perl -pni -e "s/(.{10})(.{8})(.{10})/\1\3\2/' if ($. % 2 == 0)" $convFile
            
            read=$convFile
            convR1=$read
@@ -3716,11 +3714,9 @@ else
            #compute length of adjusted barcode + original UMI
            keeplength=`echo $((${barcode_default} + ${umi_default} - ($umiadjust * - 1)))`
            #Add n characters to the end of the sequence
            sed -E "2~4s/(.{$keeplength})(.*)/\1$toS\2/" $convFile > ${crIN}/.temp
            mv ${crIN}/.temp $convFile
            perl -pni -e "s/(.{$keeplength})(.*)/\1$toS\2/ if ($. % 4 == 2)" $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
            perl -pni -e "s/(.{$keeplength})(.*)/\1$toQ\2/ if ($. % 4 == 0)" $convFile
            echo "  ${convFile} adjusted"
        done
    fi
@@ -3732,7 +3728,7 @@ else
            #compute length of adjusted barcode + original UMI
            targetlength=`echo $((${barcode_default} + ${umi_default}))`
            #Remove n characters to the end of the sequence and quality score
            sed -E "2~2s/(.{$targetlength})(.{$umiadjust})(.*)/\1\3/" $convFile > ${crIN}/.temp
            perl -pni -e "s/(.{$targetlength})(.{$umiadjust})(.*)/\1\3/ if ($. % 2 == 0)" $convFile
            mv ${crIN}/.temp $convFile
            echo "  ${convFile} adjusted"
        done
+6 −6
Original line number Diff line number Diff line
@@ -38,12 +38,12 @@ fi
if [ -d test-icell8-72618-KU812-2-lanes-non-umi ];then
    rm -rf test-icell8-72618_KU812-2-lanes-non-umi
fi
bash launch_universc.sh --id "test-icell8-72618_KU812-2-lanes-non-umi" --technology "iCell8" \
 --reference "test/cellranger_reference/cellranger-tiny-ref/3.0.0" \
 --read1 "test/shared/icell8-test/72618_KU812_L001_R1_001.fastq" "test/shared/icell8-test/72618_KU812_L002_R1_001.fastq" \
 --read2 "test/shared/icell8-test/72618_KU812_L001_R2_001.fastq" "test/shared/icell8-test/72618_KU812_L002_R2_001.fastq" \
 --barcodefile "test/shared/icell8-test/WellList.txt" \
 --per-cell-data --jobmode "local" --localcores 2 --localmem 4 --non-umi
#bash launch_universc.sh --id "test-icell8-72618_KU812-2-lanes-non-umi" --technology "iCell8" \
# --reference "test/cellranger_reference/cellranger-tiny-ref/3.0.0" \
# --read1 "test/shared/icell8-test/72618_KU812_L001_R1_001.fastq" "test/shared/icell8-test/72618_KU812_L002_R1_001.fastq" \
# --read2 "test/shared/icell8-test/72618_KU812_L001_R2_001.fastq" "test/shared/icell8-test/72618_KU812_L002_R2_001.fastq" \
# --barcodefile "test/shared/icell8-test/WellList.txt" \
# --per-cell-data --jobmode "local" --localcores 2 --localmem 4 --non-umi

if [ -f test/shared/icell8-test/72618_KU812_S1_L001_R1_001.fastq ]; then
    rename "s/_S1_L001/_L001/" test/shared/icell8-test/72618_KU812_S1_L001_R1_001.fastq*