alphagenome.models.dna_client.DnaClient#

class alphagenome.models.dna_client.DnaClient(*, channel, model_version=None, metadata=())[source]#

Client for interacting with a DNA model server.

channel#

gRPC channel to the DNA model server.

metadata#

Metadata to send with each request.

model_version#

Optional model version to use for the DNA model server.

Methods#

Table

output_metadata([organism])

Get the metadata for a given organism.

predict_interval(interval, *[, organism])

Generate predictions for a given DNA interval.

predict_intervals(intervals, *[, organism, ...])

Generate predictions for a sequence of DNA intervals.

predict_sequence(sequence, *[, organism])

Generate predictions for a given DNA sequence.

predict_sequences(sequences, *[, organism, ...])

Generate predictions for a given DNA sequence.

predict_variant(interval, variant, *[, organism])

Generate predictions for a given DNA variant.

predict_variants(intervals, variants, *[, ...])

Generate predictions for a given DNA variant.

score_interval(interval[, interval_scorers, ...])

Generate interval scores for a single given interval.

score_intervals(intervals[, ...])

Generate interval scores for a sequence of intervals.

score_ism_variants(interval, ism_interval[, ...])

Generate in-silico mutagenesis (ISM) variant scores for a given interval.

score_variant(interval, variant[, ...])

Generate variant scores for a single given DNA variant.

score_variants(intervals, variants[, ...])

Generate variant scores for a sequence of variants.

DnaClient.output_metadata(organism=Organism.HOMO_SAPIENS)[source]#

Get the metadata for a given organism.

Parameters:

organism (Organism (default: <Organism.HOMO_SAPIENS: 9606>)) – Organism to get metadata for.

Return type:

OutputMetadata

Returns:

OutputMetadata for the provided organism.

DnaClient.predict_interval(interval, *, organism=Organism.HOMO_SAPIENS, requested_outputs, ontology_terms)[source]#

Generate predictions for a given DNA interval.

Parameters:
  • interval (Interval) – DNA interval to make prediction for.

  • organism (Organism (default: <Organism.HOMO_SAPIENS: 9606>)) – Organism to use for the prediction.

  • requested_outputs (Iterable[OutputType]) – Iterable of OutputTypes indicating which subsets of predictions to return.

  • ontology_terms (Iterable[OntologyTerm | str] | None) – Iterable of ontology terms or curies to generate predictions for. If None returns all ontologies.

Return type:

Output

Returns:

Output for the provided DNA interval.

DnaClient.predict_intervals(intervals, *, organism=Organism.HOMO_SAPIENS, requested_outputs, ontology_terms, progress_bar=True, max_workers=5)[source]#

Generate predictions for a sequence of DNA intervals.

Parameters:
  • intervals (Sequence[Interval]) – DNA intervals to make predictions for.

  • organism (Organism (default: <Organism.HOMO_SAPIENS: 9606>)) – Organism to use for the predictions.

  • requested_outputs (Iterable[OutputType]) – Iterable of OutputTypes indicating which subsets of predictions to return.

  • ontology_terms (Iterable[OntologyTerm | str] | None) – Iterable of ontology terms or curies to generate predictions for. If None returns all ontologies.

  • progress_bar (bool (default: True)) – If True, show a progress bar.

  • max_workers (int (default: 5)) – Number of parallel workers to use.

Return type:

list[Output]

Returns:

Outputs for the provided DNA intervals.

DnaClient.predict_sequence(sequence, *, organism=Organism.HOMO_SAPIENS, requested_outputs, ontology_terms)[source]#

Generate predictions for a given DNA sequence.

Parameters:
  • sequence (str) – DNA sequence to make prediction for.

  • organism (Organism (default: <Organism.HOMO_SAPIENS: 9606>)) – Organism to use for the prediction.

  • requested_outputs (Iterable[OutputType]) – Iterable of OutputTypes indicating which subsets of predictions to return.

  • ontology_terms (Iterable[OntologyTerm | str] | None) – Iterable of ontology terms or curies to generate predictions for. If None returns all ontologies.

Return type:

Output

Returns:

Output for the provided DNA sequence.

DnaClient.predict_sequences(sequences, *, organism=Organism.HOMO_SAPIENS, requested_outputs, ontology_terms, progress_bar=True, max_workers=5)[source]#

Generate predictions for a given DNA sequence.

Parameters:
  • sequences (Sequence[str]) – DNA sequences to make predictions for.

  • organism (Organism (default: <Organism.HOMO_SAPIENS: 9606>)) – Organism to use for the prediction.

  • requested_outputs (Iterable[OutputType]) – Iterable of OutputTypes indicating which subsets of predictions to return.

  • ontology_terms (Iterable[OntologyTerm | str] | None) – Iterable of ontology terms or curies to generate predictions for. If None returns all ontologies.

  • progress_bar (bool (default: True)) – If True, show a progress bar.

  • max_workers (int (default: 5)) – Number of parallel workers to use.

Return type:

list[Output]

Returns:

Outputs for the provided DNA sequences.

DnaClient.predict_variant(interval, variant, *, organism=Organism.HOMO_SAPIENS, requested_outputs, ontology_terms)[source]#

Generate predictions for a given DNA variant.

Parameters:
  • interval (Interval) – DNA interval to make prediction for.

  • variant (Variant) – DNA variant to make prediction for.

  • organism (Organism (default: <Organism.HOMO_SAPIENS: 9606>)) – Organism to use for the prediction.

  • requested_outputs (Iterable[OutputType]) – Iterable of OutputTypes indicating which subsets of predictions to return.

  • ontology_terms (Iterable[OntologyTerm | str] | None) – Iterable of ontology terms or curies to generate predictions for. If None returns all ontologies.

Return type:

VariantOutput

Returns:

Variant output for the provided DNA interval and variant.

DnaClient.predict_variants(intervals, variants, *, organism=Organism.HOMO_SAPIENS, requested_outputs, ontology_terms, progress_bar=True, max_workers=5)[source]#

Generate predictions for a given DNA variant.

Parameters:
  • intervals (Interval | Sequence[Interval]) – DNA interval(s) to make predictions for.

  • variants (Sequence[Variant]) – DNA variants to make prediction for.

  • organism (Organism (default: <Organism.HOMO_SAPIENS: 9606>)) – Organism to use for the prediction.

  • requested_outputs (Iterable[OutputType]) – Iterable of OutputTypes indicating which subsets of predictions to return.

  • ontology_terms (Iterable[OntologyTerm | str] | None) – Iterable of ontology terms or curies to generate predictions for. If None returns all ontologies.

  • progress_bar (bool (default: True)) – If True, show a progress bar.

  • max_workers (int (default: 5)) – Number of parallel workers to use.

Return type:

list[VariantOutput]

Returns:

Variant outputs for each DNA interval and variant pair.

DnaClient.score_interval(interval, interval_scorers=(), *, organism=Organism.HOMO_SAPIENS)[source]#

Generate interval scores for a single given interval.

Parameters:
  • interval (Interval) – Interval to make prediction for.

  • interval_scorers (Sequence[TypeVar(IntervalScorerTypes, bound= GeneMaskScorer)] (default: ())) – Sequence of interval scorers to use for scoring. If no interval scorers are provided, the recommended interval scorers for the organism will be used.

  • organism (Organism (default: <Organism.HOMO_SAPIENS: 9606>)) – Organism to use for the prediction.

Return type:

list[AnnData]

Returns:

List of AnnData interval scores.

DnaClient.score_intervals(intervals, interval_scorers=(), *, organism=Organism.HOMO_SAPIENS, progress_bar=True, max_workers=5)[source]#

Generate interval scores for a sequence of intervals.

Parameters:
  • intervals (Sequence[Interval]) – Sequence of DNA intervals to make prediction for.

  • interval_scorers (Sequence[TypeVar(IntervalScorerTypes, bound= GeneMaskScorer)] (default: ())) – Sequence of interval scorers to use for scoring. If no interval scorers are provided, the recommended interval scorers for the organism will be used.

  • organism (Organism (default: <Organism.HOMO_SAPIENS: 9606>)) – Organism to use for the prediction.

  • progress_bar (bool (default: True)) – If True, show a progress bar.

  • max_workers (int (default: 5)) – Number of parallel workers to use.

Return type:

list[list[AnnData]]

Returns:

List of AnnData lists corresponding to score_interval outputs for each interval.

DnaClient.score_ism_variants(interval, ism_interval, variant_scorers=(), *, organism=Organism.HOMO_SAPIENS, progress_bar=True, max_workers=5)[source]#

Generate in-silico mutagenesis (ISM) variant scores for a given interval.

Parameters:
Return type:

list[list[AnnData]]

Returns:

List of variant scores for each variant in the ISM interval.

DnaClient.score_variant(interval, variant, variant_scorers=(), *, organism=Organism.HOMO_SAPIENS)[source]#

Generate variant scores for a single given DNA variant.

Parameters:
Return type:

list[AnnData]

Returns:

List of AnnData variant scores.

DnaClient.score_variants(intervals, variants, variant_scorers=(), *, organism=Organism.HOMO_SAPIENS, progress_bar=True, max_workers=5)[source]#

Generate variant scores for a sequence of variants.

Parameters:
Return type:

list[list[AnnData]]

Returns:

List of AnnData lists corresponding to score_variant outputs for each variant.