Mercurial > repos > saharlcc > isoem2_isode2
changeset 0:581e4c6b483f draft
Uploaded
author | saharlcc |
---|---|
date | Mon, 19 Sep 2016 21:57:36 -0400 |
parents | |
children | babf45f7c9a3 |
files | isoDE2.sh |
diffstat | 1 files changed, 210 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/isoDE2.sh Mon Sep 19 21:57:36 2016 -0400 @@ -0,0 +1,210 @@ +#!/bin/bash + +isoEMDir=/home/projects/isoem2/isoem-workingversion +toolpath=${isoEMDir}/bin +isoDEPath=${isoEMDir}/bin +supportCalcPath=${isoEMDir}/src/calc +fpkmGeneCommand="" +fpkmIsoformCommand="" +tpmGeneCommand="" +tpmIsoformCommand="" + + +arg=($*) +i=0 +while [ $i -lt $# ] +do + a=${arg[i]} + if [ "$a" == "-c1" ]; then + fpkmGeneCommand="$fpkmGeneCommand -c1" + fpkmIsoformCommand="$fpkmIsoformCommand -c1" + tpmGeneCommand="$tpmGeneCommand -c1" + tpmIsoformCommand="$tpmIsoformCommand -c1" + + ((i++)) + a=${arg[i]} + rep=1 + while [[ `expr index "$a" "/"` -ne 0 && $i -lt $# ]] + do + condition1File=$a + ${toolpath}/convertToisoDEFormatWithIsoforms $condition1File c1_rep${rep} + + fpkmGeneCommand="$fpkmGeneCommand c1_rep${rep}_fpkm_G" + fpkmIsoformCommand="$fpkmIsoformCommand c1_rep${rep}_fpkm_I" + tpmGeneCommand="$tpmGeneCommand c1_rep${rep}_tpm_G" + tpmIsoformCommand="$tpmIsoformCommand c1_rep${rep}_tpm_I" + ((rep++)) + + ((i++)) + a=${arg[i]} + done + elif [ "$a" == "-c2" ]; then + fpkmGeneCommand="$fpkmGeneCommand -c2" + fpkmIsoformCommand="$fpkmIsoformCommand -c2" + tpmGeneCommand="$tpmGeneCommand -c2" + tpmIsoformCommand="$tpmIsoformCommand -c2" + + ((i++)) + a=${arg[i]} + rep=1 + while [[ `expr index "$a" "/"` -ne 0 && $i -lt $# ]] + do + condition1File=$a + #echo $condition1File + ${toolpath}/convertToisoDEFormatWithIsoforms $condition1File c2_rep${rep} + + fpkmGeneCommand="$fpkmGeneCommand c2_rep${rep}_fpkm_G" + fpkmIsoformCommand="$fpkmIsoformCommand c2_rep${rep}_fpkm_I" + tpmGeneCommand="$tpmGeneCommand c2_rep${rep}_tpm_G" + tpmIsoformCommand="$tpmIsoformCommand c2_rep${rep}_tpm_I" + ((rep++)) + + ((i++)) + a=${arg[i]} + done + elif [ "$a" == "-pval" ]; then + ((i++)) + pval=${arg[i]} + ((i++)) + + + elif [ "$a" == "-geneFPKMout" ]; then + ((i++)) + geneFPKMout_file=${arg[i]} + ((i++)) + + + elif [ "$a" == "-geneTPMout" ]; then + ((i++)) + geneTPMout_file=${arg[i]} + ((i++)) + + elif [ "$a" == "-isoFPKMout" ]; then + ((i++)) + isoFPKMout_file=${arg[i]} + ((i++)) + + elif [ "$a" == "-isoTPMout" ]; then + ((i++)) + isoTPMout_file=${arg[i]} + ((i++)) + else + + ((i++)) + fi + +done + +support=`java -cp ${supportCalcPath} support 200 200 $pval` +fpkmGeneCommand="$fpkmGeneCommand -b $support" +fpkmIsoformCommand="$fpkmIsoformCommand -b $support" +tpmGeneCommand="$tpmGeneCommand -b $support" +tpmIsoformCommand="$tpmIsoformCommand -b $support" + +fpkmGeneCommand="$fpkmGeneCommand -dfc 2" +fpkmIsoformCommand="$fpkmIsoformCommand -dfc 2" +tpmGeneCommand="$tpmGeneCommand -dfc 2" +tpmIsoformCommand="$tpmIsoformCommand -dfc 2" + + +#if [ "${out_prefix}" == "$(basename ${out_prefix} )" ]; then +# pth=`pwd` +# out_prefix=${pth}/${out_prefix} +#fi + + +echo GENE FPKM +echo moving start +date + +mkdir fpkm_G +cd fpkm_G +mv ../c*_fpkm_G . + + +echo isoDE start +date + + +${isoDEPath}/isodecalls $fpkmGeneCommand -out "output.txt" +#awk '{for (f=1; f<=NF; f++) {if (f == NF) printf "%s",$f; else printf "%s\t", $f }; print ""}' Bootstrap_Merge1_DIR/output.txt | sed 1,1d > ${geneFPKMout_file} + +echo awk command +date + + +awk '{if (NR == 1) {print "Gene ID\tConfident log2 FC\t Single run log2 FC\t c1 FPKM\tc2 FPKM";} else {if ($6 == 0 && $7 == 0) {two="NDE";} else {two=$2;} print $1 "\t" two "\t" $5 "\t" $6 "\t" $7}}' Bootstrap_Merge1_DIR/output.txt > ${geneFPKMout_file} + +cd .. + + +echo ISOFORM FPKM + +echo moving start +date + +mkdir fpkm_I +cd fpkm_I +mv ../c*_fpkm_I . + + +echo isoDE start +date + +${isoDEPath}/isodecalls $fpkmIsoformCommand -out "output.txt" + +echo awk command +date +pwd +awk '{if (NR == 1) {print "Isoform ID\tConfident log2 FC\t Single run log2 FC\t c1 FPKM\tc2 FPKM";} else {if ($6 == 0 && $7 == 0) {two="NDE";} else {two=$2;} print $1 "\t" two "\t" $5 "\t" $6 "\t" $7}}' Bootstrap_Merge1_DIR/output.txt > ${isoFPKMout_file} +cd .. + + +echo ISOFORM TPM +echo moving start +date + +mkdir tpm_G +cd tpm_G +mv ../c*_tpm_G . + +echo isoDE start +date + +${isoDEPath}/isodecalls $tpmGeneCommand -out "output.txt" + +echo awk command +date +pwd +awk '{if (NR == 1) {print "Gene ID\tConfident log2 FC\t Single run log2 FC\t c1 TPM\tc2 TPM";} else {if ($6 == 0 && $7 == 0) {two="NDE";} else {two=$2;} print $1 "\t" two "\t" $5 "\t" $6 "\t" $7}}' Bootstrap_Merge1_DIR/output.txt > ${geneTPMout_file} +cd .. + + +echo ISOFORM TPM +echo moving start +date + +mkdir tpm_I +cd tpm_I +mv ../c*_tpm_I . + +echo isoDE start +date + +${isoDEPath}/isodecalls $tpmIsoformCommand -out "output.txt" + +echo awk command +date + +awk '{if (NR == 1) {print "Isoform ID\tConfident log2 FC\t Single run log2 FC\t c1 TPM\tc2 TPM";} else {if ($6 == 0 && $7 == 0) {two="NDE";} else {two=$2;} print $1 "\t" two "\t" $5 "\t" $6 "\t" $7}}' Bootstrap_Merge1_DIR/output.txt > ${isoTPMout_file} + +cd .. + + +echo final cleanup +date +rm -fr fpkm_G fpkm_I tpm_G cd tpm_I +echo done +date + +