Commit ba9813f0 authored by omietanski's avatar omietanski

Sum of the percentages added

parent 4641d6ac
Pipeline #19308 passed with stage
in 4 seconds
......@@ -184,6 +184,7 @@ def write_fuse_to_fasta(data, outfile, used_names, current_filename, options, me
used so far as well as their number of occurrences (prevents
having sequences with the same name)
'''
clones_percentage = {}
if options.top < MAX_TOP:
data.filter(data.getTop(options.top))
......@@ -207,11 +208,24 @@ def write_fuse_to_fasta(data, outfile, used_names, current_filename, options, me
else:
name += clone.d['name'].replace(' ', spacer)
additional_header_info = []
#Percentage
#take the max reads number of the samples (in case of multiple
#samples)
max_sample = max(clone.d['reads'])
#take the index corresponding to the max_sample
index_max_sample = clone.d['reads'].index(max_sample)
germline = clone.d['germline']
reads_total_nb = data.d['reads'].d['germline'][germline][index_max_sample]
percentage = float(max_sample)/reads_total_nb
if name in used_names:
used_names[name] += 1
clones_percentage[name] += percentage
  • Discuté ensemble : pas besoin du +, on affiche le pourcentage à chaque fois (l'addition est faite côté client, si on le souhaite).

Please register or sign in to reply
additional_header_info.append(str(used_names[name]))
else:
used_names[name] = 1
clones_percentage[name] = percentage
if options.germline:
additional_header_info.append('germline=%s'%clone.d['germline'])
......@@ -221,15 +235,7 @@ def write_fuse_to_fasta(data, outfile, used_names, current_filename, options, me
sample_name = current_filename
additional_header_info.append('sample_name=%s' % sample_name)
#Percentage
max_sample = max(clone.d['reads'])
index_max_sample = clone.d['reads'].index(max_sample)
germline = clone.d['germline']
reads_total_nb = data.d['reads'].d['germline'][germline][index_max_sample]
percentage = round((float(max_sample)/reads_total_nb)*100,2)
additional_header_info.append('percentage=%s'%percentage)
#Percentage
additional_header_info.append('percentage=%s'%clones_percentage[name])
if len(metadata) > 0:
additional_header_info.append(metadata.replace(' ', spacer))
......
Markdown is supported
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