Skip to content

Code generator#57

Open
loguille wants to merge 16 commits intoUCLouvain-CBIO:mainfrom
loguille:code_generator
Open

Code generator#57
loguille wants to merge 16 commits intoUCLouvain-CBIO:mainfrom
loguille:code_generator

Conversation

@loguille
Copy link
Copy Markdown
Collaborator

@loguille loguille commented Apr 7, 2026

Add code generator for each step of the workflow.
For the moment this pull request doesn't erase the code when the user goes rerun some previous step.

@loguille loguille requested a review from leopoldguyot April 7, 2026 08:41
@leopoldguyot
Copy link
Copy Markdown
Member

Could you add headers for the different steps ?
Something like this:

################################
####### Package Loading ########
################################
library(QFeatures)

#####################################
##### Step 1: Feature Filtering #####
#####################################
qf <- qf |> filterFeatures(~.qfeaturesgui_rowname != c('2'))

@leopoldguyot
Copy link
Copy Markdown
Member

leopoldguyot commented Apr 8, 2026

Also there is an issue when the user filter the features/samples by the rownames of the rowData/colData.
The internal accessor to the column that store this information in QFeaturesGUI will be used in the script:
qf <- qf |> filterFeatures(~.qfeaturesgui_rowname != c('2'))

@leopoldguyot
Copy link
Copy Markdown
Member

# Reproducible R script
# Generated on: 2026-04-08 15:15:21.352928

library(QFeatures)

qf <- qf[, colData(qf)$SampleType != c("Unused", "Blank")] ## here it should use ! ... %in% c(...,)
qf <- qf |>
    filterFeatures(~ Potential.contaminant != c("+")) |>
    filterFeatures(~ Reverse != c("+")) |>
    filterFeatures(~ .qfeaturesgui_rowname != c("4"))
## normalize() can be use with a "i" parameter
qf <- lapply(names(qf), function(name) { ## This will apply the normalisation to all sets
    normalize(
        object = qf[[name]],
        method = "center.median"
    )
})
## aggregateFeatures can be use with a "i" parameter
qf <- lapply(seq_along(qf), function(i) {
    name <- names(qf)[i]
    aggregateFeatures(
        object = qf[[name]],
        method = colMedians,
        runCol = "Modified.sequence",
        na.rm = TRUE
    )
})
qf <- joinAssays(
    x = qf,
    i = names(qf)
    # it is missing the name specification
)
qf <- lapply(seq_along(qf), function(i) {
    name <- names(qf)[i]
    aggregateFeatures(
        object = qf[[name]],
        method = colMeans,
        runCol = "Leading.razor.protein",
        na.rm = TRUE
    )
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants