Page MenuHomec4science

test_fct.py
No OneTemporary

File Metadata

Created
Mon, Jul 14, 19:39

test_fct.py

#!/usr/bin/env python
# -*- coding: utf-8 -*-
"This file contain the clustering_process functions, it take 9 arguments as input"
########################################################
from cluster_collection import ClusterCollection
########################################################
def check_clustering(clustering_software,cluster_collection):
"""check taxonomic affiliataion and size of clusters from the test files """
if clustering_software == 'dbc':
test_dbc = True
test_why = ''
if cluster_collection.cluster_collection['M01312_138_000000000-AN8YW_1_1102_26606_9417'].size!= 17:
test_dbc = False
test_why += 'wrong size of cluster '
if cluster_collection.cluster_collection['M01312_138_000000000-AN8YW_1_2113_7693_10856'].size!= 18:
test_dbc = False
test_why += 'wrong size of cluster '
if cluster_collection.cluster_collection['M01312_138_000000000-AN8YW_1_2114_7665_11757'].taxonomic_affiliation.genus!='Tetrasphaera':
test_dbc = False
test_why += 'wrong taxonomic affiliation '
if cluster_collection.cluster_collection['M01312_138_000000000-AN8YW_1_2113_7693_10856'].d_abundance_per_sample['-2016_02_15'] != 12:
test_dbc = False
test_why += 'wrong sample size '
if test_dbc :
print 'test dbc ok'
else :
print 'test dbc failed'
print test_why
if clustering_software == 'cd_hit':
test_cdhit = True
test_why = ''
if cluster_collection.cluster_collection['M01312_138_000000000-AN8YW_1_1112_16352_8661'].size!= 339:
test_cdhit = False
test_why += 'wrong size of cluster '
print 'size ',cluster_collection.cluster_collection['M01312_138_000000000-AN8YW_1_1112_16352_8661'].size
if cluster_collection.cluster_collection['M01312_138_000000000-AN8YW_1_2101_17727_17562'].size!= 506:
test_cdhit = False
test_why += 'wrong size of cluster '
print cluster_collection.cluster_collection['M01312_138_000000000-AN8YW_1_2101_17727_17562'].size
print cluster_collection.cluster_collection['M01312_138_000000000-AN8YW_1_2113_20305_2539'].size
print cluster_collection.cluster_collection['M01312_138_000000000-AN8YW_1_1105_16475_17491'].size
if cluster_collection.cluster_collection['M01312_138_000000000-AN8YW_1_2113_20305_2539'].taxonomic_affiliation.genus!='Propioniciclava':
test_cdhit = False
test_why += 'wrong taxonomic affiliation '
print cluster_collection.cluster_collection['M01312_138_000000000-AN8YW_1_2113_20305_2539'].taxonomic_affiliation.genus
if cluster_collection.cluster_collection['M01312_138_000000000-AN8YW_1_1105_16475_17491'].d_abundance_per_sample['-2016_02_15'] != 32:
test_cdhit = False
test_why += 'wrong sample size '
if test_cdhit :
print 'test cd-hit ok'
else :
print 'test cd-hit failed'
print test_why
return 0

Event Timeline