Hi, sorry to bother.
I think it is a very simple question for the professional programmers:
I have the following sequences in a .txt file:
AGCCCTCTGTAGCATTTGTATGGC
AGCCCTCTGTAGTATTTCTATGGC
AGCCCTCTGTAGTATTTGTATGGCTCCTTAGAC
...
I want them to be like:
>Leaf_1
AGCCCTCTGTAGCATTTGTATGGC
>Leaf_2
AGCCCTCTGTAGTATTTCTATGGC
>Leaf_3
AGCCCTCTGTAGTATTTGTATGGCTCCTTAGAC
...
My script does not work. Don't know why. Please help correct it. Thanks!
die "perl $0 < Input txt >\n" unless(@ARGV == 1);
open IN,$ARGV[0];
open OUT,">Output.fa";
my $count = 1;
while(<IN>){
if($_=~/[ATCG]/gi)
{
print ">Leaf_$count\n";
print OUT ">Leaf_$count\n";
$count++;
}
}
close IN; close OUT;
This is extremely similar to all your other questions, especially Perl script to extract. Also please use sensible tags for your questions (i.e. not "perl to add sequence header").