http://qs321.pair.com?node_id=11133141


in reply to Stuck in Perl.. Partial code, but it needs more improvement.. Any suggestions, please?

hello! becuase you mentioned about "CDS", "original", so I guess you want parser information from a genbank format file, right? (e.g. https://www.ncbi.nlm.nih.gov/nuccore/M85050.1) as cavac say, if you do not offer file format, other people can't understand what do you want to do, and then understand wether the code work good. so I can't offer how to make your code work correctly, too.

there are some part of your maybe need change, I just try to give some advice:)

@cds = (@cds, $content[$start]); print @cds;

before this paragraph, @cd did not defined in anywher, so this will make script stop work, and because it assigned by itself, I can't understand purpose of this statements, so I don't know how to modify it, but I sure it won't work now.

for ($start;$start <= $index_max; $start++) { @origin = (@origin, $content[$start]); shift (@origin); #Delete ORIGIN row; print @origin; for @origin {

this part have same problem, what is @origin?

#This chromosome have tags. Identify CDS ones. my @features =$mySeq ->all_seqfeatures(); foreach $feature (@features) { my @tag = $CDS; my @feat = $join; foreach $tag ( $feat->all tags() ); print "Feature region has tag", $tag, "CDS", join(‘ ‘,$feat->each tag value($tag)), "\n"; }

I guess you defined subroutines in other site, so I don't what can they do, ;-;.

open(my $file, '<', $file_name) or die "Sorry, we can't open your $fil +; open (WRITE, ">>concatenare.txt");

you used two style of open() in this code, first is better, please use it every times.

you can use  while(my $line = <$fh>){...}, this will read one line of file in each times. so you don't need read all content into a array, and don't need to find the last index before. if you actually treat a very big file, it will reduce ram occupied by program.

p.s. yes, Bioperl can resolve most of problem.

  • Comment on Re: Stuck in Perl.. Partial code, but it needs more improvement.. Any suggestions, please?
  • Select or Download Code