- 病人信息表
class Patient(models.Model):
SEX = (('M', 'Male'), ('F', 'Female'))
patient_ogid = models.CharField(max_length=20)
name = models.CharField(max_length=100)
age = models.IntegerField()
gender= models.CharField(max_length=1, choices=self.SEX)
id_number = models.CharField(max_length=18)
hospital = models.CharField(max_length=200, default='-')
doctor = models.CharField(max_length=100, default='-')
addresss = models.CharField(max_length=300, default='-')
telephone = models.CharField(max_length=15, default='-')
package = models.ForeignKey(Package, ondelete=models.CASCADE)
cancer = models.ForeignKey(Tumor, ondelete=models.CASCADE)
def __str__(self):
return self.name
- 样品信息表
class Sample(models.Model):
sample_type = models.CharField(max_length=20)
patient = models.ForeignKey(Patient, on_delete=models.CASCADE, related_name="samples")
ammount = models.IntegerField()
unit = models.CharField(max_length=10)
sampling_date = models.DateField()
notes = models.CharField(max_length=100, blank=True)
def __str__(self):
return '_'.join([self.patient.name, self.sample_type])
- 测序记录表(包括关联外键的两个表)
class Tissues(models.Model):
name = models.CharField('Tissue name', max_length=20, primary_key=True)
full_name = models.CharField('Tissue full name', max_length=100, blank=True)
def __str__(self):
return self.tissue_short_name
class Panel(models.Model):
panel_name = models.CharField('Panel name', max_length=50, primary_key=True)
panel_path = models.CharField('Panel full path', max_length=500)
panel_type = models.CharField('Panel type', max_length=20)
panel_subtype = models.CharField('Panel subtype', max_length=20, default='unknown')
def __str__(self):
return self.panel_name
class Record(models.Model):
sample = models.ForeignKey(Sample, on_delete=models.CASCADE, related_name="records")
full_id = models.CharField('Full ID', max_length=100, unique=True)
og_id = models.CharField('OG ID', max_length=100)
capm = models.CharField('CA-PM', max_length=100)
r1 = models.CharField('R1', max_length=500)
r2 = models.CharField('R2', max_length=500)
tissue = models.ForeignKey(Tissues, on_delete=models.CASCADE)
panel = models.ForeignKey(Panel, on_delete=models.CASCADE)
create_date = models.DateTimeField('Disk date')
r1_size = models.IntegerField('R1 Size (MB)', max_length=10, default=-1)
r2_size = models.IntegerField('R2 Size (MB)', max_length=10, default=-1)
indb_date = models.DateTimeField( 'In DB date', auto_now_add=True)
outdate_status = models.Boolean('Is Outdate?', default=False)
qc = models.CharField('QC', max_length=500, default='-')
- 基因位点表
class Site(models.Model):
chrom = models.CharField(max_length=2)
start = models.CharField(max_length=15)
end = models.CharField(max_length=15)
ref = models.CharField(max_length=1000)
gene = models.ForeignKey(Gene, on_delete=models.CASCADE)
nm_id = models.CharField(max_length=30)
exon_id = models.CharField(max_length=10)
@property
def site_info1(self):
return [self.chrom, self.start, self.end, self.ref]
def site_info2(self):
return [self.gene, self.nm_id, self.exon_id]
- 变异信息表
class Snv(models.Model):
site = models.ForeignKey(Site, on_delete=models.CASCADE)
alt = models.CharField(max_length=100)
canno = models.CharField(max_length=100)
panno = models.CharField(max_length=100)
variant_type = models.CharField(max_length=30)
rs_number = models.CharField(max_length=20, default='.')
kgmaf = models.FloatField(max_length=20, default='0')
sift = models.CharField(max_length=1, default='.')
polyphen2 = models.CharField(max_length=1, default='.')
@property
def snv_info(self):
return self.site.site_info1 + [self.alt] + self.site.info 2+ [self.canno, self.panno, self.variant_type, self.rs_number, self.kgmaf, self.sift, self.polyphen2]
- 测序变异信息
class Seqvars(models.Model):
ngs_record = models.ForeignKey(Record, on_delete=models.CASCADE, related_name="seqvars")
snv = models.ForeignKey(Snv, on_delete=models.CASCADE)
vf = models.FloatField()
total_dp = models.IntegerField()
var_dp = models.IntegerField()
mole = models.IntegerField()
@property
def seqvar_info(self):
return self.snv.snv_info + [self.vf, self.total_dp, self.var_dp, self.mole]
- 套餐信息(+套餐基因)
class Package(models.Model):
name = models.CharField(max_length=50)
price = models.FloatField()
tumor = models.ForeignKey(Tumor, on_delete=modelsCASCADE)
gene = models.ManyToMany(Gene, related_name='genes')
- 基因表
class Gene(models.Model):
symbol = models.CharField(max_length=30)
full_name = models.CharField(max_length=100)
detail = models.TextField()
entrez_id = models.CharField(max_length=10)
ensg_id = models.CharField(max_length=30)
- 癌症信息表
class Tumor(models.Model):
name = models.CharField(max_length=30)
detail = models.TextField()
notes = models.CharField(max_length=50, blank=True)
- 拷贝数变异与基因融合
class Cnv(models.Model):
ngs_record = models.ForeignKey(Record, on_delete=models.CASCADE)
gene = models.ForeignKey(Gene, on_delete=models.CASCADE)
start = models.CharField(max_length=10)
end = mdoels.CharField(max_length=10)
copynum = models.IntegerField()
class Fusion(models.Model):
ngs_record = models.ForeignKey(Record, on_delete=models.CASCADE)
gene1 = models.ForeignKey(Gene, on_delete=models.CASCADE, related_name='gene1')
start1 = models.CharField(max_length=10)
end 1= mdoels.CharField(max_length=10)
gene2 = models.ForeignKey(Gene, on_delete=models.CASCADE, related_name='gene2')
start2 = models.CharField(max_length=10)
end2 = mdoels.CharField(max_length=10)
- 药物信息表
class Drug(models.Model):
chinese_name = models.CharField(max_length=20)
english_name = models.CharField(max_length=30)
approved_num = models.CharField(max_length=30)
detail = models.TextField()
- 药物-癌症表
class Drugcaner(models.Model):
drug = models.ForeignKey(Drug, on_delete=models.CASCADE)
tumor = models.ForeignKey(Tumor, on_delete=models.CACADE)
- 用药信息表
class Drugusage(models.Model):
drug = models.ForeignKey(Drug, on_delete=models.CASCADE)
tumor = models.ForeignKey(Tumor, on_delete=models.CACADE)
snv = models.ForeignKey(Snv, on_delete=models.CASCADE)