質問編集履歴
3
systemが指定している最初のファイルのコードを追加
title
CHANGED
File without changes
|
body
CHANGED
@@ -20,19 +20,192 @@
|
|
20
20
|
use warnings;
|
21
21
|
|
22
22
|
system "perl ./Scripts/1_Preprocessing.pl";
|
23
|
-
system "perl ./Scripts/1_4_Rarefaction.pl";
|
24
|
-
system "perl ./Scripts/2_1_Find_unique.pl";
|
25
|
-
system "perl ./Scripts/2_2_Denoise.pl";
|
26
|
-
system "perl ./Scripts/2_3_Separate_chimera.pl";
|
27
|
-
system "perl ./Scripts/3_1_Usearch_global.pl";
|
28
|
-
system "perl ./Scripts/4_1_Annotation.pl";
|
29
|
-
system "perl ./Scripts/5_1_Fasta_for_Phylogenetic_Analysis.pl";
|
30
|
-
system "perl ./Scripts/5_2_Summary_table.pl";
|
31
|
-
system "perl ./Scripts/5_3_Fasta_classified_by_family.pl";
|
32
|
-
system "perl ./Scripts/6_1_Portal.pl";
|
33
|
-
system "perl ./Scripts/6_2_Phylogenetic_trees.pl";
|
34
|
-
|
23
|
+
以下略
|
35
24
|
|
25
|
+
以下1_Preprocessing.plのコード
|
26
|
+
#!/usr/bin/perl
|
27
|
+
use strict;
|
28
|
+
use warnings;
|
29
|
+
|
30
|
+
#2018/12/04 1_2 Strip_primers change to use the Primer_Cleaner.pl
|
31
|
+
#2018/07/01 1_2_Strip_primers.pl were changed to permit no primer seq
|
32
|
+
#2018/01/29 change Blast to Usearch_global
|
33
|
+
#2018/01/20 output a log file at 1_1 step
|
34
|
+
#2018/01/05 add compress option
|
35
|
+
|
36
|
+
#This script execute below scripts in each sample
|
37
|
+
#1_1 Merge_paird_reads.pl
|
38
|
+
#1_2_Strip_primers.pl
|
39
|
+
#1_3_Quality_filter.pl
|
40
|
+
|
41
|
+
|
42
|
+
#Setting
|
43
|
+
my ($db, $primer, $diff, $separate, $depth, $size, $identity, $identity2, $dictionary, $family, $temporary, $compress, $trim);
|
44
|
+
open (SET, "<", "Setting.txt") or die("error:$!");
|
45
|
+
while(<SET>){
|
46
|
+
if($_ =~ /^DB\s*=\s*(\S+)/){$db = $1;}
|
47
|
+
elsif($_ =~ /^Primers\s*=\s*(\S+)/){my $temp = $1;if($temp =~ /^no$/i){$primer = "No";}else{$primer = $temp;}}
|
48
|
+
elsif($_ =~ /^MaxDiff\s*=\s*(\S+)/){$diff = $1;}
|
49
|
+
elsif($_ =~ /^Divide\s*=\s*(\S+)/){$separate = $1;}
|
50
|
+
elsif($_ =~ /^Depth\s*=\s*(\S+)/){$depth = $1;}
|
51
|
+
elsif($_ =~ /^Length\s*=\s*(\d+)/){$size = $1;}
|
52
|
+
elsif($_ =~ /^UIdentity\s*=\s*(\S+)/){$identity = $1;}
|
53
|
+
elsif($_ =~ /^LIdentity\s*=\s*(\S+)/){$identity2 = $1;}
|
54
|
+
elsif($_ =~ /^Dictionary\s*=\s*(\S+)/){$dictionary = $1;}
|
55
|
+
elsif($_ =~ /^Family\s*=\s*(\S+)/){$family = $1;}
|
56
|
+
elsif($_ =~ /^Temporary\s*=\s*(\S+)/){$temporary = $1;}
|
57
|
+
elsif($_ =~ /^Compress\s*=\s*(\S+)/){$compress = $1;}
|
58
|
+
}
|
59
|
+
close(SET);
|
60
|
+
if($diff =~ /^length$/i){$trim = 1;}
|
61
|
+
unless($diff =~ /\d+/){$diff = 2;}
|
62
|
+
unless($separate){$separate = 0;}
|
63
|
+
if($separate =~ /^yes$/i){$separate = 1;}
|
64
|
+
else{$separate = 0;}
|
65
|
+
unless($db){print "Error!! Check the DB name in Setting.txt.\n"; exit;}
|
66
|
+
unless($primer){print "Error!! Check the Primer file name in Setting.txt.\n"; exit;}
|
67
|
+
unless($depth){print "Error!! Check the number of Depth in Setting.txt.\n"; exit;}
|
68
|
+
unless($size){print "Error!! Check the number of Length in Setting.txt.\n"; exit;}
|
69
|
+
unless($identity){print "Error!! Check the upper cut line of Homology Search in Setting.txt.\n"; exit;}
|
70
|
+
unless($identity2){print "Error!! Check the lower cut line of Homology Search in Setting.txt.\n"; exit;}
|
71
|
+
unless($temporary){$temporary = "YES";}
|
72
|
+
unless($compress){$compress = "YES";}
|
73
|
+
unless(-f "./DataBase/$db"){print "No DataBase file or DataBase name didn't match in Setting.txt\n"; exit;}
|
74
|
+
unless($primer =~ /^no$/i){
|
75
|
+
unless(-f "./DataBase/$primer"){print "No Primers file or file name didn't match in Setting.txt\n"; exit;}
|
76
|
+
}
|
77
|
+
unless(-f "./Dictionary/$dictionary"){
|
78
|
+
if($dictionary =~ /^no$/i){undef($dictionary);}
|
79
|
+
else{print "The file of Dictionary for common name isn't or don't match the name in Setting.txt\n"; exit;}
|
80
|
+
}
|
81
|
+
unless(-f "./Dictionary/$family"){
|
82
|
+
if($family =~ /^no$/i){undef($family);}
|
83
|
+
else{print "The file of Dictionary for Family name isn't or don't match the name in Setting.txt\n"; exit;}
|
84
|
+
}
|
85
|
+
|
86
|
+
#Get primer sequences
|
87
|
+
my $countp = 0;
|
88
|
+
my (%forward, %reverse, $namep);
|
89
|
+
my ($primerF, $primerR);
|
90
|
+
|
91
|
+
unless($primer =~ /^no$/i){
|
92
|
+
open (DATA2, "<", "./DataBase/$primer") or die("error:$!");
|
93
|
+
while(<DATA2>){
|
94
|
+
if($_ =~ /\#/){next;}
|
95
|
+
chomp($_);
|
96
|
+
if($_ =~ /Forward/){$countp = 1;next;}
|
97
|
+
if($_ =~ /Reverse/){$countp = 2;next;}
|
98
|
+
if($countp == 1){
|
99
|
+
if($_ =~ /^>(.+)/){$namep = $1;}
|
100
|
+
elsif($_ =~ /^[a-z]/i){$_ =~ tr/[a-z]/[A-Z]/; $forward{$namep} = $_;}
|
101
|
+
}
|
102
|
+
if($countp == 2){
|
103
|
+
if($_ =~ /^>(.+)/){$namep = $1;}
|
104
|
+
elsif($_ =~ /^[a-z]/i){
|
105
|
+
my $rev = reverse($_);
|
106
|
+
$rev =~ tr/ATGCURYMKDHBV/TACGAYRKMHDVB/;
|
107
|
+
$reverse{$namep} = $rev;}
|
108
|
+
}
|
109
|
+
}
|
110
|
+
close(DATA2);
|
111
|
+
unless(%forward){print "Error!! No primer seqeunce in $primer\n"; exit;}
|
112
|
+
unless(%reverse){print "Error!! No primer seqeunce in $primer\n"; exit;}
|
113
|
+
foreach(keys %forward){
|
114
|
+
unless($reverse{$_}){print "Error!! Paird primer need to be the same name!\nCheck $primer\n"; exit;}
|
115
|
+
}
|
116
|
+
foreach(keys %reverse){
|
117
|
+
unless($forward{$_}){print "Error!! Paird primer need to be the same name!\nCheck $primer\n"; exit;}
|
118
|
+
}
|
119
|
+
|
120
|
+
my $primer_num = keys %forward;
|
121
|
+
if($primer_num == 1){$separate = 0;}
|
122
|
+
if($trim and $primer_num == 1){
|
123
|
+
foreach(keys %forward){$primerF = length($forward{$_}); $primerR = length($reverse{$_});}
|
124
|
+
}elsif($trim and $primer_num > 1){
|
125
|
+
print "Error! \"MaxDiff = length\" in Setting.txt can use when primer pair is one pair\n"; exit;
|
126
|
+
}
|
127
|
+
if($trim){$separate = 0;}
|
128
|
+
}
|
129
|
+
|
130
|
+
#Database and Usearch check
|
131
|
+
opendir (DIR, "./DataBase") or die ("error:$!");
|
132
|
+
my @database = readdir DIR;
|
133
|
+
my $dbcheck = 0;
|
134
|
+
foreach(@database){
|
135
|
+
if ($_ =~ /${db}.udb/){$dbcheck++;}
|
136
|
+
}
|
137
|
+
closedir DIR;
|
138
|
+
|
139
|
+
opendir (DIR, "./Tools") or die ("error:$!");
|
140
|
+
my @tool = readdir DIR;
|
141
|
+
my $usearch;
|
142
|
+
foreach (@tool) {
|
143
|
+
if ($_ =~ /(usearch.+)/){$usearch = $1;}
|
144
|
+
}
|
145
|
+
closedir DIR;
|
146
|
+
unless($usearch){print "Error!! Please put an usearch exectable file in Tools directory!\n"; exit;}
|
147
|
+
|
148
|
+
unless($dbcheck){
|
149
|
+
my $command = "./Tools/$usearch -makeudb_usearch \"./DataBase/$db\" -output \"./DataBase/${db}.udb\"";
|
150
|
+
system $command;
|
151
|
+
}
|
152
|
+
|
153
|
+
|
154
|
+
#Decompressing files
|
155
|
+
opendir (DIR, "./Run") or die ("error:$!");
|
156
|
+
my @run = readdir DIR;
|
157
|
+
my $gzip = 0;
|
158
|
+
foreach (@run) {
|
159
|
+
if ($_ =~ /.gz$/){$gzip++;}
|
160
|
+
}
|
161
|
+
closedir DIR;
|
162
|
+
|
163
|
+
if($gzip){
|
164
|
+
print "Decompressing gz file to fastq file...\n";
|
165
|
+
foreach (@run) {
|
166
|
+
if ($_ =~ /.gz$/){
|
167
|
+
my $comand = "gzip -d \"./Run/$_\"";
|
168
|
+
system $comand;
|
169
|
+
}
|
170
|
+
}
|
171
|
+
}
|
172
|
+
|
173
|
+
#Get data names
|
174
|
+
opendir (DIR, "./Run") or die ("error:$!");
|
175
|
+
my @read = readdir DIR;
|
176
|
+
my $read_count = 0;
|
177
|
+
my %file;
|
178
|
+
foreach (@read) {
|
179
|
+
if ($_ =~ /(.+)_R1/){$file{$1}++; $read_count++;}
|
180
|
+
if ($_ =~ /(.+)_R2/){$file{$1}++; $read_count++;}
|
181
|
+
}
|
182
|
+
closedir DIR;
|
183
|
+
unless(%file){print "None of fastq files in Run file!!\n"; exit;}
|
184
|
+
foreach(keys %file){
|
185
|
+
if($file{$_} < 2){print "Error!! Check the Run directory!The analysis needs both R1 and R2 fastq files.\nR1 or R2 fastq files of $_ is not.\n"; exit;}
|
186
|
+
}
|
187
|
+
unless(-d "./Results"){mkdir "./Results";}
|
188
|
+
|
189
|
+
|
190
|
+
print "============================================================\n";
|
191
|
+
print " 1_Preprocessing \n";
|
192
|
+
print "============================================================\n";
|
193
|
+
#assemble pair seqs
|
194
|
+
mkdir "./Results/1_1_Merge_paird_reads";
|
195
|
+
unless($primer =~ /^no$/i){mkdir "./Results/1_2_Strip_primers";}
|
196
|
+
mkdir "./Results/1_3_Quality_filter";
|
197
|
+
open (LOG, ">", "./Results/log.txt") or die("error:$!");
|
198
|
+
my (%log, %raw);
|
199
|
+
|
200
|
+
my @youbi = ('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat');
|
201
|
+
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
|
202
|
+
$year += 1900;
|
203
|
+
$mon += 1;
|
204
|
+
if($min < 10){$min = "0$min";}
|
205
|
+
print LOG "Start: $year/$mon/$mday ($youbi[$wday]) $hour:$min\n";
|
206
|
+
|
207
|
+
以下略
|
208
|
+
|
36
209
|
### 試したこと
|
37
210
|
|
38
211
|
Active perlのインストールしなおし、環境変数の確認
|
2
画像追加
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
](848a977b10b17ad124d14d2a8e66bf0e.png)### 前提・実現したいこと
|
1
|
+
](848a977b10b17ad124d14d2a8e66bf0e.png)### 前提・実現したいこと
|
2
2
|
|
3
3
|
windows powershellでperlのプログラムを動かしたいが、一行目で以下のエラーが出て上手く動作しません
|
4
4
|
|
1
画像、コード追加
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
### 前提・実現したいこと
|
1
|
+
](848a977b10b17ad124d14d2a8e66bf0e.png)### 前提・実現したいこと
|
2
2
|
|
3
3
|
windows powershellでperlのプログラムを動かしたいが、一行目で以下のエラーが出て上手く動作しません
|
4
4
|
|
@@ -13,6 +13,24 @@
|
|
13
13
|
|
14
14
|
```ここに言語名を入力
|
15
15
|
perl PMiFish.pl
|
16
|
+
|
17
|
+
以下PMiFish.plコード
|
18
|
+
#!/usr/bin/perl
|
19
|
+
use strict;
|
20
|
+
use warnings;
|
21
|
+
|
22
|
+
system "perl ./Scripts/1_Preprocessing.pl";
|
23
|
+
system "perl ./Scripts/1_4_Rarefaction.pl";
|
24
|
+
system "perl ./Scripts/2_1_Find_unique.pl";
|
25
|
+
system "perl ./Scripts/2_2_Denoise.pl";
|
26
|
+
system "perl ./Scripts/2_3_Separate_chimera.pl";
|
27
|
+
system "perl ./Scripts/3_1_Usearch_global.pl";
|
28
|
+
system "perl ./Scripts/4_1_Annotation.pl";
|
29
|
+
system "perl ./Scripts/5_1_Fasta_for_Phylogenetic_Analysis.pl";
|
30
|
+
system "perl ./Scripts/5_2_Summary_table.pl";
|
31
|
+
system "perl ./Scripts/5_3_Fasta_classified_by_family.pl";
|
32
|
+
system "perl ./Scripts/6_1_Portal.pl";
|
33
|
+
system "perl ./Scripts/6_2_Phylogenetic_trees.pl";
|
16
34
|
```
|
17
35
|
|
18
36
|
### 試したこと
|