Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

reading file in Perl (input)

Status
Not open for further replies.

mama12

Programmer
Oct 18, 2005
22
NL
Hallo all,

Can anybody here tell me what I the problem of what I am messing to read in put file

I appreciate any help

regards

use strict;
use warnings;
use BeginPerlBioinfo; # sub get_file_data+for extract_sequence_from_fasta_data in 1
# Initialize variables
my @file_data = ( );
my $dna = '';
my $revcom = '';
my $protein = '';

print "name of the DNA file: ";

chomp (@file_data = <STDIN>);

# Read in the contents of the file "anything"
@file_data = get_file_data("file_data");

# Extract the sequence data from the contents of the file "file_data"
$dna = extract_sequence_from_fasta_data(@file_data);

# Translate the DNA to protein in six reading frames
# and print the protein in lines 70 characters long
print "\n -------Reading Frame 1--------\n\n";
$protein = translate_frame($dna, 1);
print_sequence($protein, 70);

print "\n -------Reading Frame 2--------\n\n";
$protein = translate_frame($dna, 2);
print_sequence($protein, 70);

print "\n -------Reading Frame 3--------\n\n";
$protein = translate_frame($dna, 3);
print_sequence($protein, 70);

# Calculate reverse complement
$revcom = revcom($dna);

print "\n -------Reading Frame 4--------\n\n";
$protein = translate_frame($revcom, 1);
print_sequence($protein, 70);

print "\n -------Reading Frame 5--------\n\n";
$protein = translate_frame($revcom, 2);
print_sequence($protein, 70);

print "\n -------Reading Frame 6--------\n\n";
$protein = translate_frame($revcom, 3);
print_sequence($protein, 70);##
 
Try changing
Code:
# Read in the contents of the file "anything"
@file_data = get_file_data("file_data");
to
Code:
# Read in the contents of the file "anything"
@file_data = get_file_data("[red]$[/red]file_data");
And next time, please use code tags, you have been asked to do that before. If you're not sure how, click on "Process TGML" at the bottom of your window.


Trojan.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top