The quasar module

A class for determining HiC data quality.

class hifive.quasar.Quasar(filename, mode='a', silent=False)

This class performs subsampling and QuASAR transformations for calculating HiC quality.

Note

This class is also available as hifive.Quasar

When initialized, this class creates an h5dict in which to store all data associated with this object.

Parameters:
  • filename (str.) – The file name of the h5dict to store the QuASAR-transformed data in.
  • mode (str.) – The mode to open the h5dict with. This should be ‘w’ for creating or overwriting an h5dict with name given in filename.
  • silent (bool.) – Indicates whether to print information about function execution for this object.
Returns:

Quasar class object.

close()

Close h5dict file.

Returns:None
find_quality_scores(chroms=[])

Find QuASAR quality scores across whole dataset.

Parameters:chroms (list) – A list of chromosome names to calculate quality scores for.
Returns:A structured numpy array with the fields ‘chromosome’, ‘resolution’, ‘coverage’, and ‘score’.
find_replicate_scores(replicate, chroms=[])

Find QuASAR replicate scores across whole dataset.

Parameters:
  • replicate (class:Quasar class object.) – A class:Quasar object to calculate replicate scores with. If this function has been previously called with a different sample, the current transformed matrices will be deleted prior to calculating new matrices.
  • chroms (list) – A list of chromosome names to calculate replicate scores for.
Returns:

A structured numpy array with the fields ‘resolution’, ‘coverage’, and ‘score’.

find_transformation(hic, chroms=[], resolutions=[1000000, 200000, 40000, 10000], coverages=[0, 40000000, 20000000, 10000000, 5000000, 2000000, 1000000], seed=None)

Find QuASAR transformation from the specified HiC project.

Parameters:
  • hic (class:HiC class object.) – The HiC project from which to calculate QuASAR transformations from. If this function has been previously called with a different HiC project, the current transformed matrices will be deleted prior to calculating new matrices.
  • chroms – A list of chromosome names to calculate transformed matrices from. If this is an empty list, all chromosomes from the HiC object will be used.
  • resolutions (list) – A list of binning resolutions to find transformed matrices for.
  • coverages (list) – A list of cis read counts to downsample to prior to finding transformed matrices. A value of 0 indicates to use all reads. Coverages are calculated across only chromosomes specified in the ‘chroms’ argument.
  • seed – An integer to use as the initialization value for the random number generator.
Returns:

Quasar class object.

load(mode='a')

Load data from h5dict specified at object creation.

Any call of this function will overwrite current object data with values from the last save() call.

Parameters:mode (str.) – The mode to open the h5dict with.
Returns:None
print_report(filename, qscores=None, rscores=None, scores_only=False)

Write QuASAR scores to output file.

Parameters:filename (str.) – The location to write the report to. The suffix will be used to determine the output format.
Returns:None
save()

Save analysis parameters to h5dict.

Returns:None