halo.examples
. Please note that,
since the different parts of HALO depend on each other, the source code provided below is
depending on previous loading of data, as shown in the previous use case.
Important note:
All variable parameters (methods, thresholds, etc) that are used in this example are chosen
arbitrarily and only for description purposes.
These parameters have to be chosen carefully depending on the data and goals for practical uses.
//choose labeling time
|
double medianHL = median(data, medMethods, time);
System.out.println("Median half-life "+medianHL);
|
//Normalization by linear regression
Normalization lr = new LinearRegression(data);
//set method for ratio calculation (default = RATIOFIRST)
data.setMethod(Data.AVERAGEFIRST);
//OR
//set replicate
// lr.setReplicate(1);
CorrectionFactors factors = lr.calculateCorrectionFactors();
|
gene_name
you have to set it (like below) to the correct label.
If you do not want a histogram as output, choose false
as last parameter in the filter
method.
//Filter with PQS
data.setGeneName("Gene Symbol");
data = Filter.filterPQS(data, lr, true);
data.writeOutput("Examples_mouse_filtered_pqs.txt", colTot, colNew, colPre, colAtt);
|
//Choose half-life calculation method: based on newly transcribed/total RNA
HalfLife hlNew = new HalfLife_New();
hlNew.initialize(data);
//Use normalization based on median half-life
hlNew.calculateCorrectionFactors(medianHL, time);
//calculate the half-lives
hlNew.calculateHalfLives(time);
//print the half-lives with gene names in an output file
hlNew.printHalfLivesWithGeneNames("Example_mouse_halflives_nt.txt");
//Calculate a second half-life method: based on pre-existing/total RNA
HalfLife hlPre = new HalfLife_Pre();
hlPre.initialize(data);
//Use normalization based on linear regression (see above)
hlPre.setCorrectionFactor(factors);
//calculate the half-lives
hlPre.calculateHalfLives(time);
|
GraphHandler.plotNormalization(lr, data);
//Prepare the parameters necessary for plotting
List<HalfLife> lives = new ArrayList<HalfLife>();
lives.add(hlNew);
//Define the names of the used methods
List<String> methods = new ArrayList<String>();
methods.add(HalfLife.NEWLY);
//Define the corresponding labeling times
List<Double> times = new ArrayList<Double>();
times.add(time);
//Leave replicate definition empty so that an average over all replicates will be used
List<Integer> replicates = new ArrayList<Integer>();
//Start plotting
XYGraphConstructor graphConstructor = GraphHandler.plotHalfLives(data, lives, methods,
times, replicates);
graphConstructor.generateGraph();
|
lives.add(hlPre);
///Define parameters
String header = "Spotid\tNewly_transcribed/Total\tPre-existing/Total"; //header for the output file
int which = HalfLifeWriter.HALFLIFE; //defines if you want only half-lives, ratios or both
String output = SampleUseCase1.DATAFILE+".halflives";
//Start printing
new HalfLifeWriter(output, header, which, lives.get(0), lives.get(1));
|
Loading data... |
Example_mouse_filtered_pqs.txt
Example_mouse_halflives_nt.txt