0
$\begingroup$

I am annotating some .txt files by Annovar software by this code

nnovar]$ module load annovar/2016Feb01

[cyan01 annovar]$ table_annovar.pl 

But I really got confused to do that by awk for all of my files in the path; Can somebody help me?

Many thanks

EDITED

I found this but not working

module load annovar/20

for file in *.vcf; do
    table_annovar.pl example/a.txt humandb/ -buildver hg19 -out file -remove -protocol refGene,cytoBand,exac03,avsnp147,dbnsfp30a -operation gx,r,f,f,f "$f" > "${f%.*}.txt"
done;
$\endgroup$
  • $\begingroup$ What do you mean by "not working"? What is the error message you are getting? $\endgroup$ – haci Nov 19 '19 at 11:58
4
$\begingroup$

$f in your command is not pointing anywhere since your for loop was defined as for file in *.vcf;. You should use $file instead of $f.

EDIT AS THE OP HAS EDITED THE QUESTION:

First of all, please copy and paste the error messages you are getting when seeking answers from the community, most of the time the error messages are clear enough to point to the right direction.

In you case, the problem is that you are trying to use a variable that you did not declare in the first place. It is explained above in my original answer but here I go again:

With this bit for file in *.vcf;, you are creating a variable file that you will using throughout the iteration. But then within the iteration, the next line (... -operation gx,r,f,f,f "$f" > ..., you try to use another variable file, that has not been declared yet (as far as I can see from your code bit).

| improve this answer | |
$\endgroup$
1
$\begingroup$

The basic outline for loops is

for sample in *; do mycommand "$sample" ; done

You might need some way of incorporating the name of $sample into the output file name, so you don't keep overwriting the same output file over and over again (or do mkdir with each sample name and write everything for each sample in its own folder).

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy