Skip to main content

Posts

Showing posts from February, 2015

JAVA directory operation : List files in a folder , copy files and folder creation

List files in a folder  import java.io.*; public static Vector listFiles_Files_Dir(String absPathFolder)     {         Vector vectAllFiles = new Vector ();         File folder = new File(absPathFolder);         File[] listOfFiles = folder.listFiles();         for (int i = 0; i < listOfFiles.length; i++) {             if (listOfFiles[i].isFile()) {                                 System.out.println("File: " + listOfFiles[i].getName());                 vectAllFiles.add(listOfFiles[i].getName() );                             } else if (listOfFiles[i].isDirectory()) {                                 System.out.println("Directory: " + listOfFiles[i].getName());                 vectAllFiles.add(listOfFiles[i].getName() );                             }         }         return vectAllFiles;     } Create folder      import java.io.*;      public static void create_new_folder(String absPathFolder)     {         File theDir = new File(absPathFolder);        

ngsplot ngs.plot tutorial

#!/bin/sh # #SBATCH --job-name=testJob #SBATCH --time=24:00:00 #SBATCH --nodes=1 #SBATCH --ntasks=1 #SBATCH --partition=dragon-default #SBATCH --ntasks-per-node=1 #SBATCH --mem=8192 # # Display all variables set by slurm env | grep "^SLURM" | sort ## run with command: sbatch NGSPLOT_test.sh #module load gcc/4.7.4 #module load  compilers-extra #module load samtools/1.1 #module load bwtool/1.0 module purge module load slurm module load gcc/4.7.4 module load R/3.1.1 module load ngsplot dataDir="/home/alamt/HMCan_test/" workDir=/home/alamt/NGSPLOT/ cd $workDir hg19size=hg19.chrom.sizes tfName="MEF_2A" bedFile="F5_robust_DPI_TSS_500_upstream_500_downstream_nonCoding_only.bed" ############################### ##### 1. Run ngs.plot.r ##### Mandatory parameters: #  -G   Genome name. Use ngsplotdb.py list to show available genomes. #  -R   Genomic regions to plot: tss, tes, genebody, exon, cgi, enhancer, dhs or bed #  -C   Indexed bam file or a configur

ggplot ggplot2 tutorial

Data format processing for ggplot2 You have to make data frame to work with ggplot2 http://mundosubmundo.kaiux.com/?p=346 START WITH THIS SITE http://www.cookbook-r.com/Graphs/Bar_and_line_graphs_%28ggplot2%29/  Official web site http://docs.ggplot2.org/current/ Practical Tips http://www.ceb-institute.org/bbs/wp-content/uploads/2011/09/handout_ggplot2.pdf 3 Steps to make any ggplot graph (Tanvir's 3 step approach; it will work on 90 percent graph)   1. Make a data frame 2. Make a ggplot object with aes ( group =.. , color=.. , x = .. , y= ..) Here for all plot don't require both x and y. For example, density plot only requires x , so for density provide only x for aes (). For boxplot it requires y value and x-value to show different group. so provide both x- and y-value in aes(). 3. Use different function to make different type of plot ##### Step -1  NoA = 10 u = rnorm(NoA) NoB = 20 v = rnorm(NoB) myfm =data.frame(genegroup = factor(