sbol_utilities.calculate_complexity_scores

Module Contents

Classes

IDTAccountAccessor

Class that wraps access to the IDT API

Functions

get_complexity_score(seq: sbol3.Sequence) → Optional[float]

Given a sequence, return its previously computed complexity score, if such exists

get_complexity_scores(sequences: list[sbol3.Sequence], include_missing=False) → dict[sbol3.Sequence, Optional[float]]

Retrieve complexity scores for a list of sequences

idt_calculate_complexity_scores(accessor: IDTAccountAccessor, doc: sbol3.Document) → dict[sbol3.Sequence, float]

Given an SBOL Document, compute the complexity scores for any sequences in the Document not currently scored

idt_calculate_sequence_complexity_scores(accessor: IDTAccountAccessor, sequences: list[sbol3.Sequence]) → dict[sbol3.Sequence, float]

Given a list of sequences, compute the complexity scores for any sequences not currently scored

main()

Main wrapper: read from input file, invoke idt_calculate_complexity_scores, then write to output file

Attributes

COMPLEXITY_SCORE_NAMESPACE

REPORT_ACTIVITY_TYPE

COMPLEXITY_SCORE_NAMESPACE = http://igem.org/IDT_complexity_score
class IDTAccountAccessor(username: str, password: str, client_id: str, client_secret: str)

Class that wraps access to the IDT API

Initialize with required access information for IDT API (see: https://www.idtdna.com/pages/tools/apidoc) Automatically logs in and obtains a session token

Parameters
  • username – Username of your IDT account

  • password – Password of your IDT account

  • client_id – ClientID key of your IDT account

  • client_secret – ClientSecret key of your IDT account

SCORE_TIMEOUT = 120

Number of seconds to wait for score query requests to complete

static from_json(json_object) IDTAccountAccessor

Initialize IDT account accessor from a JSON object with field values

Parameters

json_object – object with account information

Returns

Account accessor object

get_sequence_complexity(self, sequences: list[sbol3.Sequence]) dict[sbol3.Sequence, float]

Extract complexity scores from IDT API for a list of SBOL Sequence objects This works by computing full sequence evaluations, then compressing down to a single score for each sequence.

Parameters

sequences – list of SBOL Sequences to evaluate

Returns

dictionary mapping sequences to complexity Scores

get_sequence_scores(self, sequences: list[sbol3.Sequence]) list

Retrieve synthesis complexity scores of sequences from the IDT API This system uses the gBlock API, which is intended for sequences from 125 to 3000 bp in length. If it is more than 3000 bp or less than 125 bp your returned score will be 0. A complexity score in the range from 0 to 10 means your sequence is synthesizable, if the score is greater or equal than 10 means it is not synthesizable.

Parameters

sequences – sequences for which we want to calculate the complexity score

Returns

dictionary mapping sequences to complexity Scores

Returns

List of lists of dictionaries with information about sequence synthesis features

REPORT_ACTIVITY_TYPE = https://github.com/SynBioDex/SBOL-utilities/compute-sequence-complexity
get_complexity_score(seq: sbol3.Sequence) Optional[float]

Given a sequence, return its previously computed complexity score, if such exists

Parameters

seq – SBOL Sequence object to check for score

Returns

score if set, None if not

get_complexity_scores(sequences: list[sbol3.Sequence], include_missing=False) dict[sbol3.Sequence, Optional[float]]

Retrieve complexity scores for a list of sequences

Parameters
  • sequences – Sequences to get scores for

  • include_missing – if true, Sequences without scores are included, mapping to none

Returns

dictionary mapping Sequence to score

idt_calculate_complexity_scores(accessor: IDTAccountAccessor, doc: sbol3.Document) dict[sbol3.Sequence, float]

Given an SBOL Document, compute the complexity scores for any sequences in the Document not currently scored by sending the sequences to IDT’s online service for calculating sequence synthesis complexity. Also records the complexity computation with an activity

Parameters
  • accessor – IDT API access object

  • doc – SBOL document with sequences of interest in it

Returns

Dictionary mapping Sequences to complexity scores

idt_calculate_sequence_complexity_scores(accessor: IDTAccountAccessor, sequences: list[sbol3.Sequence]) dict[sbol3.Sequence, float]

Given a list of sequences, compute the complexity scores for any sequences not currently scored by sending the sequences to IDT’s online service for calculating sequence synthesis complexity. Also records the complexity computation with an activity

Parameters
  • accessor – IDT API access object

  • sequences – list of SBOL Sequences to evaluate

Returns

Dictionary mapping Sequences to complexity scores for newly computed sequences

main()

Main wrapper: read from input file, invoke idt_calculate_complexity_scores, then write to output file