Package data.cerevisiae.huesca2011swr1d

Source Code of data.cerevisiae.huesca2011swr1d.MapID

/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/

package data.cerevisiae.huesca2011swr1d;

import fork.lib.base.file.FileName;
import fork.lib.base.file.io.txt.ReadTable;
import fork.lib.base.file.management.Dirs;
import fork.lib.bio.data.microarray.ArrayProbeMapping;
import fork.lib.bio.data.microarray.IDMapperAffy;
import java.io.File;
import java.util.HashMap;
import java.util.Iterator;

/**
* @deprecated
* @author man-mqbpjmg4
*/
public class MapID {

   
   
public static void main(String[] args) throws Exception { //debug
    File dir= Dirs.getFile("dir");
    File anno= new File(dir+"\\anno\\microarray\\affymetrix/Yeast_2.na33.annot.csv");
    File d= new File(dir+"/other_datasets/huesca2011swr1d/raw/processed");
   
   
    File[] fs= d.listFiles();
    for( int i=0; i<fs.length; i++ ){
        File f= fs[i];
        if(f.isFile()){
            IDMapperAffy map = new IDMapperAffy(anno);

            ReadTable rt= new ReadTable(f);
            rt.param().setSkipRows(0);
            HashMap<String, String> hm= rt.getHashMap(0, 1);
            HashMap<String, Double> idv= new HashMap();
            Iterator<String> it= hm.keySet().iterator();
            while(it.hasNext()){
                String id= it.next();
                idv.put(id, Double.parseDouble(hm.get(id)));
            }


            ArrayProbeMapping ap= new ArrayProbeMapping(map, idv){
                protected boolean ifWriteID(String id)throws Exception {
                    if(id.indexOf("Y")==0){
                        return true;
                    }
                    return false;
                }
            };


            File od= new File(d+"/idmap");
            od.mkdirs();
            File out= new File(od+"/id_"+FileName.getBaseName(f)+".txt");
            ap.writeToFile(out);
        }
    }
}
   
}

TOP

Related Classes of data.cerevisiae.huesca2011swr1d.MapID

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.