Body: <p>I have a vcf file like below</p>
  <pre><code>#CHROM  POS ID  REF ALT QUAL    FILTER  INFO    FORMAT  2072184
  chr1    10109   .   AACCCT  A   21.51   PASS    AC=2;AF=1.000;AN=2;DP=10;FS=8.451;MQ=13.01;MQRankSum=0.000;QD=2.15;ReadPosRankSum=-1.300;SOR=3.236;FractionInformativeReads=0.700;R2_5P_bias=0.000  GT:AD:AF:DP:F1R2:F2R1:GQ:PL:GP:PRI:SB:MB    ./.:3,4:0.571:7:1,1:2,3:6:30,8,0:2.1511e+01,5.8560e+00,1.3473e+00:0.00,7.00,10.01:1,2,4,0:3,0,1,3
  chr1    10230   .   AC  A   29.28   PASS    AC=1;AF=0.500;AN=2;DP=21;FS=12.601;MQ=20.22;MQRankSum=-0.715;QD=1.39;ReadPosRankSum=1.109;SOR=4.407;FractionInformativeReads=0.667;R2_5P_bias=-3.357    GT:AD:AF:DP:F1R2:F2R1:GQ:PL:GP:PRI:SB:MB    0/1:6,8:0.571:14:1,4:5,4:22:59,0,19:2.9283e+01,2.9815e-02,2.2470e+01:0.00,30.00,33.01:3,3,0,8:2,4,4,4
  </code></pre>
  <p>I am going to subset this VCF by the coordinates given in a bed file using tabix</p>
  <p>This is how my bed file looks</p>
  <pre><code>chr7    127471196  127472363
  chr7    127472363  127473530
  chr7    127473530  127474697
  chr7    127474697  127475864
  </code></pre>
  <p>This is my command</p>
  <pre><code>tabix -h filevcf.gz -R XXX.bed &gt; file.vcf.gz_extracted.vcf.gz
  </code></pre>
  <p>But output file is empty after headers I can not find variants in the output</p>
  <p>I look at output by <code>bcftools view -H file.vcf.gz_extracted.vcf.gz &gt; output.txt</code> which is totally empty</p>
  <p>Where I am making a mistake here?</p>
  <p>I got results when I used some of positions in input vcf</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2024-02-05T02:46:11.743Z
Comments.Text: Do you have a typo in the name of the file? it should be `file.vcf.gz` (it's missing a period).
Comments.UserDisplayName: Yossi Farjoun
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2024-02-05T02:46:22.427Z
Comments.Text: Also: is the file block-gzipped and indexed? (you can check that it's block gzipped by running "file" on it....if the results is "Blocked GNU Zip Format (BGZF; gzip compatible)" )
Comments.UserDisplayName: Yossi Farjoun
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2024-02-05T02:49:23.373Z
Comments.Text: Could you clarify what you mean by: "got results when I used some of positions in input vcf"? used how?
Comments.UserDisplayName: Yossi Farjoun
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2024-02-13T11:36:56.037Z
Comments.Text: From what you show us here, we see a vcf that lacks headers and a bed that describes positions not present in the vcf. So empty results are expected. Please show us an example that you expect to produce output and then we can actually test.
Comments.UserDisplayName: terdon
Tags: <vcf><bash><bed><wgs><tabix>
Title: tabix to subset each VCF by the coordinates given
ThreadText: # tabix to subset each VCF by the coordinates given
  
  (Asked by: username_0 on 2024-02-02)
  
  I have a vcf file like below
  
  ```
  #CHROM  POS ID  REF ALT QUAL    FILTER  INFO    FORMAT  2072184
  chr1    10109   .   AACCCT  A   21.51   PASS    AC=2;AF=1.000;AN=2;DP=10;FS=8.451;MQ=13.01;MQRankSum=0.000;QD=2.15;ReadPosRankSum=-1.300;SOR=3.236;FractionInformativeReads=0.700;R2_5P_bias=0.000  GT:AD:AF:DP:F1R2:F2R1:GQ:PL:GP:PRI:SB:MB    ./.:3,4:0.571:7:1,1:2,3:6:30,8,0:2.1511e+01,5.8560e+00,1.3473e+00:0.00,7.00,10.01:1,2,4,0:3,0,1,3
  chr1    10230   .   AC  A   29.28   PASS    AC=1;AF=0.500;AN=2;DP=21;FS=12.601;MQ=20.22;MQRankSum=-0.715;QD=1.39;ReadPosRankSum=1.109;SOR=4.407;FractionInformativeReads=0.667;R2_5P_bias=-3.357    GT:AD:AF:DP:F1R2:F2R1:GQ:PL:GP:PRI:SB:MB    0/1:6,8:0.571:14:1,4:5,4:22:59,0,19:2.9283e+01,2.9815e-02,2.2470e+01:0.00,30.00,33.01:3,3,0,8:2,4,4,4
  
  ```
  
  I am going to subset this VCF by the coordinates given in a bed file using tabix
  
  This is how my bed file looks
  
  ```
  chr7    127471196  127472363
  chr7    127472363  127473530
  chr7    127473530  127474697
  chr7    127474697  127475864
  
  ```
  
  This is my command
  
  ```
  tabix -h filevcf.gz -R XXX.bed > file.vcf.gz_extracted.vcf.gz
  
  ```
  
  But output file is empty after headers I can not find variants in the output
  
  I look at output by `bcftools view -H file.vcf.gz_extracted.vcf.gz > output.txt` which is totally empty
  
  Where I am making a mistake here?
  
  I got results when I used some of positions in input vcf
  
  **Tags:** vcf, bash, bed, wgs, tabix
  
  > **Comments:**
  > **username_1**: Do you have a typo in the name of the file? it should be `file.vcf.gz` (it's missing a period).  
  > **username_1**: Also: is the file block-gzipped and indexed? (you can check that it's block gzipped by running "file" on it....if the results is "Blocked GNU Zip Format (BGZF; gzip compatible)" )  
  > **username_1**: Could you clarify what you mean by: "got results when I used some of positions in input vcf"? used how?  
  > **username_2**: From what you show us here, we see a vcf that lacks headers and a bed that describes positions not present in the vcf. So empty results are expected. Please show us an example that you expect to produce output and then we can actually test.  
  
  ---
  
  ## 0 answers
  
  