Skip to content
Snippets Groups Projects
Commit 23d3afca authored by kohleman's avatar kohleman
Browse files

drop box for error rate of phix, error rate and density based on illuminate

SVN: 36052
parent d9e5ba64
No related branches found
No related tags found
No related merge requests found
incoming-dir = ${incoming-root-dir}/read-json
incoming-data-completeness-condition = marker-file
top-level-data-set-handler = ch.systemsx.cisd.etlserver.registrator.api.v2.JythonTopLevelDataSetHandlerV2
script-path = read-json.py
storage-processor = ch.systemsx.cisd.etlserver.DefaultStorageProcessor
jython-version=2.7
'''
@copyright:
2016 ETH Zuerich, SIS
@license:
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
@author:
Manuel Kohler
'''
import re
import glob
import os
from itertools import islice
from ch.systemsx.cisd.openbis.generic.shared.api.v1.dto import SearchCriteria
# The following module is located in the path defined in the datastore_server.conf
# Look for: -Dpython.path}
from gfb_utils import *
import json
def get_json_from_file(file):
with open(file, 'r') as f:
read_json = f.read()
return json.loads(read_json)[0]
def get_lane_count(json_string):
return int(json_string['lanecount'])
def get_flowcell_id(json_string):
return json_string['name']
def register_in_openbis(transaction, json_string):
lane_count = get_lane_count(json_string)
flowcell_id = get_flowcell_id(json_string)
found_flow_cell = search_unique_sample(transaction, flowcell_id)
search_service = transaction.getSearchService()
get_flowcell_with_contained_samples = search_service.getSample(found_flow_cell[0].getSampleIdentifier())
flowlanes = get_flowcell_with_contained_samples.getContainedSamples()
for lane in flowlanes:
mutable_lane = transaction.getSampleForUpdate(lane.getSampleIdentifier())
lane_number = lane.getCode().split(":")[-1]
aligned_mean = json_string['cluster_lane_dict'][str(lane_number)]['aligned'][0]['mean']
cluster_density_mean = json_string['cluster_lane_dict'][str(lane_number)]['clusterDensity'][0]['mean']
error_rate_mean = json_string['error_metrics'][str(lane_number)]['mean']
mutable_lane.setPropertyValue("PERC_PHIX_ALIGNED", str(aligned_mean))
mutable_lane.setPropertyValue("CLUSTER_DENSITY", str(cluster_density_mean))
mutable_lane.setPropertyValue("ERROR_RATE", str(error_rate_mean))
def process(transaction):
incoming = transaction.getIncoming()
incoming_path = incoming.getAbsolutePath()
json_file = glob.glob(os.path.join(incoming_path, "*.json"))
if json_file:
json_string = get_json_from_file(json_file[0])
register_in_openbis(transaction, json_string)
else:
print("No json file found!")
\ No newline at end of file
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