CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner: Help with DNA sequence software: Edit Log



geneclicker
New User

Sep 27, 2012, 10:55 PM


Views: 1415
Help with DNA sequence software

Hello everyone. I'm new to perl. I work on manual curation projects on alphabet based content.

I have a perl program which reads a text file and breaks it up in contiguous chunks according to input provided by the user.

My problem is can get the program to run but it gives me error messages. It says command not found.

The original coder has moved on to better projects.

Can someone please help?

I work on a mac in case this is important to know.

Thank you much.

G clicker

The code in perl

#!/usr/bin/perl
use strict;
use warnings;
my @params = ();
while ( my $param = shift ) {
push @params, $param;
}
unless ( scalar @params == 4 ) {
print "$0 <input fasta file> <block size> <block label> <output file>\n";
exit;
}
my ( $inputFile, $blockSize, $blockLabel, $outputFile ) = @params;
print "Input seems to be valid. Now I will try reading the contents of $inputFile...";
open INPUT, '<', $inputFile or die $!;
open OUTPUT, '>', $outputFile or die $!;
my $sequence = '';
while ( <INPUT> ) {
chomp;
next if ( /^\s*$/ );
next if ( /^>/ );
$sequence .= $_;
}
print "done.\n";
my $pos = 0;
my $index = 0;
print "The sequence has ", length($sequence), " bases. Now I will try breaking it into segments, each of size $blockSize bases.\n";
while ( $pos < length($sequence) ) {
$index++;
print OUTPUT ">$blockLabel$index\n";
print OUTPUT substr($sequence, $pos, $blockSize) . "\n";
$pos += $blockSize;
}
close OUTPUT;
close INPUT;
print "Successfully generated $outputFile.\n";

end of code.

the target file looks like this, the extension on the file is .fa

GCGTCCGCGGAGGGGGCGGCGGGCCTGGGCGACCCTGCACCTCTGGGCCG
TGGGGACTGTGGGGTGGGGCGGGGGCCGATGCGGCAGGGGTGAGGCCTGG
GGCCGGCGGGGTGACGGGGACCCGGCCCTGCGTGGGGAAGCCTCGGGGGG
ACAAGCAGAGACGCAGCCTGCTGGGAGCGGCCCAAGCTCTGCACCGGCCC
GCGGCGGGAGCACAGCAGCCCCCTCCCGCCCCTCCTCCCGGGGGCTCCGA
GGGGTGGTTATGGGGCGAGGGTCCTTGCGGGGCCCGGGCAGTGAAGGGCC
TGGAGGCCCCAGAGTCTGTGCCAGGTCTGAGCCGCGGGGCGTGGGGGGAG
GAGGGGCCTCGGCCGGGGCCCAGGAGACCCAGGACAGGTGGGCCTGGGGC
CAGGTCCCTACGGAGAGGTGGCCGGGCCGGGCTCTGGCTTGCCGGGGTAG
GGGCTCCGCTAGGGGCTGGAGTCCGTCCCTTCGCCAGCGCAGAGCCCCTC
GGCCCGCATCTGCCAAGTGACTGAGGATCGAGCGACAGCGTAGTGGGGCG
GAGGGGCTGGAGGCACGGCCGGAAAGGGTGAGCGGCGCCGTGGCTCCCCC
GCTATTTATTTGGCCCCGCCACGCGCGGAGAGGGAGGAAATTCTCAGGCT
GCGGCTGCAGCTAGGGGAGGCCCAGGTGGGCCTGGAATGGGCCCAGAGAG
GGCTTCCTGGGTCAGACGTGTAGATCCAGTGGACGTGAAAACCGGGTGAG
TGTCCCGGTGGGACCCAGAGCGCGGGGAGGCTTGGAGGCAGGGGCATGGG
CTGAGGACCCTCAAGGCACCCTCCTCGCGACCTGTCAGAGCTCCGAGGGG
TGGGGGTGTCCTGTGTGTGGCTGTGGGGATCCTGGGCGGCGGGTGCTGGG

Please see attached files.


(This post was edited by geneclicker on Sep 27, 2012, 11:12 PM)
Attachments: splitFasta.pl (0.97 KB)
  IGK_2.fa (206 KB)


Edit Log:
Post edited by geneclicker (New User) on Sep 27, 2012, 11:12 PM: Attaching files


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives