Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
11 changes: 6 additions & 5 deletions tools/seurat/create_seurat.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<expand macro="bio_tools"/>
<expand macro="requirements"/>
<expand macro="version_command"/>
<expand macro="creators"/>
<command detect_errors="exit_code"><![CDATA[
#if str($method.method) == 'CreateSeuratObject':
#if str($method.input_type.input_type) == 'mtx':
Expand Down Expand Up @@ -350,7 +351,7 @@ seurat_obj[['$method.col_name']]<-PercentageFeatureSet(
<has_text_matching expression="CreateSeuratObject"/>
</assert_contents>
</output>
<output name="rds_out" location="https://zenodo.org/records/13732784/files/rawdata.rds" ftype="rds"/>
<output name="rds_out" location="https://zenodo.org/records/17817806/files/rawdata.rds" ftype="rds"/>
</test>
<test expect_num_outputs="2">
<!-- test2: CreateSeuratObject from tabular -->
Expand All @@ -370,7 +371,7 @@ seurat_obj[['$method.col_name']]<-PercentageFeatureSet(
<has_text_matching expression="CreateSeuratObject"/>
</assert_contents>
</output>
<output name="rds_out" location="https://zenodo.org/records/13732784/files/rawdata2.rds" ftype="rds"/>
<output name="rds_out" location="https://zenodo.org/records/17817806/files/rawdata2.rds" ftype="rds"/>
</test>
<test expect_num_outputs="2">
<!-- test3: CreateSeuratObject with CITE-Seq -->
Expand All @@ -395,7 +396,7 @@ seurat_obj[['$method.col_name']]<-PercentageFeatureSet(
<has_text_matching expression="CreateSeuratObject"/>
</assert_contents>
</output>
<output name="rds_out" location="https://zenodo.org/records/13732784/files/citeseq.rds" ftype="rds"/>
<output name="rds_out" location="https://zenodo.org/records/17817806/files/citeseq.rds" ftype="rds" compare="sim_size"/>
</test>
<test expect_num_outputs="2">
<!-- test4: Add_QC_Metrics -->
Expand All @@ -417,7 +418,7 @@ seurat_obj[['$method.col_name']]<-PercentageFeatureSet(
<has_text_matching expression="percent.ribo"/>
</assert_contents>
</output>
<output name="rds_out" location="https://zenodo.org/records/13732784/files/ribodata.rds" ftype="rds"/>
<output name="rds_out" location="https://zenodo.org/records/17817806/files/ribodata.rds" ftype="rds"/>
</test>
<test expect_num_outputs="2">
<!-- test5: FilterCells -->
Expand All @@ -440,7 +441,7 @@ seurat_obj[['$method.col_name']]<-PercentageFeatureSet(
<has_text_matching expression="subset"/>
</assert_contents>
</output>
<output name="rds_out" location="https://zenodo.org/records/13732784/files/filtered.rds" ftype="rds"/>
<output name="rds_out" location="https://zenodo.org/records/17817806/files/filtered.rds" ftype="rds" compare="sim_size"/>
</test>
</tests>
<help><![CDATA[
Expand Down
117 changes: 100 additions & 17 deletions tools/seurat/inspect_and_manipulate.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<expand macro="bio_tools"/>
<expand macro="requirements"/>
<expand macro="version_command"/>
<expand macro="creators"/>
<command detect_errors="exit_code"><![CDATA[
@CMD@
]]></command>
Expand Down Expand Up @@ -123,7 +124,51 @@
seurat_obj,
subset = $method.manipulate.grouping == '$method.manipulate.groups',
)


#else if $method.manipulate.manipulate == 'Subset_Logical'

colname_raw <- "$method.manipulate.column"
operator_code <- "$method.manipulate.operator"
value_str <- "$method.manipulate.value"

# Map operator codes to actual operators
operator_map <- c(
"gt" = ">",
"lt" = "<",
"gte" = ">=",
"lte" = "<=",
"eq" = "==",
"ne" = "!="
)
operator <- operator_map[operator_code]

# Wrap column name in backticks if it contains special characters
# Check for non-alphanumeric characters (except underscore and dot)
if (grepl("[^A-Za-z0-9_.]", colname_raw) || grepl("^[0-9]", colname_raw)) {
colname <- paste0("`", colname_raw, "`")
} else {
colname <- colname_raw
}

# Convert value to numeric if possible
value_num <- suppressWarnings(as.numeric(value_str))
if (!is.na(value_num)) {
value <- value_num
} else {
# If value is a string, wrap it in quotes
value <- paste0('"', value_str, '"')
}

# Build expression string
expr_text <- paste0(colname, " ", operator, " ", value)

# Parse and evaluate the expression
library(rlang)
expr <- rlang::parse_expr(expr_text)

# Subset Seurat object
seurat_obj <- subset(seurat_obj, subset = !!expr)

#else if $method.manipulate.manipulate == 'DietSeurat'

#if $method.manipulate.features
Expand Down Expand Up @@ -235,6 +280,7 @@
<option value="Merge">Merge Seurat Objects</option>
<option value="Subset_Ident">Subset by Ident</option>
<option value="Subset_Group">Subset by Group</option>
<option value="Subset_Logical">Subset Seurat Logic</option>
<option value="DietSeurat">Choose elements to keep with 'DietSeurat'</option>
<option value="AggregateExpression">Pseudobulk cells with 'AggregateExpression'</option>
<option value="DefaultAssay">Set default assay</option>
Expand Down Expand Up @@ -300,6 +346,20 @@
<param name="grouping" type="text" value="" label="Grouping to use to select cells" help="from the object metadata e.g. batch, donor"/>
<param name="groups" type="text" value="" label="Group to keep" help="enter a single category from the grouping"/>
</when>
<when value="Subset_Logical">
<param name="column" type="text" value="" label="Metadata column"
help="Column in Seurat object metadata to filter on (e.g. nCount_Spatial, percent.mt)"/>
<param name="operator" type="select" value="gt"
label="Operator" help="Logical operator for filtering">
<option value="gt">&gt; (greater than)</option>
<option value="lt">&lt; (less than)</option>
<option value="gte">&gt;= (greater than or equal)</option>
<option value="lte">&lt;= (less than or equal)</option>
<option value="eq">== (equal)</option>
<option value="ne">!= (not equal)</option>
</param>
<param name="value" type="text" value="" label="Value" help="Value to compare against"/>
</when>
<when value="DietSeurat">
<param argument="layers" type="text" value="counts" label="Layers to keep" help="comma-separated list">
<expand macro="valid_list"/>
Expand Down Expand Up @@ -356,7 +416,7 @@
<has_text_matching expression="seurat_obj"/>
</assert_contents>
</output>
<output name="inspect_general" location="https://zenodo.org/records/13732784/files/inspect.txt" ftype="txt">
<output name="inspect_general" location="https://zenodo.org/records/17817806/files/inspect.txt" ftype="txt">
<assert_contents>
<has_text_matching expression="An object of class Seurat"/>
</assert_contents>
Expand All @@ -379,7 +439,7 @@
<has_text_matching expression="Cells"/>
</assert_contents>
</output>
<output name="inspect_tabular" location="https://zenodo.org/records/13732784/files/inspect_cells.tabular" ftype="tabular">
<output name="inspect_tabular" location="https://zenodo.org/records/17817806/files/inspect_cells.tabular" ftype="tabular">
<assert_contents>
<has_n_columns n="1"/>
</assert_contents>
Expand All @@ -403,7 +463,7 @@
<has_text_matching expression="Features"/>
</assert_contents>
</output>
<output name="inspect_tabular" location="https://zenodo.org/records/13732784/files/inspect_features.tabular" ftype="tabular">
<output name="inspect_tabular" location="https://zenodo.org/records/17817806/files/inspect_features.tabular" ftype="tabular">
<assert_contents>
<has_n_columns n="1"/>
</assert_contents>
Expand All @@ -427,7 +487,7 @@
<has_text_matching expression="seurat_obj"/>
</assert_contents>
</output>
<output name="inspect_tabular" location="https://zenodo.org/records/13732784/files/inspect_metadata_group.tabular" ftype="tabular">
<output name="inspect_tabular" location="https://zenodo.org/records/17817806/files/inspect_metadata_group.tabular" ftype="tabular">
<assert_contents>
<has_n_columns n="1"/>
</assert_contents>
Expand All @@ -450,7 +510,7 @@
<has_text_matching expression="Idents"/>
</assert_contents>
</output>
<output name="inspect_tabular" location="https://zenodo.org/records/13732784/files/inspect_idents.tabular" ftype="tabular">
<output name="inspect_tabular" location="https://zenodo.org/records/17817806/files/inspect_idents.tabular" ftype="tabular">
<assert_contents>
<has_n_columns n="2"/>
</assert_contents>
Expand All @@ -473,15 +533,15 @@
<has_text_matching expression="seurat_obj"/>
</assert_contents>
</output>
<output name="inspect_tabular" location="https://zenodo.org/records/13732784/files/inspect_matrix.tabular" ftype="tabular">
<output name="inspect_tabular" location="https://zenodo.org/records/17817806/files/inspect_matrix.tabular" ftype="tabular">
<assert_contents>
<has_n_columns n="249"/>
</assert_contents>
</output>
</test>
<test expect_num_outputs="2">
<!-- test7: Change Idents-->
<param name="seurat_rds" location="https://zenodo.org/records/13732784/files/clusters.rds"/>
<param name="seurat_rds" location="https://zenodo.org/records/17817806/files/clusters.rds"/>
<conditional name="method">
<param name="method" value="Manipulate"/>
<conditional name="manipulate">
Expand All @@ -497,7 +557,7 @@
<has_text_matching expression="Idents"/>
</assert_contents>
</output>
<output name="rds_out" location="https://zenodo.org/records/13732784/files/changed_idents.rds" ftype="rds"/>
<output name="rds_out" location="https://zenodo.org/records/17817806/files/changed_idents.rds" ftype="rds" compare="sim_size"/>
</test>
<test expect_num_outputs="2">
<!-- test8: Rename Idents-->
Expand All @@ -524,7 +584,7 @@
<has_text_matching expression="Idents"/>
</assert_contents>
</output>
<output name="rds_out" location="https://zenodo.org/records/13732784/files/renamed_clusters.rds" ftype="rds"/>
<output name="rds_out" location="https://zenodo.org/records/17817806/files/renamed_clusters.rds" ftype="rds"/>
</test>
<test expect_num_outputs="2">
<!-- test9: Add Metadata-->
Expand All @@ -544,7 +604,7 @@
<has_text_matching expression="AddMetaData"/>
</assert_contents>
</output>
<output name="rds_out" location="https://zenodo.org/records/13732784/files/added_metadata.rds" ftype="rds"/>
<output name="rds_out" location="https://zenodo.org/records/17817806/files/added_metadata.rds" ftype="rds"/>
</test>
<test expect_num_outputs="2">
<!-- test10: Merge-->
Expand All @@ -564,7 +624,7 @@
<has_text_matching expression="merge"/>
</assert_contents>
</output>
<output name="rds_out" location="https://zenodo.org/records/13736785/files/merged.rds" ftype="rds"/>
<output name="rds_out" location="https://zenodo.org/records/17817806/files/merged.rds" ftype="rds"/>
</test>
<test expect_num_outputs="2">
<!-- test11: Subset Ident-->
Expand All @@ -584,7 +644,7 @@
<has_text_matching expression="subset"/>
</assert_contents>
</output>
<output name="rds_out" location="https://zenodo.org/records/13732784/files/subset_cluster.rds" ftype="rds"/>
<output name="rds_out" location="https://zenodo.org/records/17817806/files/subset_cluster.rds" ftype="rds"/>
</test>
<test expect_num_outputs="2">
<!-- test12: Subset Group-->
Expand All @@ -605,7 +665,7 @@
<has_text_matching expression="subset"/>
</assert_contents>
</output>
<output name="rds_out" location="https://zenodo.org/records/13732784/files/subset_Group_A.rds" ftype="rds"/>
<output name="rds_out" location="https://zenodo.org/records/17817806/files/subset_Group_A.rds" ftype="rds"/>
</test>
<test expect_num_outputs="2">
<!-- test13: DietSeurat-->
Expand All @@ -626,7 +686,7 @@
<has_text_matching expression="DietSeurat"/>
</assert_contents>
</output>
<output name="rds_out" location="https://zenodo.org/records/13732784/files/diet_seurat.rds" ftype="rds"/>
<output name="rds_out" location="https://zenodo.org/records/17817806/files/diet_seurat.rds" ftype="rds"/>
</test>
<test expect_num_outputs="2">
<!-- test14: AggregateExpression-->
Expand All @@ -646,7 +706,7 @@
<has_text_matching expression="AggregateExpression"/>
</assert_contents>
</output>
<output name="rds_out" location="https://zenodo.org/records/13732784/files/aggregated.rds" ftype="rds" compare="sim_size"/>
<output name="rds_out" location="https://zenodo.org/records/17817806/files/aggregated.rds" ftype="rds" compare="sim_size"/>
</test>
<test expect_num_outputs="2">
<!-- test15: Default Assay-->
Expand All @@ -666,7 +726,30 @@
<has_text_matching expression="DefaultAssay"/>
</assert_contents>
</output>
<output name="rds_out" location="https://zenodo.org/records/13732784/files/default.rds" ftype="rds"/>
<output name="rds_out" location="https://zenodo.org/records/17817806/files/default.rds" ftype="rds"/>
</test>
<test expect_num_outputs="2">
<!-- test16: Subset Logical -->
<param name="seurat_rds" location="https://zenodo.org/records/17817806/files/test_seurat_spatial.rds"/>
<conditional name="method">
<param name="method" value="Manipulate"/>
<conditional name="manipulate">
<param name="manipulate" value="Subset_Logical"/>
<!-- Split expression into column/operator/value -->
<param name="column" value="nCount_Spatial"/>
<param name="operator" value="gt"/>
<param name="value" value="0"/>
</conditional>
</conditional>
<section name="advanced_common">
<param name="show_log" value="true"/>
</section>
<output name="hidden_output">
<assert_contents>
<has_text_matching expression="subset"/>
</assert_contents>
</output>
<output name="rds_out" location="https://zenodo.org/records/17817806/files/test_seurat_spatial.rds" ftype="rds" compare="sim_size"/>
</test>
</tests>
<help><![CDATA[
Expand Down
11 changes: 6 additions & 5 deletions tools/seurat/integrate.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<expand macro="bio_tools"/>
<expand macro="requirements"/>
<expand macro="version_command"/>
<expand macro="creators"/>
<command detect_errors="exit_code"><![CDATA[
@CMD@
]]></command>
Expand Down Expand Up @@ -230,7 +231,7 @@
<has_text_matching expression="split"/>
</assert_contents>
</output>
<output name="rds_out" location="https://zenodo.org/records/13732784/files/splitdata.rds" ftype="rds"/>
<output name="rds_out" location="https://zenodo.org/records/17817806/files/splitdata.rds" ftype="rds"/>
</test>
<test expect_num_outputs="2">
<!-- test2: IntegrateLayers-->
Expand All @@ -251,7 +252,7 @@
<has_text_matching expression="IntegrateLayers"/>
</assert_contents>
</output>
<output name="rds_out" location="https://zenodo.org/records/13732784/files/cca_integrated.rds" ftype="rds"/>
<output name="rds_out" location="https://zenodo.org/records/17817806/files/cca_integrated.rds" ftype="rds"/>
</test>
<test expect_num_outputs="2">
<!-- test3: IntegrateLayers - Harmony Installed-->
Expand All @@ -272,7 +273,7 @@
<has_text_matching expression="IntegrateLayers"/>
</assert_contents>
</output>
<output name="rds_out" location="https://zenodo.org/records/13732784/files/harm_integrated.rds" ftype="rds" compare="sim_size"/>
<output name="rds_out" location="https://zenodo.org/records/17817806/files/harm_integrated.rds" ftype="rds" compare="sim_size"/>
</test>
<test expect_num_outputs="2">
<!-- test4: JoinLayers-->
Expand All @@ -288,7 +289,7 @@
<has_text_matching expression="JoinLayers"/>
</assert_contents>
</output>
<output name="rds_out" location="https://zenodo.org/records/13732784/files/joined.rds" ftype="rds"/>
<output name="rds_out" location="https://zenodo.org/records/17817806/files/joined.rds" ftype="rds"/>
</test>
<test expect_num_outputs="2">
<!-- test5: PrepSCTFindMarkers-->
Expand All @@ -304,7 +305,7 @@
<has_text_matching expression="PrepSCTFindMarkers"/>
</assert_contents>
</output>
<output name="rds_out" location="https://zenodo.org/records/13732784/files/PrepSCTFindMarkers.rds" ftype="rds"/>
<output name="rds_out" location="https://zenodo.org/records/17817806/files/PrepSCTFindMarkers.rds" ftype="rds"/>
</test>
</tests>
<help><![CDATA[
Expand Down
Loading