Commit fcbc40b9 authored by mcariou's avatar mcariou
Browse files

update

parent 20261d22
#!/bin/bash
echo "USAGE: ./4_parse_blast.sh \$1=blast_out \$2=modified_blast"
echo "USAGE: ./4_parse_blast.sh \$1=blast_out \$2=modified_blast \$3=fasta_path \$4=fasta_name \$5=seuil_evalue \$6=maxseqpertax"
echo "--------------------------------------------------"
##################################################################################################################
### En local
#./4_parse_blast.sh ~/Documents/CIRI_BIBS_projects/2021_04_Doublet/pipeline/out_blastn/lp0952.blastn
#./4_parse_blast.sh ~/Documents/CIRI_BIBS_projects/2021_04_Doublet/pipeline/out_blastn/lp0952.blastn \
#~/Documents/CIRI_BIBS_projects/2021_04_Doublet/pipeline/out_blastn/lp0952_sp.blastn \
#~/Documents/CIRI_BIBS_projects/2021_04_Doublet/pipeline/fasta/ lp0952_ortho
#0.0001 5
#./4_parse_blast.sh ~/Documents/CIRI_BIBS_projects/2021_04_Doublet/pipeline/out_blastn/lp0952.blastn ~/Documents/CIRI_BIBS_projects/2021_04_Doublet/pipeline/out_blastn/lp0952_sp.blastn ~/Documents/CIRI_BIBS_projects/2021_04_Doublet/pipeline/fasta/ lp0952_ortho 0.0001 5
### PSMN
#./
......@@ -14,62 +18,38 @@ echo "--------------------------------------------------"
# variable
OUT_BLAST=$1
MOD_BLAST=$2
FASTA=$3/$4.fasta
EVAL=$5
NPERTAX=$6
## get species name
listid=`grep -v "#" $OUT_BLAST | awk '{print $3}' | awk -F[\.] '{print $1}'`
#listid=`grep -v "#" $OUT_BLAST | awk '{print $3}' | awk -F[\.] '{print $1}'`
for id in $listid
grep -v "#" $OUT_BLAST > $OUT_BLAST.tmp
echo "nombre de lignes:"
nrow=`wc -l $OUT_BLAST.tmp | awk '{print $1}'`
echo $nrow
echo "debut de la boucle:"
for id in `seq $nrow`
do
echo $id
efetch -db nuccore -id $id -format docsum | xtract -pattern DocumentSummary -element Organism >> tmp.txt
line=`sed -n ${id}p $OUT_BLAST.tmp`
idncbi=`sed -n ${id}p $OUT_BLAST.tmp | awk '{print $3}' | awk -F[\.] '{print $1}'` #### erreur sur cette ligne, il faut selectionne la ligne $id
tax=`efetch -db nuccore -id $idncbi -format docsum | xtract -pattern DocumentSummary -element Organism`
echo $line " " $tax >> $MOD_BLAST
done
wc -l $OUT_BLAST
wc -l $MOD_BLAST
rm $OUT_BLAST.tmp
######################################################################################
## TAB with seq names / file names / species / file size
#TAB=`ls -lh $NCBI/*.fna | awk '{print $5 " " $9}' | cut -f 1,10 -d "/" | sed 's/.fna//g' | sed 's/\///g' | head`
#TAB=`ls -lh $NCBI/*.fna | awk '{print $9}' | cut -f 10 -d "/" | sed 's/.fna//g' | sed 's/\///g'`
#OUTFILE=$OUT"/tab_ncbi_contigs.csv"
#for file in $TAB
#do
#echo $file
#SIZE=`ls -lh $NCBI/${file}.fna | awk '{print $5 ";" $9}' | cut -f 1,10 -d "/" | sed 's/.fna//g' | sed 's/\///g'`
#echo $SIZE
#done
## Script R to parse sequence name and extract species name and compare with blast output (BLAST output will be an argument) the output will give
## output 1 size for each genomes/ species how many genome how many complete genomes per species
## for each species how many hit bast from which genomes
#echo "Parse all sequences from all genomes"
#OUTPARSED=$OUT"/tab_ncbi_contigs_parsed.csv"
#Rscript --vanilla explore_genomes_general.R $OUTFILE $OUTPARSED > $OUT"/explore_genomes_general.Rout"
#echo "compare Blastn results VS genomes"
#BLASTN_COMR=$DATA"/get_alignment/ComR_sup480.blastn"
#BLASTN_ROCC=$DATA"/get_alignment/RocC_sup680.blastn"
#OUTFILE2=$OUT"/tab_ncbi_file.csv"
#Rscript --vanilla genomesVblast.R $BLASTN_COMR $BLASTN_ROCC $OUTPARSED $OUTFILE2 > $OUT"/genomesVblast1.Rout"
#Rscript --vanilla 4_paste_blast.R $MOD_BLAST $FASTA $EVAL $NPERTAX > $3/paste_blast.Rout
......
LR134332
Legionella pneumophila
UGOJ01000002
Legionella pneumophila
UGOV01000002
Legionella pneumophila
UGOU01000002
Legionella pneumophila
LT632616
Legionella pneumophila
LR134332 Legionella pneumophila
UGOJ01000002 Legionella pneumophila
UGOV01000002 Legionella pneumophila
UGOU01000002 Legionella pneumophila
LT632616 Legionella pneumophila
Supports Markdown
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