Skip to content

Commit

Permalink
v0.7.4
Browse files Browse the repository at this point in the history
- Added new column proteome_with_domain_fraction
  • Loading branch information
DRL committed Dec 18, 2016
1 parent 7f32892 commit 0117fd5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion kinfin.py
Original file line number Diff line number Diff line change
Expand Up @@ -729,6 +729,7 @@ def get_header_line(self, filetype, attribute):
cluster_metrics_domains_detailed_header.append("domain_description")
cluster_metrics_domains_detailed_header.append("protein_count")
cluster_metrics_domains_detailed_header.append("protein_count_with_domain")
cluster_metrics_domains_detailed_header.append("proteomes_with_domain_fraction")
cluster_metrics_domains_detailed_header.append("proteomes_with_domain")
cluster_metrics_domains_detailed_header.append("proteomes_without_domain")
return "\t".join(cluster_metrics_domains_detailed_header)
Expand Down Expand Up @@ -957,16 +958,19 @@ def write_cluster_metrics(self):
cluster_metrics_domains_detailed_output_line.append("N/A")
cluster_metrics_domains_detailed_output_line.append(clusterObj.protein_count)
protein_with_domain_count_by_proteome_id = {}
proteome_count_with_domain = 0
protein_without_domain_count_by_proteome_id = {}
for proteome_id, protein_ids in clusterObj.protein_ids_by_proteome_id.items():
for protein_id in protein_ids:
if domain_source in proteinCollection.proteinObjs_by_protein_id[protein_id].domain_counter_by_domain_source and domain_id in proteinCollection.proteinObjs_by_protein_id[protein_id].domain_counter_by_domain_source[domain_source]:
protein_with_domain_count_by_proteome_id[proteome_id] = protein_with_domain_count_by_proteome_id.get(proteome_id, 0) + 1
proteome_count_with_domain += 1
else:
protein_without_domain_count_by_proteome_id[proteome_id] = protein_without_domain_count_by_proteome_id.get(proteome_id, 0) + 1
proteomes_with_domain_count_string = ",".join(sorted(["%s:%s/%s" % (proteome_id, count, len(clusterObj.protein_ids_by_proteome_id[proteome_id])) for proteome_id, count in protein_with_domain_count_by_proteome_id.items()]))
proteomes_without_domain_count_string = ",".join(sorted(["%s:%s/%s" % (proteome_id, count, len(clusterObj.protein_ids_by_proteome_id[proteome_id])) for proteome_id, count in protein_without_domain_count_by_proteome_id.items()]))
cluster_metrics_domains_detailed_output_line.append(sum(protein_with_domain_count_by_proteome_id.values()))
cluster_metrics_domains_detailed_output_line.append("{0:.3f}".format(proteome_count_with_domain/clusterObj.proteome_count))
cluster_metrics_domains_detailed_output_line.append(proteomes_with_domain_count_string)
cluster_metrics_domains_detailed_output_line.append(proteomes_without_domain_count_string)
cluster_metrics_domains_detailed_output_by_domain_source[domain_source].append("\t".join([str(field) for field in cluster_metrics_domains_detailed_output_line]))
Expand Down Expand Up @@ -2119,7 +2123,7 @@ def welcome_screen():
" % (__version__)
print screen
if __name__ == "__main__":
__version__ = "0.7.3"
__version__ = "0.7.4"
args = docopt(__doc__)
# Sanitise input
welcome_screen()
Expand Down

0 comments on commit 0117fd5

Please sign in to comment.