2749 |
08 Oct 14 |
nicklas |
#!/bin/sh |
2749 |
08 Oct 14 |
nicklas |
2 |
|
2749 |
08 Oct 14 |
nicklas |
# $Id$ |
2749 |
08 Oct 14 |
nicklas |
4 |
|
2749 |
08 Oct 14 |
nicklas |
# Nicklas Nordborg, 2014 |
2749 |
08 Oct 14 |
nicklas |
6 |
# |
2749 |
08 Oct 14 |
nicklas |
# Replaces tracking_id and gene_id values in Cufflinks |
2749 |
08 Oct 14 |
nicklas |
# *.fpkm_tracking files |
2749 |
08 Oct 14 |
nicklas |
9 |
# |
2749 |
08 Oct 14 |
nicklas |
# The values to search for and their replacement values must |
2749 |
08 Oct 14 |
nicklas |
# be defined in the file given as a parameter to this script. |
2749 |
08 Oct 14 |
nicklas |
# This file must have at least two columns. The second column |
2749 |
08 Oct 14 |
nicklas |
# contain the values to look for and the first column is the |
2749 |
08 Oct 14 |
nicklas |
# replacement values. |
2749 |
08 Oct 14 |
nicklas |
15 |
# |
2749 |
08 Oct 14 |
nicklas |
# The script then read stdin, perform the replacement and |
2749 |
08 Oct 14 |
nicklas |
# write the result to stdout |
2749 |
08 Oct 14 |
nicklas |
18 |
# |
2749 |
08 Oct 14 |
nicklas |
# Script inspired by post on http://www.unix.com/302448486-post6.html |
2749 |
08 Oct 14 |
nicklas |
20 |
# |
2749 |
08 Oct 14 |
nicklas |
# run ./fix_cufflinks_tracking_id.sh path/to/map-file < infile > outfile |
2749 |
08 Oct 14 |
nicklas |
22 |
# |
2749 |
08 Oct 14 |
nicklas |
23 |
|
2749 |
08 Oct 14 |
nicklas |
24 |
awk 'NR==FNR {a[$2]=$1;next} {for (i in a) gsub(i,a[i])}1' $1 /dev/stdin |