Skip to content

Commit e0bbac9

Browse files
committed
Fixed all the syntax errors.
1 parent 4aad2d1 commit e0bbac9

File tree

2 files changed

+31
-43
lines changed

2 files changed

+31
-43
lines changed

src/readers/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ export * from "./mtx.js"
44
export * from "./se.js";
55
export * from "./ArtifactDB-abstract.js";
66
export * from "./ArtifactDB-zipped.js";
7+
export * from "./takane-abstract.js";
78
export * from "./utils/extract.js";
89
export * from "./abstract/file.js";
910

src/readers/takane-abstract.js

Lines changed: 30 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ async function load_sce_components(se_path, navigator) {
488488
}
489489

490490
if (listing.indexOf("column_data") != -1) {
491-
let col_path = this.#path + "/column_data";
491+
let col_path = se_path + "/column_data";
492492
main.cells = await load_data_frame(col_path, navigator);
493493
} else {
494494
main.cells = new bioc.DataFrame({}, { numberOfRows: obj_info.summarized_experiment.dimensions[1] });
@@ -816,8 +816,6 @@ export class AbstractTakeneResult {
816816
#path;
817817
#navigator;
818818
#raw_components;
819-
#raw_other;
820-
#raw_
821819
#options;
822820

823821
/**
@@ -832,7 +830,6 @@ export class AbstractTakeneResult {
832830
this.#path = path;
833831
this.#navigator = new TakaneNavigator(getter, lister);
834832
this.#raw_components = null;
835-
this.#raw_other = null;
836833
this.#options = AbstractTakeneResult.defaults();
837834
}
838835

@@ -884,7 +881,6 @@ export class AbstractTakeneResult {
884881
*/
885882
clear() {
886883
this.#raw_components = null;
887-
this.#raw_other = null;
888884
this.#navigator.clear();
889885
}
890886

@@ -986,9 +982,9 @@ export class AbstractTakeneResult {
986982
let output = {
987983
matrix: new scran.MultiMatrix,
988984
features: {},
989-
cells: this.#raw_cells,
985+
cells: comp.core.main.cells,
990986
reduced_dimensions: {},
991-
other_metadata: this.#raw_other
987+
other_metadata: comp.other,
992988
};
993989

994990
// Fetch the reduced dimensions first.
@@ -1037,49 +1033,40 @@ export class AbstractTakeneResult {
10371033

10381034
// Now fetching the assay matrix.
10391035
{
1040-
const altmap = {};
1041-
for (const alt of comp.alternative) {
1042-
altmap[alt.name] = alt;
1043-
}
1044-
1045-
try {
1046-
for (const [k, v] of Object.entries(this.#raw_features)) {
1047-
let curassay = this.#options.primaryAssay;
1048-
if (typeof curassay == "object") {
1049-
if (k in curassay) {
1050-
curassay = curassay[k];
1051-
} else {
1052-
continue;
1053-
}
1054-
}
1055-
1056-
let curnormalized = this.#options.isPrimaryNormalized;
1057-
if (typeof curnormalized == "object") {
1058-
if (k in curnormalized) {
1059-
curnormalized = curnormalized[k];
1060-
} else {
1061-
curnormalized = true;
1062-
}
1036+
async function add_experiment(name, info) {
1037+
let curassay = this.#options.primaryAssay;
1038+
if (typeof curassay == "object") {
1039+
if (name in curassay) {
1040+
curassay = curassay[name];
1041+
} else {
1042+
return;
10631043
}
1044+
}
10641045

1065-
let info;
1066-
if (k === comp.core.main.name) {
1067-
info = comp.core.main;
1068-
} else if (k in altmap) {
1069-
info = altmap[k];
1046+
let curnormalized = this.#options.isPrimaryNormalized;
1047+
if (typeof curnormalized == "object") {
1048+
if (name in curnormalized) {
1049+
curnormalized = curnormalized[name];
1050+
} else {
1051+
curnormalized = true;
10701052
}
1053+
}
10711054

1072-
let loaded = await extract_assay(info.path, curassay, this.#navigator, !curnormalized);
1073-
output.matrix.add(k, loaded);
1055+
let loaded = await extract_assay(info.path, curassay, this.#navigator, !curnormalized);
1056+
output.matrix.add(name, loaded);
1057+
if (!curnormalized) {
1058+
let normed = scran.logNormCounts(loaded, { allowZeros: true });
1059+
output.matrix.add(name, normed);
1060+
}
10741061

1075-
if (!curnormalized) {
1076-
let normed = scran.logNormCounts(loaded, { allowZeros: true });
1077-
output.matrix.add(k, normed);
1078-
}
1062+
output.features[name] = info.features;
1063+
}
10791064

1080-
output.features[k] = info.features;
1065+
try {
1066+
add_experiment(comp.core.main.name, comp.core.main);
1067+
for (const [k, v] of Object.entries(comp.core.alternative)) {
1068+
add_experiment(k, v);
10811069
}
1082-
10831070
} catch (e) {
10841071
scran.free(output.matrix);
10851072
throw e;

0 commit comments

Comments
 (0)