Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

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

by glycine (Sexton)
on May 27, 2021 at 15:12 UTC ( #11133141=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11133141]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (3)
As of 2023-03-23 23:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Which type of climate do you prefer to live in?






    Results (60 votes). Check out past polls.

    Notices?