Skip to content
Snippets Groups Projects
Commit e1b890e0 authored by Samuel Mondy's avatar Samuel Mondy
Browse files

Upload New File

parent 15ae464b
No related branches found
No related tags found
No related merge requests found
#!/bin/bash
module purge
#$1 pourcentage identité
#$2 pourcentage de la longueur
for i in */*_mapped_fusariose.sam
do name=$(basename $i .sam)
echo $name
awk '$0~"^@"' $i > $name\_filtered_CIGAR_$1\_id_$2\_length_paired.sam
#attention la sortie awk convertit les tab en espace, besoin d'un sed pour remplacer les espaces en tabulation
awk '$0!~"^@"' $i | awk '{if($6!="*"){print $0}}' | awk '{a=$6;gsub("M","_M;",a);gsub("I","_I;",a);gsub("D","_D;",a);gsub("S","_S;",a);print $0,a}' | awk -v name=$name id=$1 len=$2'{split($NF,tab3,";");tab2["M
"]=0;sum=0;for (i=1;i<=length(tab3);i++){split(tab3[i],tab,"_");sum=sum+tab[1];tab2[tab[2]]=tab2[tab[2]]+tab[1]};print tab2["M"]/sum >> name"_freq.txt";if(tab2["M"]/sum>id && sum > len){print $0}}' | awk '{$NF
="";print $0}' | awk '$2==99 || $2==147' |sed 's/ /\t/g'>> $name\_filtered_CIGAR_$1\_id_$2\_length_paired.sam
module load bioinfo/samtools-1.9
samtools view -S -b $name\_filtered_CIGAR_$1\_id_$2\_length_paired.sam > $name\_filtered_CIGAR_$1\_id_$2\_length_paired.bam
module unload bioinfo/samtools-1.9
module load bioinfo/bedtools-2.27.1
bamToFastq -i $name\_filtered_CIGAR_$1\_id_$2\_length_paired.bam -fq $name\_filtered_CIGAR_$1\_id_$2\_length_paired_R1.fq -fq2 $name\_filtered_CIGAR_$1\_id_$2\_length_paired_R2.fq
module unload bioinfo/bedtools-2.27.1
done
gzip *R1.fq *R2.fq
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment