Can we change the width in the scorer function?

Hi,

Can we change the width of the pre-defined scorer function? If yes, can you share a sample code for changing the width ?

Regards and Thanks,

Sanjana

For the API, we only support a subset of widths (the reason is for legacy reasons and todo with how we warm-start the model during startup). You can set this as follows:

from alphagenome.data import genome
from alphagenome.models import dna_client
from alphagenome.models import variant_scorers

client = dna_client.create(API_KEY)

variant = genome.Variant.from_str('chr1:1000000:A>C')
interval = variant.reference_interval.resize(2**19)

client.score_variant(
    interval,
    variant,
    variant_scorers=[
        variant_scorers.CenterMaskScorer(
            requested_output=dna_client.OutputType.RNA_SEQ,
            width=501,
            aggregation_type=variant_scorers.AggregationType.DIFF_LOG2_SUM,
        )
    ],
)

For the open-source model, you can provide any width.

FWIW I was in the same boat (for CenterMaskScorer specifically) and tried providing a different width but iirc I hit an error saying I could only select among a pre-defined set of widths (this was with the open-source model btw). I think because even the open-source model still uses the CenterMaskScorerdefinition from the API, which throws in the post_init if the width is not a supported one. Is it safe to comment out the check or is other an actual reason that the width must be one of those? (I’m guessing yes or there wouldn’t be a check, but still :slight_smile: ) Thanks!

Ah yes, that’s an oversight in the open-source code (you can definitely use any width).

You’re absolutely fine to comment out the check, I’ll update the code so that this is only done when using the API and not the open-source model.