Skip to content
Snippets Groups Projects
Commit 617ccb48 authored by kohleman's avatar kohleman
Browse files

added extra fields, like SAMPLE_TYPE and SAMPLE_CODE

SVN: 34463
parent c95de044
No related branches found
No related tags found
No related merge requests found
...@@ -57,14 +57,26 @@ import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.SearchCriteria; ...@@ -57,14 +57,26 @@ import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.SearchCriteria;
public class create_metadata 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 TSV_ENDING = ".tsv";
private static final String FLOW_CELL_PROPERTIES_NAME = "FLOW_CELL_PROPERTIES"; private static final String FLOW_CELL_PROPERTIES_NAME = "FLOW_CELL_PROPERTIES";
private static final String EXPERIMENT_NAME = "EXPERIMENT"; 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_ILLUMINA_SEQUENCING = "ILLUMINA_SEQUENCING";
private static final String SAMPLE_TYPE = "SAMPLE_TYPE";
private static final String INDEX1_NOINDEX_VALUE = "NOINDEX"; private static final String INDEX1_NOINDEX_VALUE = "NOINDEX";
private static final String DATASET_TYPE_CODE_FASTQ_GZ = "FASTQ_GZ"; private static final String DATASET_TYPE_CODE_FASTQ_GZ = "FASTQ_GZ";
...@@ -84,6 +96,16 @@ public class create_metadata ...@@ -84,6 +96,16 @@ public class create_metadata
private static final char[] HEX_CHARACTERS = private static final char[] HEX_CHARACTERS =
{ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', }; { '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) public static void main(String[] args)
{ {
try try
...@@ -131,6 +153,11 @@ public class create_metadata ...@@ -131,6 +153,11 @@ public class create_metadata
for (String sampleCode : sampleCodeList) for (String sampleCode : sampleCodeList)
{ {
List<Sample> sampleList = searchSample(infoService, sessionToken, sampleCode, fetchOptions); 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>> sampleMap = getProperties(sampleList);
SortedMap<String, SortedMap<String, String>> flowcellMap = null; SortedMap<String, SortedMap<String, String>> flowcellMap = null;
String flowcellCode = ""; String flowcellCode = "";
...@@ -142,9 +169,14 @@ public class create_metadata ...@@ -142,9 +169,14 @@ public class create_metadata
HashMap<String, Integer> dbResult = DbAccess.doQuery(connection, permId); HashMap<String, Integer> dbResult = DbAccess.doQuery(connection, permId);
for (Sample child : children) for (Sample child : children)
{ {
if (child.getSampleTypeCode().equals("ILLUMINA_FLOW_LANE")) if (child.getSampleTypeCode().equals(ILLUMINA_FLOW_LANE))
{ {
flowcellCode = child.getCode().split(":")[0]; 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); List<Sample> flowcellList = searchSample(infoService, sessionToken, flowcellCode, flowcellFetchOptions);
flowcellMap = getProperties(flowcellList); flowcellMap = getProperties(flowcellList);
} }
...@@ -169,11 +201,18 @@ public class create_metadata ...@@ -169,11 +201,18 @@ public class create_metadata
{ {
sortedProperties.put(key, cleanString(sampleProperties.get(key).toString())); 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)) if (sample.getSampleTypeCode().equals(SAMPLE_TYPE_ILLUMINA_SEQUENCING))
{ {
sortedProperties.put(EXPERIMENT_NAME, sample.getExperimentIdentifierOrNull()); sortedProperties.put(EXPERIMENT_NAME, sample.getExperimentIdentifierOrNull());
} }
sortedProperties.put(SAMPLE_CODE, sample.getCode());
sortedProperties.put(SAMPLE_TYPE, sample.getSampleTypeCode());
sampleMap.put(sample.getCode(), sortedProperties); sampleMap.put(sample.getCode(), sortedProperties);
} }
return sampleMap; return sampleMap;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment