This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Annotation of vcftools fst output using GTF or GFF

hi everyone

I have an outputted file from vcftools for fst calculation in the following format

CHROM   BIN_START   BIN_END N_VARIANTS  WEIGHTED_FST    MEAN_FST
ch1 1   40000   75  0.0516003   0.0355082
ch1 20001   60000   22  -0.00980986 -0.0205035
ch1 40001   80000   46  0.0180676   0.0236424
ch1 60001   100000  72  0.0273771   0.0317944

how can I annotate this file using GTF or GFF file? My goal is to identify possible overlapping genes with detected windows.

Thanks in advance for your help

fst vcftools annotation gtf

1 answer

convert GTF to bed

awk -F '\t' '($3=="gene") {printf("%s\t%d\t%s\t%s\n",$1,int($4)-1,$5,$9);}' in.gtf

sort both files on chrom and position and then use bedtools intersect

Thank you very much;

based on your recombination I followed:

awk -F '\t' '($3=="gene") {printf("%s\t%d\t%s\t%s\n",$1,int($4)-1,$5,$9);}' in.gtf > GTF.bed

then

awk '{$4=$5=$6=""; print $0}' vcftools_output.fst > Fst_Windows.bed

bedtools intersect -a GTF.bed -b Fst_Windows.bed > annotated_windows

Is my method correct?

Before using the bedtools intersect, I used the bedtools sort fo sorting the files

Log in to answer this question.