text: user1770: I have the GATK FASTA reference for hg19. I would like to subset this based on the first chromosome. Normally what I do is open the FASTA as a text file, and then delete all other chromosomes except chromosome 1. 
  That's awful. 
  Picard tools has an option. But this doesn't appear to subset only by chromosome. How could this be done efficiently? 
  
  user77: It sounds like you want samtools faidx foo.fa followed by samtools faidx foo.fa chr1 > your_subset_file.fa (or whatever the first chromosome is). The output file is then a regular fasta file subset as you like. You can get any chromosome you want with that. In fact, you can also do regions (e.g., chr1:100-1000, though note that the sequence name in the resulting fasta output will be chr1:100-1000, which may break some downstream tools).
  
original_text: 1770: <p>I have the GATK FASTA reference for hg19. I would like to subset this based on the first chromosome. Normally what I do is open the FASTA as a text file, and then delete all other chromosomes except chromosome 1. </p>
  
  <p>That's awful. </p>
  
  <p>Picard tools has an <a href="https://software.broadinstitute.org/gatk/documentation/tooldocs/3.8-0/org_broadinstitute_gatk_tools_walkers_fasta_FastaReferenceMaker.php" rel="nofollow noreferrer">option</a>. But this doesn't appear to subset only by chromosome. How could this be done efficiently? </p>
   77: <p>It sounds like you want <code>samtools faidx foo.fa</code> followed by <code>samtools faidx foo.fa chr1 &gt; your_subset_file.fa</code> (or whatever the first chromosome is). The output file is then a regular fasta file subset as you like. You can get any chromosome you want with that. In fact, you can also do regions (e.g., <code>chr1:100-1000</code>, though note that the sequence name in the resulting fasta output will be <code>chr1:100-1000</code>, which may break some downstream tools).</p>
  