cannot see the tabs in output?

cannot see the tabs in output?

am 29.04.2007 23:08:02 von amit hetawal

Hello All,
I really dont know whats causing this problem. Its like i have the
input file which looks like:

:set list on in vi

TGCAGAAGAGAGTGAGCAC$
TGCAGAAGAGAGTGAGCAC $
TGCAGAAGAGAGTGAGCAC $
TGCAGAAGAGAGTGAGCAC $
TGCAGAAGAGAGTGAGCAC $
TGCAGAAGAGAGTGAGCAC $
CGCAGAAGAGAGTGAGCACA$
TTGCAGAAGAAAGAGAGCAC$
TTGCAGAAGATAGAGAGCAC$

(there are some trailing spaces in above sequences.)

And when i use the below script:

$filename = $ARGV[0];
open (FILE, "< $filename") or die "Cant open $filename : $!";

$sequence = '';
while()
{
next if /^(\s)*$/; # to skip blank lines in file
chomp;

$_=~s/\s+$//g;

$sequence=$_;
$compliment=$sequence;
$compliment =~tr/aAtTcCgGuU/TTAAGGCCTT/;
$rev_compliment=reverse $compliment;

print "sequence : $sequence\t";
print "rev_sequence : $rev_compliment\n";

$sequence = ' ';
$compliment=' ';
$rev_compliment=' ';

}


And when i see the output there is some difference in the tabs in
displays. why is that so. Any ideas

sequence : TTCAAGGACTTCTATTCAGAA rev_sequence : TTCTGAATAGAAGTCCTTGAA
sequence : TCTTGATGAAGAGGAATGGGA rev_sequence : TCCCATTCCTCTTCATCAAGA
sequence : GCTTGGCAATCTCATGTCAAA rev_sequence : TTTGACATGAGATTGCCAAGC
sequence : CTAGACCAATGTTTAGTTAGT rev_sequence : ACTAACTAAACATTGGTCTAG
sequence : TAGTTGTCGTCGTATCTTTGT rev_sequence : ACAAAGATACGACGACAACTA
sequence : GAGTAAGGCGCTTATCTTCT rev_sequence : AGAAGATAAGCGCCTTACTC
sequence : TCTGCAACCGGAAAGGGAGC rev_sequence : GCTCCCTTTCCGGTTGCAGA


last 2 outputs dont display my tabs why is that so.
I checked the escape characters in the file but cant find much in them
it look like :
sequence : TGCAGAAGAGAGTGAGCAC^Irev_sequence : GTGCTCACTCTCTTCTGCA$
sequence : TGCAGAAGAGAGTGAGCAC^Irev_sequence : GTGCTCACTCTCTTCTGCA$
sequence : TGCAGAAGAGAGTGAGCAC^Irev_sequence : GTGCTCACTCTCTTCTGCA$
sequence : CGCAGAAGAGAGTGAGCACA^Irev_sequence : TGTGCTCACTCTCTTCTGCG$
sequence : TTGCAGAAGAAAGAGAGCAC^Irev_sequence : GTGCTCTCTTTCTTCTGCAA$
sequence : TTGCAGAAGATAGAGAGCAC^Irev_sequence : GTGCTCTCTATCTTCTGCAA$

Please advice.

Thanks
_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Re: cannot see the tabs in output?

am 29.04.2007 23:40:22 von Bill Luebkert

amit hetawal wrote:
> Hello All,
> I really dont know whats causing this problem. Its like i have the
> input file which looks like:

> And when i see the output there is some difference in the tabs in
> displays. why is that so. Any ideas
>
> sequence : TTCAAGGACTTCTATTCAGAA rev_sequence : TTCTGAATAGAAGTCCTTGAA
> sequence : TCTTGATGAAGAGGAATGGGA rev_sequence : TCCCATTCCTCTTCATCAAGA
> sequence : GCTTGGCAATCTCATGTCAAA rev_sequence : TTTGACATGAGATTGCCAAGC
> sequence : CTAGACCAATGTTTAGTTAGT rev_sequence : ACTAACTAAACATTGGTCTAG
> sequence : TAGTTGTCGTCGTATCTTTGT rev_sequence : ACAAAGATACGACGACAACTA
> sequence : GAGTAAGGCGCTTATCTTCT rev_sequence : AGAAGATAAGCGCCTTACTC
> sequence : TCTGCAACCGGAAAGGGAGC rev_sequence : GCTCCCTTTCCGGTTGCAGA

Looks OK for me:

use strict;
use warnings;
my $filename = $ARGV[0] || 'data/test.dat';

open FILE, "< $filename" or die "Cant open $filename : $!";
while () {
chomp;
next if /^(\s)*$/; # skip blank lines
s/\s+$//g; # remove trailing spaces

my $sequence = $_;
my $compliment = $sequence;
$compliment =~ tr/aAtTcCgGuU/TTAAGGCCTT/;
my $rev_compliment = reverse $compliment;
print "sequence : $sequence\t";
print "rev_sequence : $rev_compliment\n";
}

__END__
sequence : TGCAGAAGAGAGTGAGCAC rev_sequence : GTGCTCACTCTCTTCTGCA
sequence : TGCAGAAGAGAGTGAGCAC rev_sequence : GTGCTCACTCTCTTCTGCA
sequence : TGCAGAAGAGAGTGAGCAC rev_sequence : GTGCTCACTCTCTTCTGCA
sequence : TGCAGAAGAGAGTGAGCAC rev_sequence : GTGCTCACTCTCTTCTGCA
sequence : TGCAGAAGAGAGTGAGCAC rev_sequence : GTGCTCACTCTCTTCTGCA
sequence : TGCAGAAGAGAGTGAGCAC rev_sequence : GTGCTCACTCTCTTCTGCA
sequence : CGCAGAAGAGAGTGAGCACA rev_sequence : TGTGCTCACTCTCTTCTGCG
sequence : TTGCAGAAGAAAGAGAGCAC rev_sequence : GTGCTCTCTTTCTTCTGCAA
sequence : TTGCAGAAGATAGAGAGCAC rev_sequence : GTGCTCTCTATCTTCTGCAA
_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Re: cannot see the tabs in output?

am 30.04.2007 00:48:54 von amit hetawal

Hi,
I tried your code too, but no success. is it because of the editor
display. I am working on Mac will that make a difference. I cannot get
correct tabs working?

On 4/29/07, Bill Luebkert wrote:
> amit hetawal wrote:
> > Hello All,
> > I really dont know whats causing this problem. Its like i have the
> > input file which looks like:
>
> > And when i see the output there is some difference in the tabs in
> > displays. why is that so. Any ideas
> >
> > sequence : TTCAAGGACTTCTATTCAGAA rev_sequence : TTCTGAATAGAAGTCCTTGAA
> > sequence : TCTTGATGAAGAGGAATGGGA rev_sequence : TCCCATTCCTCTTCATCAAGA
> > sequence : GCTTGGCAATCTCATGTCAAA rev_sequence : TTTGACATGAGATTGCCAAGC
> > sequence : CTAGACCAATGTTTAGTTAGT rev_sequence : ACTAACTAAACATTGGTCTAG
> > sequence : TAGTTGTCGTCGTATCTTTGT rev_sequence : ACAAAGATACGACGACAACTA
> > sequence : GAGTAAGGCGCTTATCTTCT rev_sequence : AGAAGATAAGCGCCTTACTC
> > sequence : TCTGCAACCGGAAAGGGAGC rev_sequence : GCTCCCTTTCCGGTTGCAGA
>
> Looks OK for me:
>
> use strict;
> use warnings;
> my $filename = $ARGV[0] || 'data/test.dat';
>
> open FILE, "< $filename" or die "Cant open $filename : $!";
> while () {
> chomp;
> next if /^(\s)*$/; # skip blank lines
> s/\s+$//g; # remove trailing spaces
>
> my $sequence = $_;
> my $compliment = $sequence;
> $compliment =~ tr/aAtTcCgGuU/TTAAGGCCTT/;
> my $rev_compliment = reverse $compliment;
> print "sequence : $sequence\t";
> print "rev_sequence : $rev_compliment\n";
> }
>
> __END__
> sequence : TGCAGAAGAGAGTGAGCAC rev_sequence : GTGCTCACTCTCTTCTGCA
> sequence : TGCAGAAGAGAGTGAGCAC rev_sequence : GTGCTCACTCTCTTCTGCA
> sequence : TGCAGAAGAGAGTGAGCAC rev_sequence : GTGCTCACTCTCTTCTGCA
> sequence : TGCAGAAGAGAGTGAGCAC rev_sequence : GTGCTCACTCTCTTCTGCA
> sequence : TGCAGAAGAGAGTGAGCAC rev_sequence : GTGCTCACTCTCTTCTGCA
> sequence : TGCAGAAGAGAGTGAGCAC rev_sequence : GTGCTCACTCTCTTCTGCA
> sequence : CGCAGAAGAGAGTGAGCACA rev_sequence : TGTGCTCACTCTCTTCTGCG
> sequence : TTGCAGAAGAAAGAGAGCAC rev_sequence : GTGCTCTCTTTCTTCTGCAA
> sequence : TTGCAGAAGATAGAGAGCAC rev_sequence : GTGCTCTCTATCTTCTGCAA
>
_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Re: cannot see the tabs in output?

am 30.04.2007 02:23:28 von Bill Luebkert

amit hetawal wrote:
> Hi,
> I tried your code too, but no success. is it because of the editor
> display. I am working on Mac will that make a difference. I cannot get
> correct tabs working?

Quite possibly. Are you outputting to a console window, file or what ?

Do you have a hex dump routine to dump the actual content if written to
a file ? Try writing it to a file and dumping the file.

Oooh! Just dawned on me - try combining the two prints into one:

print "sequence : $sequence\trev_sequence : $rev_compliment\n";

You could be getting a strange newline or some other character after
the first print. You could also try: binmode STDOUT; and see if that
makes a difference on Mac.
_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

RE: cannot see the tabs in output?

am 30.04.2007 12:45:37 von Brian Raven

amit hetawal <> wrote:
> Hello All,
> I really dont know whats causing this problem. Its like i have the
> input file which looks like: =

> =

>> set list on in vi
> =

> TGCAGAAGAGAGTGAGCAC$
> TGCAGAAGAGAGTGAGCAC $
> TGCAGAAGAGAGTGAGCAC $
> TGCAGAAGAGAGTGAGCAC $
> TGCAGAAGAGAGTGAGCAC $
> TGCAGAAGAGAGTGAGCAC $
> CGCAGAAGAGAGTGAGCACA$
> TTGCAGAAGAAAGAGAGCAC$
> TTGCAGAAGATAGAGAGCAC$
> =

> (there are some trailing spaces in above sequences.)
> =

> And when i use the below script:
> =

> $filename =3D $ARGV[0];
> open (FILE, "< $filename") or die "Cant open $filename : $!";
> =

> $sequence =3D '';
> while()
> {
> next if /^(\s)*$/; # to skip blank lines in file
> chomp;
> =

> $_=3D~s/\s+$//g;
> =

> $sequence=3D$_;
> $compliment=3D$sequence;
> $compliment =3D~tr/aAtTcCgGuU/TTAAGGCCTT/;
> $rev_compliment=3Dreverse $compliment;
> =

> print "sequence : $sequence\t";
> print "rev_sequence : $rev_compliment\n";
> =

> $sequence =3D ' ';
> $compliment=3D' ';
> $rev_compliment=3D' ';
> =

> }
> =

> =

> And when i see the output there is some difference in the tabs in
> displays. why is that so. Any ideas =

> =

> sequence : TTCAAGGACTTCTATTCAGAA rev_sequence :
> TTCTGAATAGAAGTCCTTGAA =

> sequence : TCTTGATGAAGAGGAATGGGA rev_sequence :
> TCCCATTCCTCTTCATCAAGA =

> sequence : GCTTGGCAATCTCATGTCAAA rev_sequence :
> TTTGACATGAGATTGCCAAGC =

> sequence : CTAGACCAATGTTTAGTTAGT rev_sequence :
> ACTAACTAAACATTGGTCTAG =

> sequence : TAGTTGTCGTCGTATCTTTGT rev_sequence :
> ACAAAGATACGACGACAACTA =

> sequence : GAGTAAGGCGCTTATCTTCT rev_sequence : AGAAGATAAGCGCCTTACTC
> sequence : TCTGCAACCGGAAAGGGAGC rev_sequence : GCTCCCTTTCCGGTTGCAGA =

> =

> =

> last 2 outputs dont display my tabs why is that so.
> I checked the escape characters in the file but cant find much in
> them it look like : =

> sequence : TGCAGAAGAGAGTGAGCAC^Irev_sequence : GTGCTCACTCTCTTCTGCA$
> sequence : TGCAGAAGAGAGTGAGCAC^Irev_sequence : GTGCTCACTCTCTTCTGCA$
> sequence : TGCAGAAGAGAGTGAGCAC^Irev_sequence : GTGCTCACTCTCTTCTGCA$
> sequence : CGCAGAAGAGAGTGAGCACA^Irev_sequence : TGTGCTCACTCTCTTCTGCG$
> sequence : TTGCAGAAGAAAGAGAGCAC^Irev_sequence : GTGCTCTCTTTCTTCTGCAA$
> sequence : TTGCAGAAGATAGAGAGCAC^Irev_sequence : GTGCTCTCTATCTTCTGCAA$
> =

> Please advice.

My first advice is to always have "use strict; use warnings;" at the
start of your script.

If you use tabs for formatting then the appearance of your output will
depend on the tabs settings of whatever you use to view that output.
This is a good reason to use spaces tabs for layout purposes (assuming a
monospace font).

Perl has a fairly sophisticated formatting mechanism (see 'perldoc
perlform'), but [s]printf may be simpler for this example:

------------------------------------------------------------ ---
use strict;
use warnings;

while () {
s/\s+$//;
next if $_ eq "";

my $sequence =3D $_;
my $compliment =3D $sequence;
$compliment =3D~ tr/aAtTcCgGuU/TTAAGGCCTT/;
my $rev_compliment=3Dreverse $compliment;

# print "sequence : $sequence\t";
printf "sequence : %-25s", $sequence;
print "rev_sequence : $rev_compliment\n";
}

__DATA__
TGCAGAAGAGAGTGAGCAC
TGCAGAAGAGAGTGAGCAC =

TGCAGAAGAGAGTGAGCAC =

TGCAGAAGAGAGTGAGCAC =

TGCAGAAGAGAGTGAGCAC =

TGCAGAAGAGAGTGAGCAC =

CGCAGAAGAGAGTGAGCACA
TTGCAGAAGAAAGAGAGCAC
TTGCAGAAGATAGAGAGCAC
------------------------------------------------------------ ---

HTH

-- =

Brian Raven =


==================== =====3D=
================
Atos Euronext Market Solutions Disclaimer
==================== =====3D=
================

The information contained in this e-mail is confidential and solely for the=
intended addressee(s). Unauthorised reproduction, disclosure, modification=
, and/or distribution of this email may be unlawful.
If you have received this email in error, please notify the sender immediat=
ely and delete it from your system. The views expressed in this message do =
not necessarily reflect those of Atos Euronext Market Solutions.

Atos Euronext Market Solutions Limited - Registered in England & Wales with=
registration no. 3962327. Registered office address at 25 Bank Street Lon=
don E14 5NQ United Kingdom. =

Atos Euronext Market Solutions SAS - Registered in France with registration=
no. 425 100 294. Registered office address at 6/8 Boulevard Haussmann 750=
09 Paris France.

L'information contenue dans cet e-mail est confidentielle et uniquement des=
tinee a la (aux) personnes a laquelle (auxquelle(s)) elle est adressee. Tou=
te copie, publication ou diffusion de cet email est interdite. Si cet e-mai=
l vous parvient par erreur, nous vous prions de bien vouloir prevenir l'exp=
editeur immediatement et d'effacer le e-mail et annexes jointes de votre sy=
steme. Le contenu de ce message electronique ne represente pas necessaireme=
nt la position ou le point de vue d'Atos Euronext Market Solutions.
Atos Euronext Market Solutions Limited Soci=E9t=E9 de droit anglais, enregi=
str=E9e au Royaume Uni sous le num=E9ro 3962327, dont le si=E8ge social se =
situe 25 Bank Street E14 5NQ Londres Royaume Uni.

Atos Euronext Market Solutions SAS, soci=E9t=E9 par actions simplifi=E9e, e=
nregistr=E9 au registre dui commerce et des soci=E9t=E9s sous le num=E9ro 4=
25 100 294 RCS Paris et dont le si=E8ge social se situe 6/8 Boulevard Hauss=
mann 75009 Paris France.
==================== =====3D=
================

_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Re: cannot see the tabs in output?

am 30.04.2007 13:01:02 von n.haigh

Just wondering why not use BioPerl (www.bioperl.org)?

Nath


amit hetawal wrote:
> Hello All,
> I really dont know whats causing this problem. Its like i have the
> input file which looks like:
>
> :set list on in vi
>
> TGCAGAAGAGAGTGAGCAC$
> TGCAGAAGAGAGTGAGCAC $
> TGCAGAAGAGAGTGAGCAC $
> TGCAGAAGAGAGTGAGCAC $
> TGCAGAAGAGAGTGAGCAC $
> TGCAGAAGAGAGTGAGCAC $
> CGCAGAAGAGAGTGAGCACA$
> TTGCAGAAGAAAGAGAGCAC$
> TTGCAGAAGATAGAGAGCAC$
>
> (there are some trailing spaces in above sequences.)
>
> And when i use the below script:
>
> $filename = $ARGV[0];
> open (FILE, "< $filename") or die "Cant open $filename : $!";
>
> $sequence = '';
> while()
> {
> next if /^(\s)*$/; # to skip blank lines in file
> chomp;
>
> $_=~s/\s+$//g;
>
> $sequence=$_;
> $compliment=$sequence;
> $compliment =~tr/aAtTcCgGuU/TTAAGGCCTT/;
> $rev_compliment=reverse $compliment;
>
> print "sequence : $sequence\t";
> print "rev_sequence : $rev_compliment\n";
>
> $sequence = ' ';
> $compliment=' ';
> $rev_compliment=' ';
>
> }
>
>
> And when i see the output there is some difference in the tabs in
> displays. why is that so. Any ideas
>
> sequence : TTCAAGGACTTCTATTCAGAA rev_sequence : TTCTGAATAGAAGTCCTTGAA
> sequence : TCTTGATGAAGAGGAATGGGA rev_sequence : TCCCATTCCTCTTCATCAAGA
> sequence : GCTTGGCAATCTCATGTCAAA rev_sequence : TTTGACATGAGATTGCCAAGC
> sequence : CTAGACCAATGTTTAGTTAGT rev_sequence : ACTAACTAAACATTGGTCTAG
> sequence : TAGTTGTCGTCGTATCTTTGT rev_sequence : ACAAAGATACGACGACAACTA
> sequence : GAGTAAGGCGCTTATCTTCT rev_sequence : AGAAGATAAGCGCCTTACTC
> sequence : TCTGCAACCGGAAAGGGAGC rev_sequence : GCTCCCTTTCCGGTTGCAGA
>
>
> last 2 outputs dont display my tabs why is that so.
> I checked the escape characters in the file but cant find much in them
> it look like :
> sequence : TGCAGAAGAGAGTGAGCAC^Irev_sequence : GTGCTCACTCTCTTCTGCA$
> sequence : TGCAGAAGAGAGTGAGCAC^Irev_sequence : GTGCTCACTCTCTTCTGCA$
> sequence : TGCAGAAGAGAGTGAGCAC^Irev_sequence : GTGCTCACTCTCTTCTGCA$
> sequence : CGCAGAAGAGAGTGAGCACA^Irev_sequence : TGTGCTCACTCTCTTCTGCG$
> sequence : TTGCAGAAGAAAGAGAGCAC^Irev_sequence : GTGCTCTCTTTCTTCTGCAA$
> sequence : TTGCAGAAGATAGAGAGCAC^Irev_sequence : GTGCTCTCTATCTTCTGCAA$
>
> Please advice.
>
> Thanks
> _______________________________________________
> ActivePerl mailing list
> ActivePerl@listserv.ActiveState.com
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
>

_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Re: cannot see the tabs in output?

am 30.04.2007 15:21:57 von Deane.Rothenmaier

This is a multipart message in MIME format.
--===============1846829749==
Content-Type: multipart/alternative;
boundary="=_alternative 00497105862572CD_="

This is a multipart message in MIME format.
--=_alternative 00497105862572CD_=
Content-Type: text/plain; charset="us-ascii"

Amit,

It's not a coding problem at all, simply a spacing problem. Tabbing
output is tricky-sometimes a string that's one character shorter than
another will hose up your tabbing completely.

See info on formatting output using format lines in the Camel book. It's
almost as ugly in Perl as it is in COBOL, but it does work easily.

HTH

Deane Rothenmaier
Programmer/Analyst
Walgreens Corp.
847-914-5150

I have more respect for people who change their views after acquiring new
information than for those who cling to views they held thirty years ago.
The world changes. -- Michael Crichton
--=_alternative 00497105862572CD_=
Content-Type: text/html; charset="us-ascii"



Amit,



It's not a coding problem at all, simply a spacing problem.  Tabbing output is tricky-sometimes a string that's one character shorter than another will hose up your tabbing completely.



See info on formatting output using format lines in the Camel book. It's almost as ugly in Perl as it is in COBOL, but it does work easily.



HTH



Deane Rothenmaier

Programmer/Analyst

Walgreens Corp.

847-914-5150



I have more respect for people who change their views after acquiring new information than for those who cling to views they held thirty years ago. The world changes. -- Michael Crichton

--=_alternative 00497105862572CD_=--


--===============1846829749==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
--===============1846829749==--