- 论坛徽章:
- 0
|
本帖最后由 linghu002127 于 2011-10-17 14:39 编辑
谢谢各位,已经解决~~
step1:读取文件列表并存入text文件
- #!/usr/bin/perl
- use warnings;
- use strict;
- my $dir ='D:\data\tem2';
- my $file;
- opendir (DIR, $dir);
- my @dir = readdir DIR;
- open(SAVEOUT,">&STDOUT");
- open(STDOUT,"+>test.txt");
- foreach $file (@dir) {
- if ( $file =~ /[A-Z]*\.bed/) {
- print $file,"\t";
- }
- }
- open(STDOUT,">&SAVEOUT"); #记得最后恢复STDOUT
- closedir(DIR);
- close STDOUT;
- close SAVEOUT;
复制代码 step2:调用system命令- #!/usr/bin/perl
- use strict;
- use warnings;
- my $file;
- my @files= qw /CD4-H3K8ac.bed CD4-H3K9ac.bed CD4-H3K10ac.bed /; #这个地方若改为qw /test.txt /不行
- foreach $file (@files){
- print $file;
- system ("macs14 -t $file -f BED -g hs --bw 200 --llocal 5000 -n test-$file");
- }
复制代码 然后就解决了。
但是就qw那句若改为qw /test.txt /这个命令时,得不到想要的文件名,只能得到test.txt ,不知何故,所以我干脆将文件列在qw/ /之间得了~~
现在还没有解决,但是问题太初级,所以继续赶小骆驼吧~~,以后可能会明白的。 |
|