Skip to content

Commit

Permalink
review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
nitin-ebi committed Feb 12, 2024
1 parent 3d23017 commit cb4f0f4
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ public ResponseEntity<String> retrieveAndInsertENASequenceNameForAssembly(
}


@ApiOperation(value = "Retrieve list of assemblies for which MD5 Checksum updates are running/going-to-run ")
@ApiOperation(value = "Retrieve list of Jobs that are running or scheduled to run")
@GetMapping(value = "assemblies/scheduled-jobs")
public ResponseEntity<List<String>> getMD5ChecksumUpdateTaskStatus() {
List<String> scheduledJobStatus = handler.getScheduledJobStatus();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import uk.ac.ebi.eva.contigalias.conf.ApplicationContextHolder;
import uk.ac.ebi.eva.contigalias.scheduler.Job.Job;
import uk.ac.ebi.eva.contigalias.scheduler.Job.JobSubmittedEvent;
import uk.ac.ebi.eva.contigalias.scheduler.Job.JobType;
import uk.ac.ebi.eva.contigalias.scheduler.job.Job;
import uk.ac.ebi.eva.contigalias.scheduler.job.JobSubmittedEvent;
import uk.ac.ebi.eva.contigalias.scheduler.job.JobType;

import java.util.ArrayList;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package uk.ac.ebi.eva.contigalias.scheduler.Job;
package uk.ac.ebi.eva.contigalias.scheduler.job;

public class Job {
private final JobType type;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package uk.ac.ebi.eva.contigalias.scheduler.Job;
package uk.ac.ebi.eva.contigalias.scheduler.job;


import org.springframework.context.ApplicationEvent;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package uk.ac.ebi.eva.contigalias.scheduler.Job;
package uk.ac.ebi.eva.contigalias.scheduler.job;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationListener;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package uk.ac.ebi.eva.contigalias.scheduler.Job;
package uk.ac.ebi.eva.contigalias.scheduler.job;

public enum JobType {
ENA_SEQUENCE_NAME_UPDATE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
import uk.ac.ebi.eva.contigalias.repo.AssemblyRepository;
import uk.ac.ebi.eva.contigalias.repo.ChromosomeRepository;
import uk.ac.ebi.eva.contigalias.scheduler.ChromosomeUpdater;
import uk.ac.ebi.eva.contigalias.scheduler.Job.Job;
import uk.ac.ebi.eva.contigalias.scheduler.Job.JobType;
import uk.ac.ebi.eva.contigalias.scheduler.job.Job;
import uk.ac.ebi.eva.contigalias.scheduler.job.JobType;

import javax.transaction.Transactional;
import java.io.BufferedReader;
Expand Down Expand Up @@ -146,17 +146,16 @@ public void parseFileAndInsertAssembly(String accession) throws IOException {
chrLines.add(line);
if (chrLines.size() == BATCH_SIZE) {
List<ChromosomeEntity> chromosomeEntityList = ncbiDataSource.getChromosomeEntityList(assemblyEntity, chrLines);
chromosomeService.saveAllChromosomes(chromosomeEntityList);
chromosomeService.insertAllChromosomes(chromosomeEntityList);
chromosomesSavedTillNow += chrLines.size();
logger.info("Number of chromosomes saved till now : " + chromosomesSavedTillNow);

chrLines = new ArrayList<>();
}
}
if (!chrLines.isEmpty()) {
// add ena sequence name and save
List<ChromosomeEntity> chromosomeEntityList = ncbiDataSource.getChromosomeEntityList(assemblyEntity, chrLines);
chromosomeService.saveAllChromosomes(chromosomeEntityList);
chromosomeService.insertAllChromosomes(chromosomeEntityList);
chromosomesSavedTillNow += chrLines.size();
logger.info("Number of chromosomes saved till now : " + chromosomesSavedTillNow);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ private void stripAssemblyFromChromosome(ChromosomeEntity chromosome) {
public void putChromosomeChecksumsByAccession(String accession, String md5, String trunc512) {
Page<ChromosomeEntity> page = repository.findChromosomeEntitiesByInsdcAccessionOrRefseq(
accession, accession, Pageable.unpaged());
if (page.isEmpty()){
if (page.isEmpty()) {
throw new IllegalArgumentException(
"No chromosomes corresponding to accession " + accession + " found in the database");
}
Expand Down Expand Up @@ -284,7 +284,7 @@ public long countChromosomeEntitiesByEnaName(String enaName) {
return repository.countChromosomeEntitiesByEnaSequenceName(enaName);
}

public void saveAllChromosomes(List<ChromosomeEntity> chromosomeEntityList) {
public void insertAllChromosomes(List<ChromosomeEntity> chromosomeEntityList) {
String sql = "INSERT INTO chromosome (assembly_insdc_accession,contig_type,ena_sequence_name," +
"genbank_sequence_name,insdc_accession,md5checksum,refseq,seq_length,trunc512checksum,ucsc_name) " +
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
Expand All @@ -303,6 +303,7 @@ public void setValues(PreparedStatement ps, int i) throws SQLException {
ps.setString(9, chromosome.getTrunc512checksum());
ps.setString(10, chromosome.getUcscName());
}

@Override
public int getBatchSize() {
return chromosomeEntityList.size();
Expand Down

0 comments on commit cb4f0f4

Please sign in to comment.