#!/bin/bash
PATH=/data/results/tools/align/cufflinks-2.2.1.Linux_x86_64:$PATH; export PATH

#/data/results/tools/align/cufflinks-2.2.1.Linux_x86_64/
LABELS[1]="GM-tr-0h-a"
LABELS[2]="GM-tr-0h-b"
LABELS[3]="GM-tr-1h-a"
LABELS[4]="GM-tr-1h-b"
LABELS[5]="GM-tr-3h-a"
LABELS[6]="GM-tr-3h-b"
LABELS[7]="GM-untr-0h-a"
LABELS[8]="GM-untr-0h-b"
LABELS[9]="SCAN-tr-0h-a"
LABELS[10]="SCAN-tr-0h-b"
LABELS[11]="SCAN-tr-1h-a"
LABELS[12]="SCAN-tr-1h-b"
LABELS[13]="SCAN-tr-3h-a"
LABELS[14]="SCAN-tr-3h-b"
LABELS[15]="SCAN-untr-0h-a"
LABELS[16]="SCAN-untr-0h-b"


#BASE_DIR=/home/dimopoulos/TopHat_test/

#rm time_Cuff-mm9.txt
CONCUR=6
THREADS=6

echo BEGIN Cufflinks witth $CONCUR Concurrent and $THREADS threads `date` >> time_Cuff-mm9.txt
#for i in `seq 2 16`
#for i in `seq 5 5`
#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 

 /data/results/tools/align/cufflinks-2.2.1.Linux_x86_64/cuffnorm --use-sample-sheet   --no-update-check --library-type fr-secondstrand --num-threads $THREADS  -o cuffnorm /data/images/proton/run90/pairings/merged_asm/merged.gtf sample-sheet.txt
#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

#sem --wait
exit


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


