view NEUMA-1.2.1/MA2LVKM_single_4.pl @ 0:c44c43d185ef draft default tip

NEUMA-1.2.1 Uploaded
author chawhwa
date Thu, 08 Aug 2013 00:46:13 -0400
parents
children
line wrap: on
line source

#!/usr/bin/perl

if(@ARGV<13) { print "usage: $0 sample_name sample_MA_dir midrefix(samplename.midrefix.i.all.gMA) EUMAprefix(before .gEUMA or .iEUMA) gFVKM_out_dir LGPM_out_dir EUMA_cut mapping_stat_column mapping_stat_file presence_of_i_at_end_of_midrefix[1/0] final_adjustment_option[1:average & rescaling/2:max & no rescaling] gene2NM_file gene2symbol_file datatype(R(Refseq)_or_E(Ensembl)) scriptdir\n"; exit; }

my $sample = shift @ARGV;
my $sample_MA_dir = shift @ARGV;
my $midrefix = shift @ARGV;
my $EUMAprefix = shift @ARGV;
my $FVKM_out_dir = shift @ARGV;
my $LVKM_out_dir = shift @ARGV;
my $EUMA_cut = shift @ARGV;
my $mapping_stat_column = shift @ARGV;
my $mapping_stat_file = shift @ARGV;
my $i_after_midrefix = shift @ARGV;
my $final_adjustment_option = shift @ARGV;
my $gene2NM_file = shift @ARGV;
my $gene2symbol_file = shift @ARGV;
my $datatype = shift @ARGV;
my $scriptdir = shift @ARGV;

if(!-d $FVKM_out_dir) { `mkdir -p $FVKM_out_dir`; }
if(!-d $LVKM_out_dir) { `mkdir -p $LVKM_out_dir`;}

$perlcommand= "perl -I $scriptdir";

$gMA2gFVKM_script = "$scriptdir/gMA2gFVKM_2.pl";
$iMA2iFVKM_script = "$scriptdir/iMA2iFVKM.pl";
$combine_gFVKM_iFVKM_script = "$scriptdir/combine_gFVKM_iFVKM_max.pl";
$normalize_gFVKM_script = "$scriptdir/normalize_gFVKM_5.pl";
$normalize_iFVKM_script = "$scriptdir/normalize_iFVKM_6.pl";
$NR_filter_script = "$scriptdir/filter_exclusive_NRgene_from_gene_table.pl";


#computing gFVKM and iFVKM, from EUMA/iEUMA and gMA/iMA files.
if($i_after_midrefix eq '1'){ $MA_midrefix = "$midrefix.i";}
else { $MA_midrefix = $midrefix; }
`$perlcommand $gMA2gFVKM_script $sample_MA_dir/$sample.$MA_midrefix.all.gMA $EUMAprefix.gEUMA > $FVKM_out_dir/$sample.$midrefix.gFVKM`;
`$perlcommand $iMA2iFVKM_script $sample_MA_dir/$sample.$MA_midrefix.all.iMA $EUMAprefix.iEUMA > $FVKM_out_dir/$sample.$midrefix.iFVKM`;

#updating gFVKM & iFVKM baed on each other
`$perlcommand $combine_gFVKM_iFVKM_script $FVKM_out_dir/$sample.$midrefix.gFVKM $FVKM_out_dir/$sample.$midrefix.iFVKM $gene2NM_file $EUMA_cut $FVKM_out_dir/$sample.$midrefix.$EUMA_cut.final.gFVKM $FVKM_out_dir/$sample.$midrefix.$EUMA_cut.final.iFVKM`;

#normalize and compute LGPM/LTPM
`$perlcommand $normalize_gFVKM_script $FVKM_out_dir/$sample.$midrefix.$EUMA_cut.final.gFVKM $mapping_stat_file $gene2symbol_file $mapping_stat_column $sample $LVKM_out_dir/$sample.$midrefix.$EUMA_cut.gLVKM`;
`$perlcommand $normalize_iFVKM_script $FVKM_out_dir/$sample.$midrefix.$EUMA_cut.final.iFVKM $mapping_stat_file $gene2symbol_file $mapping_stat_column $sample $LVKM_out_dir/$sample.$midrefix.$EUMA_cut.iLVKM`;

#filter NR-only genes
if($datatype eq 'R'){
 `$perlcommand $NR_filter_script $gene2NM_file $LVKM_out_dir/$sample.$midrefix.$EUMA_cut.gLVKM > $LVKM_out_dir/$sample.$midrefix.$EUMA_cut.-NR.gLVKM`;
 `$perlcommand $NR_filter_script $gene2NM_file $LVKM_out_dir/$sample.$midrefix.$EUMA_cut.iLVKM > $LVKM_out_dir/$sample.$midrefix.$EUMA_cut.-NR.iLVKM`;
}