Mercurial > repos > pjbriggs > pal_finder
diff pal_finder_wrapper_utils.sh @ 15:a3af1ff4cad1 draft
pal_finder 0.02.04.7 for testing.
| author | pjbriggs |
|---|---|
| date | Mon, 14 May 2018 11:10:19 -0400 |
| parents | e95e2b7b3c84 |
| children |
line wrap: on
line diff
--- a/pal_finder_wrapper_utils.sh Thu Mar 22 07:21:26 2018 -0400 +++ b/pal_finder_wrapper_utils.sh Mon May 14 11:10:19 2018 -0400 @@ -38,17 +38,21 @@ # sequence ids where the PRIMER_PRODUCT_SIZE_RANGE has # upper limit which is smaller than lower limit local pr3in=$1 + local outfile=$2 local pattern="^(SEQUENCE_ID|PRIMER_PRODUCT_SIZE_RANGE)" for line in $(grep -E "$pattern" $pr3in | sed 's/ /^/' | sed 'N;s/\n/*/') do # Loop over pairs of SEQUENCE_ID and PRIMER_PRODUCT_SIZE_RANGE # keywords in the primer3 input if [ ! -z "$(echo $line | grep ^SEQUENCE_ID)" ] ; then - # Extract the values + # Lines look like: + # SEQUENCE_ID=(AT_1_16)(AT_1_16)M00879:99:000000000-AH9KG:1:2107:10006:2535*PRIMER_PRODUCT_SIZE_RANGE=194-329^59-194 local size_range=$(echo $line | cut -d'*' -f2 | cut -d'=' -f2 | tr '^' ' ') local seq_id=$(echo $line | cut -d'*' -f1 | cut -d'=' -f2) - else - local size_range=$(echo $line | cut -d'*' -f1 | cut -d'=' -f2) + elif [ ! -z "$(echo $line | grep ^PRIMER_PRODUCT_SIZE_RANGE)" ] ; then + # Lines look like: + # PRIMER_PRODUCT_SIZE_RANGE=194-329^59-194*SEQUENCE_ID=(AT_1_16)(AT_1_16)M00879:99:000000000-AH9KG:1:2107:10006:2535 + local size_range=$(echo $line | cut -d'*' -f1 | cut -d'=' -f2 | tr '^' ' ') local seq_id=$(echo $line | cut -d'*' -f2 | cut -d'=' -f2) fi seq_id=$(echo $seq_id | cut -d')' -f3) @@ -58,14 +62,14 @@ for range in $(echo $size_range) ; do local lower=$(echo $range | cut -d'-' -f1) local upper=$(echo $range | cut -d'-' -f2) - if [ $lower -gt $upper ] ; then + if [ "$lower" -gt "$upper" ] ; then bad_range=yes break fi done # Report if the range is wrong if [ ! -z "$bad_range" ] ; then - echo "$seq_id ($size_range)" + echo "${seq_id}"$'\t'"(${size_range})" >>$outfile fi done }
