view NEUMA-1.2.1/NIR2LVKM_SE.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 readcount_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 $readcount_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";
$perlcommand= "perl";

$gNIR2gFVKM_script = "$scriptdir/gNIR2gFVKM.pl";
$iNIR2iFVKM_script = "$scriptdir/iNIR2iFVKM.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 $gNIR2gFVKM_script $readcount_dir/$sample.$midrefix.gNIR $EUMAprefix.gEUMA > $FVKM_out_dir/$sample.$midrefix.gFVKM`;
#`$perlcommand $iNIR2iFVKM_script $readcount_dir/$sample.$midrefix.iNIR $EUMAprefix.iEUMA > $FVKM_out_dir/$sample.$midrefix.iFVKM`;

`$gNIR2gFVKM_script $readcount_dir/$sample.$midrefix.gNIR $EUMAprefix.gEUMA > $FVKM_out_dir/$sample.$midrefix.gFVKM`;
`$iNIR2iFVKM_script $readcount_dir/$sample.$midrefix.iNIR $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`;

`$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`;
`$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`;
}