Skip to content

Commit

Permalink
dont print annotations ref and alt when they are longer than 10bp, mo…
Browse files Browse the repository at this point in the history
…re normal formatting
  • Loading branch information
JokingHero committed Apr 22, 2024
1 parent c267a66 commit 762d8d4
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/db_vcf.jl
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,9 @@ function find_ots_one(
g_rev = g_rev[overlaps]
gp_rev = gp_rev[overlaps]
gp_rev = Base.map(x -> seq_start + x.start - 1, gp_rev)
this_annot = rs_ids * ":" *seq_ref * "/" * string(alt)
seq_ref_annot = length(seq_ref) > 10 ? seq_ref[1:4] * "..." * string(length(seq_ref)) * "bp" : seq_ref
alt_annot = length(alt) > 10 ? string(alt[1:4]) * "..." * string(length(alt)) * "bp" : string(alt)
this_annot = rs_ids * ":" * seq_ref_annot * "/" * alt_annot
# instead of this we need to accumulate vector of tuples
res = vcat(
map(x -> VarOT(x[1], x[2], x[3], x[4], x[5]),
Expand Down Expand Up @@ -151,7 +153,9 @@ function find_ots_many(
rs_ids[i] * ":" * string(rs_ranges[i].start) *
string(rs_ranges[i].stop) * " and the reference file."
end
push!(annot_comb, rs_ids[i] * ":" *seq_ref * "/" * string(alt))
seq_ref_annot = length(seq_ref) > 10 ? seq_ref[1:4] * "..." * string(length(seq_ref)) * "bp" : seq_ref
alt_annot = length(alt) > 10 ? string(alt[1:4]) * "..." * string(length(alt)) * "bp" : string(alt)
push!(annot_comb, rs_ids[i] * ":" *seq_ref_annot * "/" * alt_annot)
if i == 1 # first snp --alt
seq_alt *= chrom_seq[(rst - lp + 1):(rst - 1)] * alt
push!(rg_comb, (length(seq_alt) - alt_len + 1):length(seq_alt))
Expand Down Expand Up @@ -374,7 +378,13 @@ function build_vcfDB(
ambig_chrom = ambig_chrom[order]
ambig_pos = ambig_pos[order]
ambig_isplus = ambig_isplus[order]
ambig_annot = InlineStrings.inlinestrings(ambig_annot[order])
ambig_annot = ambig_annot[order]

typeofannot = eltype(InlineStrings.inlinestrings(
[ambig_annot[argmax(length.(ambig_annot))]]))
if (typeofannot != String)
ambig_annot = InlineStrings.inlinestrings(ambig_annot)
end
save(CHOPOFF.build_ambigPrefixHashDB(
ambig_guides, ambig_chrom, ambig_pos, ambig_isplus,
l, hash_len, ot_type, hash_type, suffix_type, ambig_annot,
Expand Down

0 comments on commit 762d8d4

Please sign in to comment.