annotate microRNA.pl @ 53:f5a2e8308836 draft default tip

Uploaded
author big-tiandm
date Mon, 08 Dec 2014 01:51:16 -0500
parents 7b5a48b972e9
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
50
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
1 #!/usr/bin/perl -w
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
2 #Filename:
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
3 #Author: Tian Dongmei
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
4 #Email: tiandm@big.ac.cn
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
5 #Date: 2014-4-22
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
6 #Modified:
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
7 #Description: plant microRNA prediction
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
8 my $version=1.00;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
9
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
10 use strict;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
11 use Getopt::Long;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
12 use threads;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
13 #use threads::shared;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
14 use File::Path;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
15 use File::Basename;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
16 #use RNA;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
17 #use Term::ANSIColor;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
18
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
19 my %opts;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
20 GetOptions(\%opts,"i=s","fa=s","gfa=s","pre:s","mat:s","dis:i","flank:i","mfe:f","idx:s","mis:i","r:i","e:i","f:i","t:i","o:s","path:s","D","h");
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
21 if (!(defined $opts{i} and defined $opts{gfa}) || defined $opts{h}) { #necessary arguments
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
22 &usage;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
23 }
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
24
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
25 my $time=&Time();
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
26 print "miPlant program start:\n The time is $time!\n";
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
27 print "Command line:\n $0 @ARGV\n";
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
28
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
29 my $mypath=`pwd`;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
30 chomp $mypath;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
31
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
32 my $dir=defined $opts{'o'} ? $opts{'o'} : "$mypath/miRNA_out/";
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
33
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
34
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
35 unless ($dir=~/\/$/) {$dir.="/";}
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
36 if (not -d $dir) {
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
37 mkdir $dir;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
38 }
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
39 my $config=$opts{'i'};
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
40 my $data=$opts{'fa'};
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
41
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
42 my $scipt_path=defined $opts{'path'} ? $opts{'path'} : "/Users/big/galaxy-dist/tools/myTools/";
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
43
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
44 my $t=1; #threads number
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
45 if (defined $opts{'t'}) {$t=$opts{'t'};}
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
46
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
47 my $mis=0; #mismatch number for microRNA
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
48 if (defined $opts{'mis'}) {$mis=$opts{'mis'};}
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
49
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
50 my $hit=25; # maximum reads mapping hits in genome
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
51 if (defined $opts{'r'}) {$hit=$opts{'r'};}
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
52
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
53 my $upstream = 2; # microRNA 5' extension
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
54 $upstream = $opts{'e'} if(defined $opts{'e'});
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
55
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
56 my $downstream = 5;# microRNA 3' extension
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
57 $downstream = $opts{'f'} if(defined $opts{'f'});
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
58
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
59 my $maxd=defined $opts{'dis'} ? $opts{'dis'} : 200;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
60 my $flank=defined $opts{'flank'} ? $opts{'flank'} :10;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
61 my $mfe=defined $opts{'mfe'} ? $opts{'mfe'} : -20;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
62
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
63 $time=&Time();
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
64 print "$time, Checking input file!\n";
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
65
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
66 my (@filein,@mark);
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
67 &read_config();
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
68
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
69 &checkfa($opts{pre}) if(defined $opts{pre});
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
70 &checkfa($opts{mat}) if(defined $opts{mat});
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
71 &checkfa($opts{gfa});
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
72
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
73 chdir $dir;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
74 my $data2=$data;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
75 my $known_result=$dir."known_miRNA_Express";
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
76 if(defined $opts{pre} and defined $opts{mat}){
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
77 &quantify(); ### known microRAN quantify
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
78 $data2=$known_result."/mirbase_not_mapped.fa";
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
79 }
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
80
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
81 my $genome_map=$dir."genome_match";
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
82 &genome($data2);
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
83
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
84 #my $genome_map=&search($dir,"genome_match_");
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
85 my $mapfile=$genome_map."/genome_mapped.bwt";
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
86 my $mapfa=$genome_map."/genome_mapped.fa";
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
87 my $unmap=$genome_map."/genome_not_mapped.fa";
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
88
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
89 #$time=Time();
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
90 #print "$time: Novel microRNA prediction!\n\n";
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
91
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
92 &predict($mapfa);
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
93
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
94 $time=Time();
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
95 print "$time: Program end!!\n";
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
96
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
97 ############################## sub programs ###################################
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
98 sub predict{
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
99 my ($file)=@_;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
100 $time=&Time();
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
101 print "$time: Novel microRNA prediction!\n\n";
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
102 my $predict=$dir."Novel_miRNA_predict";
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
103 mkdir $predict;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
104 chdir $predict;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
105 system("perl $scipt_path/precursors.pl -map $mapfile -g $opts{gfa} -d $maxd -f $flank -o $predict/excised_precursor.fa -s $predict/excised_precursor_struc.txt -e $mfe");
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
106 # print "\nprecursors.pl -map $mapfile -g $opts{gfa} -d $maxd -f $flank -o $predict/excised_precursor.fa -s $predict/excised_precursor_struc.txt -e $mfe\n";
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
107
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
108 system("bowtie-build -f excised_precursor.fa excised_precursor");
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
109 # print "\nbowtie-build -f excised_precursor.fa excised_precursor\n";
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
110
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
111 system("bowtie -v $mis -f -p $t -m $hit -a --best --strata excised_precursor $file > precursor_mapped.bwt 2> run.log");
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
112 # print "\nbowtie -v $mis -f -p $t -m $hit -a --best --strata excised_precursor $file > precursor_mapped.bwt\n";
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
113
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
114 system("perl $scipt_path/convert_bowtie_to_blast.pl precursor_mapped.bwt $file excised_precursor.fa > precursor_mapped.bst");
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
115 # print "\nconvert_bowtie_to_blast.pl precursor_mapped.bwt $file excised_precursor.fa > precursor_mapped.bst\n";
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
116
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
117 system("sort -k 4 precursor_mapped.bst > signatures.bst");
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
118 # print "\nsort +3 -25 precursor_mapped.bst > ../signatures.bst\n";
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
119
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
120 chdir $dir;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
121 system("perl $scipt_path/miRDeep_plant.pl $predict/signatures.bst $predict/excised_precursor_struc.txt novel_tmp_dir -y > microRNA_prediction.mrd");
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
122 # print "\nmiRDeep_plant.pl $dir/signatures.bst $predict/excised_precursor_struc.txt tmp_dir -y > microRNA_prediction.txt\n";
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
123 #system("rm novel_tmp_dir -rf");
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
124 my $tag=join "," ,@mark;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
125 system("perl $scipt_path/miRNA_Express_and_sequence.pl -i microRNA_prediction.mrd -list novel_microRNA_express.txt -fa novel_microRNA_mature.fa -pre novel_microRNA_precursor.fa -tag $tag");
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
126
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
127 system("perl $scipt_path/non_miRNA_reads.pl -i microRNA_prediction.mrd -fa $file -o non_microRNA_sequence.fa");
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
128
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
129 }
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
130
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
131 sub genome{
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
132 my ($file)=@_;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
133 if(defined $opts{'idx'}){
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
134 system("perl $scipt_path/matching.pl -i $file -g $opts{gfa} -v $mis -p $t -r $hit -o $dir -index $opts{idx} ") ;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
135 # print "\nmatching.pl -i $file -g $opts{gfa} -v $mis -p $t -r $hit -o $dir -index $opts{idx} -time $time\n";
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
136 }else{
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
137 system("perl $scipt_path/matching.pl -i $file -g $opts{gfa} -v $mis -p $t -r $hit -o $dir ") ;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
138 # print "\nmatching.pl -i $file -g $opts{gfa} -v $mis -p $t -r $hit -o $dir -time $time\n";
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
139 }
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
140 }
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
141
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
142 sub quantify{
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
143 my $tag=join "\\;" ,@mark;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
144 system("perl $scipt_path/quantify.pl -p $opts{pre} -m $opts{mat} -r $data -o $dir -mis $mis -t $t -e $upstream -f $downstream -tag $tag");
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
145 print "\nquantify.pl -p $opts{pre} -m $opts{mat} -r $data -o $dir -mis $mis -t $t -e $upstream -f $downstream -tag $tag\n";
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
146 }
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
147
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
148 sub read_config{
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
149 open CON,"<$config";
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
150 while (my $aline=<CON>) {
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
151 chomp $aline;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
152 my @tmp=split/\t/,$aline;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
153 push @filein,$tmp[0];
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
154 push @mark,$tmp[1];
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
155 #&check_rawdata($tmp[0]);
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
156 }
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
157 close CON;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
158 if (@filein != @mark) {
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
159 #&printErr();
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
160 die "Maybe config file have some wrong!!!\n";
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
161 }
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
162 }
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
163 sub checkfa{
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
164 my ($file_reads)=@_;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
165 open N,"<$file_reads";
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
166 my $line=<N>;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
167 chomp $line;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
168 if($line !~ /^>\S+/){
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
169 #printErr();
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
170 die "The first line of file $file_reads does not start with '>identifier'
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
171 Reads file $file_reads is not a valid fasta file\n\n";
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
172 }
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
173 if(<N> !~ /^[ACGTNacgtn]*$/){
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
174 #printErr();
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
175 die "File $file_reads contains not allowed characters in sequences
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
176 Allowed characters are ACGTN
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
177 Reads file $file_reads is not a fasta file\n\n";
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
178 }
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
179 close N;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
180 }
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
181 sub search{
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
182 my ($dir,$str)=@_;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
183 opendir I,$dir;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
184 my @ret;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
185 while (my $file=readdir I) {
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
186 if ($file=~/$str/) {
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
187 push @ret, $file;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
188 }
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
189 }
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
190 closedir I;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
191 if (@ret != 1) {
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
192 #&printErr();
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
193
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
194 die "Can not find directory or file which name has string: $str !!!\n";
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
195 }
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
196 return $ret[0];
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
197 }
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
198
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
199
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
200 sub Time{
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
201 my $time=time();
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
202 my ($sec,$min,$hour,$day,$month,$year) = (localtime($time))[0,1,2,3,4,5,6];
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
203 $month++;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
204 $year+=1900;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
205 if (length($sec) == 1) {$sec = "0"."$sec";}
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
206 if (length($min) == 1) {$min = "0"."$min";}
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
207 if (length($hour) == 1) {$hour = "0"."$hour";}
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
208 if (length($day) == 1) {$day = "0"."$day";}
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
209 if (length($month) == 1) {$month = "0"."$month";}
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
210 #print "$year-$month-$day $hour:$min:$sec\n";
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
211 return("$year-$month-$day $hour:$min:$sec");
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
212 }
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
213
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
214
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
215 sub usage{
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
216 print <<"USAGE";
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
217 Version $version
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
218 Usage:
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
219
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
220 $0 -i -fa -gfa -idx -pre -mat -mis -e -f -t -o -path
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
221 options:
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
222 -i input files, # config
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
223
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
224 -fa ,#fasta sequence file
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
225
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
226 -path scirpt path
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
227
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
228 -gfa string, input file # genome fasta. sequence file
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
229 -idx string, genome file index, file-prefix #(must be indexed by bowtie-build) The parameter
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
230 string must be the prefix of the bowtie index. For instance, if
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
231 the first indexed file is called 'h_sapiens_37_asm.1.ebwt' then
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
232 the prefix is 'h_sapiens_37_asm'.##can be null
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
233
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
234 -pre string, input file #species specific microRNA precursor sequences
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
235 -mat string, input file #species specific microRNA mature sequences
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
236
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
237 -mis [int] number of allowed mismatches when mapping reads to precursors, default 0
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
238 -e [int] number of nucleotides upstream of the mature sequence to consider, default 2
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
239 -f [int] number of nucleotides downstream of the mature sequence to consider, default 5
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
240 -r int a read is allowed to map up to this number of positions in the genome,default is 25
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
241
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
242 -dis <int> Maximal space between miRNA and miRNA* (200)
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
243 -flank <int> Flank sequence length of miRNA precursor (10)
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
244 -mfe <folat> Maximal free energy allowed for a miRNA precursor (-20)
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
245
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
246 -t int, number of threads [1]
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
247
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
248 -o output directory# absolute path
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
249 -h help
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
250 USAGE
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
251 exit(1);
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
252 }
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
253