annotate bin/last-bisulfite.sh @ 0:06f8460885ff

migrate from GitHub
author yutaka-saito
date Sun, 19 Apr 2015 20:51:13 +0900
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
06f8460885ff migrate from GitHub
yutaka-saito
parents:
diff changeset
1 #! /bin/sh
06f8460885ff migrate from GitHub
yutaka-saito
parents:
diff changeset
2
06f8460885ff migrate from GitHub
yutaka-saito
parents:
diff changeset
3 # Align bisulfite-converted DNA reads to a genome.
06f8460885ff migrate from GitHub
yutaka-saito
parents:
diff changeset
4
06f8460885ff migrate from GitHub
yutaka-saito
parents:
diff changeset
5 # This assumes that the reads are all from the converted strand
06f8460885ff migrate from GitHub
yutaka-saito
parents:
diff changeset
6 # (i.e. they have C->T conversions, not G->A conversions).
06f8460885ff migrate from GitHub
yutaka-saito
parents:
diff changeset
7
06f8460885ff migrate from GitHub
yutaka-saito
parents:
diff changeset
8 [ $# -gt 1 ] || {
06f8460885ff migrate from GitHub
yutaka-saito
parents:
diff changeset
9 cat <<EOF
06f8460885ff migrate from GitHub
yutaka-saito
parents:
diff changeset
10 Typical usage:
06f8460885ff migrate from GitHub
yutaka-saito
parents:
diff changeset
11
06f8460885ff migrate from GitHub
yutaka-saito
parents:
diff changeset
12 lastdb -uBISF my_f mygenome.fa
06f8460885ff migrate from GitHub
yutaka-saito
parents:
diff changeset
13 lastdb -uBISR my_r mygenome.fa
06f8460885ff migrate from GitHub
yutaka-saito
parents:
diff changeset
14
06f8460885ff migrate from GitHub
yutaka-saito
parents:
diff changeset
15 $(basename $0) my_f my_r reads.fastq > results.maf
06f8460885ff migrate from GitHub
yutaka-saito
parents:
diff changeset
16
06f8460885ff migrate from GitHub
yutaka-saito
parents:
diff changeset
17 EOF
06f8460885ff migrate from GitHub
yutaka-saito
parents:
diff changeset
18 exit 2
06f8460885ff migrate from GitHub
yutaka-saito
parents:
diff changeset
19 }
06f8460885ff migrate from GitHub
yutaka-saito
parents:
diff changeset
20 my_f=$1
06f8460885ff migrate from GitHub
yutaka-saito
parents:
diff changeset
21 my_r=$2
06f8460885ff migrate from GitHub
yutaka-saito
parents:
diff changeset
22 shift 2
06f8460885ff migrate from GitHub
yutaka-saito
parents:
diff changeset
23
06f8460885ff migrate from GitHub
yutaka-saito
parents:
diff changeset
24 # Try to get the LAST programs into the PATH, if they aren't already:
06f8460885ff migrate from GitHub
yutaka-saito
parents:
diff changeset
25 PATH=$PATH:$(dirname $0)/../src
06f8460885ff migrate from GitHub
yutaka-saito
parents:
diff changeset
26
06f8460885ff migrate from GitHub
yutaka-saito
parents:
diff changeset
27 tmp=${TMPDIR-/tmp}/$$
06f8460885ff migrate from GitHub
yutaka-saito
parents:
diff changeset
28 trap 'rm -f $tmp.*' EXIT
06f8460885ff migrate from GitHub
yutaka-saito
parents:
diff changeset
29
06f8460885ff migrate from GitHub
yutaka-saito
parents:
diff changeset
30 # Convert C to t, and all other letters to uppercase:
06f8460885ff migrate from GitHub
yutaka-saito
parents:
diff changeset
31 perl -pe 'y/Cca-z/ttA-Z/ if $. % 4 == 2' "$@" > "$tmp".q
06f8460885ff migrate from GitHub
yutaka-saito
parents:
diff changeset
32
06f8460885ff migrate from GitHub
yutaka-saito
parents:
diff changeset
33 lastal -pBISF -s1 -Q1 -e120 "$my_f" "$tmp".q > "$tmp".f
06f8460885ff migrate from GitHub
yutaka-saito
parents:
diff changeset
34 lastal -pBISR -s0 -Q1 -e120 "$my_r" "$tmp".q > "$tmp".r
06f8460885ff migrate from GitHub
yutaka-saito
parents:
diff changeset
35
06f8460885ff migrate from GitHub
yutaka-saito
parents:
diff changeset
36 last-merge-batches "$tmp".f "$tmp".r | last-split -m0.1 |
06f8460885ff migrate from GitHub
yutaka-saito
parents:
diff changeset
37 perl -F'(\s+)' -ane '$F[12] =~ y/ta/CG/ if /^s/ and $s++ % 2; print @F'