matth has asked for the wisdom of the Perl Monks concerning the following question:
I'm coming back with a similar bit of code as to what I posted yesterday. I am at a loss as to why variables are not passing into the extactseq subroutine.
The code is:
#!/usr/bin/perl -w ######### ### Programed 15_12_02_by Matthew Redden ######### sub check_gene($); sub check_gene_seq($); sub extractseq($$$$); #use strict; mkdir Output; $input = "new_out_again_12_12_02_B_hand_edit_15_12_02.txt"; open (INPUT, "<$input"); while (<INPUT>){ if ($_ =~ /\s{3}\<gene\sid\s\=\s\"(\d{1,6})\"\slabel\s\=\s\"([.|\. +]{1,40})\"\>/){ check_gene ($_); } if ($_ =~ /\s{4}\<gene_seq\sid\s\=\s\"(\d{0,6})\"\sstatus\s{0,2}\= +\s{0,2}\"(.{0,50})\"\s{0,2}CDS_number\s{0,2}\=\s{0,2}\"(\d{1,3})\"\s{ +0,2}number_of_CDSs\s{0,2}\=\s{0,2}\"(\d{0,5})\"\s{0,2}sequence_source +\s{0,2}\=\s{0,2}\"(.{0,300})\"\s{0,2}startpos\s{0,2}\=\s{0,2}\"(\d{0, +9})\"\s{0,2}endpos\s{0,2}\=\s{0,2}\"(\d{0,9})\"\s{0,2}startopen\s{0,2 +}\=\s{0,2}\"(\d{0,1})\"\sendopen\s{0,2}\=\s{0,2}\"(\d{0,1})\"\s{0,2}c +omplement\s{0,2}\=\s{0,2}\"(.{0,1})\"\>/){ check_gene_seq ($_); $label = "$gene_seq_id.$gene_seq_status.$gene_seq_CDS_number.$gene_se +q_number_of_CDSs.$gene_seq_sequence_source.$gene_seq_startpos.$gene_s +eq_endpos.$gene_seq_startopen.$gene_seq_endopen.$gene_seq_complement" +; } extractseq ($label,$gene_seq_sequence_source,$gene_seq_startpos,$g +ene_seq_endpos); } sub check_gene($) { # <gene id = "242" label = "SPCC576.16"> my $line = $_; if ($line =~ /\s{3}\<gene\sid\s\=\s\"(\d{1,6})\"\slabel\s\=\s\"([. +|\.]{1,40})\"\>/){ $gene_id = $1; $gene_label = $2; } else { print "ERROR. Somebody has altered the regular expression"; } return $gene_id; return $gene_label; } sub check_gene_seq($){ # <gene_seq id = "311" status = "Sanger source DNA code" CDS_number + = "3" number_of_CDSs = "" sequence_source = "" startpos = "2110545" +endpos = "2110823" startopen = "1" endopen = "1" complement = "C"/> if ($_ =~ /\s{4}\<gene_seq\sid\s\=\s\"(\d{0,6})\"\sstatus\s{0,2}\= +\s{0,2}\"(.{0,50})\"\s{0,2}CDS_number\s{0,2}\=\s{0,2}\"(\d{1,3})\"\s{ +0,2}number_of_CDSs\s{0,2}\=\s{0,2}\"(\d{0,5})\"\s{0,2}sequence_source +\s{0,2}\=\s{0,2}\"(.{0,300})\"\s{0,2}startpos\s{0,2}\=\s{0,2}\"(\d{0, +9})\"\s{0,2}endpos\s{0,2}\=\s{0,2}\"(\d{0,9})\"\s{0,2}startopen\s{0,2 +}\=\s{0,2}\"(\d{0,1})\"\sendopen\s{0,2}\=\s{0,2}\"(\d{0,1})\"\s{0,2}c +omplement\s{0,2}\=\s{0,2}\"(.{0,1})\"\>/){ $gene_seq_id = $1; $gene_seq_status = $2; $gene_seq_CDS_number = $3; $gene_seq_number_of_CDSs = $4; $gene_seq_sequence_source = $5; $gene_seq_startpos = $6; $gene_seq_endpos = $7; $gene_seq_startopen = $8; $gene_seq_endopen = $9; $gene_seq_complement = $10; } else { print "Error. Someone has altered the reguar expression"; } return $gene_seq_id; return $gene_seq_status; return $gene_seq_CDS_number; return $gene_seq_number_of_CDSs; return $gene_seq_sequence_source; return $gene_seq_startpoks; return $gene_seq_endpos; return $gene_seq_startopen; return $gene_seq_endopen; return $gene_seq_complement; } sub extractseq($$$$){ # Pass through the FASTA label, the location of +sequence, the start pos and the end pos. $label = $_[0]; $gene_seq_sequence_source = $_[1]; $startpos = $_[2]; $endpos = $_[3]; print "$gene_seq_sequence_source\n"; sleep 1; print "system ('extractseq $gene_seq_sequence_source extracted_seq +_$label.txt -regions \"$startpos..$endpos\"')\;"; system ("extractseq $gene_seq_sequence_source extracted_seq_$label +.txt -regions \"$startpos..$endpos\""); } </data> The error message I am getting is: <data> Use of uninitialized value in concatenation (.) or string at extract_s +eqs.pl line 110, <INPUT> line 41. Use of uninitialized value in concatenation (.) or string at extract_s +eqs.pl line 110, <INPUT> line 41. Use of uninitialized value in concatenation (.) or string at extract_s +eqs.pl line 110, <INPUT> line 41. Use of uninitialized value in concatenation (.) or string at extract_s +eqs.pl line 110, <INPUT> line 41. Use of uninitialized value in concatenation (.) or string at extract_s +eqs.pl line 111, <INPUT> line 41. Use of uninitialized value in concatenation (.) or string at extract_s +eqs.pl line 111, <INPUT> line 41. Use of uninitialized value in concatenation (.) or string at extract_s +eqs.pl line 111, <INPUT> line 41. Use of uninitialized value in concatenation (.) or string at extract_s +eqs.pl line 111, <INPUT> line 41. system ('extractseq extracted_seq_.txt -regions ".."');Extract region +s from a sequence Error: failed to open filename extracted_seq_.txt Error: Unable to read sequence 'extracted_seq_.txt'
I know that this is a bit of an open-ended debugging job. Sorry about that.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Variables not entering sub routine
by Zaxo (Archbishop) on Dec 16, 2002 at 13:14 UTC | |
by matth (Monk) on Dec 16, 2002 at 13:51 UTC | |
by Zaxo (Archbishop) on Dec 16, 2002 at 13:59 UTC | |
|
Re: Variables not entering sub routine
by derby (Abbot) on Dec 16, 2002 at 13:23 UTC | |
|
Re: Variables not entering sub routine
by chromatic (Archbishop) on Dec 16, 2002 at 18:41 UTC | |
|
Re: Variables not entering sub routine
by Jasper (Chaplain) on Dec 16, 2002 at 15:38 UTC |