Skip to content
Snippets Groups Projects
Commit 2204a638 authored by Remi  PLANEL's avatar Remi PLANEL
Browse files

Add p_value column for the peaks

parent 382e7b3d
No related branches found
No related tags found
No related merge requests found
# Generated by Django 3.2.7 on 2022-03-14 12:21
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0059_alter_galaxyworkflow_version'),
]
operations = [
migrations.AddField(
model_name='peak',
name='p_value',
field=models.FloatField(null=True),
),
]
......@@ -239,7 +239,8 @@ class Experiment(models.Model):
raise RessourceAlreadyExists()
# Add reader role to the team the current user belongs
def generate_experiment_file(self, name, phenotype_type_name):
def generate_experiment_file(self, name, phenotype_type_name, galaxy_workflow_id):
galaxy_workflow_excel = {"657f009ad32a3f27", "bd6cadfea4e7afba"}
phenotypes = (
Phenotype.objects.filter(experiment_cc_line__experiment=self)
.values(
......@@ -278,10 +279,16 @@ class Experiment(models.Model):
columns = ["CC_ID", "Line_M", "Line_F", "Sex"] + [phenotype_type_name]
pivoted.reset_index(inplace=True)
dirpath = tempfile.mkdtemp(prefix="cc-qtl-", dir="/tmp-exp-files")
experiment_file_path = f"{dirpath}/{name}.xls"
pivoted.to_excel(
experiment_file_path, index=False, columns=columns,
)
if galaxy_workflow_id in galaxy_workflow_excel:
experiment_file_path = f"{dirpath}/{name}.xls"
pivoted.to_excel(
experiment_file_path, index=False, columns=columns,
)
else:
experiment_file_path = f"{dirpath}/{name}.csv"
pivoted.to_csv(
experiment_file_path, index=False, columns=columns,
)
return experiment_file_path
else:
raise NameError(f"No phenotype type defined for {phenotype_type_name}")
......@@ -984,6 +991,7 @@ class Peak(models.Model):
lod = models.FloatField()
ci_lo = models.FloatField()
ci_hi = models.FloatField()
p_value = models.FloatField(null=True)
objects = PeakManager()
......
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