etc. in which the first number is the start position and the second is the stop position. I need to map these positions to the DNA string and replace them with X's. I dont know whether I should be treating the start/stop positons file as a hash or array?? - there are lots of values so i couldn't declare them if i used a hash. Error messages say that $finish isn't declared within the second foreach loop. Heres the code so far:1 1800 1900 2254
this is my attempt, i realise it is bad and can't think of a good way to do this. THANX. lol#! /usr/local/bin/perl -w use strict; open (INPUT, "<positions.input") or die "unable to open file"; open (INPUT2, "<dna.file") or die "unable to open file"; open (OUTFILE, ">$$.output"); @dna = <INPUT2>; $dna = join ('', @dna); $dna =~ s/\s//g; @dna = split ('', $dna); $count = 0; $base = ("A"| "C"| "G" | "T"); foreach $base (@dna) { ++$count; } while (<INPUT>) { $line = $_; chomp ($line); @orfs = (); @orfs = split (/\s+/, $line); my @start = $orfs[0]; my @finish = $orfs[1]; } foreach $start (@orfs) { $start = substr ($dna, 0, $start); substr ($dna, $start +1, $finish - $start) =~ s/A-Z/X/g; $dna =~ s/(.{60})/$1\n/g; print "$dna\n"; print OUTFILE "$dna\n"; } close INPUT; close INPUT2; close OUTFILE; exit;
Edit kudra, 2002-04-24 Added to title
In reply to in need of wisdom: handling DNA strings by lolly
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |