Mercurial > repos > bioitcore > splicetrap
comparison bin/SpliceTrap_measure.pl @ 1:adc0f7765d85 draft
planemo upload
| author | bioitcore |
|---|---|
| date | Thu, 07 Sep 2017 15:06:58 -0400 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 0:d4ca551ca300 | 1:adc0f7765d85 |
|---|---|
| 1 # Author: wuj@cshl.edu | |
| 2 use strict; | |
| 3 use Getopt::Long; | |
| 4 #################### | |
| 5 my %config=do "$ENV{HOME}/.SpliceTrap.pl.ini"; | |
| 6 my $SrcFolder=$config{SrcFolder}; | |
| 7 #my $SrcFolder="/data/zhang/wuj/tools/SpliceTrap.0.8"; | |
| 8 #################### | |
| 9 my $MapSoftware="eland"; | |
| 10 my $ReadFileFormat=""; | |
| 11 my $ReadFile1Name=""; | |
| 12 my $ReadFile2Name=""; | |
| 13 my $CutoffLevel="H"; | |
| 14 my $OutputPrefix="Result"; | |
| 15 my $CutoffOnly=0; | |
| 16 my $ReadSize=36; | |
| 17 | |
| 18 GetOptions ( | |
| 19 "m:s"=>\$MapSoftware, | |
| 20 "f:s"=>\$ReadFileFormat, | |
| 21 "1:s"=>\$ReadFile1Name, | |
| 22 "2:s"=>\$ReadFile2Name, | |
| 23 "c:s"=>\$CutoffLevel, | |
| 24 "o:s"=>\$OutputPrefix, | |
| 25 "s:i"=>\$ReadSize, | |
| 26 # "local:s"=>\$local, | |
| 27 "rerun"=>\$CutoffOnly | |
| 28 ); | |
| 29 | |
| 30 | |
| 31 my $InputParaDes=" Usage of the script (v0.82): | |
| 32 -m Mapping software: eland/bowtie/rmap | |
| 33 -f Read File Format: fasta/fastq | |
| 34 -1 Read File 1 | |
| 35 -2 Read File 2 | |
| 36 -c Cutoff Level:H/M/L | |
| 37 Means High, Middle or Low | |
| 38 -o Output prefix | |
| 39 -s Read Size 36 | |
| 40 --rerun Only run the last step, which is filtering | |
| 41 "; | |
| 42 | |
| 43 if($ReadFile1Name eq "" or $ReadFile2Name eq "" or $ReadFileFormat eq "") | |
| 44 { | |
| 45 print $InputParaDes; | |
| 46 exit; | |
| 47 } | |
| 48 | |
| 49 if($ReadFileFormat ne "fastq" and $ReadFileFormat ne "fasta") | |
| 50 { | |
| 51 print $InputParaDes; | |
| 52 exit; | |
| 53 | |
| 54 } | |
| 55 | |
| 56 if($CutoffLevel ne "H" and $CutoffLevel ne "M" and $CutoffLevel ne "L") | |
| 57 { | |
| 58 print $InputParaDes; | |
| 59 exit; | |
| 60 } | |
| 61 | |
| 62 my $dirname1=`dirname $ReadFile1Name`; | |
| 63 my $dirname2=`dirname $ReadFile2Name`; | |
| 64 if($dirname1 ne ".") | |
| 65 { | |
| 66 system("ln -s $ReadFile1Name ./"); | |
| 67 } | |
| 68 if($dirname2 ne ".") | |
| 69 { | |
| 70 system("ln -s $ReadFile2Name ./"); | |
| 71 } | |
| 72 | |
| 73 $ReadFile1Name = `basename $ReadFile1Name`; | |
| 74 chomp($ReadFile1Name); | |
| 75 $ReadFile2Name = `basename $ReadFile2Name`; | |
| 76 chomp($ReadFile2Name); | |
| 77 my $start = time; | |
| 78 if($MapSoftware eq "bowtie") | |
| 79 { | |
| 80 print "=================STAGE 1 MAPPING===================\n"; | |
| 81 system("bash $SrcFolder/mapping_bowtie.sh $ReadFile1Name $ReadFileFormat") if not $CutoffOnly; | |
| 82 system("bash $SrcFolder/mapping_bowtie.sh $ReadFile2Name $ReadFileFormat") if not $CutoffOnly; | |
| 83 print "STAGE 1 FINISHED IN ",time-$start," seconds\n"; | |
| 84 print "=================STAGE 2 ESTIMATION================\n"; | |
| 85 | |
| 86 system("bash $SrcFolder/batch_para_cov10p_fit.sh $ReadFile1Name $ReadFile2Name $OutputPrefix $ReadSize") if not $CutoffOnly; | |
| 87 print "STAGE 2 FINISHED IN ",time-$start," seconds\n"; | |
| 88 print "=================STAGE 3 CUTOFF====================\n"; | |
| 89 system("bash $SrcFolder/apply_cutoff.sh $OutputPrefix $CutoffLevel"); | |
| 90 print "STAGE 3 FINISHED IN ",time-$start," seconds\n"; | |
| 91 | |
| 92 | |
| 93 | |
| 94 } | |
| 95 | |
| 96 if($MapSoftware eq "rmap") | |
| 97 { | |
| 98 print "=================STAGE 1 MAPPING===================\n"; | |
| 99 | |
| 100 system("bash $SrcFolder/mapping_rmap.sh $ReadFile1Name $ReadFileFormat") if not $CutoffOnly; | |
| 101 system("bash $SrcFolder/mapping_rmap.sh $ReadFile2Name $ReadFileFormat") if not $CutoffOnly; | |
| 102 print "=================STAGE 2 ESTIMATION================\n"; | |
| 103 | |
| 104 system("bash $SrcFolder/batch_para_cov10p_fit.sh $ReadFile1Name $ReadFile2Name $OutputPrefix $ReadSize") if not $CutoffOnly; | |
| 105 print "=================STAGE 3 CUTOFF====================\n"; | |
| 106 system("bash $SrcFolder/apply_cutoff.sh $OutputPrefix $CutoffLevel"); | |
| 107 | |
| 108 | |
| 109 } | |
| 110 | |
| 111 print "============ALL DONE, OUTPUTFILE:$OutputPrefix.txt\n"; |
