Commit c31e4210 authored by Claire Kuchly's avatar Claire Kuchly
Browse files

modification les index avec peu de reads

parent ce9f47f4
......@@ -95,19 +95,40 @@ class DemultiplexStats (Analysis):
for data in indices_stat.values():
if data["number"] >= min_determined :
overmin += 1
if float(overmin) / float(len(list(indices_stat.values()))) >= self.undetermined_threshold :
raise Exception("More than %s percent of undetermined indexes are higher than the minimum determined index count %s"%(self.undetermined_threshold, min_determined))
for index_seq in indices_stat.keys():
if indices_stat[index_seq]["number"] >= self.index_count_threshold*min_determined:
# determine the maximum number of undetermined index (with too much sequences) that have to be saved like new indexs
max_nbindexsaved = float(len(list(indices_stat.values()))) # maximum number of undetermined index saved as new indexs
if max_nbindexsaved > 100 :
max_nbindexsaved = 100
# Sort undetermined index on number of sequences
indices_stat_sorted = sorted(indices_stat, reverse=True, key=indices_stat.__getitem__)
nbindexsaved = 0
for index_seq in indices_stat_sorted:
if indices_stat[index_seq]["number"] >= self.index_count_threshold*min_determined and nbindexsaved <= max_nbindexsaved :
self._add_result_element(index_seq, "number", str(indices_stat[index_seq]["number"]), "undetermined")
self._add_result_element(index_seq, "passing_filter", str(indices_stat[index_seq]["passing_filter"]), "undetermined")
nbindexsaved =+ 1
else:
other["number"] += indices_stat[index_seq]["number"]
other["passing_filter"] += indices_stat[index_seq]["passing_filter"]
self._add_result_element("All others", "number", str(other["number"]), "undetermined")
self._add_result_element("All others", "passing_filter", str(other["passing_filter"]), "undetermined")
self._add_result_element("All others", "passing_filter", str(other["passing_filter"]), "undetermined")
# if float(overmin) / float(len(list(indices_stat.values()))) >= self.undetermined_threshold :
# raise Exception("More than %s percent of undetermined indexes are higher than the minimum determined index count %s"%(self.undetermined_threshold, min_determined))
#
# for index_seq in indices_stat.keys():
# if indices_stat[index_seq]["number"] >= self.index_count_threshold*min_determined:
# self._add_result_element(index_seq, "number", str(indices_stat[index_seq]["number"]), "undetermined")
# self._add_result_element(index_seq, "passing_filter", str(indices_stat[index_seq]["passing_filter"]), "undetermined")
# else:
# other["number"] += indices_stat[index_seq]["number"]
# other["passing_filter"] += indices_stat[index_seq]["passing_filter"]
# self._add_result_element("All others", "number", str(other["number"]), "undetermined")
# self._add_result_element("All others", "passing_filter", str(other["passing_filter"]), "undetermined")
def get_version(self):
return "-"
......@@ -143,4 +164,4 @@ class DemultiplexStats (Analysis):
demultiplex_stats( inputs = infile, outputs = self.undetermined_idx_count_files[idx], arguments = 'undetermined')
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment