Getting Started#
Loading a sample#
First import missionbio.mosaic and define your h5path, or path to your h5 file on your local device:
import missionbio.mosaic as ms h5path = '/path/to/your/h5/file'
Load in your h5 file using
load():sample = ms.load( h5path, raw=False, filter_variants=True, filter_cells=False, single=True )
The first parameter in the function is the h5path which is defined above.
Next is the
rawparameter, which is set toFalsein most cases. Changing this toTruewill load in all barcodes and raw counts.The
filter_variantsparameter is generally set toTrue, which will only load in filtered dna variants. In some cases your variants of interest may not meet filter criteria, in which case you can change this to False, to load in all dna variants.The
singleparameter is set toFalseby default and will load in merged h5s as separate samples in aSampleGroupobject. The SampleGroup object can be converted to aSampleobject using themerge()method, that can be reversed back by using thesplit()method.Note you can also add a whitelist to this load function to ensure that variants of interest are included, despite filtering thresholds. See the example below:
sample = ms.load( h5path, raw=False, filter_variants=True, single=True, whitelist=["chr1:115258747:C/T", "chr2:198266834:T/C", "chrX:133547940:C/T"], )
Once the analysis is complete, it can be saved using:
ms.save(sample,'/path/to/save/h5')
Merging h5 files#
Multiple h5 files can be merged into one h5 file prior to loading into Mosaic. This code should be run in a terminal/console. Note, this can also be done on the Tapestri pipeline, but this may be the preferred method if you are merging pre-filtered h5 files.
Activate your anaconda environment
$ conda activate mosaic
Call tapestri h5 merge -h to show all all of the different calls you can make with this command.
$ tapestri h5 merge -h
To merge files, run this command tapestri h5 merge samples followed by the files you want to merge, and lastly the name for the new output file.
$ tapestri h5 merge samples sample1.h5 sample2.h5 sample3.h5 merged.h5
Tutorials#
The best way to learn Mosaic is through our Jupyter notebook Vignettes, which demonstrate basic tutorials on how to use Mosaic to analyse DNA + Protein data.