Problam in extract data

R

Rita

Hi all,
I have a output file where data store like-
print OUTPUT">
\t$seqid\t\t(Start,End)=","\(",$end+1,"\,",$start3-1,"\)\n$intron_seq\n";

now I want to extract that intron_seq from this file so i am using
split function-
(my ($seqid, $sequence) = (split /\t/, $line)[0,2]);
print "Sequence ID- $seqid\n\n";
print "Sequence- $sequence\n";

then I am getting output
Sequence ID- >

Sequence-
Sequence ID- ABCDHJUEIEROJEOFJDLFJDLJFDLJDLOFOFUOFJ
use of uninitialized value in concatenation (.) or string at
filename.pl line 25,<FILEHANDLE> line 8.

If i print just
my ( $sequence) = (split /\t/, $line)[0];
print "Sequence - $seq\n\n";

than I am getting output
Sequence->
Sequence ID- ABCDHJUEIEROJEOFJDLFJDLJFDLJDLOFOFUOFJ
though I just want to split this sequence not another data.I tried \n
and \s at place oh \t .
How I can do this?
Thanks.
 
P

Paul Lalli

Rita wrote:

<another long message with no runnable sample code>

Rita, you have been asked countless times to post a short-but-complete
script which demonstrates your problem. Reduce the problem you're
having to the smallest possible script which still has the error you're
seeing. Why do you refuse to do this? Is it because it's too much
work for you? If you're not willing to put any effort into solving
your problem, why should any of us?

Is it because you simply don't know how?
Create a small script that assigns the variable $line to the string you
believe $line contains. Then run your splitting code and examine the
results. Do they match what you expect? If you can't figure out your
problem from this short script, post it here, and explain what output
you did receive, and what output you wanted to receive.

Until you start taking these simple steps, I will be surprised to see
very many people attempting to help you. Many of the "regulars" have
already added you to their list of senders they don't see.

Paul Lalli
 
U

usenet

Rita said:
">\t$seqid\t\t(Start,End)=","\(",$end+1,"\,",$start3-1,"\)\n$intron_seq\n";
now I want to extract that intron_seq from this file so i am using
(my ($seqid, $sequence) = (split /\t/, $line)[0,2]);

Look again at your string and where your tabs are. When you split on
\t, you have an array that looks like this:

[0] >
[1] seqid
[2] (undef)
[3] (Start,End...
 
R

Rita

Paul said:
Rita wrote:

<another long message with no runnable sample code>

Rita, you have been asked countless times to post a short-but-complete
script which demonstrates your problem. Reduce the problem you're
having to the smallest possible script which still has the error you're
seeing. Why do you refuse to do this? Is it because it's too much
work for you? If you're not willing to put any effort into solving
your problem, why should any of us?

Why you always have problam with me? I already tried my best than i am
posting here.
If you know solution of my problam than tell me else dont read it.
Is it because you simply don't know how?
Create a small script that assigns the variable $line to the string you
believe $line contains. Then run your splitting code and examine the
results. Do they match what you expect? If you can't figure out your
problem from this short script, post it here, and explain what output
you did receive, and what output you wanted to receive.

I think you didnot see my question properly . I alredy write what i am
getting and what i want to recieve.
Until you start taking these simple steps, I will be surprised to see
very many people attempting to help you. Many of the "regulars" have
already added you to their list of senders they don't see.

Thanks
 
R

Rita

Rita said:
">\t$seqid\t\t(Start,End)=","\(",$end+1,"\,",$start3-1,"\)\n$intron_seq\n";
now I want to extract that intron_seq from this file so i am using
(my ($seqid, $sequence) = (split /\t/, $line)[0,2]);

Look again at your string and where your tabs are. When you split on
\t, you have an array that looks like this:

[0] >
[1] seqid
[2] (undef)
[3] (Start,End...
Yes I am also thinking same thing but when i print [1] that time also
it giving me same error that it is undefined sowhat is the reason for
that?
Is it not splitting the lines?
 
R

Rita

">\t$seqid\t\t(Start,End)=","\(",$end+1,"\,",$start3-1,"\)\n$intron_seq\n";
now I want to extract that intron_seq from this file so i am using
(my ($seqid, $sequence) = (split /\t/, $line)[0,2]);

Look again at your string and where your tabs are. When you split on
\t, you have an array that looks like this:

[0] >
[1] seqid
[2] (undef)
[3] (Start,End...
ohh Now I understand that you are not understanding my problam my
problam is that I have data in this format
">\t$seqid\t(Start,End)=","\(",$end+1,"\,",$start3-1,"\)\n$intron_seq\n";

In this line some data are seprate with \t and some with \n.
so how I can Split that $intron_seq.
Thanks
 
G

Gunnar Hjalmarsson

Rita said:
----------------^^^^
now I want to extract that intron_seq from this file so i am using
(my ($seqid, $sequence) = (split /\t/, $line)[0,2]);

Look again at your string and where your tabs are. When you split on
\t, you have an array that looks like this:

[0] >
[1] seqid
[2] (undef)
[3] (Start,End...

ohh Now I understand that you are not understanding my problam

Or put differently: David is not a mind reader.
my problam is that I have data in this format
">\t$seqid\t(Start,End)=","\(",$end+1,"\,",$start3-1,"\)\n$intron_seq\n";
------------^^

Your problem is that you seem to think that people here are mind readers.

Please follow Paul's advice.
 
K

Keith Keller

Why you always have problam with me?

See above. And it's not just Paul--see below.
I already tried my best than i am posting here.
If you know solution of my problam than tell me else dont read it.

Here is the root of your problem: nobody can possibly know the solution,
because you've stated the problem so poorly. Thus, at some point
*nobody* will be reading your posts, and you won't be getting any
answers. Is that really what you want?
I think you didnot see my question properly . I alredy write what i am
getting and what i want to recieve.

I think you did not understand Paul's request. You should post a
short but *complete* Perl script that duplicates your problem. Posting
random code snippets is generally not helpful.

Not that it matters much to you (others are much more expert than I),
but I've done so (well, you're being scored down, anyway). Part of
getting good answers is asking good questions, and thus far you haven't
really done that. I understand that part of the difficulty may lie in
the fact that English may not be your first language, but that simply
makes it more important for you to post a complete script that
replicates your problem, so that there's less chance for
misunderstanding your issue.

--keith
 
T

Tad McClellan

Rita said:
Why you always have problam with me?


Might it be because you are rude over and over and over?

Many people here, myself included, have been offended by you
multiple times.

You have never posted a short and complete program that
we can run that illustrates your problem.

Try it that way just one time, and see how the thread goes.

I already tried my best than i am
posting here.


No you haven't.

If you had tried your best, then you would have posted a short
and complete program that we can run that illustrates your problem.

If you know solution of my problam than tell me


If you post a short and complete program that we can run that
illustrates your problem, then there are lots and lots of people
that could show you the solution to your problem.

else dont read it.


That's enough of your disrepect for me.

I had been resisting killfiling you because I thought that you
just didn't know any better, but I now see that it is because
you have a bad attitude.

So long!

I think you didnot see my question properly .


That was because you did not post a short and complete program
that we could run that illustrates your problem.

I alredy write what i am
getting and what i want to recieve.


Good, then all you'll need to add is a short and complete program
that we could run that illustrates your problem.



I'm coming to that party late it seems...
 
T

Tad McClellan

[ no code ]
what is the reason for
that?


Post a short and complete program that we can run that illustrates
your problem, and we can tell you why it is behaving the way it is.
 
T

Tad McClellan

Rita said:
ohh Now I understand that you are not understanding my problam


Now why do you suppose that happened?

Might it have been because you did not post a short and complete
program that we can run that illustrates your problem?
 
R

Rita

Post a short and complete program that we can run that illustrates
your problem, and we can tell you why it is behaving the way it is.
use warnings;
use strict;

my $filename='data.txt';

# Remove the newline from the file:
chomp $filename;

# either open the file, or exit from the program
unless ( open(FILE,$filename)){
print "Cannot open file \"$mascot_filename\"\n\n";
}

while ($line = <FILE>) {
(my ($sequence) = (split /\t/, $line)[2]);
print "Sequence- $sequence\n";
}

# Close the file
close FILE;

<data.txt> has format like
">$seqid\t(Start,End)=","\(",$end+1,"\,",$start3-1,"\)\n$intron_seq\n";

.......................................................^^
This is the problem. \n . If I put \t that is fine but in my program I
want to put \n for that line but I want to extract too. Is there any
way that I can extract data from that type of format.any help will be
appreciated.
I hope this is better.
Thanks in advance.
 
A

A. Sinan Unur

See above. And it's not just Paul--see below.

Some of us have already chosen not to see your ramblings. I see that you
are doing your best to alienate the remaining capable people who are
still willing to try to help.

Sinan
 
N

Neil

Rita said:
Post a short and complete program that we can run that illustrates
your problem, and we can tell you why it is behaving the way it is.
use warnings;
use strict;

my $filename='data.txt';

# Remove the newline from the file:
chomp $filename;

# either open the file, or exit from the program
unless ( open(FILE,$filename)){
print "Cannot open file \"$filename\"\n\n";
}

while ($line = <FILE>) {
(my ($sequence) = (split /\t/, $line)[2]);
print "Sequence- $sequence\n";
}

# Close the file
close FILE;

<data.txt> has format like
">$seqid\t(Start,End)=","\(",$end+1,"\,",$start3-1,"\)\n$intron_seq\n";

......................................................^^
This is the problem. \n . If I put \t that is fine but in my program I
want to put \n for that line but I want to extract too. Is there any
way that I can extract data from that type of format.any help will be
appreciated.
I hope this is better.
Thanks in advance.
 
K

Keith Keller

Some of us have already chosen not to see your ramblings. I see that you
are doing your best to alienate the remaining capable people who are
still willing to try to help.

Hey, she finally posted code! No data, though. Still, maybe getting
there....

--keith
 
R

Rita

This assumes that $seqid and $intro_seq are always made up of integers.
If your data is more complicated than that, we can help you, but you
need to "show me the data".
#!/usr/bin/perl
use strict;
use warnings;
while( my $line = <DATA> ) {
print $line;
}
__DATA__
123456 (Start,End)=(100.101)
987654

etc.

If you do this, someone will surely be able to help you. If you do not
do this, then you will get less and less help with each posting. It is
up to you.
use warnings;
use strict;
while (my$line = <DATA>) {
(my ($sequence) = (split /\t/, $line)[2]);
print "Sequence- $sequence\n";
}

_DATA_
018183 (Start,End)=(162,479) ATAATATTTAFDCTTAGATYHTBJAACCTCTTAACATADFDFFGJGHKJYREWERDTUIATCTCATTGGATTGATTTGTTTGGTGTGAATCATTATGAA
TACAAAACAFDGDTATFGHFJHGLJYYTURETEUCAACTAGGTCGACACATGAGGYGHJFHGDFGSDFSASFAAACTATTTTCFYFYYFY
CTATAACCFDGDAGGCAAYHTATCAATCATCCACTTCACGDCGDYHGSHGDHGTCATATATTTTAAAACTTTAAATATCCTATGAAAGGCTTA
CTAAACDGAACCATGGHYGGCCACACCCCJHGFKUTGOUTIRFAAGTTACACAATGGATACAFGDFAATAACAACTAGCAAACATGGACAAGCACTCA
015455 (Start,End)=(358,416)
CTGCADGFATACAHHATTCATATCAGATTAGGTTUKFGYFTDFTAAAAAAGAAAGGAGAGAGATGAAGATATACA
I Want to just Extract Sequences from this Data,Which is seprate by \n .
 
T

Tad McClellan

[snip unattributed comment about posting a short and complete
program that we can run.
]
use warnings;
use strict;
while (my$line = <DATA>) {
(my ($sequence) = (split /\t/, $line)[2]);
print "Sequence- $sequence\n";
}

_DATA_


Did you try the courtesy of running this yourself before asking
hundreds of people around the world to look at it?

It does not even compile for me.

Your disrespect for other's time is showing again.

I Want to just Extract Sequences from this Data,Which is seprate by \n .


The input operator already separates it by newline, so when you
find a line with a tab, all you need to do is to read the _following_
line:


#!/usr/bin/perl
use warnings;
use strict;

while (my $line = <DATA>) {
if ($line =~ /\t/) {
my $sequence = <DATA>;
print "Sequence- $sequence\n";
}
else
{ die "found line with no tab..." }
}
 
R

Rita

#!/usr/bin/perl
use warnings;
use strict;

while (my $line = <DATA>) {
if ($line =~ /\t/) {
my $sequence = <DATA>;
print "Sequence- $sequence\n";
}
else
{ die "found line with no tab..." }
}

Thanks .
 
T

Tad McClellan

Rita said:


If you had posted a short and complete program that we can run
that illustrates your problem in your very first post, then
the thread would be only 2 messages long instead of the
round-and-round that we got instead.

There is a *reason* that we ask for a complete program, please
trust us and (at least try to) do that from now on.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top