Commit 95a7ca66 authored by psimion's avatar psimion
Browse files

last changes : conf.file now works

parent 18430303
......@@ -84,15 +84,6 @@ else
exit 1
fi
### TESTS
echo "fasta_array:"
echo "${!fasta_array[@]}"
echo
echo "orders:"
echo "${orders[@]}"
echo
###
### detecting suspect transcripts with BLAST
#source "$my_dir/detect_suspect_trans_with_blast.sh"
......@@ -115,7 +106,10 @@ echo
esac
echo -e "\nIndex built : $out/$toolidx\n"
#for (( j=0; j <i; j++ ))
### preparing contigs files with transcripts length
refseqALL=$out/ALL_transcripts.ctgs
touch $refseqALL
for ref in "${orders[@]}"
do
refseqs=$out/$ref".ctgs"
......@@ -128,24 +122,23 @@ echo
Seqlength = length($2) ;
print a[1]"\t"Seqlength > refseqs
}' $out/$ref".fasta_mod"
# regroup all samples
echo -e "command to create ALL_transcripts.ctgs :\tcat $refseqs >> $refseqALL"
cat $refseqs >> $refseqALL
done
# regroup all samples
refseqALL=$out/ALL_transcripts.ctgs
cat $out/$ref.ctgs > $refseqALL
# mapping successively every read sets on all transcripts.
#for (( k=0; k <i; k++ ))
for ref in "${orders[@]}"
do
InfosCtg=${fasta_array[$ref]}
#reads=${fasta_array[$k]}"_reads"
#fileout=$out/${fasta_array[$k]}"_vs_ALL.out"
reads=${ref}"_reads"
fileout=$out/${ref}"_vs_ALL.out"
finalout=$out/"ALL_transcripts.all"
#echo -e "\nMapping ${fasta_array[$k]} reads"
echo -e "\nMapping ${ref} reads"
echo -e "\nInfo Contigs :\t$InfosCtg\nOutfile :\t$fileout\n"
#echo -e "\nInfo Contigs :\t$InfosCtg\nInfo Contigs detailed :\t${InfosCtg[0]};${InfosCtg[1]};${InfosCtg[2]} \
# \nfastq files :\t`echo $InfosCtg | cut -d';' -f2`\t`echo $InfosCtg | cut -d';' -f3` \
# \nOutfile :\t$fileout\nrefseqALL :\t$refseqALL\n"
# calculate expression level with selected tool
case "$TOOL" in
......@@ -185,11 +178,15 @@ echo
R) if [ $MODE == "u" ]
then
#fastq=" -r "$INDIR"/"${fasta_array[$k]}".fastq"
fastq=" -r "$INDIR"/"${InfosCtg[1]}
fastq=" -r "$INDIR"/"`echo $InfosCtg | cut -d';' -f2`
else
#fastq=" -1 "$INDIR"/"${fasta_array[$k]}".L.fastq -2 "$INDIR"/"${fasta_array[$k]}".R.fastq"
fastq=" -1 "$INDIR"/"${InfosCtg[1]}" -2 "$INDIR"/"${InfosCtg[2]}
fastq=" -1 "$INDIR"/"`echo $InfosCtg | cut -d';' -f2`" -2 "$INDIR"/"`echo $InfosCtg | cut -d';' -f3`
fi
echo -e "rapmap quasimap -t $PROCESSORS $ADDOPT -i $out/$toolidx $fastq | grep -v "@" | cut -f3 | \
awk -v reads=$reads -v refseqs=$refseqALL -AWKPART- > $fileout\n"
rapmap quasimap -t $PROCESSORS $ADDOPT -i $out/$toolidx $fastq | grep -v "@" | cut -f3 | \
awk -v reads=$reads -v refseqs=$refseqALL 'BEGIN{OFS="\t"; while ((getline sequ < refseqs) > 0) {split(sequ,a,"\t");ctg[a[1]] = 0; ctgsize[a[1]]= a[2];}; close(refseqs) } {ctg[$1]++}
END{
......@@ -216,6 +213,7 @@ echo
# splitting "All_transcript.all" file into files corresponding to samples
#for (( j=0; j <i; j++ ))
j=0
for ref in "${orders[@]}"
do
#ref=${fasta_array[$j]}
......@@ -256,6 +254,7 @@ echo
LC_ALL=C grep -F -w -m$nb -f $out/$ref.suspects $out/$ref.all >> $out/$ref".all_suspectonly"
mv $out/$ref".all" $out/$ref".all_quants" ; mv $out/$ref".all_suspectonly" $out/$ref".all"
sed -i 's/ /\t/g' $out/$ref".all"
j=$((j+1))
done
# http://www.inmotionhosting.com/support/website/ssh/speed-up-grep-searches-with-lc-all
......
......@@ -84,15 +84,6 @@ else
exit 1
fi
### TESTS
echo "fasta_array:"
echo "${!fasta_array[@]}"
echo
echo "orders:"
echo "${orders[@]}"
echo
###
### detecting suspect transcripts with BLAST
#source "$my_dir/detect_suspect_trans_with_blast.sh"
......@@ -115,7 +106,10 @@ echo
esac
echo -e "\nIndex built : $out/$toolidx\n"
#for (( j=0; j <i; j++ ))
### preparing contigs files with transcripts length
refseqALL=$out/ALL_transcripts.ctgs
touch $refseqALL
for ref in "${orders[@]}"
do
refseqs=$out/$ref".ctgs"
......@@ -128,24 +122,23 @@ echo
Seqlength = length($2) ;
print a[1]"\t"Seqlength > refseqs
}' $out/$ref".fasta_mod"
# regroup all samples
echo -e "command to create ALL_transcripts.ctgs :\tcat $refseqs >> $refseqALL"
cat $refseqs >> $refseqALL
done
# regroup all samples
refseqALL=$out/ALL_transcripts.ctgs
cat $out/$ref.ctgs > $refseqALL
# mapping successively every read sets on all transcripts.
#for (( k=0; k <i; k++ ))
for ref in "${orders[@]}"
do
InfosCtg=${fasta_array[$ref]}
#reads=${fasta_array[$k]}"_reads"
#fileout=$out/${fasta_array[$k]}"_vs_ALL.out"
reads=${ref}"_reads"
fileout=$out/${ref}"_vs_ALL.out"
finalout=$out/"ALL_transcripts.all"
#echo -e "\nMapping ${fasta_array[$k]} reads"
echo -e "\nMapping ${ref} reads"
echo -e "\nInfo Contigs :\t$InfosCtg\nOutfile :\t$fileout\n"
#echo -e "\nInfo Contigs :\t$InfosCtg\nInfo Contigs detailed :\t${InfosCtg[0]};${InfosCtg[1]};${InfosCtg[2]} \
# \nfastq files :\t`echo $InfosCtg | cut -d';' -f2`\t`echo $InfosCtg | cut -d';' -f3` \
# \nOutfile :\t$fileout\nrefseqALL :\t$refseqALL\n"
# calculate expression level with selected tool
case "$TOOL" in
......@@ -185,11 +178,15 @@ echo
R) if [ $MODE == "u" ]
then
#fastq=" -r "$INDIR"/"${fasta_array[$k]}".fastq"
fastq=" -r "$INDIR"/"${InfosCtg[1]}
fastq=" -r "$INDIR"/"`echo $InfosCtg | cut -d';' -f2`
else
#fastq=" -1 "$INDIR"/"${fasta_array[$k]}".L.fastq -2 "$INDIR"/"${fasta_array[$k]}".R.fastq"
fastq=" -1 "$INDIR"/"${InfosCtg[1]}" -2 "$INDIR"/"${InfosCtg[2]}
fastq=" -1 "$INDIR"/"`echo $InfosCtg | cut -d';' -f2`" -2 "$INDIR"/"`echo $InfosCtg | cut -d';' -f3`
fi
echo -e "rapmap quasimap -t $PROCESSORS $ADDOPT -i $out/$toolidx $fastq | grep -v "@" | cut -f3 | \
awk -v reads=$reads -v refseqs=$refseqALL -AWKPART- > $fileout\n"
rapmap quasimap -t $PROCESSORS $ADDOPT -i $out/$toolidx $fastq | grep -v "@" | cut -f3 | \
awk -v reads=$reads -v refseqs=$refseqALL 'BEGIN{OFS="\t"; while ((getline sequ < refseqs) > 0) {split(sequ,a,"\t");ctg[a[1]] = 0; ctgsize[a[1]]= a[2];}; close(refseqs) } {ctg[$1]++}
END{
......@@ -216,6 +213,7 @@ echo
# splitting "All_transcript.all" file into files corresponding to samples
#for (( j=0; j <i; j++ ))
j=0
for ref in "${orders[@]}"
do
#ref=${fasta_array[$j]}
......@@ -256,6 +254,7 @@ echo
LC_ALL=C grep -F -w -m$nb -f $out/$ref.suspects $out/$ref.all >> $out/$ref".all_suspectonly"
mv $out/$ref".all" $out/$ref".all_quants" ; mv $out/$ref".all_suspectonly" $out/$ref".all"
sed -i 's/ /\t/g' $out/$ref".all"
j=$((j+1))
done
# http://www.inmotionhosting.com/support/website/ssh/speed-up-grep-searches-with-lc-all
......
......@@ -42,9 +42,9 @@ done
# regroup all samples
echo '' > $out/ALL_transcripts.fasta
echo '' > $out/ALL_transcripts.suspects
echo '' > $out/ALL_transcripts.fasta_suspects
touch $out/ALL_transcripts.fasta
touch $out/ALL_transcripts.suspects
touch $out/ALL_transcripts.fasta_suspects
for ref in "${orders[@]}"; do
cat $out/$ref.fasta_mod >> $out/ALL_transcripts.fasta
......
......@@ -42,9 +42,9 @@ done
# regroup all samples
echo '' > $out/ALL_transcripts.fasta
echo '' > $out/ALL_transcripts.suspects
echo '' > $out/ALL_transcripts.fasta_suspects
touch $out/ALL_transcripts.fasta
touch $out/ALL_transcripts.suspects
touch $out/ALL_transcripts.fasta_suspects
for ref in "${orders[@]}"; do
cat $out/$ref.fasta_mod >> $out/ALL_transcripts.fasta
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment