@@ -0,0 +1,2067 @@
+package data_manipulation;%0A%0Aimport java.io.File;%0Aimport java.io.FileNotFoundException;%0Aimport java.util.Scanner;%0A%0A/**********%0A * get all 18,000 gene names from ALS dataset;%0A * %0A * routine: D:%5CPhD%5CLizDeidentified_151002%5CLizDeidentified_151002%0A * file: gene_samp_matrix_high_LOF_het.txt%0A * %0A * all names could be found in the first line, also called the title line%0A * the very first one is %22sample%22, so we ignore that one. %0A * %0A * @author Jeff%0A *%0A */%0Apublic class D0627_GetGeneNames_from_ALSData %7B%0A%09%0A%09%0A%09public static void main(String%5B%5D args) throws FileNotFoundException%7B%0A%09%09%0A%09%09//create an object D0627_GetGeneNames_from_ALSData%0A%09%09D0627_GetGeneNames_from_ALSData getNames = new D0627_GetGeneNames_from_ALSData();%0A%09%09%0A%09%09//get the names%5B%5D array;%0A%09%09String%5B%5D names = getNames.run();%0A%09%09%0A%09%09%0A%09%09//check the results%0A%09%09System.out.println(%22There are: %22 + names.length + %22 gene names in ALS dataset.%22);%0A%09%09%0A%09%09%0A%09%09for(int i=1; i%3Cnames.length; i++)%7B%0A%09%09%09%0A%09%09%09System.out.print(names%5Bi%5D + %22%5Ct%22);%0A%09%09%09if(i%25200 == 0) System.out.println();%0A%09%09%7D%0A%09%09%0A%09%7D//end main();%0A%0A%09%0A%09/***************%0A%09 * run() method, to get all gene names from ALS dataset;%0A%09 * %0A%09 * @return%0A%09 * @throws FileNotFoundException%0A%09 */%0A%09String%5B%5D run() throws FileNotFoundException %7B%0A%09%09// TODO Auto-generated method stub%0A%09%09%0A%09%09//initial the routine and file name%0A%09%09String routine = %22D:/PhD/LizDeidentified_151002/LizDeidentified_151002/%22;%0A%09%09String file_name = %22gene_samp_matrix_high_LOF_het.txt%22;%0A%09%09%09%09%0A%09%09//create a scanner to scan the txt file%0A%09%09Scanner name_scanner = new Scanner(new File(routine + file_name));%0A%09%09%09%0A%09%09%09%09%0A%09%09//read in the title line; %0A%09%09String title_line = name_scanner.nextLine();%0A%09%09%09%09%0A%09%09//we do not need to read more lines, so close the scanner here%0A%09%09name_scanner.close();%0A%09%09%09%09%0A%09%09%09%09%0A%09%09//split the title into an array, by %22%5Ct%22%0A%09%09String%5B%5D names = title_line.split(%22%5Ct%22);%0A%09%09%0A%09%09//remove the first elementary, %22samples%22%0A%09%09String%5B%5D retNames = new String%5Bnames.length - 1%5D;%0A%09%09%0A%09%09for(int i=1; i%3Cnames.length; i++)%7B%0A%09%09%09retNames%5Bi-1%5D = names%5Bi%5D;%0A%09%09%7D%0A%09%09%0A%09%09//return the array%0A%09%09return retNames;%0A%09%09%0A%09%7D //end run() method;%0A%0A%7D//ee%0A

add get gene names java code