def test_resolve_protein_type(self): proteomics = factory.CategoryFactory( type_group=models.MeasurementType.Group.PROTEINID) type_A = main_factory.ProteinFactory(accession_code="P12345") tr = TypeResolver(self.user, proteomics) found = tr.lookup_type("sp|P12345") assert found.pk == type_A.pk
def _setup_parse_success(self): mime = "text/csv" assay = factory.AssayFactory(study=self.study, protocol=self.protocol) factory.ProteinFactory(accession_code="P12345") ParserFactory( layout=self.layout, mime_type=mime, parser_class="edd.load.parsers.skyline.SkylineCsvParser", ) content = f""" Replicate Name,Protein Name,Total Area {assay.name},sp|P12345,42 """ file = SimpleUploadedFile("example", content.encode("utf-8"), content_type=mime) self.load.update({"file": file}) return self.load.request
def _setup_parse_excel(self): mime = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" assay = factory.AssayFactory(study=self.study, protocol=self.protocol) factory.ProteinFactory(accession_code="P12345") ParserFactory( layout=self.layout, mime_type=mime, parser_class="edd.load.parsers.skyline.SkylineExcelParser", ) wb = Workbook() wb.active.title = "Simple Upload" wb.active.append(["Replicate Name", "Protein Name", "Total Area"]) wb.active.append([assay.name, "sp|P12345", 42]) with NamedTemporaryFile() as temp: wb.save(temp) temp.seek(0) file = SimpleUploadedFile("example", temp.read(), content_type=mime) self.load.update({"file": file}) return self.load.request
def test_resolve_broad_type_with_uniprot_existing(self): broad = factory.CategoryFactory() type_A = main_factory.ProteinFactory(accession_code="P12345") tr = TypeResolver(self.user, broad) found = tr.lookup_type("sp|P12345") assert found.pk == type_A.pk