/* (non-Javadoc) * @see org.genomesmanager.services.impl.snps.SnpsImporter#save() */ @Override public void save() { for (Individual i : individuals) { individualRepository.save(i); } for (Snp snp : snps) { snpRepository.save(snp); } }
@Test public void test() { Species sp = SpeciesOM.Generate(1).get(0); speciesRepo.save(sp); Chromosome chr = ChromosomesOM.Generate(1, sp).get(0); chromosomeRepo.save(chr); Sequence seq = SequencesOM.Generate(1, chr).get(0); sequenceRepo.save(seq); Variety variety = VarietiesOM.Generate(1, sp).get(0); varietyRepo.save(variety); Individual individual = IndividualsOM.Generate(1, variety).get(0); individualRepo.save(individual); Snp snp = SnpsOM.Generate(1, individual, seq).get(0); snp = snpRepo.save(snp); Snp postSnp = snpRepo.findOne(snp.getId()); assertEquals(snp, postSnp); }
@Test public void testGetAll() { int nOfSnps = 7; Species sp = SpeciesOM.Generate(1).get(0); sp = speciesRepo.save(sp); Chromosome chr = ChromosomesOM.Generate(1, sp).get(0); chr = chromosomeRepo.save(chr); Sequence seq = SequencesOM.Generate(1, chr).get(0); seq = sequenceRepo.save(seq); Variety variety = VarietiesOM.Generate(1, sp).get(0); variety = varietyRepo.save(variety); Individual individual = IndividualsOM.Generate(1, variety).get(0); individual = individualRepo.save(individual); for (Snp snp : SnpsOM.Generate(nOfSnps, individual, seq)) { snp = snpRepo.save(snp); } assertEquals(nOfSnps, snpRepo.getAllByChromosome(chr).size()); assertEquals(nOfSnps, snpRepo.getAllBySpecies(sp).size()); }
/* (non-Javadoc) * @see org.genomesmanager.services.impl.snps.SnpsImporter#setIndividuals(java.util.List) */ @Override public void setIndividuals(List<Integer> ids) { for (Integer id : ids) { individuals.add(individualRepository.findOne(id)); } }