Skip to content

Commit

Permalink
Don't include allele synonym refs on gene page
Browse files Browse the repository at this point in the history
  • Loading branch information
kimrutherford committed May 20, 2024
1 parent 6c006c1 commit 8d6fe12
Showing 1 changed file with 22 additions and 9 deletions.
31 changes: 22 additions & 9 deletions src/pombase/web/data_build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ lazy_static! {
Regex::new(r"^(\d\d\d\d)-(\d\d)-(\d\d)($|\s)").unwrap();
}

#[derive(Clone, Debug, PartialEq, Eq, Hash)]
enum AddToHashFlag {
AlleleCommentRefs,
AlleleSynonymRefs,
}

fn make_organism(rc_organism: &Rc<ChadoOrganism>) -> ConfigOrganism {
let mut maybe_taxonid: Option<u32> = None;
for prop in rc_organism.organismprops.borrow().iter() {
Expand Down Expand Up @@ -962,7 +968,7 @@ impl <'a> WebDataBuild<'a> {
let genotype_short = self.make_genotype_short(genotype_uniquename);
for locus in &genotype_short.loci {
for expressed_allele in &locus.expressed_alleles {
self.add_allele_to_hash(seen_alleles, seen_genes,
self.add_allele_to_hash(HashSet::new(), seen_alleles, seen_genes,
seen_references, identifier,
&expressed_allele.allele_uniquename);
}
Expand All @@ -975,21 +981,25 @@ impl <'a> WebDataBuild<'a> {
}

fn add_allele_to_hash(&self,
flags: HashSet<AddToHashFlag>,
seen_alleles: &mut HashMap<FlexStr, AlleleShortMap>,
seen_genes: &mut HashMap<FlexStr, GeneShortOptionMap>,
seen_references: &mut HashMap<FlexStr, ReferenceShortOptionMap>,
identifier: &FlexStr,
allele_uniquename: &AlleleUniquename) -> AlleleShort {
let allele_short = self.make_allele_short(allele_uniquename);
{
for comment_details in &allele_short.comments {
self.add_ref_to_hash(seen_references, identifier,
&comment_details.reference);

if flags.contains(&AddToHashFlag::AlleleCommentRefs) {
for comment_details in &allele_short.comments {
self.add_ref_to_hash(seen_references, identifier,
&comment_details.reference);
}
}
for synonym_details in &allele_short.synonyms {
self.add_ref_to_hash(seen_references, identifier,
&synonym_details.reference);
if flags.contains(&AddToHashFlag::AlleleSynonymRefs) {
for synonym_details in &allele_short.synonyms {
self.add_ref_to_hash(seen_references, identifier,
&synonym_details.reference);
}
}

let allele_gene_uniquename = &allele_short.gene_uniquename;
Expand Down Expand Up @@ -5859,7 +5869,10 @@ phenotypes, so just the first part of this extension will be used:
for genotype_short in &allele_details.genotypes {
for locus in &genotype_short.loci {
for expressed_allele in &locus.expressed_alleles {
self.add_allele_to_hash(&mut seen_alleles, &mut seen_genes,
let mut flags = HashSet::new();
flags.insert(AddToHashFlag::AlleleCommentRefs);
flags.insert(AddToHashFlag::AlleleSynonymRefs);
self.add_allele_to_hash(flags, &mut seen_alleles, &mut seen_genes,
&mut seen_references, allele_uniquename,
&expressed_allele.allele_uniquename);
}
Expand Down

0 comments on commit 8d6fe12

Please sign in to comment.