001/*
002 *                    BioJava development code
003 *
004 * This code may be freely distributed and modified under the
005 * terms of the GNU Lesser General Public Licence.  This should
006 * be distributed with the code.  If you do not have a copy,
007 * see:
008 *
009 *      http://www.gnu.org/copyleft/lesser.html
010 *
011 * Copyright for this code is held jointly by the individual
012 * authors.  These should be listed in @author doc comments.
013 *
014 * For more information on the BioJava project and its aims,
015 * or to join the biojava-l mailing list, visit the home page
016 * at:
017 *
018 *      http://www.biojava.org/
019 *
020 */
021package org.biojava.nbio.survival.kaplanmeier.metadata;
022
023import org.biojava.nbio.survival.data.WorkSheet;
024
025import java.util.ArrayList;
026import java.util.LinkedHashMap;
027
028/**
029 *
030 * @author Scooter Willis <willishf at gmail dot com>
031 */
032public class ClinicalMetaDataOutcome {
033
034        /**
035         *
036         * @param worksheet
037         * @param sensorMapColumn
038         * @param censorMap
039         * @param timeColumn
040         * @param timeScale
041         * @param metaDataInfoList
042         * @throws Exception
043         */
044        static public void process(WorkSheet worksheet, String sensorMapColumn, LinkedHashMap<String, String> censorMap, String timeColumn, Double timeScale, ArrayList<MetaDataInfo> metaDataInfoList) throws Exception {
045                for (MetaDataInfo metaDataInfo : metaDataInfoList) {
046                        if (metaDataInfo.numeric) {
047                                metaDataInfo.discreteQuantizer.process(worksheet, metaDataInfo.column);
048                        }
049                        metaDataInfo.setDiscreteValues(worksheet);
050                }
051
052                for (MetaDataInfo metaDataInfo : metaDataInfoList) {
053                        int numberValues = metaDataInfo.getNumberDiscreteValues();
054                        for(int i = 0; i < numberValues; i++){
055
056                        }
057
058                }
059
060        }
061
062        /**
063         *
064         * @param args
065         */
066        public static void main(String[] args) {
067
068                try {
069                        LinkedHashMap<String, String> censorMap = new LinkedHashMap<String, String>();
070                        censorMap.put("a", "0");
071                        censorMap.put("d", "1");
072                        censorMap.put("d-d.s.", "1");
073                        censorMap.put("d-o.c.", "1");
074                        String timeColumn = "TIME";
075                        String sensorMapColumn = "last_follow_up_status"; // "survstat3";
076                        double timeScale = 1.0;
077                        ArrayList<MetaDataInfo> metaDataInfoList = new ArrayList<MetaDataInfo>();
078                        metaDataInfoList.add(new MetaDataInfo("age_at_diagnosis", true, new MeanQuantizer()));
079                        metaDataInfoList.add(new MetaDataInfo("size", true, new MeanQuantizer()));
080                        metaDataInfoList.add(new MetaDataInfo("lymph_nodes_positive", true, new MeanQuantizer()));
081                        metaDataInfoList.add(new MetaDataInfo("lymph_nodes_removed", true, new MeanQuantizer()));
082                        metaDataInfoList.add(new MetaDataInfo("NPI", true, new MeanQuantizer()));
083                        metaDataInfoList.add(new MetaDataInfo("menopausal_status_inferred"));
084                        metaDataInfoList.add(new MetaDataInfo("group"));
085                        metaDataInfoList.add(new MetaDataInfo("grade"));
086                        metaDataInfoList.add(new MetaDataInfo("stage"));
087                        metaDataInfoList.add(new MetaDataInfo("ER_IHC_status"));
088                        metaDataInfoList.add(new MetaDataInfo("HER2_IHC_status"));
089                        metaDataInfoList.add(new MetaDataInfo("HER2_SNP6_state"));
090                        metaDataInfoList.add(new MetaDataInfo("cellularity"));
091                        metaDataInfoList.add(new MetaDataInfo("P53_mutation_status"));
092                        metaDataInfoList.add(new MetaDataInfo("P53_mutation_type"));
093                        metaDataInfoList.add(new MetaDataInfo("Pam50Subtype"));
094                        metaDataInfoList.add(new MetaDataInfo("Genefu"));
095
096                        WorkSheet worksheet = WorkSheet.readCSV("/Users/Scooter/scripps/ngs/DataSets/METABRIC/EGAD00010000210/table_S2_revised.txt", '\t');
097
098                        ClinicalMetaDataOutcome.process(worksheet, sensorMapColumn, censorMap, timeColumn, timeScale, metaDataInfoList);
099                } catch (Exception e) {
100                        e.printStackTrace();
101                }
102        }
103}