Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fixing projection issues with cdot::json::Provider #55

Merged
merged 4 commits into from
Mar 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
150 changes: 101 additions & 49 deletions src/data/cdot/json.rs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/data/uta_sr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ pub mod test_helpers {
}

/// Helper that builds the cache writing SeqRepo with inner stock SeqRepo.
fn build_writing_sr(
pub fn build_writing_sr(
sr_cache_path: String,
) -> Result<(Rc<dyn SeqRepoInterface>, String), anyhow::Error> {
let seqrepo_path = std::env::var("TEST_SEQREPO_PATH")
Expand Down
3 changes: 2 additions & 1 deletion src/mapper/alignment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,8 @@ impl Mapper {
));
}

let cigar_mapper = CigarMapper::new(&build_tx_cigar(&tx_exons, strand)?);
let cigar = build_tx_cigar(&tx_exons, strand)?;
let cigar_mapper = CigarMapper::new(&cigar);
let tgt_len = cigar_mapper.tgt_len;

(
Expand Down
3 changes: 1 addition & 2 deletions src/mapper/assembly.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ impl Mapper {
.get_assembly_map(config.assembly)
.keys()
.clone()
.into_iter()
.map(|s| s.to_string())
.collect::<HashSet<_>>();
let asm_map = HashMap::from_iter(
Expand Down Expand Up @@ -262,7 +261,7 @@ impl Mapper {
.map(|rec| rec.tx_ac)
.collect::<Vec<_>>())
}
_ => return Err(anyhow::anyhow!("Not a GenomeVariant: {}", &var_g)),
_ => Err(anyhow::anyhow!("Not a GenomeVariant: {}", &var_g)),
}
}

Expand Down
14 changes: 6 additions & 8 deletions src/mapper/variant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,9 @@ impl Mapper {
self.validator.validate(var_g)?;
let mapper = self.build_alignment_mapper(tx_ac, var_g.accession(), alt_aln_method)?;
if mapper.is_coding_transcript() {
self.g_to_c(&var_g, tx_ac, alt_aln_method)
self.g_to_c(var_g, tx_ac, alt_aln_method)
} else {
self.g_to_n(&var_g, tx_ac, alt_aln_method)
self.g_to_n(var_g, tx_ac, alt_aln_method)
}
}

Expand Down Expand Up @@ -580,12 +580,10 @@ impl Mapper {
match var_t {
HgvsVariant::TxVariant { .. } => self.n_to_g(&var_t, alt_ac, alt_aln_method),
HgvsVariant::CdsVariant { .. } => self.c_to_g(&var_t, alt_ac, alt_aln_method),
_ => {
return Err(anyhow::anyhow!(
"Expected transcript or CDS variant but received {}",
&var_t
))
}
_ => Err(anyhow::anyhow!(
"Expected transcript or CDS variant but received {}",
&var_t
)),
}
}

Expand Down
7 changes: 1 addition & 6 deletions src/parser/impl_parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -927,15 +927,10 @@ mod test {
let inputs = if in_type == "list" {
in_string
.split('|')
.into_iter()
.map(|s| s.to_string())
.collect::<Vec<_>>()
} else if in_type == "string" {
in_string
.chars()
.into_iter()
.map(|c| c.to_string())
.collect::<Vec<_>>()
in_string.chars().map(|c| c.to_string()).collect::<Vec<_>>()
} else if in_type == "one" {
vec![in_string.to_string()]
} else {
Expand Down
Loading