Answers.Body: <p><code>Read10X()</code> works on <code>mtx</code> files, that is not the root of your problem. The problem is that you are pushing non-10x-data to look and work like 10x-data.</p>
  
  <p>You can just use <code>CreateSeuratObject()</code> and feed your count matrix to this function. I am not sure if this particular function accepts <code>mtx</code> files, could not find this in the documentation, but in the worst case you will just need to supply a plain count matrix, count matrix being genes as rows and cells as columns.</p>
  
  <p>And that could be a good idea to show the first few rows and columns of your <code>SPLIT-Seq</code> output so that we can have and idea.</p>
  
  <p>Regarding gene identifiers, I would stick with gene symbols, to help you in cluster annotation but also using the "MT" prefix for mitochondrial genes for example.</p>
  
  <p>It looks like you are providing somewhat obscure identifiers as gene identifiers, a mix of genome build, ensemble gene id and gene symbol and apparently <code>Seurat</code> does not appreciate the <code>,</code>. While I cannot give you a definitive recipe on what can and cannot be set as gene identifiers when using Seurat, I can tell that I have worked both with gene symbols and Ensembl identifiers, separately, and both was fine with Seurat. </p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-04-22T11:18:59.380Z
Answers.Text: Yes, I converted my data to tsv where rows are genes and columns are cells. Setting aside my concerns about cell column names, don’t the row names have to be unique, especially when the genes are a collection from 2 species? I also noted that the hg38 Ensembl gene symbols already have MT- in them, but mm10 doesn’t, so I would have to address that.
Answers.UserDisplayName: hepcat72
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-04-22T11:24:35.390Z
Answers.Text: In theory the human and mouse gene symbols would not be the same for the "same" (actually orthologous genes); human gene symbols would be all uppercase and those of mouse would start with an uppercase letter followed by lowercase. Anyway, you can alter gene names anyway you like, doing that before reading the data into Seurat would be the "safest" I believe.
Answers.UserDisplayName: haci
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-04-22T11:25:15.507Z
Answers.Text: And yes, I’m feeding CreateSeuratObject the dge_data I described above.
Answers.UserDisplayName: hepcat72
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-04-22T11:37:18.423Z
Answers.Text: I also did end up modifying the column names (the cell barcode IDs) to replace the underscore with a dash. When I do that and call CellsByIdentities, it returns a single list of 7 cell barcodes instead of 3 pairs and 1 single barcode, so it seems like not having underscores in those column names is critical? I tried to address all of the row/column name issues I encountered and after doing so, the plots all look much better. For example, the violin plots now all have curvy brown columns that weren’t there before I changed the row/col names for commas and underscores.
Answers.UserDisplayName: hepcat72
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-04-22T11:40:45.560Z
Answers.Text: I have edited my answer, basically I would not have commas in my gene identifiers. Secondly, I have underscores in my cell names and Seurat is fine with it, in fact I believe it was one of the Seurat functions appending underscores to cell names while merging data.
Answers.UserDisplayName: haci
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-04-22T11:44:06.743Z
Answers.Text: Thanks so much for your help. I will add a sample of the data to the question in a bit.
Answers.UserDisplayName: hepcat72
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-04-22T13:11:53.960Z
Answers.Text: OK, I updated the question to add the requested sample.  Note, the core facility requested the cell barcodes to be used as the column names. Also, WRT hg38's and mm10's gene symbols' uniqueness... My background is more prokaryotic. Gene symbols in that realm are definitely not unique and my tentative understanding was that symbols for eukaryotes were not unique either, particularly when it comes to paralogues. However, I suspect that only unique mappings make it through the process, which mitigates uniqueness issues, but may not eliminate it totally. Does Seurat group by common gene name?
Answers.UserDisplayName: hepcat72
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-04-22T13:20:27.217Z
Answers.Text: With the recent additions to your question, now it looks like it would be the best to address to the Seurat developers. They are quite active on GitHub.
Answers.UserDisplayName: haci
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-04-22T13:28:35.903Z
Answers.Text: Thanks. Yes, I posted a couple days ago (https://github.com/satijalab/seurat/issues/2887).  I guess I am just anxious to hear back. Your feedback has been valuable though because I wasn't sure whether I was doing something wrong or not. And it sounds like I am doing things roughly correctly and that these issues may not necessarily be due to me doing something wrong (though I'm still not entirely sure).
Answers.UserDisplayName: hepcat72
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-04-22T07:06:36.160Z
Answers.LastActivityDate: 2020-04-22T11:38:12.477Z
Answers.LastEditDate: 2020-04-22T11:38:12.477Z
Answers.UserDisplayName: haci
Body: <p>I'm trying to use Seurat for the first time and am learning about single-cell analysis for the first time, and I'm doing so with split-seq data. (Full disclosure: I'm also a lightweight when it comes to R.)</p>
  
  <p>When Read10X didn't work on the mtx and associated files output by the split-seq-pipeline no matter how much I tried to make it look exactly like a 10x dataset (based on numerous examples and descriptions), I tried converting my sparse market matrix format into a dense tsv format (see update below for a sample of the file) and I read it in using:</p>
  
  <pre><code>dge_data &lt;- as.matrix(read.table("DGE.tsv", sep="\t", header=TRUE))
  pbmc &lt;- CreateSeuratObject(counts = dge_data, min.cells = 3, min.features  = 200, project = "SPLITSEQ_TT", assay = "RNA")
  </code></pre>
  
  <p>I started following chapter 9 of the scRNA-Seq course I found <a href="https://scrnaseq-course.cog.sanger.ac.uk/website/seurat-chapter.html" rel="nofollow noreferrer">here</a>. I ran into some issues which I was able to resolve by tweaking my mtx to tsv conversion script, such as including the chromosome in the row names (so that the mitochondrial QC step would work), but I ran into some errors that I assume have to do with the format of the gene names/IDs and possibly some issues stemming from cell names/IDs (which I've thus far been able to work through I think).</p>
  
  <p>However, given errors like the following, and the fact that I can't seem to find specifications on these sorts of row/column name requirements (e.g. no commas and must include at least the "MT" chromosome name for QC steps using mitochondrial genes), I was wondering if I could be directed to somewhere where those specifications are laid bare. For the most part, the gene names have not been a problem, but I run afoul in this step (where it appears to complain about a comma):</p>
  
  <pre><code>&gt; FeatureScatter(object = pbmc, feature1 = "hg38-4,ENSG00000074966,TXK", feature2 = "PC_1")
  Error in parse(text = x) : &lt;text&gt;:1:7: unexpected ','
  1: hg38.4,
            ^
  </code></pre>
  
  <p>Also, when I look at how CellsByIdentities behaves (while I was working through other errors/warnings), I realized I'm not sure that the column names are being processed correctly due to the underscores (followed by a number (e.g. <code>_0</code>)), because my understanding is that the <code>_#</code> portion of the split-seq cell barcode indicates the first well barcode, which would be needed to uniquely identify the cells in the table. I had retrieved the cell barcode IDs from the cell_metadata.csv file output by split-seq. Should I modify these column names? Because I infer from this output from CellsByIdentities that it's only using the sequence portion of the cell barcodes to uniquely identify cells, which I don't think is correct:</p>
  
  <pre><code>&gt; CellsByIdentities(object=pbmc, cells=colnames(pbmc))
  $AAACATCGAAACATCG
  [1] "AAACATCGAAACATCG_0" "AAACATCGAAACATCG_1"
  
  $AAACATCGAACGTGAT
  [1] "AAACATCGAACGTGAT_0"
  
  $AACGTGATAAACATCG
  [1] "AACGTGATAAACATCG_0" "AACGTGATAAACATCG_1"
  
  $AACGTGATAACGTGAT
  
  [1] "AACGTGATAACGTGAT_0" "AACGTGATAACGTGAT_1"
  </code></pre>
  
  <p>The other assumptions have to do with data size. I was running a small set of test data, and I had to adjust some parameters. So I would like to know if there's a hard lower limit on the data. And do I need to restructure my data to separate counts of genes from different species (e.g. mouse &amp; human)? I.e. Should I create separate matrices that have only the human-identified cells and gene annotations to use it with Seurat?</p>
  
  <p>I can't seem to find these specifications, presumably because Seurat was designed exclusively around 10x data and that the tool wasn't tested on data from other sources.  Perhaps I'm worrying too much, but without knowing what may rely on column/row name format assumptions, I can't be sure my data is being analyzed properly.</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Here is the head of the tsv file I originally tried to load when I ran into various errors that I suspect were due to the formatting of the row and column names (note, there are only 7 cells total, and it's a small but real test dataset from our core facility):</p>
  
  <pre><code>AAACATCGAAACATCG_0  AAACATCGAAACATCG_1  AAACATCGAACGTGAT_0  AACGTGATAAACATCG_0  AACGTGATAAACATCG_1  AACGTGATAACGTGAT_0  AACGTGATAACGTGAT_1
  hg38_X,ENSG00000000003,TSPAN6   8   2   2   26  15  17  13
  hg38_X,ENSG00000000005,TNMD 0   0   0   0   0   2   0
  hg38_20,ENSG00000000419,DPM1    22  26  27  73  43  50  28
  hg38_1,ENSG00000000457,SCYL3    6   6   5   12  7   19  8
  hg38_1,ENSG00000000460,C1orf112 23  10  24  59  34  49  21
  hg38_1,ENSG00000000971,CFH  101 44  129 331 151 270 122
  hg38_6,ENSG00000001036,FUCA2    33  28  24  82  58  74  36
  hg38_6,ENSG00000001084,GCLC 30  16  14  72  27  54  42
  hg38_6,ENSG00000001167,NFYA 14  9   17  41  28  31  12
  </code></pre>
  
  <p>Yesterday, I did end up trying to change the column and row names to the following:</p>
  
  <pre><code>AAACATCGAAACATCG-0  AAACATCGAAACATCG-1  AAACATCGAACGTGAT-0  AACGTGATAAACATCG-0  AACGTGATAAACATCG-1  AACGTGATAACGTGAT-0  AACGTGATAACGTGAT-1
  hg38-X.ENSG00000000003.TSPAN6   8   2   2   26  15  17  13
  hg38-X.ENSG00000000005.TNMD 0   0   0   0   0   2   0
  hg38-20.ENSG00000000419.DPM1    22  26  27  73  43  50  28
  hg38-1.ENSG00000000457.SCYL3    6   6   5   12  7   19  8
  hg38-1.ENSG00000000460.C1orf112 23  10  24  59  34  49  21
  hg38-1.ENSG00000000971.CFH  101 44  129 331 151 270 122
  hg38-6.ENSG00000001036.FUCA2    33  28  24  82  58  74  36
  hg38-6.ENSG00000001084.GCLC 30  16  14  72  27  54  42
  hg38-6.ENSG00000001167.NFYA 14  9   17  41  28  31  12
  </code></pre>
  
  <p>And it seems to have fixed most of the issues.  The violin plots now have curvy brown swaths down the center that were not there before.  And in particular, when I run CellsByIdentities manually on the column names now, I get what looks correct (as opposed to what I pasted yesterday above (which appeared to group the 7 cells in 3 pairs and one individual):</p>
  
  <pre><code>CellsByIdentities(object = pbmc, cells = colnames(pbmc))
  $SPLITSEQ_TT
  [1] "AAACATCGAAACATCG.0" "AAACATCGAAACATCG.1" "AAACATCGAACGTGAT.0" "AACGTGATAAACATCG.0" "AACGTGATAAACATCG.1" "AACGTGATAACGTGAT.0"
  [7] "AACGTGATAACGTGAT.1"
  </code></pre>
  
  <p>I think that the remaining issues are likely due to the small data size.  For reference as to the data size, this is the first data line from the original mtx file:</p>
  
  <pre><code>7 38526 194539
  </code></pre>
  
  <p>Please note also that I'm not looking for how to get this particular dataset to work.  I am (as a member of the bioinformatics team that supports users of our core sequencing facility) trying to establish the requirements for the conversion script so that when we deliver SPLiT-Seq results, our output can be directly used with Seurat by the users without issues or need for further conversion.  So I specifically need to know what makes row or column names valid or invalid, as opposed to what to change WRT this specific dataset.  We may be supplied with annotations from various sources that may have different characters in the gene symbols, or accession numbers, or even chromosome names.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-09-04T21:04:56.907Z
Comments.Text: hepcat72 you have thanks @haci for their answer. Please do consider "accepting" the answer, because it appears close to what you are requesting and/or upvoting.
Comments.UserDisplayName: M__
Tags: <scrnaseq><seurat><splitseq>
Title: What column and row naming requirements exist with Seurat (context: when loading SPLiT-Seq data)
ThreadText: # What column and row naming requirements exist with Seurat (context: when loading SPLiT-Seq data)
  
  (Asked by: username_0 on 2020-04-21)
  
  I'm trying to use Seurat for the first time and am learning about single-cell analysis for the first time, and I'm doing so with split-seq data. (Full disclosure: I'm also a lightweight when it comes to R.)
  
  When Read10X didn't work on the mtx and associated files output by the split-seq-pipeline no matter how much I tried to make it look exactly like a 10x dataset (based on numerous examples and descriptions), I tried converting my sparse market matrix format into a dense tsv format (see update below for a sample of the file) and I read it in using:
  
  ```
  dge_data <- as.matrix(read.table("DGE.tsv", sep="\t", header=TRUE))
  pbmc <- CreateSeuratObject(counts = dge_data, min.cells = 3, min.features  = 200, project = "SPLITSEQ_TT", assay = "RNA")
  
  ```
  
  I started following chapter 9 of the scRNA-Seq course I found [here](https://scrnaseq-course.cog.sanger.ac.uk/website/seurat-chapter.html). I ran into some issues which I was able to resolve by tweaking my mtx to tsv conversion script, such as including the chromosome in the row names (so that the mitochondrial QC step would work), but I ran into some errors that I assume have to do with the format of the gene names/IDs and possibly some issues stemming from cell names/IDs (which I've thus far been able to work through I think).
  
  However, given errors like the following, and the fact that I can't seem to find specifications on these sorts of row/column name requirements (e.g. no commas and must include at least the "MT" chromosome name for QC steps using mitochondrial genes), I was wondering if I could be directed to somewhere where those specifications are laid bare. For the most part, the gene names have not been a problem, but I run afoul in this step (where it appears to complain about a comma):
  
  ```
  > FeatureScatter(object = pbmc, feature1 = "hg38-4,ENSG00000074966,TXK", feature2 = "PC_1")
  Error in parse(text = x) : <text>:1:7: unexpected ','
  1: hg38.4,
            ^
  
  ```
  
  Also, when I look at how CellsByIdentities behaves (while I was working through other errors/warnings), I realized I'm not sure that the column names are being processed correctly due to the underscores (followed by a number (e.g. `_0`)), because my understanding is that the `_#` portion of the split-seq cell barcode indicates the first well barcode, which would be needed to uniquely identify the cells in the table. I had retrieved the cell barcode IDs from the cell\_metadata.csv file output by split-seq. Should I modify these column names? Because I infer from this output from CellsByIdentities that it's only using the sequence portion of the cell barcodes to uniquely identify cells, which I don't think is correct:
  
  ```
  > CellsByIdentities(object=pbmc, cells=colnames(pbmc))
  $AAACATCGAAACATCG
  [1] "AAACATCGAAACATCG_0" "AAACATCGAAACATCG_1"
  
  $AAACATCGAACGTGAT
  [1] "AAACATCGAACGTGAT_0"
  
  $AACGTGATAAACATCG
  [1] "AACGTGATAAACATCG_0" "AACGTGATAAACATCG_1"
  
  $AACGTGATAACGTGAT
  
  [1] "AACGTGATAACGTGAT_0" "AACGTGATAACGTGAT_1"
  
  ```
  
  The other assumptions have to do with data size. I was running a small set of test data, and I had to adjust some parameters. So I would like to know if there's a hard lower limit on the data. And do I need to restructure my data to separate counts of genes from different species (e.g. mouse & human)? I.e. Should I create separate matrices that have only the human-identified cells and gene annotations to use it with Seurat?
  
  I can't seem to find these specifications, presumably because Seurat was designed exclusively around 10x data and that the tool wasn't tested on data from other sources. Perhaps I'm worrying too much, but without knowing what may rely on column/row name format assumptions, I can't be sure my data is being analyzed properly.
  
  **UPDATE**
  
  Here is the head of the tsv file I originally tried to load when I ran into various errors that I suspect were due to the formatting of the row and column names (note, there are only 7 cells total, and it's a small but real test dataset from our core facility):
  
  ```
  AAACATCGAAACATCG_0  AAACATCGAAACATCG_1  AAACATCGAACGTGAT_0  AACGTGATAAACATCG_0  AACGTGATAAACATCG_1  AACGTGATAACGTGAT_0  AACGTGATAACGTGAT_1
  hg38_X,ENSG00000000003,TSPAN6   8   2   2   26  15  17  13
  hg38_X,ENSG00000000005,TNMD 0   0   0   0   0   2   0
  hg38_20,ENSG00000000419,DPM1    22  26  27  73  43  50  28
  hg38_1,ENSG00000000457,SCYL3    6   6   5   12  7   19  8
  hg38_1,ENSG00000000460,C1orf112 23  10  24  59  34  49  21
  hg38_1,ENSG00000000971,CFH  101 44  129 331 151 270 122
  hg38_6,ENSG00000001036,FUCA2    33  28  24  82  58  74  36
  hg38_6,ENSG00000001084,GCLC 30  16  14  72  27  54  42
  hg38_6,ENSG00000001167,NFYA 14  9   17  41  28  31  12
  
  ```
  
  Yesterday, I did end up trying to change the column and row names to the following:
  
  ```
  AAACATCGAAACATCG-0  AAACATCGAAACATCG-1  AAACATCGAACGTGAT-0  AACGTGATAAACATCG-0  AACGTGATAAACATCG-1  AACGTGATAACGTGAT-0  AACGTGATAACGTGAT-1
  hg38-X.ENSG00000000003.TSPAN6   8   2   2   26  15  17  13
  hg38-X.ENSG00000000005.TNMD 0   0   0   0   0   2   0
  hg38-20.ENSG00000000419.DPM1    22  26  27  73  43  50  28
  hg38-1.ENSG00000000457.SCYL3    6   6   5   12  7   19  8
  hg38-1.ENSG00000000460.C1orf112 23  10  24  59  34  49  21
  hg38-1.ENSG00000000971.CFH  101 44  129 331 151 270 122
  hg38-6.ENSG00000001036.FUCA2    33  28  24  82  58  74  36
  hg38-6.ENSG00000001084.GCLC 30  16  14  72  27  54  42
  hg38-6.ENSG00000001167.NFYA 14  9   17  41  28  31  12
  
  ```
  
  And it seems to have fixed most of the issues. The violin plots now have curvy brown swaths down the center that were not there before. And in particular, when I run CellsByIdentities manually on the column names now, I get what looks correct (as opposed to what I pasted yesterday above (which appeared to group the 7 cells in 3 pairs and one individual):
  
  ```
  CellsByIdentities(object = pbmc, cells = colnames(pbmc))
  $SPLITSEQ_TT
  [1] "AAACATCGAAACATCG.0" "AAACATCGAAACATCG.1" "AAACATCGAACGTGAT.0" "AACGTGATAAACATCG.0" "AACGTGATAAACATCG.1" "AACGTGATAACGTGAT.0"
  [7] "AACGTGATAACGTGAT.1"
  
  ```
  
  I think that the remaining issues are likely due to the small data size. For reference as to the data size, this is the first data line from the original mtx file:
  
  ```
  7 38526 194539
  
  ```
  
  Please note also that I'm not looking for how to get this particular dataset to work. I am (as a member of the bioinformatics team that supports users of our core sequencing facility) trying to establish the requirements for the conversion script so that when we deliver SPLiT-Seq results, our output can be directly used with Seurat by the users without issues or need for further conversion. So I specifically need to know what makes row or column names valid or invalid, as opposed to what to change WRT this specific dataset. We may be supplied with annotations from various sources that may have different characters in the gene symbols, or accession numbers, or even chromosome names.
  
  **Tags:** scrnaseq, seurat, splitseq
  
  > **Comments:**
  > **username_1**: username_0 you have thanks @username_2 for their answer. Please do consider "accepting" the answer, because it appears close to what you are requesting and/or upvoting.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2020-04-22. Score: 1 | Accepted answer
  
  `Read10X()` works on `mtx` files, that is not the root of your problem. The problem is that you are pushing non-10x-data to look and work like 10x-data.
  
  You can just use `CreateSeuratObject()` and feed your count matrix to this function. I am not sure if this particular function accepts `mtx` files, could not find this in the documentation, but in the worst case you will just need to supply a plain count matrix, count matrix being genes as rows and cells as columns.
  
  And that could be a good idea to show the first few rows and columns of your `SPLIT-Seq` output so that we can have and idea.
  
  Regarding gene identifiers, I would stick with gene symbols, to help you in cluster annotation but also using the "MT" prefix for mitochondrial genes for example.
  
  It looks like you are providing somewhat obscure identifiers as gene identifiers, a mix of genome build, ensemble gene id and gene symbol and apparently `Seurat` does not appreciate the `,`. While I cannot give you a definitive recipe on what can and cannot be set as gene identifiers when using Seurat, I can tell that I have worked both with gene symbols and Ensembl identifiers, separately, and both was fine with Seurat.
  
  > **Comments:**
  > **username_0**: Yes, I converted my data to tsv where rows are genes and columns are cells. Setting aside my concerns about cell column names, don’t the row names have to be unique, especially when the genes are a collection from 2 species? I also noted that the hg38 Ensembl gene symbols already have MT- in them, but mm10 doesn’t, so I would have to address that.  
  > **username_2**: In theory the human and mouse gene symbols would not be the same for the "same" (actually orthologous genes); human gene symbols would be all uppercase and those of mouse would start with an uppercase letter followed by lowercase. Anyway, you can alter gene names anyway you like, doing that before reading the data into Seurat would be the "safest" I believe.  
  > **username_0**: And yes, I’m feeding CreateSeuratObject the dge_data I described above.  
  > **username_0**: I also did end up modifying the column names (the cell barcode IDs) to replace the underscore with a dash. When I do that and call CellsByIdentities, it returns a single list of 7 cell barcodes instead of 3 pairs and 1 single barcode, so it seems like not having underscores in those column names is critical? I tried to address all of the row/column name issues I encountered and after doing so, the plots all look much better. For example, the violin plots now all have curvy brown columns that weren’t there before I changed the row/col names for commas and underscores.  
  > **username_2**: I have edited my answer, basically I would not have commas in my gene identifiers. Secondly, I have underscores in my cell names and Seurat is fine with it, in fact I believe it was one of the Seurat functions appending underscores to cell names while merging data.  
  > **username_0**: Thanks so much for your help. I will add a sample of the data to the question in a bit.  
  > **username_0**: OK, I updated the question to add the requested sample.  Note, the core facility requested the cell barcodes to be used as the column names. Also, WRT hg38's and mm10's gene symbols' uniqueness... My background is more prokaryotic. Gene symbols in that realm are definitely not unique and my tentative understanding was that symbols for eukaryotes were not unique either, particularly when it comes to paralogues. However, I suspect that only unique mappings make it through the process, which mitigates uniqueness issues, but may not eliminate it totally. Does Seurat group by common gene name?  
  > **username_2**: With the recent additions to your question, now it looks like it would be the best to address to the Seurat developers. They are quite active on GitHub.  
  > **username_0**: Thanks. Yes, I posted a couple days ago (https://github.com/satijalab/seurat/issues/2887).  I guess I am just anxious to hear back. Your feedback has been valuable though because I wasn't sure whether I was doing something wrong or not. And it sounds like I am doing things roughly correctly and that these issues may not necessarily be due to me doing something wrong (though I'm still not entirely sure).  
  
  ---
  
  