Assalam-o-alaikum everyone,
I have downloaded whole genome of some vertebrates from NCBI and then then fetched coordinates and sequence of genes and CDS from whole genome subsequently.
Now I have CDS file like below:
$ cat input file:
>chr16:7161867-7161955
TTTAGTTTCCCCATCATCCCAGAAAAGTTCGCCTTTTGCTTCTTTGTTTTCATCCAGGGCAATGATAAGACCAAGGGGGTT
>chr16:7161148-7161197
TGGGTGACAGAAAACTCACATAAGAGATAAACTTGATTGGCCACAGTAT
>chr16:7160414-7160581
TGTAGGTTAGAATCATAAGTGACATTAGGAGAAGTTTGACTTGGGATACCATTGTGTTTCACTATAACATTGGTAGGTTCC
>chr16:7157321-7157473
TCCCAGGCACAGCCACGGGCAGTACAGTTTGCTGCNGAAGCACCGCTCTCATCAGGAAAACAGTCTATTTTCTCTTCATC
I want to concatenate these parts of CDS to a single sequence then making its reverse complement and counting length of the final sequence. P.S all parts of CDS in a single file
Expected output:
>Dog
TTTAGTTTCCCCATCATCCCAGAAAAGTTCGCCTTTTGCTTCTTTGTTTTCATCCAGGGCAATGATAAGACCAAGGGGGTTTCACATAAGAGATAAACTTGATTGGCCACAGTATTGTAGGTTAGAATCATAAGTGACATTAGGAGAAGTTTGACTTGGGAATAACATTGGTAGGTTCCTCCCAGGCACAGCCACGGGCAGTACAGTTTGCTGCNGAAGCACCGCTCTCATCAGGAAAACAGTCTATTTTCTCTTC
I have tried following script but its not give my desired output (its not give concatenating sequence against a single fasta headers).
open my $fh,"<","filename.text" or die"error opening $!";
$/ = ">";
<$fh>;
while (<$fh>)
{
my ($header,@ar) = split("\n",$_);
my $entry =join("\n",@ar);
$entry = reverse $entry;
$entry =~ tr/ACGUacgu/UGCAugca/;
print ">$header\n$entry\n\n";
}
Any other way to do so ??
little late but I want to show you this on Perl: