docalf has asked for the wisdom of the Perl Monks concerning the following question:
Dear Perl Monks,
I am trying to "hack" (not a real coder)a script to break a text file like this:
>Long_DNA_ScaffoldInto this:
>Long_DNA_Scaffold.0It "partially" works and I get a lot of "uninitialized value in transliteration" errors. I will appreciate any help/poiners etc to get it to work#!/usr/bin/perl -w open (IN, "$ARGV[0]"); $/=">"; $i=0; while (<IN>) { if(/^(\S+)?.*?\n(.*)/ms) { $i++; $seq[$i]=$2; $name[$i]=$1; } } close IN; for $j(1..$i){ $j++; tr/>//,$name[$j]; tr/>//,$seq[$j]; @sequence=split(/N+/,$seq[$j]); $n=length(@sequence); $seqs_to_print=$n-1; # print "$name[$j]\tLength of seqs:$n\n"; for $x(0..$seqs_to_print){ print ">$name[$j].$x\n"; print "$sequence[$x]\n"; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Seeking help with script
by toolic (Bishop) on Jun 29, 2010 at 01:02 UTC | |
by docalf (Initiate) on Jun 29, 2010 at 15:26 UTC | |
|
Re: Seeking help with script
by ww (Archbishop) on Jun 29, 2010 at 11:45 UTC | |
by docalf (Initiate) on Jun 29, 2010 at 15:30 UTC |