Skip to content

Commit

Permalink
visualisation works fine
Browse files Browse the repository at this point in the history
  • Loading branch information
anastasiia committed Dec 11, 2018
1 parent bf0d295 commit 94f32ca
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions visualize.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ def make_box_plot(groups_files_names, groups_genes_of_interest, output_directory
sorted_genes_of_interest = sorted(genes_of_interest, key = lambda x: np.mean(genes_of_interest[x]))

for gene in sorted_genes_of_interest:
print(genes_of_interest[gene])
group_data.extend(genes_of_interest[gene])

data.append(group_data)
Expand Down Expand Up @@ -165,18 +164,20 @@ def read_correlation(correlation_file, groups, variable):
if len(genes_family) != 0:
logger.info("working with the gene " + gene_name)

#the score is in [3], the tsl is in [2]

for genes_line in re.split(r'\n', genes_family):
genes_array = re.split(r'\t', genes_line)
if genes_array[0] == gene_name:
#this is a perfect match <3
genes_to_show[gene_name].append(float(genes_array[2])) #append score to the array
genes_to_show[gene_name].append(float(genes_array[3])) #append score to the array
elif genes_array[0].startswith(gene_name) and len(genes_array[0]) <= len(gene_name) + variable: #the found gene is by default 1 char longer than the gene name
if genes_array[0] in genes_to_show.keys():
genes_to_show[genes_array[0]].append(float(genes_array[2]))
genes_to_show[genes_array[0]].append(float(genes_array[3]))
else: #this gene is not yet saved
#make a new place in the dictionary for this gene
genes_to_show[genes_array[0]] = genes_to_show.get(genes_array[0], [])
genes_to_show[genes_array[0]].append(float(genes_array[2]))
genes_to_show[genes_array[0]].append(float(genes_array[3]))

else:
logger.info("no similar genes to " + gene_name + " were found")
Expand Down

0 comments on commit 94f32ca

Please sign in to comment.