- 论坛徽章:
- 0
|
那位大侠能给解释下,不胜感激!!
#!/usr/bin/perl -w
$input_file_1 = $ARGV[0];
open(IN_1, "$input_file_1")
or die "can't open the input file : $!";
$output_file = $ARGV[1];
open OUT_1, ">$output_file"
or die "Can not open $output_file : $!";
$num_1=0;
$num_2=0;
$num_total=0;
while(<IN_1>){
if($_ =~ />()/){
$num_total++;
# print OUT_1 "$_";
$title = $_;
# chomp($title);
}
elsif($_ =~ /([ACUG]+)/){
# print OUT_1 "$_";
$seq_letter = $_;
chomp($seq_letter);
# $len_seq = length $seq_letter;
# $last_char = substr($seq_letter, $len_seq, 1);
# if($last_char eq '\r' || $last_char eq '\n' || $last_char eq '\t'){
# chop($seq_letter);
# }
if($seq_letter =~ /([^ACUG\r])/){
$num_1++;
# print "$1\n";
$flag = 0;
}
else{
$num_2++;
$flag = 1;
}
if($flag == 1){
print OUT_1 "$title$_";
}
}
else{
if($flag == 1){
print OUT_1 "$_";
}
}
}
print "check $num_total queries, delete $num_1 queries with non-ACGU and save $num_2 queries\n";
print "done!\n";
|
|