in reply to Re^3: Converting Uniprot File to a Fasta File in Perl
in thread Converting Uniprot File to a Fasta File in Perl

hi poj! thank you so much for your help! could you explain what the flag is actually doing? i'm reading the code and i'm having difficulty understanding. also what is Dumper? i'm trying to format my code so that I can get this type of output once i parse the headers and sequence:
>NM_012514 | Rattus norvegicus | breast cancer 1 (Brca1) | mRNA CGCTGGTGCAACTCGAAGACCTATCTCCTTCCCGGGGGGGCTTCTCCGGCATTTAGGCCT CGGCGTTTGGAAGTACGGAGGTTTTTCTCGGAAGAAAGTTCACTGGAAGTGGAAGAAATG GATTTATCTGCTGTTCGAATTCAAGAAGTACAAAATGTCCTTCATGCTATGCAGAAAATC TTGGAGTGTCCAATCTGTTTGGAACTGATCAAAGAACCGGTTTCCACACAGTGCGACCAC ATATTTTGCAAATTTTGTATGCTGAAACTCCTTAACCAGAAGAAAGGACCTTCCCAGTGT CCTTTGTGTAAGAATGAGATAACCAAAAGGAGCCTACAAGGAAGTGCAAGG

Replies are listed 'Best First'.
Re^5: Converting Uniprot File to a Fasta File in Perl
by huck (Prior) on Feb 27, 2017 at 23:55 UTC

    Once you find the SQ line you set the flag, then you accumulate all further lines(without the spaces) into $seq untill you find a line the begins with K and only has spaces or nothing after it. Then you unset the flag.

    Dumper is a nice way to printout arrays and hashes for inspection, also works with scalars too

    as for your output, it will look something like

    print $hash{AC}; print ' | ' print $hash{OS}; print ' | ' print $hash{OX}; print ' | ' print $hash{ID}; print ' | ' print $hash{GN}; print "\n"; my $split_after=50; while (length($seq)>$split_after){ print substr($seq,0,50)."\n"; $seq=substr($seq,$split_after); } print $seq."\n";
    Since your sample input doesnt seem to have your sample output values i cant say what the sequence of the print statements should look like. And you may need to adjust $split_after, i didnt feel like counting

Re^5: Converting Uniprot File to a Fasta File in Perl
by AnomalousMonk (Archbishop) on Feb 28, 2017 at 01:52 UTC