Question: Renaming Bcftools lsec for multiple runs
0
gravatar for Seigfried
11 weeks ago by
Seigfried70
Seigfried70 wrote:

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?

isec bcftools • 110 views
ADD COMMENTlink modified 11 weeks ago by genomax91k • written 11 weeks ago by Seigfried70

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 REPLYlink written 11 weeks ago by Seigfried70

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 REPLYlink modified 11 weeks ago • written 11 weeks ago by genomax91k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 2271 users visited in the last hour