#!/bin/bash


LABELS[1]="GKR14_0h"
LABELS[2]="GKR20_0h"
LABELS[3]="GKR26_0h"
LABELS[4]="GKR15_1h"
LABELS[5]="GKR21_1h"
LABELS[6]="GKR27_1h"
LABELS[7]="GKR16_3h"
LABELS[8]="GKR22_3h"
LABELS[9]="GKR28_3h"
LABELS[10]="GKR17_6h"
LABELS[11]="GKR23_6h"
LABELS[12]="GKR29_6h"
LABELS[13]="GKR18_24h"
LABELS[14]="GKR24_24h"
LABELS[15]="GKR30_24h"
LABELS[16]="GKR19_7d"
LABELS[17]="GKR25_7d"
LABELS[18]="GKR31_7d"



#BASE_DIR=/home/dimopoulos/TopHat_test/

#rm time_Cuff-mm9.txt
CONCUR=1
THREADS=8

echo BEGIN Cufflinks witth $CONCUR Concurrent and $THREADS threads `date` >> time_Cuff-mm9.txt
#for i in `seq 7 12`
for i in `seq 1 18`
do
echo ${LABELS[$i]}

#-F/--min-isoform-fraction <0.0-1.0>	 After calculating isoform abundance for a gene, Cufflinks filters out transcripts that it believes are very low abundance, because isoforms expressed at extremely low levels often cannot reliably be assembled, and may even be artifacts of incompletely spliced precursors of processed transcripts. This parameter is also used to filter out introns that have far fewer spliced alignments supporting them. The default is 0.1, or 10% of the most abundant isoform (the major isoform) of the gene.
#http://seqanswers.com/forums/showthread.php?p=76430
#--no-effective-length-correction	 Cufflinks will not employ its "effective" length normalization to transcript FPKM.
#/home/reczko/tools/align/cufflinks-2.1.1.Linux_x86_64/cufflinks --upper-quartile-norm -L ${LABELS[$i]} --no-update-check --library-type fr-unstranded --num-threads $THREADS -q -o ${OUT_DIR[$i]}/accepted_hits3 ${IN_DIR[$i]}/accepted_hits.bam 

samtools reheader sam.head ${LABELS[$i]}.bam  > bam2
/data/results/tools/samtools/mysamtools-0.1.19/samtools sort -@ 8 bam2 sorted.bam2
cp sorted.bam2.bam www/${LABELS[$i]}.bam
rm sorted.bam2.bam
/data/results/tools/align/cufflinks-2.2.0.Linux_x86_64/cufflinks --no-effective-length-correction -G /data/results/reference/mmu/Mus_musculus/UCSC/mm9/Annotation/Genes/genes.gtf -L ${LABELS[$i]} --no-update-check --library-type fr-secondstrand --num-threads $THREADS -q -o ${LABELS[$i]}/accepted_hits www/${LABELS[$i]}.bam
#sem -j $CONCUR /data/results/tools/align/cufflinks-2.1.1.Linux_x86_64/cufflinks --no-effective-length-correction -G /data/results/reference/hg19/Homo_sapiens/UCSC/hg19/Annotation/Genes/genes.gtf -L ${LABELS[$i]} --no-update-check --library-type fr-secondstrand --num-threads $THREADS -q -o ${LABELS[$i]}/accepted_hits tracks/${LABELS[$i]}.bam

done

#sem --wait

for i in `seq 1 2`
#for i in `seq 5 5`
do
echo ${LABELS[$i]}

#sem -j $CONCUR /home/reczko/tools/align/cufflinks-2.1.1.Linux_x86_64/cuffcompare -o ${OUT_DIR[$i]}/cuffcompare  -R -s /mnt/raid/data/reference/mmu/Mus_musculus/UCSC/mm9/Sequence/WholeGenomeFasta/genome.fa  -r /mnt/raid/data/reference/mmu/Mus_musculus/UCSC/mm9/Annotation/Archives/archive-2013-03-06-15-01-24/Genes/genes.gtf ${OUT_DIR[$i]}/accepted_hits3/transcripts.gtf

#sem -j $CONCUR cuffcompare -o ${OUT_DIR[$i]}/cuffcompare  -R -s /mnt/raid/data/reference/mmu/nocolor/mm9.fa  -r /mnt/raid/data/reference/mmu/filter/mm9-rRNAtRNA.gtf  ${OUT_DIR[$i]}/accepted_hits3/transcripts.gtf

done

#sem --wait

echo END Cufflinks witth $CONCUR Concurrent and $THREADS threads `date` >> time_Cuff-mm9.txt
echo "************************ " >> time_Cuff-mm9.txt
echo "************************ " >> time_Cuff-mm9.txt
exit


