3.5 Saving and Loading an ArchRProject

ArchR provides a facile way to save an ArchRProject object to either re-load at a later time or share with other users. Fundamentally, an ArchRProject points to a set of Arrow files. Because of this, the process of saving an ArchRProject using the saveArchRProject() function will:

  1. Copy the current Arrow files to the designated outputDirectory so that they are exclusively associated with the new ArchRProject object.
  2. Save a copy of the designated ArchRProject in the outputDirectory.

For example, we can save our projHeme1 using saveArchRProject() which will allow us to use this project in future chapters.

saveArchRProject(ArchRProj = projHeme1, outputDirectory = "Save-ProjHeme1", load = FALSE)

## Copying ArchRProject to new outputDirectory : /oak/stanford/groups/howchang/users/jgranja/ArchRTutorial/ArchRBook/BookOutput4/Save-ProjHeme1
## Copying Arrow Files…
## Copying Arrow Files (1 of 3)
## Copying Arrow Files (2 of 3)
## Copying Arrow Files (3 of 3)
## Getting ImputeWeights
## No imputeWeights found, returning NULL
## Copying Other Files…
## Copying Other Files (1 of 1): Plots
## Saving ArchRProject…

This will copy the Arrow files and save a .RDS file of the projHeme1 ArchRProject object in the specified outputDirectory. Very important! This process does NOT automatically update the ArchRProject object that is active in your current R session. Specifically, the object named projHeme1 in the current R session will still point to the original location of the Arrow files, not the copied Arrow files that reside in the specified outputDirectory. If we wanted to do this, we would specify load = TRUE which causes the saveArchRProject() function to return the saved ArchRProject object which you can assign to overwrite the original ArchRProject object using <-. This effectively saves and loads the ArchRProject from its new location.