This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Gene based data extraction from finally annotated VCF file

Hi there, I have annotated .vcf and .txt file as a result of variant calling pipeline for whole exome sequencing. Now I want to extract almost 50 genes data from these files, either .vcf or .txt.

I used grep command with for loop but it is also extracting the other genes data as well. For example if I want to see only CCL2, grep command is extracting CCL20, CCL28 and so on as well.

i used the following command:

for GENE in `cat Genelist`;
do
grep -i  "${GENE}"  /Final_annotated_files/1st-Priority/file_name.txt > /Final_annotated_files/1st-Priority/file_output-${GENE}.csv
done

If I used -x instead of -i, loop don't work.

Please help me with the any command which I can used in loops because I have many samples and from each sample I need to extract almost 100 gene's data.

Thanks

vcf filtration annotation

1 answer

grep -F -w '${GENE}' in.txt

I tried this, but again its now writing any information in the file.

show us such line+keyword.

Also, check there is no empty line in your Genelist.

for GENE in cat Genelist; #to get the name from gene list do grep -i "${GENE}" input_file_name.txt > file_output-${GENE}.csv # checking the .txt file for the gene name and extracting data into new file done

Log in to answer this question.