SEQanswers

Go Back   SEQanswers > Bioinformatics > Bioinformatics



Similar Threads
Thread Thread Starter Forum Replies Last Post
Software for generating "synthetic" reads MBender Bioinformatics 10 03-11-2011 10:10 AM
Need script to estimate error rate Melissa Bioinformatics 1 04-22-2010 11:31 PM
454 homopolymer error rate joa_ds 454 Pyrosequencing 10 12-18-2009 11:33 AM
error rate der_eiskern Illumina/Solexa 0 12-11-2009 03:51 PM
MAQ mapstat error rate fadista Bioinformatics 0 02-05-2009 02:21 AM

Reply
 
Thread Tools
Old 03-02-2009, 01:33 AM   #1
foolishbrat
Member
 
Location: South East Asia

Join Date: Nov 2008
Posts: 44
Default Pseudocode for Generating Synthetic Tags with Error Rate

Dear all,

I am aware of Metasim program that generates synthetic tags,
but it doesn't seem to give me much control for what I want to do.

What I intend to do is this:

Given these inputs:

Code:
 my $init_seq = "AAAAAAAAAA" #length 10 bp 
    my $sub_rate = 0.003;
    my $nof_tags = 1000;
    my @dna = qw( A C G T );

I want to generate:
  1. 1. One thousand length-10 tags
  2. 2. Substitution rate for each position in a tag is 0.003


Yielding output like:

Code:
   AAAAAAAAAA
    AATAACAAAA
    .....
    AAGGAAAAGA # 1000th tags
Is there a compact way to do it in Perl?

I am stuck with this script logic as core:

Code:
#!/usr/bin/perl
    
    my $init_seq = "AAAAAAAAAA" #length 10 bp 
    my $sub_rate = 0.003;
    my $nof_tags = 1000;
    my @dna = qw( A C G T );
    
        $i = 0;
        while ($i < length($init_seq)) {
        	$roll = int(rand 4) + 1;       # $roll is now an integer between 1 and 4
        	
        	if ($roll == 1) {$base = A;}
        	elsif ($roll == 2) {$base = T;}
        	elsif ($roll == 3) {$base = C;}
        	elsif ($roll == 4) {$base = G;};
        	
        	print $base;
        }
        continue {
        	$i++;
        }
foolishbrat is offline   Reply With Quote
Old 03-02-2009, 04:32 AM   #2
andpet
Member
 
Location: Germany

Join Date: Jul 2008
Posts: 26
Default

One problem could be that $i is not increased in the while - loop ? Something like this would make more sense:

while ($i < length($init_seq)) {
...
print $base;
$i++;
}

Maybe your "continue" statement is supposed to do this ?

Andreas
andpet is offline   Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off




All times are GMT -8. The time now is 09:59 PM.


Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2020, vBulletin Solutions, Inc.
Single Sign On provided by vBSSO