-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
…ation genome fraction by haplotypes.
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,6 +37,7 @@ | |
|
||
from quast_libs.log import get_logger | ||
from quast_libs.qutils import is_python2, run_parallel | ||
from quast_libs.diputils import DipQuastAnalyzer | ||
|
||
logger = get_logger(qconfig.LOGGER_DEFAULT_NAME) | ||
|
||
|
@@ -100,9 +101,11 @@ def analyze_coverage(ref_aligns, reference_chromosomes, ns_by_chromosomes, used_ | |
genome_mapping[align.ref][pos] = 1 | ||
for i in ns_by_chromosomes[align.ref]: | ||
genome_mapping[align.ref][i] = 0 | ||
|
||
covered_ref_bases = sum([sum(genome_mapping[chrom]) for chrom in genome_mapping]) | ||
return covered_ref_bases, indels_info | ||
if qconfig.ambiguity_usage == 'ploid': | ||
return genome_mapping, indels_info | ||
This comment has been minimized.
Sorry, something went wrong.
alexeigurevich
Contributor
|
||
else: | ||
covered_ref_bases = sum([sum(genome_mapping[chrom]) for chrom in genome_mapping]) | ||
return covered_ref_bases, indels_info | ||
|
||
|
||
# former plantagora and plantakolya | ||
|
@@ -197,6 +200,15 @@ def align_and_analyze(is_cyclic, index, contigs_fpath, output_dirpath, ref_fpath | |
if qconfig.show_snps: | ||
log_out_f.write('Writing SNPs into ' + used_snps_fpath + '\n') | ||
aligned_ref_bases, indels_info = analyze_coverage(ref_aligns, reference_chromosomes, ns_by_chromosomes, used_snps_fpath) | ||
|
||
if qconfig.ambiguity_usage == 'ploid': | ||
dip_dict_haplotypes = DipQuastAnalyzer().fill_dip_dict_by_chromosomes(ref_fpath) | ||
for key, val in dip_dict_haplotypes.items(): | ||
for chrom in val: | ||
DipQuastAnalyzer.ploid_aligned[key] = DipQuastAnalyzer.ploid_aligned.get(key, 0) + sum(aligned_ref_bases[chrom]) | ||
This comment has been minimized.
Sorry, something went wrong.
alexeigurevich
Contributor
|
||
|
||
aligned_ref_bases = sum([sum(aligned_ref_bases[chrom]) for chrom in aligned_ref_bases]) | ||
|
||
total_indels_info += indels_info | ||
cov_stats = {'SNPs': total_indels_info.mismatches, 'indels_list': total_indels_info.indels_list, 'aligned_ref_bases': aligned_ref_bases} | ||
result.update(cov_stats) | ||
|
1 comment
on commit 9e6569a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See inline comments
Here and below: it does not make sense to do
dict(sorted(...))
since dictionaries in Python are not sorted! Use OrderedDict if the order of keys is important for you.