App-SimulateReads

 view release on metacpan or  search on metacpan

lib/App/SimulateReads/Command/Custom.pm  view on Meta::CPAN

	'verbose'          => 0,
	'prefix'           => 'out',
	'output-dir'       => '.',
	'jobs'             => 1,
	'gzip'             => 1,
	'count-loops-by'   => 'coverage',
	'coverage'         => 8,
	'strand-bias'      => 'random',
	'seqid-weight'     => 'length',
	'sequencing-type'  => 'paired-end',
	'fragment-mean'    => 300,
	'fragment-stdd'    => 50,
	'sequencing-error' => 0.005,
	'read-size'        => 100,
	'quality-profile'  => 'poisson'
}

sub rm_opt {
}

__END__

lib/App/SimulateReads/Command/Custom.pm  view on Meta::CPAN

  -n, --number-of-reads          directly set the number of reads [Integer]
  -t, --sequencing-type          single-end or paired-end reads
                                 [default:"paired-end"]
  -q, --quality-profile          illumina sequencing system profiles
                                 [default:"hiseq"]
  -e, --sequencing-error         sequencing error rate
                                 [default:"0.005"; Number]
  -r, --read-size                the read size [default:"100"; Integer]
                                 the quality_profile from database overrides
                                 this value
  -m, --fragment-mean            the mean size fragments for paired-end reads
                                 [default:"300"; Integer]
  -d, --fragment-stdd            the standard deviation for fragment sizes
                                 [default:"50"; Integer]
  -b, --strand-bias              which strand to be used: plus, minus and random
                                 [default:"random"]
  -w, --seqid-weight             seqid raffle type: length, same, file
                                 [default: "length"]
  -f, --expression-matrix        an expression-matrix entry from database,
                                 when seqid-weight=count

=head1 DESCRIPTION

lib/App/SimulateReads/Command/Custom.pm  view on Meta::CPAN

	Escape       Meaning
	------       ------------------------------------------
	%i   	     instrument id composed by SR + PID
	%I           job slot number
	%q           quality profile
	%e           sequencing error
	%R           read 1, or 2 if it is the paired-end mate
	%U           read number
	%r           read size
	%c           sequence id as chromossome, ref
	%s           read or fragment strand
	%t           read start position
	%n           read end position

Paired-end specific escape characters

	Escape       Meaning
	------       ------------------------------------------
	%T           mate read start position
	%N           mate read end position
	%D           distance between the paired-reads
	%m           fragment mean
	%d           fragment standard deviation
	%f           fragment size
	%S           fragment start position
	%E           fragment end position

=item B<--jobs>

Sets the number of child jobs to be created

=item B<--gzip>

Compress the output-file with gzip algorithm. It is
possible to pass --no-output-gzip if one wants
uncompressed output-file

lib/App/SimulateReads/Command/Custom.pm  view on Meta::CPAN


=item B<--number-of-reads>

Sets directly the number of reads desired. It overrides coverage,
in case the two options are given

=item B<--sequencing-type>

Sets the sequencing type to single-end or paired-end

=item B<--fragment-mean>

If the sequencing-type is set to paired-end, it sets the
fragment mean

=item B<--fragment-stdd>

If the sequencing-type is set to paired-end, it sets the
fragment standard deviation

=item B<--sequencing-error>

Sets the sequencing error rate. Valid values are between zero and one

=item B<--quality-profile>

Sets the illumina sequencing system profile for quality. For now, the unique
valid values are hiseq and poisson

lib/App/SimulateReads/Command/Genome.pm  view on Meta::CPAN

	'verbose'          => 0,
	'prefix'           => 'out',
	'output-dir'       => '.',
	'jobs'             => 1,
	'gzip'             => 1,
	'count-loops-by'   => 'coverage',
	'coverage'         => 8,
	'strand-bias'      => 'random',
	'seqid-weight'     => 'length',
	'sequencing-type'  => 'paired-end',
	'fragment-mean'    => 300,
	'fragment-stdd'    => 50,
	'sequencing-error' => 0.005,
	'read-size'        => 100,
	'quality-profile'  => 'poisson'
}

sub rm_opt {
	'strand-bias',
	'number-of-reads',
	'seqid-weight',
	'expression-matrix'

lib/App/SimulateReads/Command/Genome.pm  view on Meta::CPAN

  -c, --coverage                 fastq-file coverage [default:"8", Number]
  -t, --sequencing-type          single-end or paired-end reads
                                 [default:"paired-end"]
  -q, --quality-profile          illumina sequencing system profiles
                                 [default:"poisson"]
  -e, --sequencing-error         sequencing error rate
                                 [default:"0.005"; Number]
  -r, --read-size                the read size [default:"100"; Integer]
                                 the quality_profile from database overrides
                                 this value
  -m, --fragment-mean            the fragment mean size for paired-end reads
                                 [default:"300"; Integer]
  -d, --fragment-stdd            the fragment standard deviation size for
                                 paired-end reads [default:"50"; Integer]

=head1 DESCRIPTION

Simulate genome sequencing.

=head1 OPTIONS

=over 8

lib/App/SimulateReads/Command/Genome.pm  view on Meta::CPAN

	Escape       Meaning
	------       ------------------------------------------
	%i   	     instrument id composed by SR + PID
	%I           job slot number
	%q           quality profile
	%e           sequencing error
	%R           read 1, or 2 if it is the paired-end mate
	%U           read number
	%r           read size
	%c           sequence id as chromossome, ref
	%s           read or fragment strand
	%t           read start position
	%n           read end position

Paired-end specific escape characters

	Escape       Meaning
	------       ------------------------------------------
	%T           mate read start position
	%N           mate read end position
	%D           distance between the paired-reads
	%m           fragment mean
	%d           fragment standard deviation
	%f           fragment size
	%S           fragment start position
	%E           fragment end position

=item B<--jobs>

Sets the number of child jobs to be created

=item B<--gzip>

Compress the output-file with gzip algorithm. It is
possible to pass --no-gzip if one wants
uncompressed output-file

lib/App/SimulateReads/Command/Genome.pm  view on Meta::CPAN

=item B<--coverage>

Calculates the number of reads based on the sequence
coverage: number_of_reads = (sequence_size * coverage) / read_size.
This is the default option for genome sequencing simulation

=item B<--sequencing-type>

Sets the sequencing type to single-end or paired-end

=item B<--fragment-mean>

If the sequencing-type is set to paired-end, it sets the
fragment mean

=item B<--fragment-stdd>

If the sequencing-type is set to paired-end, it sets the
fragment standard deviation

=item B<--sequencing-error>

Sets the sequencing error rate. Valid values are between zero and one

=item B<--quality-profile>

Sets the illumina sequencing system profile for quality. For now, the unique
valid values are hiseq and poisson

lib/App/SimulateReads/Command/Transcriptome.pm  view on Meta::CPAN

	'verbose'          => 0,
	'prefix'           => 'out',
	'output-dir'       => '.',
	'jobs'             => 1,
	'gzip'             => 1,
	'count-loops-by'   => 'number-of-reads',
	'number-of-reads'  => 1000000,
	'strand-bias'      => 'minus',
	'seqid-weight'     => 'count',
	'sequencing-type'  => 'paired-end',
	'fragment-mean'    => 300,
	'fragment-stdd'    => 50,
	'sequencing-error' => 0.005,
	'read-size'        => 100,
	'quality-profile'  => 'poisson'
}

sub rm_opt {
	'strand-bias',
	'coverage',
	'seqid-weight'
}

lib/App/SimulateReads/Command/Transcriptome.pm  view on Meta::CPAN

                                 [default:"1000000", Integer]
  -t, --sequencing-type          single-end or paired-end reads
                                 [default:"paired-end"]
  -q, --quality-profile          illumina sequencing system profiles
                                 [default:"hiseq"]
  -e, --sequencing-error         sequencing error rate
                                 [default:"0.005"; Number]
  -r, --read-size                the read size [default:"100"; Integer]
                                 the quality_profile from database overrides
                                 this value
  -m, --fragment-mean            the fragment mean size for paired-end reads
                                 [default:"300"; Integer]
  -d, --fragment-stdd            the fragment standard deviation size for
                                 paired-end reads [default:"50"; Integer]

=head1 DESCRIPTION

Simulate transcriptome sequencing.

=head1 OPTIONS

=over 8

lib/App/SimulateReads/Command/Transcriptome.pm  view on Meta::CPAN

	Escape       Meaning
	------       ------------------------------------------
	%i   	     instrument id composed by SR + PID
	%I           job slot number
	%q           quality profile
	%e           sequencing error
	%R           read 1, or 2 if it is the paired-end mate
	%U           read number
	%r           read size
	%c           sequence id as chromossome, ref
	%s           read or fragment strand
	%t           read start position
	%n           read end position

Paired-end specific escape characters

	Escape       Meaning
	------       ------------------------------------------
	%T           mate read start position
	%N           mate read end position
	%D           distance between the paired-reads
	%m           fragment mean
	%d           fragment standard deviation
	%f           fragment size
	%S           fragment start position
	%E           fragment end position

=item B<--jobs>

Sets the number of child jobs to be created

=item B<--gzip>

Compress the output-file with gzip algorithm. It is
possible to pass --no-gzip if one wants
uncompressed output-file

lib/App/SimulateReads/Command/Transcriptome.pm  view on Meta::CPAN


=item B<--number-of-reads>

Sets the number of reads desired. This is the default option
for transcriptome sequencing simulation

=item B<--sequencing-type>

Sets the sequencing type to single-end or paired-end

=item B<--fragment-mean>

If the sequencing-type is set to paired-end, it sets the
fragment mean

=item B<--fragment-stdd>

If the sequencing-type is set to paired-end, it sets the
fragment standard deviation

=item B<--sequencing-error>

Sets the sequencing error rate. Valid values are between zero and one

=item B<--quality-profile>

Sets the illumina sequencing system profile for quality. For now, the unique
valid values are hiseq and poisson

lib/App/SimulateReads/Fastq/PairedEnd.pm  view on Meta::CPAN

with 'App::SimulateReads::Role::RunTimeTemplate';

our $VERSION = '0.16'; # VERSION

has 'template_id' => (
	is         => 'ro',
	isa        => 'Str',
	required   => 1
);

has 'fragment_mean' => (
	is         => 'ro',
	isa        => 'My:IntGt0',
	required   => 1
);

has 'fragment_stdd' => (
	is         => 'ro',
	isa        => 'My:IntGe0',
	required   => 1
);

has 'sequencing_error' => (
	is         => 'ro',
	isa        => 'My:NumHS',
	required   => 1
);

lib/App/SimulateReads/Fastq/PairedEnd.pm  view on Meta::CPAN

	my $self = shift;
	## Just to ensure that the lazy attributes are built before &new returns
	$self->_read;
}

sub _build_read {
	my $self = shift;
	App::SimulateReads::Read::PairedEnd->new(
		sequencing_error => $self->sequencing_error,
		read_size        => $self->read_size,
		fragment_mean    => $self->fragment_mean,
		fragment_stdd    => $self->fragment_stdd
	);
}

sub _build_gen_header {
	my $self = shift;
	my %sym_table = (
		'%q' => '$info->{quality_profile}',
		'%r' => '$info->{read_size}',
		'%e' => '$info->{sequencing_error}',
		'%m' => '$info->{fragment_mean}',
		'%d' => '$info->{fragment_stdd}',
		'%f' => '$info->{fragment_size}',
		'%S' => '$info->{fragment_start}',
		'%E' => '$info->{fragment_end}',
		'%c' => '$info->{seq_id}',
		'%t' => '$info->{start}',
		'%n' => '$info->{end}',
		'%T' => '$info->{mate_start}',
		'%N' => '$info->{mate_end}',
		'%D' => '$info->{tlen}',
		'%i' => '$info->{instrument}',
		'%I' => '$info->{id}',
		'%R' => '$info->{read}',
		'%U' => '$info->{num}',

lib/App/SimulateReads/Fastq/PairedEnd.pm  view on Meta::CPAN


sub _build_info {
	my $self = shift;

	my %info = (
#		instrument       => sprintf("SR%d", getppid),
		instrument       => 'SR',
		quality_profile  => $self->quality_profile,
		read_size        => $self->read_size,
		sequencing_error => $self->sequencing_error,
		fragment_mean    => $self->fragment_mean,
		fragment_stdd    => $self->fragment_stdd
	);

	return \%info;
}

sub sprint_fastq {
	my ($self, $id, $num, $seq_id, $seq_ref, $seq_size, $is_leader) = @_;

	my ($read1_ref, $read2_ref, $fragment_pos, $fragment_size) = $self->gen_read($seq_ref, $seq_size, $is_leader);

	my ($fragment_start, $fragment_end) = ($fragment_pos + 1, $fragment_pos + $fragment_size);

	my ($start1, $end1) = ($fragment_start, $fragment_start + $self->read_size - 1);
	my ($start2, $end2) = ($fragment_end, $fragment_end - $self->read_size + 1);

	unless ($is_leader) {
		($start1, $end1, $start2, $end2) = ($start2, $end2, $start1, $end1);
	}

	$self->_set_info1(
		'id'               => $id,
		'num'              => $num,
		'fragment_size'    => $fragment_size,
		'fragment_start'   => $fragment_start,
		'fragment_end'     => $fragment_end,
		'seq_id'           => $seq_id,
		'start'            => $start1,
		'end'              => $end1,
		'mate_start'       => $start2,
		'mate_end'         => $end2,
		'tlen'             => $end2 - $end1,
		'read'             => 1,
		'strand'           => $is_leader ? 'P' : 'M'
	);

	$self->_set_info2(
		'id'               => $id,
		'num'              => $num,
		'fragment_size'    => $fragment_size,
		'fragment_start'   => $fragment_start,
		'fragment_end'     => $fragment_end,
		'seq_id'           => $seq_id,
		'start'            => $start2,
		'end'              => $end2,
		'mate_start'       => $start1,
		'mate_end'         => $end1,
		'tlen'             => $end1 - $end2,
		'read'             => 2,
		'strand'           => $is_leader ? 'P' : 'M'
	);

lib/App/SimulateReads/Read/PairedEnd.pm  view on Meta::CPAN

use Math::Random 'random_normal';

extends 'App::SimulateReads::Read';

our $VERSION = '0.16'; # VERSION

use constant {
	NUM_TRIES => 1000
};

has 'fragment_mean' => (
	is       => 'ro',
	isa      => 'My:IntGt0',
	required => 1
);

has 'fragment_stdd' => (
	is       => 'ro',
	isa      => 'My:IntGe0',
	required => 1
);

sub BUILD {
	my $self = shift;
	unless (($self->fragment_mean - $self->fragment_stdd) >= $self->read_size) {
		die sprintf "fragment_mean (%d) minus fragment_stdd (%d) must be greater or equal to read_size (%d)\n"
			=> $self->fragment_mean,  $self->fragment_stdd, $self->read_size;
	}
}

sub gen_read {
	my ($self, $seq_ref, $seq_size, $is_leader) = @_;

	if ($seq_size < $self->fragment_mean) {
		die sprintf "seq_size (%d) must be greater or equal to fragment_mean (%d)\n"
			=> $seq_size, $self->fragment_mean;
	}

	my $fragment_size = 0;
	my $random_tries = 0;

	until (($fragment_size <= $seq_size) && ($fragment_size >= $self->read_size)) {
		# seq_size must be greater or equal to fragment_size and
		# fragment_size must be greater or equal to read_size
		# As fragment_size is randomly calculated, try out NUM_TRIES times
		if (++$random_tries > NUM_TRIES) {
			die sprintf
				"So many tries to calculate a fragment. the constraints were not met:\n" .
				"fragment_size <= seq_size (%d) and fragment_size >= read_size (%d)\n"
					=> $seq_size, $self->read_size;
		}

		$fragment_size = $self->_random_half_normal;
	}

	my ($fragment_ref, $fragment_pos) = $self->subseq_rand($seq_ref, $seq_size, $fragment_size);

	my $read1_ref = $self->subseq($fragment_ref, $fragment_size, $self->read_size, 0);
	$self->update_count_base($self->read_size);
	$self->insert_sequencing_error($read1_ref);

	my $read2_ref = $self->subseq($fragment_ref, $fragment_size, $self->read_size, $fragment_size - $self->read_size);
	$self->reverse_complement($read2_ref);
	$self->update_count_base($self->read_size);
	$self->insert_sequencing_error($read2_ref);

	return $is_leader ?
		($read1_ref, $read2_ref, $fragment_pos, $fragment_size) :
		($read2_ref, $read1_ref, $fragment_pos, $fragment_size);
}

sub _random_half_normal {
	my $self = shift;
	return abs(int(random_normal(1, $self->fragment_mean, $self->fragment_stdd)));
}

__END__

=pod

=encoding UTF-8

=head1 NAME

lib/App/SimulateReads/Role/Digest.pm  view on Meta::CPAN

		'seed'              => 'seed|s=i',
		'prefix'            => 'prefix|p=s',
		'id'                => 'id|I=s',
		'append-id'         => 'append-id|i=s',
		'verbose'           => 'verbose|v',
		'output-dir'        => 'output-dir|o=s',
		'jobs'              => 'jobs|j=i',
		'gzip'              => 'gzip|z!',
		'coverage'          => 'coverage|c=f',
		'read-size'         => 'read-size|r=i',
		'fragment-mean'     => 'fragment-mean|m=i',
		'fragment-stdd'     => 'fragment-stdd|d=i',
		'sequencing-error'  => 'sequencing-error|e=f',
		'sequencing-type'   => 'sequencing-type|t=s',
		'quality-profile'   => 'quality-profile|q=s',
		'strand-bias'       => 'strand-bias|b=s',
		'seqid-weight'      => 'seqid-weight|w=s',
		'number-of-reads'   => 'number-of-reads|n=i',
		'expression-matrix' => 'expression-matrix|f=s'
	);

	for my $opt (@rm_opt) {

lib/App/SimulateReads/Role/Digest.pm  view on Meta::CPAN

		die "Option 'strand-bias' requires one of these arguments: $opt. Not $opts->{'strand-bias'}\n";
	}

	# sequencing_type (SEQUENCING_TYPE_OPT)
	if (not exists $SEQUENCING_TYPE{$opts->{'sequencing-type'}}) {
		my $opt = join ', ' => keys %SEQUENCING_TYPE;
		die "Option 'sequencing-type' requires one of these arguments: $opt not $opts->{'sequencing-type'}\n";
	}

	## Dependently validated arguments
	# fragment_mean and fragment_stdd
	if ($opts->{'sequencing-type'} eq 'paired-end') {
		# fragment_mean > 0
		if ($opts->{'fragment-mean'} <= 0) {
			die "Option 'fragment-mean' requires an integer greater than zero, not $opts->{'fragment-mean'}\n";
		}

		# fragment_stdd > 0
		if ($opts->{'fragment-stdd'} < 0) {
			die "Option 'fragment-stdd' requires an integer greater or equal to zero, not $opts->{'fragment-stdd'}\n";
		}

		# (fragment_mean - fragment_stdd) >= read_size
		if (($opts->{'fragment-mean'} - $opts->{'fragment-stdd'}) < $opts->{'read-size'}) {
			die "Option 'fragment-mean' minus 'fragment-stdd' requires a value greater or equal read-size, not " .
				($opts->{'fragment-mean'} - $opts->{'fragment-stdd'}) . "\n";
		}
	}

	# count-loops-by (COUNT_LOOPS_BY_OPT). The default value is defined into the consuming class
	if (not exists $COUNT_LOOPS_BY{$default_opt{'count-loops-by'}}) {
		my $opt = join ', ' => keys %COUNT_LOOPS_BY;
		die "The provider must define the default count-lopps-by: $opt, not $default_opt{'count-loops-by'}";
	}

	# If default is 'coverage'

lib/App/SimulateReads/Role/Digest.pm  view on Meta::CPAN

HEADER

	#-------------------------------------------------------------------------------
	#  Construct the Fastq and Simulator classes
	#-------------------------------------------------------------------------------
	my %paired_end_param = (
		template_id       => $opts->{'id'},
		quality_profile   => $opts->{'quality-profile'},
		sequencing_error  => $opts->{'sequencing-error'},
		read_size         => $opts->{'read-size'},
		fragment_mean     => $opts->{'fragment-mean'},
		fragment_stdd     => $opts->{'fragment-stdd'}
	);

	my %single_end_param = (
		template_id       => $opts->{'id'},
		quality_profile   => $opts->{'quality-profile'},
		sequencing_error  => $opts->{'sequencing-error'},
		read_size         => $opts->{'read-size'}
	);

	my $fastq;

lib/App/SimulateReads/Simulator.pm  view on Meta::CPAN

			when ('App::SimulateReads::Fastq::SingleEnd') {
				my $read_size = $self->fastq->read_size;
				if ($index_size < $read_size) {
					log_msg ":: Parsing fasta file '$fasta': Seqid sequence length (>$id => $index_size) lesser than required read size ($read_size)\n" .
						"  -> I'm going to include '>$id' in the blacklist\n";
					delete $indexed_fasta->{$id};
					push @blacklist => $id;
				}
			}
			when ('App::SimulateReads::Fastq::PairedEnd') {
				my $fragment_mean = $self->fastq->fragment_mean;
				if ($index_size < $fragment_mean) {
					log_msg ":: Parsing fasta file '$fasta': Seqid sequence length (>$id => $index_size) lesser than required fragment mean ($fragment_mean)\n" .
						"  -> I'm going to include '>$id' in the blacklist\n";
					delete $indexed_fasta->{$id};
					push @blacklist => $id;
				}
			}
			default {
				die "Unknown option '$_' for sequencing type\n";
			}
		}
	}

t/lib/TestsFor/App/SimulateReads/Fastq/PairedEnd.pm  view on Meta::CPAN

sub startup : Tests(startup) {
	my $test = shift;
	$test->SUPER::startup;
}

sub setup : Tests(setup) {
	my $test = shift;

	my %default_attr = (
		sequencing_error => 0.1,
		fragment_mean    => 50,
		fragment_stdd    => 10,
		template_id      => 'sr0001 simulation_read length=%r position=%c:%t-%n'
	);

	$test->SUPER::setup(%default_attr);
}

sub cleanup : Tests(shutdown) {
	my $test = shift;
	$test->SUPER::shutdown;
}

t/lib/TestsFor/App/SimulateReads/Read/PairedEnd.pm  view on Meta::CPAN


sub startup : Tests(startup) {
	my $test = shift;
	$test->SUPER::startup;
}

sub setup : Tests(setup) {
	my $test = shift;

	my %default_attr = (
		fragment_mean    => 50,
		fragment_stdd    => 10
	);

	$test->SUPER::setup(%default_attr);
}

sub constructor : Tests(9) {
	my $test = shift;

	my $class = $test->class_to_test;
	my $read = $test->default_read;
	my %default_attr = %{ $test->default_attr };

	while (my ($attr, $value) = each %default_attr) {
		can_ok $read, $attr;
		is $read->$attr, $value,"The value for $attr shold be correct";
	}

	my %attrs = %default_attr;
	
	$attrs{fragment_mean} = 50;
	$attrs{read_size} = 51;
	throws_ok { $class->new(%attrs) }
	qr/must be greater or equal/,
		"Setting fragment_mean to less than read_size should fail";
}

sub gen_read : Tests(122) {
	my $test = shift;

	my $read = $test->default_read;
	my $seq = $test->seq;
	my $seq_len = $test->seq_len;

	throws_ok { $read->gen_read(\$seq, $read->read_size - 1, 1) }
	qr/must be greater or equal to fragment_mean/,
		"Sequence length lesser than read_size must return error";
	
	my $err = 0;
	for (1..100) {
		my ($r1_ref, $r2_ref, $frag_pos, $frag_size) = $read->gen_read(\$seq, $seq_len, 1);
		$err++ unless defined $$r1_ref && defined $$r2_ref && defined $frag_pos && defined $frag_size;
	}

	ok $err == 0, "100 tries: It must not give error";
	
	for my $i (0..9) {
		#For leader strand
		my ($r1_ref, $r2_ref, $frag_pos, $frag_size) = $read->gen_read(\$seq, $seq_len, 1);
		ok index($seq, $$r1_ref) < 0,
			"Sequence with error must be outside seq in gen_read (PairEnd -> read1). Try $i";
		my $r1_l1 = substr $$r1_ref, 0, $read->read_size - 1;
		ok index($seq, $r1_l1) >= 0,
			"Sequence with error (but last char -> err) must be inside seq in gen_read (PairedEnd -> read1). Try $i";
		is index($seq, $r1_l1), $frag_pos,
			"Position returned must be equal to index in gen_read (PairEnd -> read1). Try $i";

		$read->reverse_complement($r2_ref);
		ok index($seq, $$r2_ref) < 0,
			"Sequence with error must be outside seq in gen_read (PairEnd -> read2). Try $i";
		my $r2_f1 = substr $$r2_ref, 1, $read->read_size;
		ok index($seq, $r2_f1) >= 0,
			"Sequence with error (but first char -> err) must be inside seq in gen_read (PairedEnd -> read2). Try $i";
		is index($seq, $r2_f1), $frag_pos + $frag_size - $read->read_size + 1,
			"Position returned + fragment size must be equal to index in gen_read (PairEnd -> read2). Try $i";

		#For retarded strand
		my ($r3_ref, $r4_ref, $frag_pos2, $frag_size2) = $read->gen_read(\$seq, $seq_len, 0);
		ok index($seq, $$r4_ref) < 0,
			"Sequence with error must be outside seq in gen_read (PairEnd, reverse_complement -> read2). Try $i";
		my $r4_l1 = substr $$r4_ref, 0, $read->read_size - 1;
		ok index($seq, $r4_l1) >= 0,
			"Sequence with error (but last char -> err) must be inside seq in gen_read (PairedEnd, reverse_complement -> read2). Try $i";
		is index($seq, $r4_l1), $frag_pos2,
			"Position returned must be equal to index in gen_read (PairEnd, reverse_complement -> read2). Try $i";

		$read->reverse_complement($r3_ref);
		ok index($seq, $$r3_ref) < 0,
			"Sequence with error must be outside seq in gen_read (PairEnd, reverse_complement -> read1). Try $i";
		my $r3_f1 = substr $$r2_ref, 1, $read->read_size;
		ok index($seq, $r3_f1) >= 0,
			"Sequence with error (but first char -> err) must be inside seq in gen_read (PairedEnd, reverse_complement -> read1). Try $i";
		is index($seq, $r3_f1), $frag_pos + $frag_size - $read->read_size + 1,
			"Position returned + fragment size must be equal to index in gen_read (PairEnd, reverse_complement -> read1). Try $i";
	}
}

#sub normality : Tests(1) {
#	my $test = shift;
#	my $read = $test->default_read;
#
#	SKIP: {
#		eval { require Statistics::Normality };
#		skip 'Statistics::Normality not installed', 1 if $@;

t/lib/TestsFor/App/SimulateReads/Simulator.pm  view on Meta::CPAN

			template_id       => 'sr0001 simulation_read length=%r position=%c:%t-%n'
		)
	);

	my %sg_paired_end = (
		%default_attr,
		fastq => App::SimulateReads::Fastq::PairedEnd->new(
			quality_profile   => 'poisson',
			read_size         => QUALITY_SIZE,
			sequencing_error  => 0.1,
			fragment_mean     => 50,
			fragment_stdd     => 10,
			template_id       => 'sr0001 simulation_read length=%r position=%c:%t-%n'
		)
	);

	$test->default_attr(\%default_attr);
	$test->default_sg_single_end($test->class_to_test->new(%sg_single_end));
	$test->default_sg_paired_end($test->class_to_test->new(%sg_paired_end));
}

sub cleanup : Tests(shutdown) {



( run in 0.553 second using v1.01-cache-2.11-cpan-b16cb0d3907 )