Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
cAmpSeqR
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Simeon Rossmann
cAmpSeqR
Commits
02892b7b
Commit
02892b7b
authored
1 year ago
by
Simeon
Browse files
Options
Downloads
Patches
Plain Diff
more efficient cluster writing by only reading in seqtab_nochim once
parent
3431af23
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
R/per_cluster_abundance.R
+3
-6
3 additions, 6 deletions
R/per_cluster_abundance.R
R/read_and_write_cluster_abundance.R
+3
-18
3 additions, 18 deletions
R/read_and_write_cluster_abundance.R
man/per_cluster_abundance.Rd
+2
-2
2 additions, 2 deletions
man/per_cluster_abundance.Rd
with
8 additions
and
26 deletions
R/per_cluster_abundance.R
+
3
−
6
View file @
02892b7b
...
@@ -3,22 +3,19 @@
...
@@ -3,22 +3,19 @@
#' Primarily intended for use inside \code{\link{read_and_write_cluster_abundance}}.
#' Primarily intended for use inside \code{\link{read_and_write_cluster_abundance}}.
#'
#'
#' @param seqs_of_one_cluster DNAStringSet containing sequences of one cluster
#' @param seqs_of_one_cluster DNAStringSet containing sequences of one cluster
#' @param seqtab_nochim
Path to the seqtab_nochim file (in RDS format
)
#' @param seqtab_nochim
seqtab object, as imported by readRDS ("path/to/seqtab_nochim.rds"
)
#' @param reference_seqs Named vector of reference sequences to exclude (Optional) or NULL (default)
#' @param reference_seqs Named vector of reference sequences to exclude (Optional) or NULL (default)
#' @return A table with the abundance of sequences within the cluster
#' @return A table with the abundance of sequences within the cluster
#' @import dplyr readr tibble tidyr
#' @import dplyr readr tibble tidyr
#' @export
#' @export
per_cluster_abundance
<-
function
(
seqs_of_one_cluster
=
DNAStringSet
,
per_cluster_abundance
<-
function
(
seqs_of_one_cluster
=
DNAStringSet
,
seqtab_nochim
=
'seqtab_nochim.rds'
,
seqtab_nochim
=
stab
,
reference_seqs
=
NULL
){
reference_seqs
=
NULL
){
stab
<-
readRDS
(
seqtab_nochim
)
%>%
t
()
%>%
as.data.frame
()
%>%
rownames_to_column
(
var
=
'seqs'
)
seq_tbl
<-
tibble
(
seqs
=
as.data.frame
(
seqs_of_one_cluster
)[[
1
]],
seq_tbl
<-
tibble
(
seqs
=
as.data.frame
(
seqs_of_one_cluster
)[[
1
]],
ID
=
names
(
seqs_of_one_cluster
))
ID
=
names
(
seqs_of_one_cluster
))
named_stab
<-
left_join
(
seq_tbl
,
stab
,
by
=
'seqs'
)
named_stab
<-
left_join
(
seq_tbl
,
s
eq
tab
_nochim
,
by
=
'seqs'
)
if
(
!
is.null
(
reference_seqs
)){
if
(
!
is.null
(
reference_seqs
)){
named_stab
<-
named_stab
%>%
named_stab
<-
named_stab
%>%
...
...
This diff is collapsed.
Click to expand it.
R/read_and_write_cluster_abundance.R
+
3
−
18
View file @
02892b7b
...
@@ -22,25 +22,10 @@ read_and_write_cluster_abundance <- function(
...
@@ -22,25 +22,10 @@ read_and_write_cluster_abundance <- function(
seqtab_nochim
=
'seqtab_nochim.rds'
,
seqtab_nochim
=
'seqtab_nochim.rds'
,
outpath
=
path
)
{
outpath
=
path
)
{
#
stab <- readRDS(seqtab_nochim) %>%
stab
<-
readRDS
(
seqtab_nochim
)
%>%
#
t() %>% as.data.frame() %>%
t
()
%>%
as.data.frame
()
%>%
#
rownames_to_column(var = 'seqs')
rownames_to_column
(
var
=
'seqs'
)
# per_cluster_abundance <- function(seqs_of_one_cluster = DNAStringSet){
# seq_tbl <- tibble(seqs = as.data.frame(seqs_of_one_cluster)[[1]],
# ID = names(seqs_of_one_cluster))
# named_stab <- left_join(seq_tbl, stab, by = 'seqs')
# if(!is.null(reference_seqs)){
# named_stab <- named_stab %>%
# filter(!(ID %in% names(reference_seqs)))
# }
# stab_tbl <- named_stab %>%
# select(-seqs) %>%
# pivot_longer(cols = -ID, names_to = 'Sample', values_to = 'count')
# }
#
out
<-
lapply
(
cluster_sequence_list
,
per_cluster_abundance
,
out
<-
lapply
(
cluster_sequence_list
,
per_cluster_abundance
,
seqtab_nochim
=
seqtab_nochim
,
reference_seqs
=
reference_seqs
)
seqtab_nochim
=
seqtab_nochim
,
reference_seqs
=
reference_seqs
)
...
...
This diff is collapsed.
Click to expand it.
man/per_cluster_abundance.Rd
+
2
−
2
View file @
02892b7b
...
@@ -6,14 +6,14 @@
...
@@ -6,14 +6,14 @@
\usage{
\usage{
per_cluster_abundance(
per_cluster_abundance(
seqs_of_one_cluster = DNAStringSet,
seqs_of_one_cluster = DNAStringSet,
seqtab_nochim =
"seqtab_nochim.rds"
,
seqtab_nochim =
stab
,
reference_seqs = NULL
reference_seqs = NULL
)
)
}
}
\arguments{
\arguments{
\item{seqs_of_one_cluster}{DNAStringSet containing sequences of one cluster}
\item{seqs_of_one_cluster}{DNAStringSet containing sequences of one cluster}
\item{seqtab_nochim}{
Path to the seqtab_nochim file (in RDS format
)}
\item{seqtab_nochim}{
seqtab object, as imported by readRDS ("path/to/seqtab_nochim.rds"
)}
\item{reference_seqs}{Named vector of reference sequences to exclude (Optional) or NULL (default)}
\item{reference_seqs}{Named vector of reference sequences to exclude (Optional) or NULL (default)}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment