pulsarpy.utils¶
-
pulsarpy.utils.
send_mail
(form, from_name)[source]¶ Sends a mail using the configured mail server for Pulsar. See mailgun documentation at https://documentation.mailgun.com/en/latest/user_manual.html#sending-via-api for specifics.
Parameters: form – dict. The mail form fields, i.e. ‘to’, ‘from’, …
Returns: requests.models.Response instance.
Raises: - requests.exceptions.HTTPError – The status code is not ok.
- Exception – The environment variable MAILGUN_DOMAIN or MAILGUN_API_KEY isn’t set.
Example:
payload = { "from"="{} <mailgun@{}>".format(from_name, pulsarpy.MAIL_DOMAIN), "subject": "mailgun test", "text": "howdy there", "to": "nathankw@stanford.edu", } send_mail(payload)
-
pulsarpy.utils.
get_exp_of_biosample
(biosample_rec)[source]¶ Determines whether the biosample is part of a ChipseqExperiment or SingleCellSorting Experiment, and if so, returns the associated experiment as a models.Model instance that is one of those two classes. The biosample is determined to be part of a ChipseqExperiment if the Biosample.chipseq_experiment_id attribute is set, meaning that the biosample can be associated to the ChipseqExperiment as a replicate via any of of the following ChipseqExperiment attributes:
ChipseqExperiment.replicates ChipseqExperiment.control_replicatesThe biosample will be determined to be part of a SingleCellSorting experiment if the Biosample.sorting_biosample_single_cell_sorting attribute is set, meaning that it is the SingleCellSorting.sorting_biosample.
Parameters: biosample_rec – dict. A Biosample record as returned by instantiating models.Biosample. Raises: Exception – An experiment is not associated to this biosample.