-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #113 from lehtiolab/dia_longit_qc
Include DIA in longitudinal qc
- Loading branch information
Showing
22 changed files
with
901 additions
and
293 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
95 changes: 95 additions & 0 deletions
95
src/backend/dashboard/migrations/0003_lineplotdata_plottype.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
# Generated by Django 4.2.13 on 2025-01-09 13:53 | ||
|
||
from django.db import migrations, models | ||
from django.db.models import F | ||
|
||
from dashboard import models as dm | ||
|
||
|
||
dtmap = { | ||
'psms': dm.LineDataTypes.NRPSMS, | ||
'scans': dm.LineDataTypes.NRSCANS, | ||
'peptides': dm.LineDataTypes.NRPEPTIDES, | ||
'unique_peptides': dm.LineDataTypes.NRPEPTIDES_UNI, | ||
'proteins': dm.LineDataTypes.NRPROTEINS, | ||
'miscleav1': dm.LineDataTypes.MISCLEAV1, | ||
'miscleav2': dm.LineDataTypes.MISCLEAV2, | ||
'peaks_fwhm': dm.LineDataTypes.PEAKS_FWHM, | ||
|
||
'perror': dm.QuartileDataTypes.MASSERROR, | ||
'msgfscore': dm.QuartileDataTypes.SCORE, | ||
'rt': dm.QuartileDataTypes.RT, | ||
'peparea': dm.QuartileDataTypes.PEPMS1AREA, | ||
'ionmob': dm.QuartileDataTypes.IONMOB, | ||
'fwhms': dm.QuartileDataTypes.FWHM, | ||
'ioninj': dm.QuartileDataTypes.IONINJ, | ||
'matched_peaks': dm.QuartileDataTypes.MATCHED_PEAKS, | ||
} | ||
|
||
|
||
def fill_datatypes_remove_old(a, s): | ||
Box = a.get_model('dashboard', 'BoxplotData') | ||
Box.objects.filter(shortname='sagescores').delete() | ||
for b in Box.objects.all(): | ||
b.datatype = dtmap[b.shortname] | ||
b.save() | ||
Line = a.get_model('dashboard', 'LineplotData') | ||
Line.objects.filter(shortname='miscleav3').delete() | ||
Line.objects.filter(shortname='miscleav0').delete() | ||
for l in Line.objects.all(): | ||
l.datatype = dtmap[l.shortname] | ||
l.save() | ||
# Remove thermo ion mob plots | ||
Box.objects.filter(datatype=dm.QuartileDataTypes.IONMOB, q2=F('q3'), q1=0.0).delete() | ||
|
||
def fake(a,s): | ||
pass | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('dashboard', '0002_qcdata_is_ok_qcdata_message'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='boxplotdata', | ||
name='datatype', | ||
field=models.IntegerField(choices=[(1, 'FWHM'), (2, 'Peptide MS1 area'), (3, 'Mass error'), (4, 'Retention time'), (5, 'Score'), (6, 'Ion mobility'), (7, 'Ion injection time(ms)'), (8, 'Amount MS2 peaks matched')]), | ||
preserve_default=False, | ||
), | ||
|
||
migrations.AddField( | ||
model_name='lineplotdata', | ||
name='datatype', | ||
field=models.IntegerField(choices=[(1, 'Nr of proteins'), (2, 'Nr of peptides'), (3, 'Nr of peptides mapping uniquely'), (4, 'Nr of PSMs'), (5, 'Nr of scans'), (6, 'Nr of PSMs with 1 missed cleavage'), (7, 'Nr of PSMs with 2 missed cleavage'), (8, 'Amount scans FWHM')]), | ||
preserve_default=False, | ||
), | ||
|
||
migrations.AddField( | ||
model_name='qcdata', | ||
name='runtype', | ||
field=models.IntegerField(choices=[(1, 'DDA'), (2, 'DIA')], default=1), | ||
preserve_default=False, | ||
), | ||
|
||
migrations.RunPython(fill_datatypes_remove_old, fake), | ||
|
||
migrations.AlterField( | ||
model_name='qcdata', | ||
name='analysis', | ||
field=models.OneToOneField(on_delete=models.deletion.CASCADE, to='analysis.analysis'), | ||
), | ||
migrations.AlterField( | ||
model_name='qcdata', | ||
name='rawfile', | ||
field=models.OneToOneField(on_delete=models.deletion.CASCADE, to='rawstatus.rawfile'), | ||
), | ||
|
||
migrations.RenameModel( | ||
old_name='QCData', | ||
new_name='QCRun', | ||
), | ||
|
||
] |
29 changes: 29 additions & 0 deletions
29
src/backend/dashboard/migrations/0004_remove_lineplotdata_plottype_qcdata_runtype.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Generated by Django 4.2.13 on 2025-01-13 14:47 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('dashboard', '0003_lineplotdata_plottype'), | ||
] | ||
|
||
operations = [ | ||
migrations.RemoveField( | ||
model_name='lineplotdata', | ||
name='shortname', | ||
), | ||
migrations.RemoveField( | ||
model_name='boxplotdata', | ||
name='shortname', | ||
), | ||
migrations.RemoveField( | ||
model_name='boxplotdata', | ||
name='lower', | ||
), | ||
migrations.RemoveField( | ||
model_name='boxplotdata', | ||
name='upper', | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,49 @@ | ||
from django.db import models | ||
|
||
from rawstatus import models as filemodels | ||
from analysis import models as analysismodels | ||
from rawstatus import models as rm | ||
from analysis import models as am | ||
from datasets import models as dm | ||
|
||
|
||
class QCData(models.Model): | ||
rawfile = models.ForeignKey(filemodels.RawFile, on_delete=models.CASCADE) | ||
analysis = models.ForeignKey(analysismodels.Analysis, on_delete=models.CASCADE) | ||
class QCRun(models.Model): | ||
rawfile = models.OneToOneField(rm.RawFile, on_delete=models.CASCADE) | ||
analysis = models.OneToOneField(am.Analysis, on_delete=models.CASCADE) | ||
is_ok = models.BooleanField(default=True) | ||
message = models.TextField() | ||
runtype = models.IntegerField(choices=dm.AcquisistionMode.choices) | ||
|
||
|
||
class LineDataTypes(models.IntegerChoices): | ||
NRPROTEINS = 1, 'Nr of proteins' | ||
NRPEPTIDES = 2, 'Nr of peptides' | ||
NRPEPTIDES_UNI = 3, 'Nr of peptides mapping uniquely' | ||
NRPSMS = 4, 'Nr of PSMs' | ||
NRSCANS = 5, 'Nr of scans' | ||
MISCLEAV1 = 6, 'Nr of PSMs with 1 missed cleavage' | ||
MISCLEAV2 = 7, 'Nr of PSMs with 2 missed cleavage' | ||
PEAKS_FWHM = 8, 'Amount scans FWHM' | ||
|
||
|
||
class QuartileDataTypes(models.IntegerChoices): | ||
FWHM = 1, 'FWHM' | ||
PEPMS1AREA = 2, 'Peptide MS1 area' | ||
MASSERROR = 3, 'Mass error' | ||
RT = 4, 'Retention time' | ||
SCORE = 5, 'Score' | ||
IONMOB = 6, 'Ion mobility' | ||
IONINJ = 7, 'Ion injection time(ms)' | ||
MATCHED_PEAKS = 8, 'Amount MS2 peaks matched' | ||
|
||
|
||
class LineplotData(models.Model): | ||
qcrun = models.ForeignKey(QCData, on_delete=models.CASCADE) | ||
qcrun = models.ForeignKey(QCRun, on_delete=models.CASCADE) | ||
value = models.FloatField() | ||
shortname = models.CharField(max_length=20) | ||
datatype = models.IntegerField(choices=LineDataTypes.choices) | ||
|
||
|
||
class BoxplotData(models.Model): | ||
shortname = models.CharField(max_length=15) | ||
qcrun = models.ForeignKey(QCData, on_delete=models.CASCADE) | ||
upper = models.FloatField() | ||
lower = models.FloatField() | ||
datatype = models.IntegerField(choices=QuartileDataTypes.choices) | ||
qcrun = models.ForeignKey(QCRun, on_delete=models.CASCADE) | ||
q1 = models.FloatField() | ||
q2 = models.FloatField() | ||
q3 = models.FloatField() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.