Running ANNOVAR table_annovar.pl. Error convert2annovar.pl: not found
0
0
Entering edit mode
15 months ago
vvs.hazia ▴ 10

Python code solution was sugested, but bash fixes are still very welcomed!

Hi, I am running ANNOVAR with following code:

perl $TABL_ANN_DIR $READS_INPUT_DIR/$folder/${name}_unfiltered.annovar.ann.avinput $DATASETS_DIR  --buildver $GENOME_VERSION --outfile ${name}.annovar.ann --remove --protocol $GENOME_SOURSE,$CLIMVAR_VERSION,$dbSNP,$COSMIC_COD,$COSMIC_NONCOD,$HGP --operation g,f,f,f,f,f  --nastring . --vcfinput  --thread $THREAD

The input file is .avinput, but anyway it starts not from table_annovar.pl, but convert2annovar.pl and can not find it

sh: 1: convert2annovar.pl: not found

Obviously, because I am working in another directory then where this file is. I copied this file to the working dir, but it didn`t help.

I know I can use annotate_variation.pl with the same purpose instead of table_annovar.pl, but I realy need the output file to be VCF and annotate_variation.pl dose not have this argument, as table_annovar.pl does (--vcfinput).

May be anybody can suggest a solution? Thanks!

ANNOVAR perl Annotation VCF • 1.6k views
ADD COMMENT
0
Entering edit mode

Does ANNOVAR output VCF file?

Also, you're giving .avinput file with --vcfinput parameter which doesn't seem right.

ADD REPLY
0
Entering edit mode

Thank you for your comment!

  1. Because of the error ANNOVAR does not output any file, but if to use annotate_variation.pl it outputs tab-deliminated anotated file.
  2. Hmm, you might be right. I also tried to run it with vcf file instead of avinput, but still error pops out.
ADD REPLY
0
Entering edit mode

but I realy need the output file to be VCF

Because of the error ANNOVAR does not output any file, but if to use annotate_variation.pl it outputs tab-deliminated anotated file.

I am just wondering if ANNOVAR has any option to output a VCF file? Because I haven't seen such option.

If you really need a VCF file you might need to look into another tool like Ensembl VEP.

Hmm, you might be right. I also tried to run it with vcf file instead of avinput, but still error pops out.

Error is probably because the script is not your path. Try adding the directory of annovar to your path.

ADD REPLY
0
Entering edit mode

As far as ANNOVAR documentation states, VCF output is available.

table_annovar.pl can directly support input and output of VCF files (the annotation will be written to the INFO field of the output VCF file). Let's try this: $ table_annovar.pl example/ex2.vcf humandb/ -buildver hg19 -out myanno -remove -protocol refGene,cytoBand,exac03,avsnp147,dbnsfp30a -operation g,r,f,f,f -nastring . -vcfinput -polish You can download the output file here: ex2.hg19_multianno.vcf.

We can read it on this page https://annovar.openbioinformatics.org/en/latest/user-guide/startup/

Error is probably because the script is not your path. Try adding the directory of annovar to your path.

You mean, to add ANNOVAR path to perl-script file? If yes, then it is there.

$TABL_ANN_DIR=$STORAGE_DIR/Tools/ANNOVAR/annovar/table_annovar.pl
ADD REPLY
0
Entering edit mode

You mean, to add ANNOVAR path to perl-script file? If yes, then it is there.

I mean the PATH variable. Which should be something like this

export PATH="$STORAGE_DIR/Tools/ANNOVAR/annovar/table_annovar.pl:$PATH"

You can add this to your shell config file.

As far as ANNOVAR documentation states, VCF output is available.

Since documentation says you can get VCF output if you input a VCF file. So instead of avinput maybe you should call table annovar with VCF file directly? This way you won't need any further intermediate processing.

ADD REPLY
0
Entering edit mode

export PATH="$STORAGE_DIR/Tools/ANNOVAR/annovar/table_annovar.pl:$PATH"

Thank you for your suggestion! I added to the PATH table_annovar.pl and convert2annovar.pl. Unfortunatly, fort now, error still exists (convert2annovar.pl: not found).

ADD REPLY
0
Entering edit mode

Oh, I made a mistake in previous reply. Could you try it like so?

export PATH="$STORAGE_DIR/Tools/ANNOVAR/annovar:$PATH"
ADD REPLY
0
Entering edit mode

Thank you for concerning. Unfortunately, it did not work out either.

ADD REPLY
0
Entering edit mode

To solve the problem I wrote a python code to transform tab-deliminated files from ANNOVAR output to vcf-like files.

First run ANNOVAR in filter mode in bash with command

perl $STORAGE_DIR/Tools/ANNOVAR/annovar/convert2annovar.pl  -includeinfo -allsample -withfreq -format vcf4 $sample >$READS_INPUT_DIR/$folder/${name}_unfiltered.annovar.ann.avinput

perl $STORAGE_DIR/Tools/ANNOVAR/annovar/annotate_variation.pl -filter -dbtype $COSMIC_NONCOD -buildver $GENOME_VERSION --outfile ${name}_unfiltered.annovar.ann.cosmic_noncoding $READS_INPUT_DIR/$folder/${name}_unfiltered.annovar.ann.avinput $DATASETS_DIR 

Then use python

def standart_db_annovar_file(filename, line="ch st  ed  ref alt qual    dot hz  CHROM   POS ID  REF ALT QUAL    FILTER  INFO    FORMAT  100"):
with open(filename, 'r+') as f:
    content = f.read()
    f.seek(0, 0)
    f.write(line.rstrip('\r\n') + '\n' + content)
tsvfile=pd.read_csv(filename, sep='\t')
tsvfile = tsvfile.iloc[: , 8:]
tsvfile.to_csv(filename+".vcf", sep="\t", index=None)
#delet first line
with open(filename+".vcf", 'r') as fin:
    data = fin.read().splitlines(True)
with open(filename+".vcf", 'w') as fout:
    fout.writelines(data[1:])
#vcf header
header="##fileformat=VCFv4.2\n#CHROM    POS ID  REF ALT QUAL    FILTER  INFO    FORMAT  100"
with open(filename+".vcf", 'r+') as f:
    content = f.read()
    f.seek(0, 0)
    f.write(header.rstrip('\r\n') + '\n' + content)

For example input:

test_tab.tx

chr10   101241643   101241643   -   C   0.5 .   1   chr10   101241643   .   G   GC  .   PASS    AS_FilterStatus=SITE;AS_SB_TABLE=0,0|0,0;DP=2;ECNT=2;GERMQ=29;MBQ=0,28;MFRL=0,158;MMQ=60,60;MPOS=6;POPAF=7.30;ROQ=93;TLOD=4.13  GT:AD:AF:DP:F1R2:F2R1:FAD:PGT:PID:PS:SB 0|1:0,1:0.683:1:0,0:0,1:0,1:0|1:101241643_G_GC:101241643:0,0,0,1

Code:

standart_db_annovar_file('test_tab.txt')

output:

test_tab.txt.vcf

##fileformat=VCFv4.2
#CHROM  POS ID  REF ALT QUAL    FILTER  INFO    FORMAT  100
chr10   101241643   .   G   GC  .   PASS    AS_FilterStatus=SITE;AS_SB_TABLE=0,0|0,0;DP=2;ECNT=2;GERMQ=29;MBQ=0,28;MFRL=0,158;MMQ=60,60;MPOS=6;POPAF=7.30;ROQ=93;TLOD=4.13  GT:AD:AF:DP:F1R2:F2R1:FAD:PGT:PID:PS:SB 0|1:0,1:0.683:1:0,0:0,1:0,1:0|1:101241643_G_GC:101241643:0,0,0,1

So now this file could be used with cyvcf2 module in python to analize VCF files.

ADD REPLY

Login before adding your answer.

Traffic: 2832 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6