use of org.cbioportal.cmo.pipelines.cvr.model.staging.MskimpactSeqDate in project cmo-pipelines by knowledgesystems.
the class MskimpactSeqDateFieldSetMapper method mapFieldSet.
@Override
public MskimpactSeqDate mapFieldSet(FieldSet fs) throws BindException {
MskimpactSeqDate record = new MskimpactSeqDate();
List<String> fields = MskimpactSeqDate.getFieldNames();
for (int i = 0; i < fields.size(); i++) {
String field = fields.get(i);
try {
record.getClass().getMethod("set" + field, String.class).invoke(record, fs.readString(i));
} catch (Exception e) {
if (e.getClass().equals(NoSuchMethodException.class)) {
log.info("No set method exists for " + field);
}
}
}
return record;
}
use of org.cbioportal.cmo.pipelines.cvr.model.staging.MskimpactSeqDate in project cmo-pipelines by knowledgesystems.
the class CVRClinicalDataReader method processSeqDateFile.
private void processSeqDateFile(ExecutionContext ec) {
File mskimpactSeqDateFile = new File(stagingDirectory, CVRUtilities.SEQ_DATE_CLINICAL_FILE);
if (!mskimpactSeqDateFile.exists()) {
log.error("File does not exist - skipping data loading from seq date file: " + mskimpactSeqDateFile.getName());
return;
}
log.info("Loading seq date data from: " + mskimpactSeqDateFile.getName());
DelimitedLineTokenizer tokenizer = new DelimitedLineTokenizer(DelimitedLineTokenizer.DELIMITER_TAB);
DefaultLineMapper<MskimpactSeqDate> mapper = new DefaultLineMapper<>();
mapper.setLineTokenizer(tokenizer);
mapper.setFieldSetMapper(new MskimpactSeqDateFieldSetMapper());
FlatFileItemReader<MskimpactSeqDate> reader = new FlatFileItemReader<>();
reader.setResource(new FileSystemResource(mskimpactSeqDateFile));
reader.setLineMapper(mapper);
reader.setLinesToSkip(1);
reader.open(ec);
MskimpactSeqDate mskimpactSeqDate;
try {
while ((mskimpactSeqDate = reader.read()) != null) {
// of samples, we might want a separate sampleToRecordMap for performance
if (patientToRecordMap.keySet().contains(mskimpactSeqDate.getPATIENT_ID())) {
for (CVRClinicalRecord record : patientToRecordMap.get(mskimpactSeqDate.getPATIENT_ID())) {
if (record.getSAMPLE_ID().equals(mskimpactSeqDate.getSAMPLE_ID())) {
record.setSEQ_DATE(mskimpactSeqDate.getSEQ_DATE());
break;
}
}
}
}
} catch (Exception e) {
log.error("Error reading data from seq date file: " + mskimpactSeqDateFile.getName());
throw new ItemStreamException(e);
} finally {
reader.close();
}
}
Aggregations