Renaming Bcftools lsec for multiple runs
0
0
Entering edit mode
4.3 years ago
Seigfried ▴ 80

Hello!

I have a reference file

x.vcf.gz

I also have multiple query files say

1y.vcf.gz

2y.vcf.gz

3y.vcf.gz

.... 603y.vcf.gz

I want to intersect the reference with each separate query file.

Since I have the query files all in one folder, I did

for i in *.vcf.gz; do bcftools isec $i /mnt/projects/x.vcf.gz -p $i -n =2 -w 1; done

This generated multiple folders called 1y.vcf.gz 2y.vcf.gz 3y.vcf.gz.

If I don't specify -p it will just overwrite the files.

Each of these folders contain files with the same name.

Is there any way to simply just rename the files with a prefix and not create multiple folders?

bcftools isec • 922 views
ADD COMMENT
0
Entering edit mode

Thank you @genomax for the edits. I need to specify there is an option -o $i.vcf. This gives me one of the output files and if i specify -p i get 3 outputs. Thank you.

ADD REPLY
0
Entering edit mode

Can you not create separate folders for each query and then send the output to that folder in your for loop? Following is NOT a solution just an idea for you to think about.

for i in *.vcf.gz; do name=$(basename ${i} .vcf.gz); mkdir ${name}; bcftools isec $i /mnt/projects/x.vcf.gz -o ${name}/{name}.vcf -p $i -n =2 -w 1; done
ADD REPLY

Login before adding your answer.

Traffic: 2718 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