Skip to content

Commit

Permalink
Write curator ORCID to GPAD file
Browse files Browse the repository at this point in the history
  • Loading branch information
kimrutherford committed Dec 12, 2023
1 parent 8c43862 commit eac7914
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/pombase/bio/go_format_writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -480,12 +480,19 @@ pub fn write_gene_product_annotation(gpad_writer: &mut dyn io::Write,
} else {
&db_object_id
};
let line = format!("{}\t{}\t{}\t{}\t{}\t{}\t{}\t\t{}\t{}\t{}\t\n",
let annotation_props =
if let Some(ref curator_orcid) = annotation_detail.curator {
flex_fmt!("contributor-id=orcid:{}", curator_orcid)
} else {
flex_str!("")
};

let line = format!("{}\t{}\t{}\t{}\t{}\t{}\t{}\t\t{}\t{}\t{}\t{}\n",
db_object_id,
not, relation, ontology_class_id,
reference_uniquename, evidence_type,
with_or_from, date, assigned_by,
annotation_extensions);
annotation_extensions, annotation_props);
gpad_writer.write_all(line.as_bytes())?;
} else {
println!("WARNING while writing GAF file: \
Expand Down
4 changes: 4 additions & 0 deletions src/pombase/data_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -727,6 +727,8 @@ impl PartialOrd for WithFromValue {
}
}

pub type CuratorOrcid = FlexStr;

#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct OntAnnotationDetail {
pub id: i32,
Expand Down Expand Up @@ -767,6 +769,8 @@ pub struct OntAnnotationDetail {
pub assigned_by: Option<FlexStr>,
#[serde(skip_serializing_if="Option::is_none")]
pub throughput: Option<Throughput>,
#[serde(skip_serializing_if="Option::is_none")]
pub curator: Option<CuratorOrcid>,
}

impl PartialEq for OntAnnotationDetail {
Expand Down
5 changes: 5 additions & 0 deletions src/pombase/web/data_build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3853,6 +3853,7 @@ phenotypes, so just the first part of this extension will be used:
let mut eco_evidence: Option<FlexStr> = None;
let mut genotype_background: Option<FlexStr> = None;
let mut throughput: Option<Throughput> = None;
let mut curator_orcid: Option<CuratorOrcid> = None;

// need to get evidence first as it's used later
// See: https://github.com/pombase/website/issues/455
Expand Down Expand Up @@ -3942,6 +3943,9 @@ phenotypes, so just the first part of this extension will be used:
froms.insert(self.make_with_or_from_value(&value));
}
},
"curator_orcid" => {
curator_orcid = prop.value.clone();
},
"annotation_throughput_type" => {
if let Some(throughput_type) = prop.value.clone() {
throughput = Some(match throughput_type.as_ref() {
Expand Down Expand Up @@ -4081,6 +4085,7 @@ phenotypes, so just the first part of this extension will be used:
date,
assigned_by,
throughput,
curator: curator_orcid,
};

if &feature.feat_type.name == "genotype_interaction" {
Expand Down

0 comments on commit eac7914

Please sign in to comment.