I have a Perl script which calculate the molecular weight of the protein. I just want to modify the header section of this script. I want this much of header section


>gi|226694487|sp|Q1DF98.2|ATPF_MYXXD

instead of


>gi|226694487|sp|Q1DF98.2|ATPF_MYXXD RecName: Full=ATP synthase subunit b; AltName: Full=ATP synthase F(0) sector subunit b; AltName: Full=ATPase subunit I; AltName: Full=F-type ATPase subunit b; Short=F-ATPase subunit b

this is the perl script

#!/usr/bin/perl use strict; use warnings; use Encode; for my $file (@ARGV) { open my $fh, '<:encoding(UTF-8)', $file; my $input = join q{}, <$fh>; close $fh; while ( $input =~ /(^>.*?\w?)$([^>]*)/smxg ) { my $name = $1; my $seq = $2; $seq =~ s/\n//smxg; my $mass = calc_mass($seq); print "$name, Molecular weight: $mass\n"; } } sub calc_mass { my $a = shift; my @a = (); my $x = length $a; @a = split q{}, $a; my $b = 0; my %data = ( A=>88, R=>173, D=>132, N=>131, C=>120, E=>146, Q=>145, G=>74, H=>154, I=>130, L=>130, K=>145, M=>198, F=>164, P=>114, S=>104, T=>118, W=>203, Y=>180, V=>116, X=>0,U=>0,Z=>0 ); for my $i( @a ) { $b += $data{$i}; } my $c = sprintf("%0.2f",$b - (18.01528 * ($x - 1))); return $c; }

In reply to Molecular weight of Protein by yuvraj_ghaly

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.