tseemann / abricate

:mag_right: :pill: Mass screening of contigs for antimicrobial and virulence genes
GNU General Public License v2.0
368 stars 92 forks source link

Multiple files at once #149

Open peflanag opened 4 years ago

peflanag commented 4 years ago

Hi,

This is a question, can someone explain to me how to run multiple aligned.fasta files at once? And I want the data all outputted into one .csv file rater than running one at a time and copying and pasting into one table. I dont understand the --fofn or abricate assembly.* options

If it helps all my aligned fasta files are in on folder. Normally I run looping scripts like below that I am sure are basic for running spades and snippy etc. But the output is individual files. For this I want them merged into one if its possible!

Cheers,

P

Loop script;

!/bin/sh

sampleLoc=/Path/to/input sampleName=("446823" "452596" "452603" "482688" "482709" "483949" "483950" "483950_2" "500433" "M19_1191" "M19_443136" "M19_443692" "M19_481346" "M19_482945" "M19_510161" "M19_510166" "M19_510167" "M19_516538" "M20_0013" "M20_1943593" "M20_2091356rpt" "M20_2110133" "M19_500433" "M19_500860") outputLoc=/Path/to/output

for sample in ${sampleName[*]}

do

spades.py -1 $sampleLoc/${sample}_R1.fq.gz -2 $sampleLoc/${sample}_R2.fq.gz -o $outputLoc/${sample}

done

fmaguire commented 4 years ago

--fofn lets you provide a list of input filepaths for abricate (see test/fofn.txt to see an example for running abricate on all the gbk and assembly files in the test folder)

You can also just provide a list of files directly to abricate on the command-line e.g. abricate file1 file2 file3 > output.tsv see https://tldp.org/LDP/abs/html/globbingref.html for an explanation of using * in the shell (aka globbing).

Finally, you could run it using an bash loop if you prefer (using the --noheader flag to not create a file with repeated column names, and >> will append to a file not overwrite it in bash):

for file in {file1, file2, file3}; do abricate $file --noheader >> output.tsv; done