Answers.Body: <p><code>bcftools</code> has the <code>view</code> command which can do this. Create a text file (<code>samples</code>) which has the names of the samples you want, one per line, and then:</p>
  
  <pre><code>bcftools view -S samples merged.vcf.gz &gt; new.vcf
  </code></pre>
  
  <p>Or, if you're running a shell that supports it, you can use input redirection for a single sample name:</p>
  
  <pre><code>bcftools view -S &lt;(echo "sample name") merged.vcf.gz &gt; new.vcf
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-11-29T12:37:15.610Z
Answers.LastActivityDate: 2019-11-29T12:37:15.610Z
Answers.UserDisplayName: terdon
Body: <p>How can one do the reverse of bcftools merge?
  To get one sample back out of the merged one.
  Without holding reference sites.</p>
  
Tags: <bcftools>
Title: How to do the reverse of bcf merge?
ThreadText: # How to do the reverse of bcf merge?
  
  (Asked by: username_0 on 2019-11-29)
  
  How can one do the reverse of bcftools merge?
  To get one sample back out of the merged one.
  Without holding reference sites.
  
  **Tags:** bcftools
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2019-11-29. Score: 1 | Accepted answer
  
  `bcftools` has the `view` command which can do this. Create a text file (`samples`) which has the names of the samples you want, one per line, and then:
  
  ```
  bcftools view -S samples merged.vcf.gz > new.vcf
  
  ```
  
  Or, if you're running a shell that supports it, you can use input redirection for a single sample name:
  
  ```
  bcftools view -S <(echo "sample name") merged.vcf.gz > new.vcf
  
  ```
  
  
  ---
  
  