Deletion

Safely delete output from a PhysiCellModelManager.jl project.

Public API

PhysiCellModelManager.deleteSimulationsMethod
deleteSimulations(simulation_ids::AbstractVector{<:Union{Integer,Missing}}; delete_supers::Bool=true, filters::Dict{<:AbstractString, <:Any}=Dict{AbstractString, Any}())

Deletes the simulations with the input IDs from the database and from the data/outputs/simulations folder.

Works with a vector of simulation IDs, a single simulation ID, a vector of Simulations or a single Simulation. If delete_supers is true, it will also delete any monads, samplings, and trials that no longer have any simulations associated with them. It is recommended to leave this to true to keep the database clean. The filters argument allows for additional SQLite conditions to be added to the WHERE clause of the SQLite query. Use this only after inspecting the simulations table in the data/pcmm.db database. Note: deleteSimulation is an alias for deleteSimulations.

Examples

deleteSimulations(1:3)
deleteSimulations(4)
deleteSimulations(1:100; filters=Dict("config_id" => 1)) # delete simulations with IDs 1 to 100 that have config_id = 1
source
PhysiCellModelManager.deleteSimulationsByStatusFunction
deleteSimulationsByStatus(status_codes_to_delete::Vector{String}=["Failed"]; user_check::Bool=true)

Delete simulations from the database based on their status codes.

The list of possible status codes is: "Not Started", "Queued", "Running", "Completed", "Failed".

Arguments

  • status_codes_to_delete::Vector{String}: A vector of status codes for which simulations should be deleted. Default is ["Failed"].
  • user_check::Bool: If true, prompts the user for confirmation before deleting simulations. Default is true.
source
PhysiCellModelManager.resetDatabaseMethod
resetDatabase()

Reset the database (after user confirmation) by deleting all simulations, monads, samplings, and trials.

All the base inputs files will be kept, so previously run scripts should still work as expected. If the user aborts the reset, the user will then be asked if they want to continue with the script.

Keyword Arguments

  • force_reset::Bool: If true, skips the user confirmation prompt. Default is false.
  • force_continue::Bool: If true, skips the user confirmation prompt for continuing with the script after aborting the reset. Default is false.
source

Private API

PhysiCellModelManager.buildWhereClauseMethod
buildWhereClause(table_name::String, ids::Vector{<:Integer}, filters::Dict{<:AbstractString, <:Any}; db::SQLite.DB=centralDB())

Builds a WHERE clause for SQL queries based on the provided IDs and filters.

Following PCMM conventions, the ID of the table is expected to be named "$(x)_id", where x is the table name with the end s removed (e.g., simulation_id for the simulations table).

Arguments

  • table_name: The name of the table to check for valid columns.
  • ids: A vector of IDs to include in the WHERE clause.
  • filters: A dictionary of additional filters to apply to the WHERE clause. Default is an empty dictionary. The keys should be valid column names and the values should be the values to filter by.

Keyword Arguments

  • db: The SQLite database connection to use. Default is the central database.

Examples

julia> PhysiCellModelManager.buildWhereClause("simulations", [1, 2, 3], Dict("config_id" => 1))
("WHERE simulation_id IN (1,2,3) AND config_id = ?", Any[1])
source
PhysiCellModelManager.deleteMonadMethod
deleteMonad(monad_ids::AbstractVector{<:Integer}; delete_subs::Bool=true, delete_supers::Bool=true)

Delete monads from the database by monad ID.

Arguments

  • monad_ids: list of monad IDs to delete. Can also pass an Integer.
  • delete_subs: If delete_subs is true, will further delete the simulations corresponding to the monad.
  • delete_supers: If delete_supers is true, will further delete any samplings that no longer have associated monads after the deletion.
source
PhysiCellModelManager.deleteSamplingMethod
deleteSampling(sampling_ids::AbstractVector{<:Integer}; delete_subs::Bool=true, delete_supers::Bool=true)

Delete samplings from the database by sampling ID.

Arguments

  • sampling_ids: list of sampling IDs to delete. Can also pass an Integer.
  • delete_subs: If delete_subs is true, will further delete the monads corresponding to the sampling.
  • delete_supers: If delete_supers is true, will further delete any trials that no longer have associated samplings after the deletion.
source
PhysiCellModelManager.deleteTrialMethod
deleteTrial(trial_ids::AbstractVector{<:Integer}; delete_subs::Bool=true)

Delete trials from the database by trial ID.

Arguments

  • trial_ids: list of trial IDs to delete. Can also pass an Integer.
  • delete_subs: If delete_subs is true, will further delete the samplings corresponding to the trials.
source
PhysiCellModelManager.eraseSimulationIDFromConstituentsMethod
eraseSimulationIDFromConstituents(simulation_id::Int[; monad_id::Union{Missing,Int}=missing])

Erase a simulation ID from the simulations.csv file of the monad it belongs to.

If monad_id is not provided, the function will infer it from the simulation ID. If the monad contains only the given simulation ID, the monad will be deleted. This is used when running simulations if they error so that the monads no longer rely on them, but the simulation output can still be checked.

source
PhysiCellModelManager.resetFolderMethod
resetFolder(location::Symbol, folder::String)

Reset a specific folder in the database for a given location, removing the variations database and variations folder.

Arguments

  • location: The location of the folder to reset.
  • folder: The name of the folder to reset.
source
PhysiCellModelManager.rm_hpc_safeMethod
rm_hpc_safe(path::String; force::Bool=false, recursive::Bool=false)

Remove files and take care if on an HPC since the NFS filesystem can leave behind extra files.

If on an HPC, move deleted files into the hidden directory data/.trash/ in a time-stamped folder.

source