From 617ccb48320d1a7eff90542e8f960f64f70258e8 Mon Sep 17 00:00:00 2001 From: kohleman <kohleman> Date: Mon, 17 Aug 2015 09:27:43 +0000 Subject: [PATCH] added extra fields, like SAMPLE_TYPE and SAMPLE_CODE SVN: 34463 --- .../cisd/dsu/metadata/create_metadata.java | 41 ++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/deep_sequencing_unit/source/java/ch/ethz/bsse/cisd/dsu/metadata/create_metadata.java b/deep_sequencing_unit/source/java/ch/ethz/bsse/cisd/dsu/metadata/create_metadata.java index f719077766f..3bc3b617219 100644 --- a/deep_sequencing_unit/source/java/ch/ethz/bsse/cisd/dsu/metadata/create_metadata.java +++ b/deep_sequencing_unit/source/java/ch/ethz/bsse/cisd/dsu/metadata/create_metadata.java @@ -57,14 +57,26 @@ import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.SearchCriteria; public class create_metadata { + private static final String SEQUENCER = "SEQUENCER"; + + private static final String SEQUENCER_MODEL = "SEQUENCER_MODEL"; + + private static final String ILLUMINA_FLOW_LANE = "ILLUMINA_FLOW_LANE"; + + private static final String LANE_NUMBER = "LANE_NUMBER"; + private static final String TSV_ENDING = ".tsv"; private static final String FLOW_CELL_PROPERTIES_NAME = "FLOW_CELL_PROPERTIES"; private static final String EXPERIMENT_NAME = "EXPERIMENT"; + private static final String SAMPLE_CODE = "SAMPLE_CODE"; + private static final String SAMPLE_TYPE_ILLUMINA_SEQUENCING = "ILLUMINA_SEQUENCING"; + private static final String SAMPLE_TYPE = "SAMPLE_TYPE"; + private static final String INDEX1_NOINDEX_VALUE = "NOINDEX"; private static final String DATASET_TYPE_CODE_FASTQ_GZ = "FASTQ_GZ"; @@ -84,6 +96,16 @@ public class create_metadata private static final char[] HEX_CHARACTERS = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', }; + private static final Map<String, String> SEQUENCER_NAMING; + static + { + SEQUENCER_NAMING = new HashMap<String, String>(); + SEQUENCER_NAMING.put("D00535", "Illumina HiSeq 2500"); + SEQUENCER_NAMING.put("J00121", "Illumina HiSeq 3000"); + SEQUENCER_NAMING.put("M01761", "Illumina MiSeq"); + SEQUENCER_NAMING.put("NS500318", "Illumina NextSeq 500"); + } + public static void main(String[] args) { try @@ -131,6 +153,11 @@ public class create_metadata for (String sampleCode : sampleCodeList) { List<Sample> sampleList = searchSample(infoService, sessionToken, sampleCode, fetchOptions); + if (sampleList.size() < 1) + { + System.out.println(sampleCode + " Not found!"); + } + SortedMap<String, SortedMap<String, String>> sampleMap = getProperties(sampleList); SortedMap<String, SortedMap<String, String>> flowcellMap = null; String flowcellCode = ""; @@ -142,9 +169,14 @@ public class create_metadata HashMap<String, Integer> dbResult = DbAccess.doQuery(connection, permId); for (Sample child : children) { - if (child.getSampleTypeCode().equals("ILLUMINA_FLOW_LANE")) + if (child.getSampleTypeCode().equals(ILLUMINA_FLOW_LANE)) { flowcellCode = child.getCode().split(":")[0]; + String flowlaneCode = child.getCode().split(":")[1]; + SortedMap<String, String> sampleProps = sampleMap.get(sampleCode); + sampleProps.put(LANE_NUMBER, flowlaneCode); + sampleMap.put(sampleCode, sampleProps); + List<Sample> flowcellList = searchSample(infoService, sessionToken, flowcellCode, flowcellFetchOptions); flowcellMap = getProperties(flowcellList); } @@ -169,11 +201,18 @@ public class create_metadata { sortedProperties.put(key, cleanString(sampleProperties.get(key).toString())); } + if (key.equals(SEQUENCER)) + { + sortedProperties.put(SEQUENCER_MODEL, SEQUENCER_NAMING.get(sampleProperties.get(key))); + } } if (sample.getSampleTypeCode().equals(SAMPLE_TYPE_ILLUMINA_SEQUENCING)) { sortedProperties.put(EXPERIMENT_NAME, sample.getExperimentIdentifierOrNull()); } + sortedProperties.put(SAMPLE_CODE, sample.getCode()); + sortedProperties.put(SAMPLE_TYPE, sample.getSampleTypeCode()); + sampleMap.put(sample.getCode(), sortedProperties); } return sampleMap; -- GitLab