Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge into devel #402

Closed
wants to merge 107 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
107 commits
Select commit Hold shift + click to select a range
2d3a353
Update clonalQuant.R
noranekonobokkusu Jan 11, 2024
2fe9b80
Update clonalAbundance.R
noranekonobokkusu Jan 11, 2024
7d2f1b3
Merge pull request #1 from noranekonobokkusu/patch-2
noranekonobokkusu Jan 11, 2024
20d7478
Update clonalRarefaction.R
noranekonobokkusu Jan 11, 2024
08e7292
Merge pull request #2 from noranekonobokkusu/patch-3
noranekonobokkusu Jan 11, 2024
db49913
Merge pull request #305 from noranekonobokkusu/master
ncborcherding Jan 12, 2024
0ce50bb
Adding documentation for rarefaction
ncborcherding Jan 12, 2024
823ca0a
Update clonalCluster
ncborcherding Jan 15, 2024
d8734c3
Updated bioconductor links
ncborcherding Jan 16, 2024
51622eb
rm dev branch reference
ncborcherding Jan 17, 2024
2d4e9eb
small docum issues
ncborcherding Jan 17, 2024
43a4db3
#308 double chain removal
ncborcherding Jan 18, 2024
9e261ac
Add positionalEntropy
ncborcherding Jan 18, 2024
bbd36f2
add positionalentropy documentation clarif
ncborcherding Jan 19, 2024
1ae908c
update vignette for positionalEnt
ncborcherding Jan 22, 2024
1459890
Update combineExpression.R
noranekonobokkusu Feb 9, 2024
ff08088
Merge pull request #311 from noranekonobokkusu/master
ncborcherding Feb 12, 2024
e55da4c
Merge pull request #314 from ncborcherding/master
ncborcherding Feb 13, 2024
43d3b48
#312 .off.the.chain to filter chain content
ncborcherding Feb 13, 2024
96eb783
Fix 10X contigs filename
ycl6 Feb 14, 2024
07492e9
Merge pull request #315 from ycl6/fix_10x_contigs_filename
ncborcherding Feb 14, 2024
8f31a43
Use file.path() to build export file path
ycl6 Feb 14, 2024
3f25230
Merge pull request #316 from ycl6/Improve_export_path_construction
ncborcherding Feb 14, 2024
0692934
#318 combineExpression Issue with chains
ncborcherding Feb 16, 2024
1a462e6
Adding positionalProperty()
ncborcherding Feb 16, 2024
1e0d8ca
working on check pass
ncborcherding Feb 16, 2024
e51695a
Merge pull request #320 from ncborcherding/dev
ncborcherding Feb 16, 2024
f56ef1d
Update pkgdown page
ncborcherding Feb 19, 2024
427f525
Updating vignette articles
ncborcherding Feb 24, 2024
6a919b9
Merge pull request #321 from ncborcherding/dev
ncborcherding Feb 24, 2024
0e8667d
edit of vignettes
ncborcherding Feb 25, 2024
e2f6437
Allow selecting a single diversity metric in 'clonalDiversity()'
ycl6 Feb 26, 2024
097a999
Fix 'ident' field name of sc object in '.grabMeta()'
ycl6 Feb 26, 2024
9f4a659
Merge pull request #323 from ycl6/fix_se_ident
ncborcherding Feb 28, 2024
2c842f0
Merge pull request #322 from ycl6/single_diversity_metric
ncborcherding Feb 28, 2024
50eb0fa
testthat new viz svgs
ncborcherding Feb 28, 2024
bdfcc02
Merge pull request #327 from ncborcherding/master
ncborcherding Feb 29, 2024
7bfb6bd
clonalOverlay() changes for flexibility
ncborcherding Feb 29, 2024
b1a1aa5
Update NEWS.md
ncborcherding Feb 29, 2024
baf8377
Update loadContigs.R
JHYSiu Mar 6, 2024
83ab850
Merge pull request #330 from JHYSiu/loadContigs_Immcantation
ncborcherding Mar 7, 2024
91e0aaf
Update loadContigs_Immcantation.rds
ncborcherding Mar 7, 2024
9555d2b
Merge branch 'master' of https://github.com/ncborcherding/scRepertoire
ncborcherding Mar 7, 2024
1adabeb
Fixing immcantation testhat example
ncborcherding Mar 8, 2024
31da94c
Merge pull request #338 from ncborcherding/master
ncborcherding Mar 27, 2024
25a8137
clonalOccupy NA fix
ncborcherding Mar 27, 2024
ced1942
clonalOccupy NA include argument fix
ncborcherding Apr 2, 2024
cb31601
updating testthat
ncborcherding Apr 2, 2024
568edc1
Update Ibex/Trex vingette
ncborcherding Apr 5, 2024
ad95f8f
Merge pull request #351 from ncborcherding/master
ncborcherding Apr 11, 2024
39573e2
Update OS load
ncborcherding Apr 11, 2024
3837bef
Merge branch 'dev' of https://github.com/ncborcherding/scRepertoire i…
ncborcherding Apr 11, 2024
2167f1d
combineExpression() readd clone
ncborcherding Apr 11, 2024
6e48a1a
Add dplyr imports
ncborcherding Apr 11, 2024
e249070
Add ParseBio support
ncborcherding Apr 15, 2024
4534f48
add filterNonproductive parameter
ncborcherding Apr 18, 2024
62248fb
loadcontigs support pulling productive info
ncborcherding Apr 18, 2024
877e0f6
combineTCR output columns fix
ncborcherding Apr 18, 2024
18e963e
update of testthat functions for combine
ncborcherding Apr 18, 2024
046dde5
update clonalOverlap ordering
ncborcherding Apr 18, 2024
38b2ab5
name index over numeric index
ncborcherding Apr 20, 2024
a84f821
updating lvcompare testing
ncborcherding Apr 24, 2024
a416610
Update test-coverage.yaml
ncborcherding Apr 25, 2024
865dac7
clonalCluster update
ncborcherding Apr 26, 2024
5cdfd22
Update test-loadContigs.R
ncborcherding Apr 30, 2024
1287e29
update testhat
ncborcherding May 1, 2024
bb2232c
working on failed tests
ncborcherding May 1, 2024
8652001
dplyr import issue
ncborcherding May 1, 2024
406c9f0
working on final issues of dplyr|igraph conflict
ncborcherding May 3, 2024
7b0d94e
readd exporttable
ncborcherding May 3, 2024
93d31af
Merge pull request #359 from ncborcherding/dev
ncborcherding May 3, 2024
f0d69fa
Update site/NEWS
ncborcherding May 4, 2024
7cf56eb
update vignettes for 2.0.3
ncborcherding May 4, 2024
38442fe
Merge pull request #362 from ncborcherding/master
ncborcherding May 7, 2024
9511292
refactor getCirclize
ncborcherding May 7, 2024
f680b79
Initial order.by parameter
ncborcherding May 7, 2024
b80124e
Progressing #357
ncborcherding May 7, 2024
ac572d6
clonalCompare add retention of original.clone info
ncborcherding May 7, 2024
bad5df2
#357 completed
ncborcherding May 7, 2024
d53ceeb
Update README.md
ncborcherding May 8, 2024
18c32c0
running order plots
ncborcherding May 9, 2024
c0ffda1
devtools::check() 2.0.4
ncborcherding May 9, 2024
4798f8d
Fix order.by parameter
ncborcherding May 9, 2024
4af6636
Update README.md
ncborcherding May 12, 2024
c5e0f3c
Update README.md
ncborcherding May 12, 2024
62ea623
Update vignette.Rmd
ncborcherding May 13, 2024
4ba9290
Adding support for Dandelion
ncborcherding May 13, 2024
2a244d7
fix #366 don't assume all AA
ncborcherding May 14, 2024
6489403
vizGene IG issue fix
ncborcherding May 15, 2024
b375cdd
adding filter to vizgenes
ncborcherding May 15, 2024
f6eb5ff
v2.0.4 dev push
ncborcherding May 17, 2024
2d9861f
updating vizdiffr
ncborcherding May 20, 2024
9f6ef41
Merge pull request #372 from ncborcherding/dev
ncborcherding May 20, 2024
503ed86
#384 clonalCluster graph error
ncborcherding Jun 25, 2024
6cb58c0
#390 fix
ncborcherding Jul 15, 2024
5b04c75
Adding immApex vignette to site
ncborcherding Jul 15, 2024
5ab9e35
update positionalProperty for odd characters
ncborcherding Jul 23, 2024
0cd6d43
small quality of life changes with assertthat
Qile0317 Jul 25, 2024
df21fb2
Merge pull request #393 from Qile0317/qualOfLife
ncborcherding Aug 5, 2024
0996a08
update assertthat
ncborcherding Aug 6, 2024
8ed51ed
Update clonalQuant.R
ncborcherding Aug 7, 2024
5899292
updating testthat for positionalProperty
ncborcherding Aug 8, 2024
17fecff
Update NEWS.md
ncborcherding Aug 8, 2024
0d4ace6
Merge pull request #397 from ncborcherding/dev
ncborcherding Aug 9, 2024
cee16f5
Update README.md
ncborcherding Aug 9, 2024
f77a695
Update pkgdown.yml
ncborcherding Aug 27, 2024
6c7c632
Update DESCRIPTION
ncborcherding Aug 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ jobs:
covr::codecov(
quiet = FALSE,
clean = FALSE,
exclusions = "R/global.R",
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package")
)
shell: Rscript {0}
Expand Down
14 changes: 8 additions & 6 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
Package: scRepertoire
Title: A toolkit for single-cell immune receptor profiling
Version: 2.0.0
Version: 2.1.1
Authors@R: c(
person(given = "Nick", family = "Borcherding", role = c("aut", "cre"), email = "[email protected]"),
person(given = "Qile", family = "Yang", role = c("aut"), email = "[email protected]"),
person(given = "Qile", family = "Yang", role = c("aut"), email = "[email protected]"),
person(given = "Ksenia", family = "Safina", role = c("aut"), email = "[email protected]"))
Description: scRepertoire is a toolkit for processing and analyzing single-cell T-cell receptor (TCR) and immunoglobulin (Ig). The scRepertoire framework supports use of 10x, AIRR, BD, MiXCR, Omniscope, TRUST4, and WAT3R single-cell formats. The functionality includes basic clonal analyses, repertoire summaries, distance-based clustering and interaction with the popular Seurat and SingleCellExperiment/Bioconductor R workflows.
License: MIT + file LICENSE
Encoding: UTF-8
LazyData: true
RoxygenNote: 7.2.3
RoxygenNote: 7.3.2
biocViews: Software, ImmunoOncology, SingleCell, Classification, Annotation, Sequencing
Depends:
ggplot2,
R (>= 4.0)
ggplot2,
R (>= 4.0)
Imports:
assertthat,
cubature,
dplyr,
evmix,
Expand Down Expand Up @@ -60,4 +61,5 @@ Config/testthat/edition: 3
Language: en-US
LinkingTo:
Rcpp
URL: https://ncborcherding.github.io/scRepertoire/
URL: https://www.borch.dev/uploads/scRepertoire/
BugReports: https://github.com/ncborcherding/scRepertoire/issues
28 changes: 26 additions & 2 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@ export(percentAA)
export(percentGenes)
export(percentKmer)
export(percentVJ)
export(positionalEntropy)
export(positionalProperty)
export(subsetClones)
export(vizGenes)
import(dplyr)
import(ggplot2)
importFrom(Rcpp,sourceCpp)
importFrom(S4Vectors,DataFrame)
Expand All @@ -44,16 +45,33 @@ importFrom(SingleCellExperiment,reducedDim)
importFrom(SummarizedExperiment,"colData<-")
importFrom(SummarizedExperiment,colData)
importFrom(VGAM,dpareto)
importFrom(assertthat,assert_that)
importFrom(assertthat,is.flag)
importFrom(assertthat,is.string)
importFrom(cubature,adaptIntegrate)
importFrom(dplyr,"%>%")
importFrom(dplyr,across)
importFrom(dplyr,all_of)
importFrom(dplyr,arrange)
importFrom(dplyr,bind_rows)
importFrom(dplyr,coalesce)
importFrom(dplyr,count)
importFrom(dplyr,desc)
importFrom(dplyr,filter)
importFrom(dplyr,group_by)
importFrom(dplyr,left_join)
importFrom(dplyr,mutate)
importFrom(dplyr,mutate_at)
importFrom(dplyr,mutate_if)
importFrom(dplyr,n)
importFrom(dplyr,sample_n)
importFrom(dplyr,select)
importFrom(dplyr,slice_max)
importFrom(dplyr,summarise)
importFrom(dplyr,summarize)
importFrom(dplyr,summarize_all)
importFrom(dplyr,transmute)
importFrom(dplyr,ungroup)
importFrom(evmix,dgpd)
importFrom(evmix,fgpd)
importFrom(evmix,pgpd)
Expand Down Expand Up @@ -83,25 +101,31 @@ importFrom(igraph,components)
importFrom(igraph,graph_from_data_frame)
importFrom(igraph,graph_from_edgelist)
importFrom(igraph,set_vertex_attr)
importFrom(igraph,union)
importFrom(methods,slot)
importFrom(plyr,join)
importFrom(plyr,llply)
importFrom(quantreg,rqss)
importFrom(reshape2,dcast)
importFrom(reshape2,melt)
importFrom(rjson,fromJSON)
importFrom(rlang,"!!")
importFrom(rlang,"%||%")
importFrom(rlang,":=")
importFrom(rlang,ensym)
importFrom(rlang,sym)
importFrom(stats,as.dist)
importFrom(stats,hclust)
importFrom(stats,mad)
importFrom(stats,na.omit)
importFrom(stats,optim)
importFrom(stats,pgamma)
importFrom(stats,qt)
importFrom(stats,quantile)
importFrom(stats,sd)
importFrom(stats,setNames)
importFrom(stringdist,stringdist)
importFrom(stringr,str_c)
importFrom(stringr,str_remove_all)
importFrom(stringr,str_replace_all)
importFrom(stringr,str_replace_na)
importFrom(stringr,str_sort)
Expand Down
55 changes: 53 additions & 2 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,52 @@
# scRepertoire VERSION 2.0.5

## UNDERLYING CHANGES
* added type checks using assertthat
* updated conditional statements in constructConDFAndparseTCR.cpp
* Fixed issue in ```clonalQuant()``` and factor-based **group.by** variable

# scRepertoire VERSION 2.0.4

## UNDERLYING CHANGES
* ```getCirclize()``` refactored to prevent assumptions and added **include.self** argument
* Added ```.count.clones()``` internal function for ```getCirclize()``` and ```clonalNetwork()```
* Added **order.by** parameter to visualizations to specifically call order of plotting using a vector or can use "alphanumeric" to plot things in order
* Fix issue with ```clonalLength()``` and NA handling
* ```clonalCompare()``` now retains the original clonal info if using **relabel.clones**
* Add Dandelion support in to ```loadContigs()``` and testthat
* Fixed issue with ```positionalProperty()``` assumption that the clones will all have 20 amino acids.
* Fixed issue with ```positionalProperty()``` and removing non-amino acids.
* Fixed IGH/K/L mistaking gene issue in ```vizGenes()```
* Add error message for NULL results in ```clonalCluster()``` with **export.graph = TRUE**
* Fixed issue with "full.clones" missing in ```combineExpression()``` when using 1 chain


# scRepertoire VERSION 2.0.3

## UNDERLYING CHANGES

* Modified support for Omniscope format to allow for dual chains
* Added ParseBio support in to ```loadContigs()``` and testthat
* Added support for productive variable to ```loadContigs()``` for BD, Omniscope, and Immcantation formats
* Replace numerical indexing with name indexing for ```loadContigs()```
* ```combineBCR()``` and ```combineTCR()``` no allow for unproductive contig inclusions with new **filterNonproductive** parameter.
* ```combineBCR()``` will now prompt user if **samples** is not included instead of erroring.
* Added base threshold by length for internal ```.lvCompare()```
* Ensured internal ```.lvCompare()``` only looks at first set of sequences in multi-sequence chain.
* Fixed bug in exporting graph for ```clonaCluster()```
* Fixed conflict in functions between igraph and dplyr packages

# scRepertoire VERSION 2.0.2

## UNDERLYING CHANGES

* ```clonalOccupy()``` rewrite counting and NA handling

# scRepertoire VERSION 2.0.1

## UNDERLYING CHANGES

* ```clonalOverlay()``` arguments now cutpoint and use cut.category to select either clonalProportion or clonalFrequency

# scRepertoire VERSION 2.0.0 (2024-01-10)

Expand All @@ -8,6 +57,8 @@
* Added ```percentVJ()```
* Added ```percentKmer()```
* Added ```exportClones()```
* Added ```positionalEntropy()```
* Added ```positionalProperty()```
* Changed compareClonotypes to ```clonalCompare()```
* Changed clonotypeSizeDistribution to ```clonalSizeDistribution()```
* Changed scatterClonotypes to ```clonalScatter()```
Expand All @@ -25,7 +76,7 @@
* **.theCall()** now allows for a custom header/variable and checks the colnames.
* Replaced data arguments to be more descriptive: *df* is now *input.data*, *dir* is now *input*, and *sc* is now *sc.data*
* Deep clean on the documentation for each function for increased consistency and explainability
* ```Startracdiversity()``` metric re-implemented to remove startrac-class object intermediary
* ```StartracDiversity()``` metric re-implemented to remove startrac-class object intermediary
* Implemented powerTCR locally to reduce dependencies and continue support
* Universalized underlying function language and intermediate variables
* License change to MIT
Expand All @@ -38,14 +89,14 @@
* ```clonalDiversity()``` no longer automatically orders samples.
* Remove **order** parameter from ```clonalQuant()```, ```clonalLength()```, and ```clonalAbundance()```
* **x.axis** parameter in ```clonalDiversity()``` separated from **group.by** parameter
* filtering chains will not eliminate none matching chains.

## DEPRECATED AND DEFUNCT

* Deprecate stripBarcodes()
* Deprecate expression2List() (now only an internal function).
* Deprecate checkContigs()


# scRepertoire VERSION 1.11.0

* Rebasing for the purposes of bioconductor version
Expand Down
27 changes: 21 additions & 6 deletions R/clonalAbundance.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
#' @param chain indicate if both or a specific chain should be used -
#' e.g. "both", "TRA", "TRG", "IGH", "IGL"
#' @param group.by The variable to use for grouping
#' @param order.by A vector of specific plotting order or "alphanumeric"
#' to plot groups in order
#' @param scale Converts the graphs into density plots in order to show
#' relative distributions.
#' @param exportTable Returns the data frame used for forming the graph
Expand All @@ -42,7 +44,8 @@ clonalAbundance <- function(input.data,
chain = "both",
scale=FALSE,
group.by = NULL,
exportTable = FALSE,
order.by = NULL,
exportTable = FALSE,
palette = "inferno") {
Con.df <- NULL
xlab <- "Abundance"
Expand All @@ -58,11 +61,17 @@ clonalAbundance <- function(input.data,
data1 <- .parseContigs(input.data, i, names, cloneCall)
label <- input.data[[i]][1,group.by]
data1[,paste(group.by)] <- label
Con.df<- rbind.data.frame(Con.df, data1) }
Con.df <- data.frame(Con.df)
col <- length(unique(Con.df[,group.by]))
fill <- group.by
if (scale == TRUE) {
Con.df<- rbind.data.frame(Con.df, data1)
}
Con.df <- data.frame(Con.df)
col <- length(unique(Con.df[,group.by]))
fill <- group.by
if(!is.null(order.by)) {
Con.df <- .ordering.function(vector = order.by,
group.by = group.by,
data.frame = Con.df)
}
if (scale == TRUE) {
ylab <- "Density of Clones"
plot <- ggplot(Con.df, aes(x=Abundance, fill=Con.df[,group.by])) +
geom_density(aes(y=after_stat(scaled)),
Expand All @@ -86,6 +95,12 @@ clonalAbundance <- function(input.data,
Con.df<- rbind.data.frame(Con.df, data1)
}
Con.df <- data.frame(Con.df)
if(!is.null(order.by)) {
Con.df <- .ordering.function(vector = order.by,
group.by = "values",
data.frame = Con.df)
}

col <- length(unique(Con.df$values))
fill <- "Samples"
if (scale == TRUE) {
Expand Down
64 changes: 40 additions & 24 deletions R/clonalCluster.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#' \code{\link{combineBCR}} or \code{\link{combineExpression}} and amends a
#' cluster to the data frame or meta data. If \strong{exportGraph} is set
#' to TRUE, the function returns an igraph object of the connected sequences.
#' If multiple sequences per chain are present, this function only compares
#' the first sequence.
#'
#' @examples
#' # Getting the combined contigs
Expand All @@ -28,17 +30,20 @@
#' The higher the number the more similarity of sequence will be
#' used for clustering.
#' @param group.by The column header used for to group contigs.
#' If (\strong{NULL}), clusters will be calculated across samples.
#' @param exportGraph Return an igraph object of connected
#' sequences (\strong{TRUE}) or the amended input with a
#' new cluster-based variable (\strong{FALSE}).
#' @importFrom stringdist stringdist
#' @importFrom igraph set_vertex_attr V
#' @importFrom igraph set_vertex_attr V union
#' @importFrom plyr join
#' @importFrom dplyr bind_rows
#' @importFrom dplyr bind_rows summarize
#' @importFrom stringr str_split str_replace_all
#' @importFrom rlang %||%
#' @importFrom SummarizedExperiment colData<- colData
#' @importFrom stats na.omit
#' @importFrom S4Vectors DataFrame
#'
#' @export
#' @concept Visualizing_Clones
#' @return Either amended input with edit-distanced clusters added
Expand Down Expand Up @@ -94,18 +99,23 @@ clonalCluster <- function(input.data,

if (!is.null(group.by)) {
bound <- bind_rows(dat, .id = "group.by")
bound <- bound[!is.na(bound[,ref2]),]
retain.ref <- data.frame(old = bound[,ref2], new = str_split(bound[,ref2], ";", simplify = TRUE)[,1])
bound[,ref2] <- str_split(bound[,ref2], ";", simplify = TRUE)[,1]
graph.variables <- bound %>%
group_by(bound[,ref2]) %>%
dplyr::summarize(sample_count = n(),
unique_samples = paste0(unique(group.by), collapse = ","))
dictionary <- list(bound)
} else {
bound <- bind_rows(dat)
graph.variables <- bind_rows(dat) %>%
bound <- bound[!is.na(bound[,ref2]),]
retain.ref <- data.frame(old = bound[,ref2], new = str_split(bound[,ref2], ";", simplify = TRUE)[,1])
bound[,ref2] <- str_split(bound[,ref2], ";", simplify = TRUE)[,1]
graph.variables <- bound %>%
group_by(bound[,ref2]) %>%
dplyr::summarize(sample_count = n())
dictionary <- dat
}
dictionary <- dat
#Generating Connected Component
output.list <- lapply(dictionary, function(x) {
cluster <- .lvCompare(x,
Expand All @@ -118,25 +128,30 @@ clonalCluster <- function(input.data,
#Grabbing column order for later return
column.order <- colnames(bound)

#Returning the igraph object if eexportGraph = TRUE
#Returning the igraph object if exportGraph = TRUE
if(exportGraph) {
cluster <- output.list[[1]]
vertex <- names(V(cluster))
data_df <- unique(data.frame(
id = V(cluster)$name
))
data_df <- merge(data_df, graph.variables, by = 1)
cluster <- set_vertex_attr(cluster,
name = "size",
index = data_df$id,
value = data_df[,2])
if(ncol(data_df) == 3) { #add grouping variable
if(length(is.null(output.list)) == length(output.list)) {
stop("No clusters detected with current parameters.")
} else {
output.list <- output.list[lapply(output.list,length)>0]
cluster <- do.call(igraph::union, output.list)
vertex <- names(V(cluster))
data_df <- unique(data.frame(
id = vertex
))
data_df <- merge(data_df, graph.variables, by = 1)
cluster <- set_vertex_attr(cluster,
name = "group",
name = "size",
index = data_df$id,
value = data_df[,3])
value = data_df[,2])
if(ncol(data_df) == 3) { #add grouping variable
cluster <- set_vertex_attr(cluster,
name = "group",
index = data_df$id,
value = data_df[,3])
}
return(cluster)
}
return(cluster)
}

cluster.list <- lapply(seq_len(length(output.list)), function(x) {
Expand Down Expand Up @@ -169,10 +184,11 @@ clonalCluster <- function(input.data,
col.name <- names(PreMeta) %||% colnames(PreMeta)
input.data[[col.name]] <- PreMeta
} else {
rownames <- rownames(colData(input.data))
colData(input.data) <- cbind(colData(input.data),
PreMeta[rownames,])[, union(colnames(colData(input.data)), colnames(PreMeta))]
rownames(colData(input.data)) <- rownames
combined_col_names <- unique(c(colnames(colData(sc.data)), colnames(PreMeta)))
full_data <- merge(colData(sc.data), PreMeta[rownames, , drop = FALSE], by = "row.names", all.x = TRUE)
rownames(full_data) <- full_data[, 1]
full_data <- full_data[, -1]
colData(sc.data) <- DataFrame(full_data[, combined_col_names])
}
} else {
#Reorder columns
Expand Down
Loading
Loading