text: user10296: HG38 human reference is the collection of reference from all 22 chromosomes,x,y chromosomes, and some others. I was targeting to split the reference file into 22 chromosomes fasta files. I am following this link https://crashcourse.housegordon.org/split-fasta-files.html to split the fasta files.More specifically I want to split the fasta file into all possible (placed,unlocalized and unplaced) sequence and the merge placed and localized sequences.
  However, I am unsure where to put the HLA part of the reference. Should I put it in Chromosome 6? Also, should I dump the unknown chromosomes as I am specifically interested in chromosomes 1-22?
  Any suggestion on splitting the fasta file into 22 chromosomes would be nice.
  
  user10775: The HLA region is already a part of chromosome 6. When you split the file, it will just be included with the rest of the chromosome. Whether or not you include the remaining contigs depends on your specific objectives. Inclusion of the unplaced and unlocalized scaffolds usually helps to reduce mapping errors, for example. To split/extract only chr1-22 from the UCSC hg38.fa.gz, we can just use awk. With the following in a file called script.awk:
  BEGIN {
      for(i=1;i<=22;i++) {
          arr["chr" i]
      }
  }
  
  /^>/ {
      f=substr($0,2)
  }
  
  f in arr {
      print > f ".fa"
  }
  
  Run using:
  awk -f script.awk <(zcat hg38.fa.gz)
  
  
original_text: 10296: <p>HG38 human reference is the collection of reference from all 22 chromosomes,x,y chromosomes, and some others. I was targeting to split the reference file into 22 chromosomes fasta files. I am following this link <a href="https://crashcourse.housegordon.org/split-fasta-files.html" rel="nofollow noreferrer">https://crashcourse.housegordon.org/split-fasta-files.html</a> to split the fasta files.More specifically I want to split the fasta file into all possible (placed,unlocalized and unplaced) sequence and the merge placed and localized sequences.
  However, I am unsure where to put the HLA part of the reference. Should I put it in Chromosome 6? Also, should I dump the unknown chromosomes as I am specifically interested in chromosomes 1-22?</p>
  <p>Any suggestion on splitting the fasta file into 22 chromosomes would be nice.</p>
   10775: <p>The HLA region is already a part of chromosome 6. When you split the file, it will just be included with the rest of the chromosome. Whether or not you include the remaining contigs depends on your specific objectives. Inclusion of the unplaced and unlocalized scaffolds usually helps to reduce mapping errors, for example. To split/extract <strong>only</strong> chr1-22 from the UCSC <a href="http://hgdownload.cse.ucsc.edu/goldenPath/hg38/bigZips/hg38.fa.gz" rel="nofollow noreferrer">hg38.fa.gz</a>, we can just use <a href="/questions/tagged/awk" class="post-tag" title="show questions tagged &#39;awk&#39;" aria-label="show questions tagged &#39;awk&#39;" rel="tag" aria-labelledby="awk-container">awk</a>. With the following in a file called <code>script.awk</code>:</p>
  <pre><code>BEGIN {
      for(i=1;i&lt;=22;i++) {
          arr[&quot;chr&quot; i]
      }
  }
  
  /^&gt;/ {
      f=substr($0,2)
  }
  
  f in arr {
      print &gt; f &quot;.fa&quot;
  }
  </code></pre>
  <p>Run using:</p>
  <pre><code>awk -f script.awk &lt;(zcat hg38.fa.gz)
  </code></pre>
  