snippy icon indicating copy to clipboard operation
snippy copied to clipboard

Super new to Snippy: How to change the output file instead of the default snps.XXX?

Open Gracengan327 opened this issue 2 years ago • 1 comments

Hello, I am super new to the world of code/script etc. I am doing Covid-19 phylogenetic work. I used snippy-multi to generate indel profile before confirming using IGV and editing them in Jalview

snippy-multi input.tab --ref ref.fasta --cpus 16 > runme.sh less runme.sh sh ./runme.sh

I have 2 questions:

  1. The output file is all named as snps.XXX by default and I would like to name them according to my sample ( which is the directory name by default).
  2. Once the name has been changed, how could I concatenate all of the .consensus.fa into one multifasta file. Thank you for your help!

Gracengan327 avatar Sep 10 '21 10:09 Gracengan327

for your first question : imagine that your output dir has the name workdir:

for file in $(find workdir -type f -name "snps.*");\
do name=$(echo $file | cut -d"/" -f 2); mv "$file" "`dirname $file`/${name}.${file##*.}";done

for the second one:

for file in $(find workdir -type f -name "*consensus.fa");`\
do cut $file >> all.consensus.fa;done

SolayMane avatar Jan 20 '22 12:01 SolayMane