TCGA_ATAC-seq 比对文件整理 (Adjusting alignment file of ATAC-seq in TCGA)

#!/usr/bin/perl -w
use strict;
use warnings;
use Cwd;
use File::Copy;

my $usage=<<USAGE;
Usage:
    perl $0 filename
    将该目录下的所有文件放在一个叫filename的文件夹下
USAGE
if(@ARGV==0){die $usage};

my $file1=$ARGV[0];
my $dir=getcwd;
my @filename;

opendir(DIR,$dir) || die $!;
my @temp=readdir(DIR);
for my $i (0..$#temp){
    if ((-d "$dir/$temp[$i]") & ($temp[$i] ne $file1)){
        opendir(DIR2,"$dir/$temp[$i]") || die $!;
        my @temp1=readdir(DIR2);
        for my $j (0..$#temp1){
            if((-f "$dir/$temp[$i]/$temp1[$j]") & (($temp1[$j])=~/.bam$/) | ($temp1[$j]=~/.bai$/) ){
                push(@filename,"$dir/$temp[$i]/$temp1[$j]");
            }
        }
    }
}
close(DIR2);
close(DIR);

#print @filename;

my $lujing="$dir/$file1";

if(!(-e $lujing)){
    mkdir ($lujing) || die "can not create $file1 doctory";
}

for my $i (0..$#filename){
    move("$filename[$i]","$lujing");
}
此条目发表在Perl, TCGA分类目录。将固定链接加入收藏夹。

发表评论

电子邮件地址不会被公开。 必填项已用*标注

To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four 
    spaces will be stripped off, but all other whitespace
    will be preserved.
    
    Markdown is turned off in code blocks:
     [This is not a link](http://example.com)

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.

For more help see http://daringfireball.net/projects/markdown/syntax

Protected with IP Blacklist CloudIP Blacklist Cloud