http://qs321.pair.com?node_id=11104900

yueli711 has asked for the wisdom of the Perl Monks concerning the following question:

Hello, I have file here. I want to change file 1.fa to file 1.txt. Thanks in advance for great help! Best, yue

open(IN1, "1.fa") || die "Cannot open this file"; @lines = <IN1>; $i = 0; for (@lines) { $lines[$i]=~s/\nA/\tA//g; $lines[$i]=~s/\nT/\tT//g; $lines[$i]=~s/\nC/\tC//g; $lines[$i]=~s/\nG/\tG//g; $lines[$i]=~s/\nN/\tN//g; $thislines[$i]=$lines[$i]; print $thislines[$i]; $i++; } open(OUT, ">1.txt") || die "Cannot open this file"; for $thisline(@thislines){ print OUT $thisline;} close(OUT); close(IN1);
1.fa >1 AGTCGTAGCAT >2 TGAGCTACG >3 GGCATAGN >4 CGCACNCAGCTACACC >5 NGATAGCTACA
1.txt >1 AGTCGTAGCAT >2 TGAGCTACG >3 GGCATAGN >4 CGCACNCAGCTACACC >5 NGATAGCTACA