Body: <p>I have some marmoset snRNA reads that I want to align with the reference transcriptome using cellranger. The primary assembly for marmoset is available here, which is broken down into 22 parts. However, <code>cellranger mkref</code> only accepts one <code>.fa</code> file to generate the transcriptome.</p>
  <p>I tried concatentaing all the extracted <code>.fa</code> files into one (After removing the first line which is a comment), but I get the following error while trying to make a reference transcriptome using cellranger:</p>
  <pre class="lang-bash prettyprint-override"><code>Creating new reference folder at /data/users/abhishek/ensembl/common_marmoset_ref/combined/common_marmoset
   ...done
   
   Writing genome FASTA file into reference folder...
   ...done
   
   Indexing genome FASTA file...
   Traceback (most recent call last):
     File &quot;/data/public-data/cellranger-6.1.1/bin/rna/mkref&quot;, line 137, in &lt;module&gt;
       main()
     File &quot;/data/public-data/cellranger-6.1.1/bin/rna/mkref&quot;, line 128, in main
       reference_builder.build_gex_reference()
     File &quot;/data/public-data/cellranger-6.1.1/lib/python/cellranger/reference.py&quot;, line 630, in build_gex_reference
       self.process_fasta()
     File &quot;/data/public-data/cellranger-6.1.1/lib/python/cellranger/reference.py&quot;, line 529, in process_fasta
       subprocess.check_call([&quot;samtools&quot;, &quot;faidx&quot;, self.fasta_path])
     File &quot;/data/public-data/cellranger-6.1.1/external/anaconda/lib/python3.8/subprocess.py&quot;, line 364, in check_call
       raise CalledProcessError(retcode, cmd)
   subprocess.CalledProcessError: Command '['samtools', 'faidx', '/data/users/abhishek/ensembl/common_marmoset_ref/combined/common_marmoset/fasta/genome.fa']' returned non-zero exit     status 1.
  </code></pre>
  <p>There are also files which contain only one or two characters. I suspect that these aren't being handled properly with the direct concatenation of all the files. Some examples are below:</p>
  <pre class="lang-bash prettyprint-override"><code>==&gt; Callithrix_jacchus.mCalJac1.pat.X.dna.primary_assembly.1.fa &lt;==
  CCCATTATCCCTGCTTCTGCTAATCTTTCAAAATCTCACCACCATAGTC
  
  ==&gt; Callithrix_jacchus.mCalJac1.pat.X.dna.primary_assembly.20.fa &lt;==
  TTTTT
  
  ==&gt; Callithrix_jacchus.mCalJac1.pat.X.dna.primary_assembly.21.fa &lt;==
  TT
  
  ==&gt; Callithrix_jacchus.mCalJac1.pat.X.dna.primary_assembly.22.fa &lt;==
  AAAATTGTTTCTTGTTT
  
  ==&gt; Callithrix_jacchus.mCalJac1.pat.X.dna.primary_assembly.2.fa &lt;==
  C
  
  ==&gt; Callithrix_jacchus.mCalJac1.pat.X.dna.primary_assembly.3.fa &lt;==
  TTAGGGTTAGGGTTAGGGTTAGGGTTAGGGTTAGGG
  </code></pre>
  <p>How do I combine all these <code>.fa</code> files to generate the reference transcriptome for downstream analysis?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-03-03T15:39:27.143Z
Comments.Text: When you say "After removing the first line which is a comment", do you mean you removed the lines which start with a `>`? Those are the headers and are required to have a valid fasta file. They contain the name or identifier of the contig/chromosome/transcript. They separate the contigs in the fasta if there are multiple and will be needed for alignment in order to know which contigs your reads mapped to.
Comments.UserDisplayName: DavyCats
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-03-03T21:04:03.243Z
Comments.Text: Why do not you run "samtools faidx" alone on the fasta file any see if you are getting any useful error message. Looks like your program is calling samtools for indexing. You can tell this from the last line of the error.
Comments.UserDisplayName: Supertech
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-03-03T21:06:29.343Z
Comments.Text: And your fasta file does not look correct.
Comments.UserDisplayName: Supertech
Tags: <transcriptome><reference-genome><ensembl><10x-genomics><cellranger>
Title: How to combine multiple .fasta files of primary assembly from Ensembl into one for sequence alignment?
ThreadText: # How to combine multiple .fasta files of primary assembly from Ensembl into one for sequence alignment?
  
  (Asked by: username_0 on 2022-03-03)
  
  I have some marmoset snRNA reads that I want to align with the reference transcriptome using cellranger. The primary assembly for marmoset is available here, which is broken down into 22 parts. However, `cellranger mkref` only accepts one `.fa` file to generate the transcriptome.
  
  I tried concatentaing all the extracted `.fa` files into one (After removing the first line which is a comment), but I get the following error while trying to make a reference transcriptome using cellranger:
  
  ```bash
  Creating new reference folder at /data/users/username_0/ensembl/common_marmoset_ref/combined/common_marmoset
   ...done
   
   Writing genome FASTA file into reference folder...
   ...done
   
   Indexing genome FASTA file...
   Traceback (most recent call last):
     File "/data/public-data/cellranger-6.1.1/bin/rna/mkref", line 137, in <module>
       main()
     File "/data/public-data/cellranger-6.1.1/bin/rna/mkref", line 128, in main
       reference_builder.build_gex_reference()
     File "/data/public-data/cellranger-6.1.1/lib/python/cellranger/reference.py", line 630, in build_gex_reference
       self.process_fasta()
     File "/data/public-data/cellranger-6.1.1/lib/python/cellranger/reference.py", line 529, in process_fasta
       subprocess.check_call(["samtools", "faidx", self.fasta_path])
     File "/data/public-data/cellranger-6.1.1/external/anaconda/lib/python3.8/subprocess.py", line 364, in check_call
       raise CalledProcessError(retcode, cmd)
   subprocess.CalledProcessError: Command '['samtools', 'faidx', '/data/users/username_0/ensembl/common_marmoset_ref/combined/common_marmoset/fasta/genome.fa']' returned non-zero exit     status 1.
  
  ```
  
  There are also files which contain only one or two characters. I suspect that these aren't being handled properly with the direct concatenation of all the files. Some examples are below:
  
  ```bash
  ==> Callithrix_jacchus.mCalJac1.pat.X.dna.primary_assembly.1.fa <==
  CCCATTATCCCTGCTTCTGCTAATCTTTCAAAATCTCACCACCATAGTC
  
  ==> Callithrix_jacchus.mCalJac1.pat.X.dna.primary_assembly.20.fa <==
  TTTTT
  
  ==> Callithrix_jacchus.mCalJac1.pat.X.dna.primary_assembly.21.fa <==
  TT
  
  ==> Callithrix_jacchus.mCalJac1.pat.X.dna.primary_assembly.22.fa <==
  AAAATTGTTTCTTGTTT
  
  ==> Callithrix_jacchus.mCalJac1.pat.X.dna.primary_assembly.2.fa <==
  C
  
  ==> Callithrix_jacchus.mCalJac1.pat.X.dna.primary_assembly.3.fa <==
  TTAGGGTTAGGGTTAGGGTTAGGGTTAGGGTTAGGG
  
  ```
  
  How do I combine all these `.fa` files to generate the reference transcriptome for downstream analysis?
  
  **Tags:** transcriptome, reference-genome, ensembl, 10x-genomics, cellranger
  
  > **Comments:**
  > **username_1**: When you say "After removing the first line which is a comment", do you mean you removed the lines which start with a `>`? Those are the headers and are required to have a valid fasta file. They contain the name or identifier of the contig/chromosome/transcript. They separate the contigs in the fasta if there are multiple and will be needed for alignment in order to know which contigs your reads mapped to.  
  > **username_2**: Why do not you run "samtools faidx" alone on the fasta file any see if you are getting any useful error message. Looks like your program is calling samtools for indexing. You can tell this from the last line of the error.  
  > **username_2**: And your fasta file does not look correct.  
  
  ---
  
  ## 0 answers
  
  