/* (non-Javadoc)
  * @see org.genomesmanager.services.impl.snps.SnpsImporter#parseMipsSnps(java.util.List)
  */
 @Override
 public void parseMipsSnps(List<String> lines) {
   System.out.println("Lines: " + lines.size());
   int lineN = 1;
   for (String line : lines) {
     String[] elems = line.split("\t+");
     String scaffoldName = elems[0];
     Sequence seq = sequenceRepository.findLatest(scaffoldName);
     if (seq == null) {
       errors.add(lineN + "\t" + line + "\t" + "Scaffold " + scaffoldName + " not found");
       continue;
     }
     int pos = Integer.parseInt(elems[1]);
     String referenceNucl = elems[2];
     for (int i = 3; i < elems.length; i++) {
       String reseq = elems[i];
       if (!reseq.equals("?")) {
         Snp snp = new Snp();
         snp.setIndividual(individuals.get(i - 3));
         snp.setPos(pos);
         snp.setSequence(seq);
         snp.setReference(referenceNucl);
         snp.setReseq(reseq);
         snps.add(snp);
       }
     }
     if (lineN % 1000 == 0) {
       System.out.println("Done " + lineN + " of " + lines.size());
     }
     lineN++;
   }
 }
 @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());
 }