Browse code

add metadata methods and append to outputs

LiNk-NY authored on 18/10/2024 22:04:04
Showing 1 changed files
... ...
@@ -46,9 +46,16 @@ fl <- system.file(
46 46
 ## Method 1 (tarball)
47 47
 TENxFileList(fl)
48 48
 
49
+## metadata before import
50
+metadata(TENxFileList(fl))
51
+
49 52
 ## import() method
50 53
 import(TENxFileList(fl))
51 54
 
55
+## metadata after import
56
+import(TENxFileList(fl)) |>
57
+    metadata()
58
+
52 59
 ## untar to simulate folder output
53 60
 dir.create(tdir <- tempfile())
54 61
 untar(fl, exdir = tdir)
Browse code

re-add changes to TENxFileList constructor

LiNk-NY authored on 20/11/2023 19:40:15
Showing 1 changed files
... ...
@@ -7,8 +7,8 @@
7 7
 TENxFileList(..., version, compressed = FALSE)
8 8
 }
9 9
 \arguments{
10
-\item{...}{A single file path, named arguments corresponding to file paths,
11
-or a list of named file paths}
10
+\item{...}{Typically, a file path to a tarball archive. Can be named
11
+arguments corresponding to file paths, or a named list of file paths.}
12 12
 
13 13
 \item{version}{character(1) The version in the tarball. See details.}
14 14
 
... ...
@@ -43,6 +43,37 @@ fl <- system.file(
43 43
     package = "TENxIO", mustWork = TRUE
44 44
 )
45 45
 
46
+## Method 1 (tarball)
47
+TENxFileList(fl)
48
+
49
+## import() method
46 50
 import(TENxFileList(fl))
47 51
 
52
+## untar to simulate folder output
53
+dir.create(tdir <- tempfile())
54
+untar(fl, exdir = tdir)
55
+
56
+## Method 2 (folder)
57
+TENxFileList(tdir)
58
+import(TENxFileList(tdir))
59
+
60
+## Method 3 (list of TENxFile objects)
61
+files <- list.files(tdir, recursive = TRUE, full.names = TRUE)
62
+names(files) <- basename(files)
63
+filelist <- lapply(files, TENxFile)
64
+
65
+TENxFileList(filelist, compressed = FALSE)
66
+
67
+## Method 4 (SimpleList)
68
+TENxFileList(as(filelist, "SimpleList"), compressed = FALSE)
69
+
70
+## Method 5 (named arguments)
71
+TENxFileList(
72
+    barcodes.tsv.gz = TENxFile(files[1]),
73
+    features.tsv.gz = TENxFile(files[2]),
74
+    matrix.mtx.gz = TENxFile(files[3])
75
+)
76
+
77
+unlink(tdir, recursive = TRUE)
78
+
48 79
 }
Browse code

Revert "allow folder-wise importing TENxVisium"

This reverts commit 7a62584e12ea7ebfd5e09c2cf43c031a867a092f.

LiNk-NY authored on 20/11/2023 16:35:32
Showing 1 changed files
... ...
@@ -7,8 +7,8 @@
7 7
 TENxFileList(..., version, compressed = FALSE)
8 8
 }
9 9
 \arguments{
10
-\item{...}{Typically, a file path to a tarball archive. Can be named
11
-arguments corresponding to file paths, or a named list of file paths.}
10
+\item{...}{A single file path, named arguments corresponding to file paths,
11
+or a list of named file paths}
12 12
 
13 13
 \item{version}{character(1) The version in the tarball. See details.}
14 14
 
... ...
@@ -43,37 +43,6 @@ fl <- system.file(
43 43
     package = "TENxIO", mustWork = TRUE
44 44
 )
45 45
 
46
-## Method 1 (tarball)
47
-TENxFileList(fl)
48
-
49
-## import() method
50 46
 import(TENxFileList(fl))
51 47
 
52
-## untar to simulate folder output
53
-dir.create(tdir <- tempfile())
54
-untar(fl, exdir = tdir)
55
-
56
-## Method 2 (folder)
57
-TENxFileList(tdir)
58
-import(TENxFileList(tdir))
59
-
60
-## Method 3 (list of TENxFile objects)
61
-files <- list.files(tdir, recursive = TRUE, full.names = TRUE)
62
-names(files) <- basename(files)
63
-filelist <- lapply(files, TENxFile)
64
-
65
-TENxFileList(filelist, compressed = FALSE)
66
-
67
-## Method 4 (SimpleList)
68
-TENxFileList(as(filelist, "SimpleList"), compressed = FALSE)
69
-
70
-## Method 5 (named arguments)
71
-TENxFileList(
72
-    barcodes.tsv.gz = TENxFile(files[1]),
73
-    features.tsv.gz = TENxFile(files[2]),
74
-    matrix.mtx.gz = TENxFile(files[3])
75
-)
76
-
77
-unlink(tdir, recursive = TRUE)
78
-
79 48
 }
Browse code

allow folder-wise importing TENxVisium

- update examples in docs

LiNk-NY authored on 20/10/2023 03:26:31
Showing 1 changed files
... ...
@@ -7,8 +7,8 @@
7 7
 TENxFileList(..., version, compressed = FALSE)
8 8
 }
9 9
 \arguments{
10
-\item{...}{A single file path, named arguments corresponding to file paths,
11
-or a list of named file paths}
10
+\item{...}{Typically, a file path to a tarball archive. Can be named
11
+arguments corresponding to file paths, or a named list of file paths.}
12 12
 
13 13
 \item{version}{character(1) The version in the tarball. See details.}
14 14
 
... ...
@@ -43,6 +43,37 @@ fl <- system.file(
43 43
     package = "TENxIO", mustWork = TRUE
44 44
 )
45 45
 
46
+## Method 1 (tarball)
47
+TENxFileList(fl)
48
+
49
+## import() method
46 50
 import(TENxFileList(fl))
47 51
 
52
+## untar to simulate folder output
53
+dir.create(tdir <- tempfile())
54
+untar(fl, exdir = tdir)
55
+
56
+## Method 2 (folder)
57
+TENxFileList(tdir)
58
+import(TENxFileList(tdir))
59
+
60
+## Method 3 (list of TENxFile objects)
61
+files <- list.files(tdir, recursive = TRUE, full.names = TRUE)
62
+names(files) <- basename(files)
63
+filelist <- lapply(files, TENxFile)
64
+
65
+TENxFileList(filelist, compressed = FALSE)
66
+
67
+## Method 4 (SimpleList)
68
+TENxFileList(as(filelist, "SimpleList"), compressed = FALSE)
69
+
70
+## Method 5 (named arguments)
71
+TENxFileList(
72
+    barcodes.tsv.gz = TENxFile(files[1]),
73
+    features.tsv.gz = TENxFile(files[2]),
74
+    matrix.mtx.gz = TENxFile(files[3])
75
+)
76
+
77
+unlink(tdir, recursive = TRUE)
78
+
48 79
 }
Browse code

update docs and spellcheck

LiNk-NY authored on 05/10/2022 22:01:03
Showing 1 changed files
... ...
@@ -32,8 +32,8 @@ identifiers
32 32
 If all above files are in the tarball, the import method will provide a
33 33
 \code{SingleCellExperiment}. Otherwise, a simple list of imported data is given.
34 34
 Note that version "3" uses 'features.tsv.gz' and version "2" uses
35
-'genes.tsv.gz'. If known, indicate the version argument in the \code{TENxFileList}
36
-constructor function.
35
+'genes.tsv.gz'. If known, indicate the \code{version} argument in the
36
+\code{TENxFileList} constructor function.
37 37
 }
38 38
 }
39 39
 \examples{
Browse code

add support for versions 2 and 3 in TENxFileList

LiNk-NY authored on 05/10/2022 20:32:22
Showing 1 changed files
... ...
@@ -4,12 +4,14 @@
4 4
 \alias{TENxFileList}
5 5
 \title{TENxFileList: Represent groups of files from 10X Genomic}
6 6
 \usage{
7
-TENxFileList(..., compressed = FALSE)
7
+TENxFileList(..., version, compressed = FALSE)
8 8
 }
9 9
 \arguments{
10 10
 \item{...}{A single file path, named arguments corresponding to file paths,
11 11
 or a list of named file paths}
12 12
 
13
+\item{version}{character(1) The version in the tarball. See details.}
14
+
13 15
 \item{compressed}{logical(1) Whether or not the file provided is compressed,
14 16
 usually as \code{tar.gz} (default FALSE)}
15 17
 }
... ...
@@ -29,6 +31,9 @@ These tarballs usually contain three files:
29 31
 identifiers
30 32
 If all above files are in the tarball, the import method will provide a
31 33
 \code{SingleCellExperiment}. Otherwise, a simple list of imported data is given.
34
+Note that version "3" uses 'features.tsv.gz' and version "2" uses
35
+'genes.tsv.gz'. If known, indicate the version argument in the \code{TENxFileList}
36
+constructor function.
32 37
 }
33 38
 }
34 39
 \examples{
Browse code

update TENxFileList examples

LiNk-NY authored on 03/08/2022 19:48:07
Showing 1 changed files
... ...
@@ -33,7 +33,11 @@ If all above files are in the tarball, the import method will provide a
33 33
 }
34 34
 \examples{
35 35
 
36
-fl <- "~/data/10x/pbmc_3k/pbmc_granulocyte_sorted_3k_filtered_feature_bc_matrix.tar.gz"
37
-con <- TENxFileList(fl)
36
+fl <- system.file(
37
+    "extdata", "pbmc_granulocyte_sorted_3k_ff_bc_ex_matrix.tar.gz",
38
+    package = "TENxIO", mustWork = TRUE
39
+)
40
+
41
+import(TENxFileList(fl))
38 42
 
39 43
 }
Browse code

export decompress, doc TENxFileList constructor and class

LiNk-NY authored on 24/06/2022 21:40:39
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,39 @@
1
+% Generated by roxygen2: do not edit by hand
2
+% Please edit documentation in R/TENxFileList-class.R
3
+\name{TENxFileList}
4
+\alias{TENxFileList}
5
+\title{TENxFileList: Represent groups of files from 10X Genomic}
6
+\usage{
7
+TENxFileList(..., compressed = FALSE)
8
+}
9
+\arguments{
10
+\item{...}{A single file path, named arguments corresponding to file paths,
11
+or a list of named file paths}
12
+
13
+\item{compressed}{logical(1) Whether or not the file provided is compressed,
14
+usually as \code{tar.gz} (default FALSE)}
15
+}
16
+\value{
17
+Either a \code{SingleCellExperiment} or a list of imported data
18
+}
19
+\description{
20
+This constructor function is meant to handle \code{.tar.gz} tarball
21
+files from 10X Genomics.
22
+}
23
+\details{
24
+These tarballs usually contain three files:
25
+\enumerate{
26
+\item \code{matrix.mtx.gz} - the counts matrix
27
+\item \code{features.tsv.gz} - row metadata usually represented as \code{rowData}
28
+\item \code{barcodes.tsv.gz} - column names corresponding to cell barcode
29
+identifiers
30
+If all above files are in the tarball, the import method will provide a
31
+\code{SingleCellExperiment}. Otherwise, a simple list of imported data is given.
32
+}
33
+}
34
+\examples{
35
+
36
+fl <- "~/data/10x/pbmc_3k/pbmc_granulocyte_sorted_3k_filtered_feature_bc_matrix.tar.gz"
37
+con <- TENxFileList(fl)
38
+
39
+}