File: cleanDOSfasta.pl

package info (click to toggle)
augustus 3.2.3%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 289,676 kB
  • sloc: cpp: 48,711; perl: 13,339; ansic: 1,251; makefile: 859; sh: 58
file content (21 lines) | stat: -rwxr-xr-x 535 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/perl

# "Clean" a MS/DOS fasta file from weird characters that screw with e.g. Perl

my $usage = "cleanDOSfasta.pl inFile > outFile\n";

if(@ARGV != 1){
	print $usage;
	exit;
}

my $inFile = $ARGV[0];

open(IN, "<", $inFile) or die "Could not open file $inFile\n!";
LINE: while($line = <IN>){
	next LINE if $line =~ m/^#/; #discard comments
	$line =~ s/[\x0A\x0D]+//g; # remove all those ugly whitespaces
	$line =~ s/(\n)(\r)//g; #remove them alllll!
	print $line."\n";
}
close(IN) or die "Could not close file $inFile!\n";