Skip to content

Commit 647a9ed

Browse files
jkancheLTLA
andauthored
Support Summarized Experiment derivatives (RDS file) (#145)
* feat: Load any single-cell dataset stored as a `SummarizedExperiment` or `SingleCellExperiment` derivative * docs: update documentation Co-authored-by: LTLA <[email protected]>
1 parent 6d6a00b commit 647a9ed

File tree

3 files changed

+54
-7
lines changed

3 files changed

+54
-7
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Our client-side approach has a number of advantages:
2424

2525
## For users
2626

27-
If you have a Matrix Market (`.mtx`) file or HDF5 (tenx V3 or AnnData representation stored as h5ad), you're ready to go.
27+
If you have a Matrix Market (`.mtx`) file or HDF5 (tenx V3 or `AnnData` representation stored as h5ad), or `SummarizedExperiment` (or derivatives like `SingleCellExperiment`) stored as an RDS file, you're ready to go.
2828

2929
1. Launch the application by clicking [**here**](https://www.jkanche.com/kana/).
3030
2. Select the Matrix Market file (this may be Gzip-compressed).

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "kana",
33
"description": "Single cell data analysis in the browser",
4-
"version": "2.3.1",
4+
"version": "2.4.0",
55
"private": true,
66
"author": {
77
"name": "Jayaram Kancherla",
@@ -32,7 +32,7 @@
3232
"@testing-library/jest-dom": "^5.16.5",
3333
"@testing-library/react": "^11.1.0",
3434
"@testing-library/user-event": "^12.1.10",
35-
"bakana": "^0.5.0",
35+
"bakana": "^0.6.0",
3636
"d3": "^7.1.1",
3737
"epiviz.gl": "^1.0.2",
3838
"epiviz.scatter.gl": "^0.0.5",

src/components/Analysis/index.js

Lines changed: 51 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ const AnalysisDialog = ({
4646
genes: "Choose feature/gene file",
4747
annotations: "Choose barcode/annotation file",
4848
file: "Choose file...",
49+
rds: "Choose file..."
4950
});
5051

5152
let [stmpInputFiles, ssetTmpInputFiles] = useState({
@@ -218,9 +219,19 @@ const AnalysisDialog = ({
218219
) {
219220
all_valid = false;
220221
}
222+
223+
if (
224+
x?.rds && !(
225+
inputText[ix]?.rds.toLowerCase().endsWith("rds")
226+
)
227+
) {
228+
all_valid = false;
229+
}
221230

222231
if (x.format === "MatrixMarket") {
223232
if (!x.mtx) all_valid = false;
233+
} else if (x.format === "SummarizedExperiment") {
234+
if (!x.rds) all_valid = false;
224235
} else {
225236
if (!x.h5) all_valid = false;
226237
}
@@ -323,11 +334,20 @@ const AnalysisDialog = ({
323334
}
324335

325336
if (!x.h5 && (sinputText?.file !== "Choose file...")) all_valid = false;
337+
} else if (
338+
x.format === "SummarizedExperiment") {
339+
if (x?.rds && !(
340+
sinputText?.rds.toLowerCase().endsWith("rds")
341+
)
342+
) {
343+
all_valid = false;
344+
}
345+
346+
if (!x.rds && (sinputText?.file !== "Choose file...")) all_valid = false;
326347
}
327348

328349
// setTmpInputValid(all_valid);
329350
ssetTmpInputValid(all_valid);
330-
331351
}
332352
}
333353
}, [stmpInputFiles]);
@@ -1103,7 +1123,7 @@ const AnalysisDialog = ({
11031123
}}
11041124
defaultSelectedTabId={newImportFormat}
11051125
>
1106-
<Tab id="MatrixMarket" title="Matrix Market file" panel={
1126+
<Tab id="MatrixMarket" title="Matrix Market" panel={
11071127
<div className="row"
11081128
>
11091129
<Label className="row-input">
@@ -1132,7 +1152,7 @@ const AnalysisDialog = ({
11321152
</Label>
11331153
</div>
11341154
} />
1135-
<Tab id="10X" title="10x HDF5 matrix" panel={
1155+
<Tab id="10X" title="10X HDF5 Matrix" panel={
11361156
<div className="row"
11371157
>
11381158
<Label className="row-input">
@@ -1166,6 +1186,23 @@ const AnalysisDialog = ({
11661186
</Label>
11671187
</div>
11681188
} />
1189+
<Tab id="SummarizedExperiment" title="SummarizedExperiment (RDS)" panel={
1190+
<div className="row"
1191+
>
1192+
<Label className="row-input">
1193+
<FileInput style={{
1194+
marginTop: '5px'
1195+
}}
1196+
text={sinputText.rds}
1197+
onInputChange={(msg) => {
1198+
if (msg.target.files) {
1199+
ssetInputText({ ...sinputText, "rds": msg.target.files[0].name });
1200+
ssetTmpInputFiles({ ...stmpInputFiles, "rds": msg.target.files[0] })
1201+
}
1202+
}} />
1203+
</Label>
1204+
</div>
1205+
} />
11691206
</Tabs>
11701207
</div>
11711208
</div>
@@ -1490,6 +1527,8 @@ const AnalysisDialog = ({
14901527
if (row.annotations) {
14911528
tname += ` annotations: ${row.annotations.name} `;
14921529
}
1530+
} else if (row["format"] === "SummarizedExperiment") {
1531+
tname += ` file: ${row.rds.name} `;
14931532
} else {
14941533
tname += ` file: ${row.h5.name} `;
14951534
}
@@ -1948,7 +1987,8 @@ const AnalysisDialog = ({
19481987
<ul>
19491988
<li>Matrix Market - <code>*.mtx</code> or <code>*.mtx.gz</code></li>
19501989
<li>features or genes, <code>*.tsv</code> or <code>*.tsv.gz</code></li>
1951-
<li>HDF5 (10x or h5ad) - <code>*.h5</code> or <code>*.hdf5</code> or <code>*.h5ad</code></li>
1990+
<li>HDF5 (10X or H5AD) - <code>*.h5</code> or <code>*.hdf5</code> or <code>*.h5ad</code></li>
1991+
<li>RDS - <code>*.rds</code></li>
19521992
</ul>
19531993

19541994
Note: Names of dataset must be unique!
@@ -1977,6 +2017,13 @@ const AnalysisDialog = ({
19772017
We will also try to guess which field in the <code>obs</code> annotation contains gene symbols.
19782018
</p>
19792019

2020+
<p>
2021+
<strong>A SummarizedExperiment object saved in the RDS (<code>*.rds</code>) format. </strong>
2022+
We support any SummarizedExperiment subclass containing a dense or sparse count matrix
2023+
(identified as any assay with name starting with "counts", or if none exist, just the first assay).
2024+
For a SingleCellExperiment, any alternative experiment with name starting with "hto", "adt" or "antibody" is assumed to represent CITE-seq data.
2025+
</p>
2026+
19802027
<p><strong>Batch correction:</strong> you can now import more than one file to integrate and analyze datasets.
19812028
If you only import a single dataset, specify the annotation column that contains the batch information.</p>
19822029
</Callout>

0 commit comments

Comments
 (0)