Skip to content

Commit

Permalink
please please please
Browse files Browse the repository at this point in the history
  • Loading branch information
MattWellie committed Jan 29, 2025
1 parent b92c351 commit c0fb2e2
Showing 1 changed file with 54 additions and 7 deletions.
61 changes: 54 additions & 7 deletions src/talos/RunHailFiltering.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,23 @@ def annotate_exomiser(mt: hl.MatrixTable, exomiser: str | None = None) -> hl.Mat
Returns:
The same MatrixTable but with additional annotations
"""
if not exomiser or (
'exomiser'
in config_retrieve(
['ValidateMOI', 'ignore_categories'],
[],
)
):
get_logger().info('No exomiser table found, skipping annotation')
return mt.annotate_rows(info=mt.info.annotate(categorydetailsexomiser=MISSING_STRING))

get_logger().info(f'loading exomiser variants from {exomiser}')
exomiser_ht = hl.read_table(exomiser)
return mt.annotate_rows(
info=mt.info.annotate(
categorydetailsexomiser=hl.or_else(exomiser_ht[mt.row_key].proband_details, MISSING_STRING),
),
)

get_logger().info('No exomiser table found, skipping annotation')
return mt.annotate_rows(info=mt.info.annotate(categorydetailsexomiser=MISSING_STRING))
Expand Down Expand Up @@ -235,16 +252,46 @@ def annotate_splicevardb(mt: hl.MatrixTable, svdb_path: str | None):
Returns:
Same MT with an extra category label
"""
if svdb_path is None or (
'svdb'
in config_retrieve(
['ValidateMOI', 'ignore_categories'],
[],
)
):
get_logger().info('Skipping SVDB annotation')
return mt.annotate_rows(
info=mt.info.annotate(
categorybooleansvdb=MISSING_INT,
svdb_location=MISSING_STRING,
svdb_method=MISSING_STRING,
svdb_doi=MISSING_STRING,
)
)

# read in the codon table
get_logger().info(f'Reading SpliceVarDB data from {svdb_path}')
svdb_ht = hl.read_table(svdb_path)

get_logger().info('SVDB table not found, skipping annotation')
# annotate relevant variants with the SVDB results
mt = mt.annotate_rows(
info=mt.info.annotate(
svdb_classification=hl.or_else(svdb_ht[mt.row_key].classification, MISSING_STRING),
svdb_location=hl.or_else(svdb_ht[mt.row_key].location, MISSING_STRING),
svdb_method=hl.or_else(svdb_ht[mt.row_key].method, MISSING_STRING),
svdb_doi=hl.or_else(svdb_ht[mt.row_key].doi, MISSING_STRING),
),
)

# annotate category if Splice-altering according to SVDB
return mt.annotate_rows(
info=mt.info.annotate(
categorydetailssvdb=MISSING_STRING,
svdb_classification=MISSING_STRING,
svdb_location=MISSING_STRING,
svdb_method=MISSING_STRING,
svdb_doi=MISSING_STRING,
)
categorybooleansvdb=hl.if_else(
mt.info.svdb_classification.lower().contains(SPLICE_ALTERING),
ONE_INT,
MISSING_INT,
),
),
)


Expand Down

0 comments on commit c0fb2e2

Please sign in to comment.