Skip to content

Commit

Permalink
Adding PMIDs for struc vars
Browse files Browse the repository at this point in the history
  • Loading branch information
xiamaz committed Oct 4, 2023
1 parent 8cf00de commit 25c1ac2
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions clinvar_this/io/tsv.py
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,8 @@ def record_pubmed_citations(
)
for pmid in record.pmids
]
return None
else:
return None

def record_clinical_features(
record: SeqVarTsvRecord,
Expand Down Expand Up @@ -778,6 +779,20 @@ def record_condition(record: StrucVarTsvRecord) -> SubmissionCondition:
else:
return SubmissionCondition(db=ConditionDb.OMIM, id=record.omim[0])

def record_pubmed_citations(
record: StrucVarTsvRecord,
) -> typing.Optional[typing.List[SubmissionCitation]]:
if record.pmids:
return [
SubmissionCitation(
db=CitationDb.PUBMED,
id=pmid,
)
for pmid in record.pmids
]
else:
return None

def record_clinical_features(
record: StrucVarTsvRecord,
) -> typing.Optional[typing.List[SubmissionClinicalFeature]]:
Expand Down Expand Up @@ -825,6 +840,7 @@ def record_clinical_features(
clinical_significance=SubmissionClinicalSignificance(
clinical_significance_description=record.clinical_significance_description,
mode_of_inheritance=record.inheritance,
citation=record_pubmed_citations(record),
),
record_status=RecordStatus.NOVEL,
variant_set=SubmissionVariantSet(
Expand Down Expand Up @@ -879,7 +895,8 @@ def _hpo_terms(submission: SubmissionClinvarSubmission) -> typing.Optional[typin
def _pmids(submission: SubmissionClinvarSubmission) -> typing.Optional[typing.List[str]]:
if citations := submission.clinical_significance.citation:
return [c.id for c in citations if c.db == CitationDb.PUBMED and c.id]
return None
else:
return None

def submission_to_seq_var_tsv_record(
submission: SubmissionClinvarSubmission,
Expand Down Expand Up @@ -979,7 +996,8 @@ def _inheritance(submission: SubmissionClinvarSubmission) -> typing.Optional[Mod
def _pmids(submission: SubmissionClinvarSubmission) -> typing.Optional[typing.List[str]]:
if citations := submission.clinical_significance.citation:
return [c.id for c in citations if c.db == CitationDb.PUBMED and c.id]
return None
else:
return None

def submission_to_struc_var_tsv_record(
submission: SubmissionClinvarSubmission,
Expand Down

0 comments on commit 25c1ac2

Please sign in to comment.