If you want to get files out of Bascets, this the tutorial for you! Note that you should avoid doing this unless needed - the map system is there if you wish to process each cell; aggregate can then be used to systematically extract information. These offer the benefit of multithreading and you do not need to worry about having copious amounts of files which definitely will not make your systems administrator happy.
That said, in case of emergency, or if you just want a single file, this is the approach to take.
First obtain an instance using the current precompiled Bascet binary, and ensure that it works. An existing cached binary will be reused:
bascetInstance <- getBascetBinary()
TestBascetInstance(bascetInstance)You can now open a file (here named “skesa”). Internally, this starts a persistent Bascet process to which R sends commands. Reusing this handle makes repeated file operations efficient.
skesa_file <- OpenBascet(
bascetRoot,
"skesa",
bascetInstance
)You can obtain a list of files for a cell like this (see reference for more commands):
BascetListFilesForCell(
skesa_file,
"G1_E5_H7_E11",
bascetInstance = bascetInstance
)A common scenario is that you want the assembled genome of a particular cell. It can be done like this:
contig_file <- BascetReadFile(
skesa_file,
cellID = "G1_E5_H7_E11",
filename = "contigs.fa",
as="text"
)Be sure to close the file when you are done, as you have a rather large ecosystem of tools still in memory!
CloseBascet(
skesa_file
)You can now save the file to disk. If you want to actually look at the data, we recommend loading it using the seqinr package rather than directly using the raw file data obtained by the function above.
writeLines(
contig_file,
"my_genome.fa"
)