pulsarpy_to_encodedcc.backport_from_encode_portal.backport

pulsarpy_to_encodedcc.backport_from_encode_portal.backport.set_name(rec)[source]

Most of the models in Pulsar have a name attribute, and most of the time it is required. When backporting a record from the ENCODE Portal, we need some value to use as the record’s name, and records in the Portal don’t have a name prop, so we need to use some other propery value.

The approach taken here is to use the record’s first alias in the ‘aliases’ property as a name if that is present. The alias prefix (the part that includes the ‘:’ and preceeding text) is stripped off. Otherwise, use the ‘acccession’ property if that is present. Otherwise, use the record’s “uuid” property. If for some reason none of these properties are set, an Exception is raised.

Parameters:rec_idstr. An identifier for some record on the ENCODE Portal.
Returns:str designating the value to use for a Pulsar LIMS record’s ‘name’ attribute.
Raises:Exception – A value for name couldn’t be set.
pulsarpy_to_encodedcc.backport_from_encode_portal.backport.target(rec_id)[source]

Backports a source record belonging to https://www.encodeproject.org/profiles/source/json into the Pulsar model called Target.

Identifying properties on the Portal are “aliases”, “label-organism.name”, and “uuid”.

Parameters:rec_idstr. An identifier for a source record on the ENCODE Portal.
Returns:The JSON representation of the existing Target if it already exists in in Pulsar, otherwise the POST response.
Return type:dict
pulsarpy_to_encodedcc.backport_from_encode_portal.backport.biosample(rec_id, patch=False)[source]

Backports a biosample record belonging to https://www.encodeproject.org/profiles/biosample.json into the Pulsar model called Biosample.

Identifying properties on the Portal are “accession”, “aliases”, and “uuid”. Portal’s required props are: award, biosample_term_id, biosample_term_name, biosample_type lab, organism, source

Parameters:rec_idstr. An identifier for a biosample record on the ENCODE Portal.
Returns:The JSON representation of the existing Biosample if it already exists in Pulsar, otherwise the POST response.
Return type:dict
pulsarpy_to_encodedcc.backport_from_encode_portal.backport.crispr_modification(dcc_rec, pulsar_biosample_id, patch=False)[source]

Backports a CRISPR genetic_modification record belonging to https://www.encodeproject.org/profiles/genetic_modification.json into the Pulsar model called CripsrModification. A CRISPR genetic_modification has the “method” property set to “CRISPR”.

Identifying properties on the Portal are “accession”, “aliases”, and “uuid”. Required properties on the Portal include “category”, “method”, and “purpose”.

Parameters:
  • dcc_recdict. The JSON serialization of a genetic_modification record from the ENCODE Portal.
  • pulsar_biosample_idint. The ID of the Biosample record in Pulsar with which to associate the genetic modification.
Returns:

The JSON representation of the existing Document if it already exists in in Pulsar, otherwise the POST response.

Return type:

dict

pulsarpy_to_encodedcc.backport_from_encode_portal.backport.biosample_term_name(biosample_term_name, biosample_term_id)[source]

On the ENCODE Portal, a biosample record has a biosample_term_name property and a biosample_term_id property. These two properties in Pulsar fall under the BiosampleTermName model with names ‘biosample_term_name’ and ‘accession’, respectivly. There isn’t a corresponding model for BiosampleTermName on the ENCODE Portal, and to be able to determine whether Pulsar already has the provided biosample_term_name, a lookup in Pulsar will be done to try and match up the provided biosample_term_id with BiosampleTermName.accession.

Parameters:
  • biosample_term_idstr. The value of a biosample’s ‘biosample_term_id’ property on the Portal.
  • biosample_term_namestr. The value of a biosample’s ‘biosample_term_name’ property on the Portal.
Returns:

The JSON representation of the existing BiosampleTermName if it already exists in in Pulsar, otherwise the POST response.

Return type:

dict

pulsarpy_to_encodedcc.backport_from_encode_portal.backport.document(rec_id)[source]

Backports a document record belonging to https://www.encodeproject.org/profiles/document.json. Example document: https://www.encodeproject.org/documents/716003cd-3ce7-41ce-b1e3-6f203b6632a0/?format=json

Identifying properties on the Portal are “aliases” and “uuid”.

Parameters:rec_idstr. An identifier for a document record on the ENCODE Portal.
Returns:The JSON representation of the existing Document if it already exists in in Pulsar, otherwise the POST response.
Return type:dict
pulsarpy_to_encodedcc.backport_from_encode_portal.backport.donor(rec_id)[source]

Backports a huma-donor record belonging to https://www.encodeproject.org/profiles/human_donor.json.

The record will be checked for existence in Pulsar by doing a search on the field donor.upstread_identifer` using as a query value the record’s accession on the ENCODE Portal, and also its aliases alias.

Parameters:rec_idstr. An identifier (alias or uuid) for a human-donor record on the ENCODE Portal.
Returns:The JSON representation of the existing Donor if it already exists in in Pulsar, otherwise the POST response.
Return type:dict
pulsarpy_to_encodedcc.backport_from_encode_portal.backport.treatment(rec_id, patch=False)[source]

Backports a treatement record belonging to https://www.encodeproject.org/profiles/treatment.json. The required properties in the ENCODE Portal are:

  1. treatment_term_name,
  2. treatment_type.

An example on the Portal: https://www.encodeproject.org/treatments/933a1ff2-43a2-4a54-9c87-aad228d0033e/. Identifying properties on the Portal are ‘aliases’ and ‘uuid’.

Parameters:rec_idstr. An identifier (alias or uuid) for a treatment record on the ENCODE Portal.
Returns:The JSON representation of the existing Treatment if it already exists in in Pulsar, otherwise the POST response.
Return type:dict
pulsarpy_to_encodedcc.backport_from_encode_portal.backport.treatment_term_name(treatment_term_name, treatment_term_id)[source]

On the ENCODE Portal, a treatment record has a treatment_term_name property and a treatment_term_id property. These two properties in Pulsar fall under the TreatmentTermName model with names ‘treatment_term_name’ and ‘accession’, respectivly.

There isn’t a corresponding model for TreatmentTermName on the ENCODE Portal, and to be able to determine whether Pulsar already has the provided treatment_term_name, a lookup in Pulsar will be done to try and match up the provided treatment_term_id with TreatmentTermName.accession.

Parameters:
  • treatment_term_idstr. The value of a treatment’s ‘treatment_term_id’ property on the Portal.
  • treatment_term_namestr. The value of a treatment’s ‘treatment_term_name’ property on the Portal.
Returns:

The JSON representation of the existing TreatmentTermName if it already exists in in Pulsar, otherwise the POST response.

Return type:

dict

pulsarpy_to_encodedcc.backport_from_encode_portal.backport.vendor(rec_id)[source]

Backports a source record belonging to https://www.encodeproject.org/profiles/source.json.

Identifying properties on the Portal are “name”, and “uuid”. Portal’s required props are: “name”, and “title”.

Parameters:rec_idstr. An identifier (uuid or value of the @id’ property) for a source record on the ENCODE Portal. Note that even though a source’s ‘name’ property is specified as identifying on the ENCODE Portal, that alone won’t work for a GET request to pull down that record from the Portal.
Returns:The JSON representation of the existing source if it already exists in in Pulsar, otherwise the POST response.
Return type:dict