Skip to content

Commit

Permalink
model class added
Browse files Browse the repository at this point in the history
  • Loading branch information
sureshhewabi committed Nov 3, 2023
1 parent 91596c0 commit 3453dd8
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 0 deletions.
32 changes: 32 additions & 0 deletions xi_web_api/models/detailedview.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
from xi_web_api.models.proteindetails import ProteinDetails


class DetailedView:

def __init__(self, accession, title, description, pubmed_id, protein_details):
self.accession = accession
self.title = title
self.description = description
self.pubmed_id = pubmed_id
self.protein_details = protein_details

def add_protein_details(self, protein_details):
if isinstance(protein_details, ProteinDetails):
self.protein_details.append(protein_details)
else:
print("Invalid protein_details object. Please provide a protein_details instance.")

def remove_protein_details(self, protein_details):
if protein_details in self.protein_details:
self.protein_details.remove(protein_details)
else:
print("Protein details not found in the Detailed View.")

# def to_dict(self):
# return {
# 'accession': self.accession,
# 'title': self.title,
# 'description': self.description,
# 'pubmed_id': self.pubmed_id,
# 'protein_details': self.protein_details
# }
17 changes: 17 additions & 0 deletions xi_web_api/models/proteindetails.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
class ProteinDetails:

def __init__(self, proteins, peptides, spectra, cross_linking, pdb):
self.proteins = proteins
self.peptides = peptides
self.spectra = spectra
self.cross_linking = cross_linking
self.pdb = pdb

# def to_dict(self):
# return {
# 'proteins': self.self.proteins,
# 'peptides': self.self.peptides,
# 'spectra': self.self.spectra,
# 'cross_linking': self.self.cross_linking,
# 'pdb': self.self.pdb
# }
10 changes: 10 additions & 0 deletions xi_web_api/models/summary.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class Summary:

def __init__(self):
self.accession = ""
self.title = ""
self.pubmed_id = ""
self.proteins = 0
self.peptides = 0
self.spectra = 0
self.aggregated_view = ""

0 comments on commit 3453dd8

Please sign in to comment.