LREN-CHUV / algorithm-repository

Repository of functions or algorithms packaged (with Docker) for Algorithm Factory/Woken
3 stars 10 forks source link

Python-histogram fails on genetic variables #4

Closed ludovicc closed 6 years ago

ludovicc commented 7 years ago

INFO:root:variable: rs17125944_c INFO:root:groups: ['dataset', 'gender', 'agegroup', 'alzheimerbroadcategory'] INFO:root:columns: ['rs17125944_c', 'dataset', 'gender', 'agegroup', 'alzheimerbroadcategory'] Traceback (most recent call last): File "/main.py", line 273, in main() File "/main.py", line 31, in main json.dumps(generate_descriptive_stats(var, groups, data, data_columns), File "/main.py", line 45, in generate_descriptive_stats output.append(generate_histogram(data, data_columns, var)) File "/main.py", line 78, in generate_histogram var_categories) File "/main.py", line 105, in histo_nominal sums[v.rstrip()] += 1 KeyError: '0'

docker inspect 8ca8c5b6026a [ { "Id": "8ca8c5b6026a719d2c1f7b7677905c5d487d4b574ee58854367001d7ae28d4ed", "Created": "2017-10-16T10:45:54.46321336Z", "Path": "/docker-entrypoint.sh", "Args": [ "compute" ], "State": { "Status": "exited", "Running": false, "Paused": false, "Restarting": false, "OOMKilled": false, "Dead": false, "Pid": 0, "ExitCode": 1, "Error": "", "StartedAt": "2017-10-16T10:45:54.795594797Z", "FinishedAt": "2017-10-16T10:45:55.313828253Z" }, "Image": "sha256:5ad4879b87429baf105d219aee70c96575a7c4a084593574a4a48562c789747f", "ResolvConfPath": "/var/lib/docker/containers/8ca8c5b6026a719d2c1f7b7677905c5d487d4b574ee58854367001d7ae28d4ed/resolv.conf", "HostnamePath": "/var/lib/docker/containers/8ca8c5b6026a719d2c1f7b7677905c5d487d4b574ee58854367001d7ae28d4ed/hostname", "HostsPath": "/var/lib/docker/containers/8ca8c5b6026a719d2c1f7b7677905c5d487d4b574ee58854367001d7ae28d4ed/hosts", "LogPath": "", "Name": "/mesos-3b920c1c-0295-46f7-913f-29efaf61a17f", "RestartCount": 0, "Driver": "overlay", "Platform": "linux", "MountLabel": "", "ProcessLabel": "", "AppArmorProfile": "docker-default", "ExecIDs": null, "HostConfig": { "Binds": [ "/var/lib/mesos/slaves/dcf68ead-69c7-47cf-a4e5-5c062974548c-S0/docker/links/3b920c1c-0295-46f7-913f-29efaf61a17f:/mnt/mesos/sandbox" ], "ContainerIDFile": "", "LogConfig": { "Type": "journald", "Config": {} }, "NetworkMode": "host", "PortBindings": {}, "RestartPolicy": { "Name": "no", "MaximumRetryCount": 0 }, "AutoRemove": false, "VolumeDriver": "", "VolumesFrom": null, "CapAdd": null, "CapDrop": null, "Dns": [], "DnsOptions": [], "DnsSearch": [], "ExtraHosts": null, "GroupAdd": null, "IpcMode": "shareable", "Cgroup": "", "Links": null, "OomScoreAdj": 0, "PidMode": "", "Privileged": false, "PublishAllPorts": false, "ReadonlyRootfs": false, "SecurityOpt": null, "UTSMode": "", "UsernsMode": "", "ShmSize": 67108864, "Runtime": "runc", "ConsoleSize": [ 0, 0 ], "Isolation": "", "CpuShares": 512, "Memory": 536870912, "NanoCpus": 0, "CgroupParent": "", "BlkioWeight": 0, "BlkioWeightDevice": [], "BlkioDeviceReadBps": null, "BlkioDeviceWriteBps": null, "BlkioDeviceReadIOps": null, "BlkioDeviceWriteIOps": null, "CpuPeriod": 0, "CpuQuota": 0, "CpuRealtimePeriod": 0, "CpuRealtimeRuntime": 0, "CpusetCpus": "", "CpusetMems": "", "Devices": [], "DeviceCgroupRules": null, "DiskQuota": 0, "KernelMemory": 0, "MemoryReservation": 0, "MemorySwap": -1, "MemorySwappiness": null, "OomKillDisable": false, "PidsLimit": 0, "Ulimits": null, "CpuCount": 0, "CpuPercent": 0, "IOMaximumIOps": 0, "IOMaximumBandwidth": 0 }, "GraphDriver": { "Data": { "LowerDir": "/var/lib/docker/overlay/8b0cedaad7e59864d3157a855d0c8829c6827ca7f2878492ad5630f08e095058/root", "MergedDir": "/var/lib/docker/overlay/aa995cca2fd566f1a64511665d92fe9ca5a5a34ec03f1713a00e00c91667787e/merged", "UpperDir": "/var/lib/docker/overlay/aa995cca2fd566f1a64511665d92fe9ca5a5a34ec03f1713a00e00c91667787e/upper", "WorkDir": "/var/lib/docker/overlay/aa995cca2fd566f1a64511665d92fe9ca5a5a34ec03f1713a00e00c91667787e/work" }, "Name": "overlay" }, "Mounts": [ { "Type": "bind", "Source": "/var/lib/mesos/slaves/dcf68ead-69c7-47cf-a4e5-5c062974548c-S0/docker/links/3b920c1c-0295-46f7-913f-29efaf61a17f", "Destination": "/mnt/mesos/sandbox", "Mode": "", "RW": true, "Propagation": "rprivate" } ], "Config": { "Hostname": "hos49130", "Domainname": "", "User": "", "AttachStdin": false, "AttachStdout": true, "AttachStderr": true, "Tty": false, "OpenStdin": false, "StdinOnce": false, "Env": [ "IN_JDBC_PASSWORD=r5s3a6c9d8p2v", "IN_JDBC_URL=jdbc:postgresql://hos49130.intranet.chuv:31433/research", "OUT_JDBC_USER=woken", "PARAM_covariables=", "PARAM_meta={\"rs17125944_c\":{\"sql_type\":\"int\",\"enumerations\":[{\"code\":0,\"label\":0},{\"code\":1,\"label\":1},{\"code\":2,\"label\":2}],\"description\":\"\",\"methodology\":\"lren-nmm-volumes\",\"label\":\"rs17125944_C\",\"code\":\"rs17125944_c\",\"type\":\"polynominal\"},\"agegroup\":{\"enumerations\":[{\"code\":\"-50y\",\"label\":\"-50y\"},{\"code\":\"50-59y\",\"label\":\"50-59y\"},{\"code\":\"60-69y\",\"label\":\"60-69y\"},{\"code\":\"70-79y\",\"label\":\"70-79y\"},{\"code\":\"+80y\",\"label\":\"+80y\"}],\"description\":\"Age Group\",\"methodology\":\"mip-cde\",\"label\":\"Age Group\",\"code\":\"agegroup\",\"type\":\"polynominal\"},\"alzheimerbroadcategory\":{\"enumerations\":[{\"code\":\"AD\",\"label\":\"Alzheimer's disease\"},{\"code\":\"CN\",\"label\":\"Cognitively Normal\"},{\"code\":\"Other\",\"label\":\"Other\"}],\"description\":\"There will be two broad categories taken into account. Alzheimer's disease (AD) in which the diagnostic is 100% certain and \\"Other\\" comprising the rest of Alzheimer's related categories. The \\"Other\\" category refers to Alzheime's related diagnosis which origin can be traced to other pathology eg. vascular. In this category MCI diagnosis can also be found. In summary, all Alzheimer's related diagnosis that are not pure.\",\"methodology\":\"mip-cde\",\"label\":\"Alzheimer Broad Category\",\"code\":\"alzheimerbroadcategory\",\"type\":\"polynominal\"},\"dataset\":{\"enumerations\":[{\"code\":\"edsd\",\"label\":\"EDSD\"},{\"code\":\"adni\",\"label\":\"ADNI\"},{\"code\":\"ppmi\",\"label\":\"PPMI\"}],\"description\":\"Variable used to differentiate datasets.\",\"label\":\"Dataset\",\"code\":\"dataset\",\"type\":\"polynominal\"},\"gender\":{\"enumerations\":[{\"code\":\"M\",\"label\":\"Male\"},{\"code\":\"F\",\"label\":\"Female\"}],\"description\":\"Gender of the patient - Sex assigned at birth\",\"methodology\":\"mip-cde\",\"label\":\"Gender\",\"code\":\"gender\",\"length\":1,\"type\":\"binominal\"}}", "PARAM_query=select rs17125944_c,dataset,gender,agegroup,alzheimerbroadcategory from mip_local_features where rs17125944_c is not null and dataset is not null and gender is not null and agegroup is not null and alzheimerbroadcategory is not null ", "IN_JDBC_DRIVER=org.postgresql.Driver", "JOB_ID=40c37a3b-c0f2-4c87-ae1f-360d490a91a3", "OUT_JDBC_PASSWORD=aDB/neuroinfo", "OUT_JDBC_URL=jdbc:postgresql://hos49130.intranet.chuv:31433/woken", "PARAM_variables=rs17125944_c", "IN_JDBC_JAR_PATH=/usr/lib/R/libraries/postgresql-9.4-1201.jdbc41.jar", "DOCKER_IMAGE=hbpmip/python-histograms:4cb93ea", "NODE=hos49130.intranet.chuv", "CHRONOS_RESOURCE_CPU=0.5", "OUT_JDBC_DRIVER=org.postgresql.Driver", "HOST=hos49130.intranet.chuv", "OUT_JDBC_JAR_PATH=/usr/lib/R/libraries/postgresql-9.4-1201.jdbc41.jar", "PARAM_grouping=dataset,gender,agegroup,alzheimerbroadcategory", "CHRONOS_RESOURCE_MEM=512.0", "IN_JDBC_USER=research", "CHRONOS_RESOURCE_DISK=256.0", "MESOS_SANDBOX=/mnt/mesos/sandbox", "CHRONOS_JOB_NAME=python_histograms_40c37a3b_c0f2_4c87_ae1f_360d490a91a3", "MESOS_CONTAINER_NAME=mesos-3b920c1c-0295-46f7-913f-29efaf61a17f", "mesos_task_id=ct:1508150752607:2:python_histograms_40c37a3b_c0f2_4c87_ae1f_360d490a91a3:", "CHRONOS_JOB_OWNER=admin@mip.chuv.ch", "PATH=/opt/conda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", "LANG=C.UTF-8", "LC_ALL=C.UTF-8", "COMPUTE_IN=/data/in", "COMPUTE_OUT=/data/out", "MODEL=histograms", "FUNCTION=python-histograms", "CODE=histo", "NAME=Histograms" ], "Cmd": [ "compute" ], "Image": "hbpmip/python-histograms:4cb93ea", "Volumes": null, "WorkingDir": "", "Entrypoint": [ "/docker-entrypoint.sh" ], "OnBuild": null, "Labels": { "eu.humanbrainproject.category": "Python" } }, "NetworkSettings": { "Bridge": "", "SandboxID": "b32fbbaa1aa9b729443855d9c090aa67e149387d338ebf4a858fa74e357295ed", "HairpinMode": false, "LinkLocalIPv6Address": "", "LinkLocalIPv6PrefixLen": 0, "Ports": {}, "SandboxKey": "/var/run/docker/netns/default", "SecondaryIPAddresses": null, "SecondaryIPv6Addresses": null, "EndpointID": "", "Gateway": "", "GlobalIPv6Address": "", "GlobalIPv6PrefixLen": 0, "IPAddress": "", "IPPrefixLen": 0, "IPv6Gateway": "", "MacAddress": "", "Networks": { "host": { "IPAMConfig": null, "Links": null, "Aliases": null, "NetworkID": "dd644a5262cb021644570c9257a95e808a3d4fca5e813fd3513752dfd3a26e8b", "EndpointID": "", "Gateway": "", "IPAddress": "", "IPPrefixLen": 0, "IPv6Gateway": "", "GlobalIPv6Address": "", "GlobalIPv6PrefixLen": 0, "MacAddress": "", "DriverOpts": null } } } } ]

mirco-nasuti commented 7 years ago

Should be fixed ! Still have to test it on the CLM Vertex.

Marigold commented 6 years ago

Same as #11, fails if all values are null. Should be fixed by https://github.com/LREN-CHUV/algorithm-repository/pull/11

ludovicc commented 6 years ago

Fixed