Skip to content

Commit 3d9749f

Browse files
author
TomSmithCGAT
committed
removes %>% explanation and uses file.path in place of str_c
1 parent 7145092 commit 3d9749f

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

Markdowns/07_Data_Exploration.Rmd

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,7 @@ need for the analysis today: name, cell type, status.
8282
```{r loadSampleInfo, message = FALSE}
8383
# Read the sample information into a data frame
8484
sampleinfo <- read_tsv("data/samplesheet.tsv", col_types = c("cccc"))
85-
sampleinfo %>%
86-
arrange(Status, TimePoint, Replicate)
85+
arrange(sampleinfo, Status, TimePoint, Replicate)
8786
```
8887

8988
## Reading in the count data
@@ -102,9 +101,8 @@ The Salmon quantification results are per transcript, we'll want to summarise
102101
to gene level. To this we need a table that relates transcript IDs to gene IDs.
103102

104103
```{r readSalmon}
105-
files <- str_c("salmon/", sampleinfo$SampleName, "/quant.sf")
104+
files <- file.path("salmon", sampleinfo$SampleName, "quant.sf")
106105
files <- set_names(files, sampleinfo$SampleName)
107-
108106
tx2gene <- read_tsv("references/tx2gene.tsv")
109107
110108
txi <- tximport(files, type = "salmon", tx2gene = tx2gene)
@@ -138,8 +136,7 @@ saveRDS(txi, file = "salmon_outputs/txi.rds")
138136
One of the most complex aspects of learning to work with data in `R` is
139137
getting to grips with subsetting and manipulating data tables. The package
140138
`dplyr` [@Wickham2018] was developed to make this process more intuitive than it
141-
is using standard base `R` processes. It also makes use of a new symbol `%>%`,
142-
called the "pipe", which makes the code a bit tidier.
139+
is using standard base `R` processes.
143140

144141
In particular we will use the commands:
145142

Markdowns/07_Data_Exploration.Solutions.Rmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ library(ggfortify)
2525
# Read the sample information into R
2626
sampleinfo <- read_tsv("data/samplesheet.tsv", col_types = c("cccc"))
2727
# Read the data into R
28-
files <- str_c("salmon/", sampleinfo$SampleName, "/quant.sf")
28+
files <- file.path("salmon", sampleinfo$SampleName, "quant.sf")
2929
files <- set_names(files, sampleinfo$SampleName)
3030
3131
tx2gene <- read_tsv("references/tx2gene.tsv")

0 commit comments

Comments
 (0)