App-Sandy

 view release on metacpan or  search on metacpan

lib/App/Sandy/Read.pm  view on Meta::CPAN

	default    => 0
);

has '_base' => (
	is         => 'rw',
	isa        => 'Int',
	builder    => '_build_base',
	lazy_build => 1
);

has '_not_base' => (
	is         => 'ro',
	isa        => 'HashRef',
	builder    => '_build_not_base',
	lazy_build => 1
);

sub _build_not_base {
	my %not_base = (
		A => ['T', 'C', 'G'],
		a => ['t', 'c', 'g'],
		T => ['A', 'C', 'G'],
		t => ['a', 'c', 'g'],
		C => ['A', 'T', 'G'],
		c => ['a', 't', 'g'],
		G => ['A', 'T', 'C'],
		g => ['a', 't', 'c']
	);
	return \%not_base;
}

sub _build_base {
	my $self = shift;
	# If sequencing_error equal to zero, set _base to zero
	return $self->sequencing_error && int(1 / $self->sequencing_error);
}

sub subseq {
	my ($self, $seq_ref, $seq_len, $slice_len, $pos) = @_;

lib/App/Sandy/Read.pm  view on Meta::CPAN

	my @errors;

	if ($self->sequencing_error) {
		my $acm_base = $read_size + $self->_count_base;
		my $num_err = int($acm_base / $self->_base);
		my $left_count = $acm_base % $self->_base;

		for (my $i = 0; $i < $num_err; $i++) {
			my $pos = $i * $self->_base + $self->_base - $self->_count_base - 1;
			my $b = substr($$seq_ref, $pos, 1);
			my $not_b = $self->_randb($b, $rng);
			substr($$seq_ref, $pos, 1) = $not_b;
			push @errors => sprintf("%d:%s/%s", $pos + 1, $b, $not_b);
		}

		$self->_count_base($left_count);
	}

	return \@errors;
}

sub reverse_complement {
	my ($self, $seq_ref) = @_;
	$$seq_ref = reverse $$seq_ref;
	$$seq_ref =~ tr/atcgATCG/tagcTAGC/;
}

sub _randb {
	my ($self, $base, $rng) = @_;
	return $self->_not_base->{$base}[$rng->get_n(3)] || $base;
}

__END__

=pod

=encoding UTF-8

=head1 NAME

lib/App/Sandy/Seq/PairedEnd.pm  view on Meta::CPAN

	# In order to work third gen sequencing
	# simulator, it is necessary to truncate
	# the read according to the ptable size
	if ($read_size > $ptable_size) {
		$read_size = $ptable_size;
	}

	my ($read1_ref, $read2_ref, $attr) = $self->gen_read($ptable, $ptable_size,
		$read_size, $is_leader, $rng, $blacklist);

	my $annot_a = $attr->{annot};

	$self->_set_info(
		'id'                 => $id,
		'num'                => $num,
		'seq_id'             => $seq_id,
		'seq_id_type'        => $seq_id_type,
		'read_size'          => $read_size,
		'fragment_start'     => $attr->{start},
		'fragment_end'       => $attr->{end},
		'fragment_start_ref' => $attr->{start_ref},
		'fragment_end_ref'   => $attr->{end_ref},
		'fragment_size'      => $attr->{end} - $attr->{start} + 1,
		'fragment_strand'    => $is_leader ? 'P' : 'M',
		'var'                => @$annot_a ? join ',' => @$annot_a : 'none'
	);

	return $is_leader
		? ($self->_sprint_seq($read1_ref, $read_size, 1, $attr, 1, $rng), $self->_sprint_seq($read2_ref, $read_size, 2, $attr, 0, $rng))
		: ($self->_sprint_seq($read2_ref, $read_size, 1, $attr, 0, $rng), $self->_sprint_seq($read1_ref, $read_size, 2, $attr, 1, $rng));
}

sub _sprint_seq {
	my ($self, $read_ref, $read_size, $read_num, $attr, $is_leader, $rng) = @_;

lib/App/Sandy/Seq/SingleEnd.pm  view on Meta::CPAN

		$read_size = $ptable_size;
	}

	my ($read_ref, $attr) = $self->gen_read($ptable, $ptable_size, $read_size, $is_leader, $rng, $blacklist);

	my $error_a = $attr->{error};
	my $error = @$error_a
		? join ',' => @$error_a
		: 'none';

	my $annot_a = $attr->{annot};
	my $var = @$annot_a
		? join ',' => @$annot_a
		: 'none';

	$self->_set_info(
		'id'          => $id,
		'num'         => $num,
		'seq_id'      => $seq_id,
		'read'        => 1,
		'error'       => $error,
		'var'         => $var,
		'seq_id_type' => $seq_id_type,

ppport.h  view on Meta::CPAN

ASCII_TO_NATIVE|5.007001||Viu
ASCII_TO_NEED|5.019004||dcVnu
asctime|5.009000||Viu
ASCTIME_R_PROTO|5.008000|5.008000|Vn
assert|5.003007||Viu
__ASSERT_|5.019007|5.008008|p
ASSERT_CURPAD_ACTIVE|5.008001||Viu
ASSERT_CURPAD_LEGAL|5.008001||Viu
ASSERT_IS_LITERAL|||Viu
ASSERT_IS_PTR|||Viu
assert_not_glob|5.009004||Viu
ASSERT_NOT_PTR|5.035004||Viu
assert_not_ROK|5.008001||Viu
assert_uft8_cache_coherent|5.013003||Viu
assignment_type|5.021005||Viu
ASSUME|5.019006|5.003007|p
atfork_lock|5.007003|5.007003|nu
atfork_unlock|5.007003|5.007003|nu
aTHX|5.006000|5.003007|p
aTHX_|5.006000|5.003007|p
aTHXa|5.017006||Viu
aTHXo|5.006000||Viu
aTHXR||5.003007|ponu

ppport.h  view on Meta::CPAN

NONDESTRUCT_PAT_MODS|5.013002||Viu
NON_OTHER_COUNT|5.033005||Viu
NONV|||Viu
no_op|5.003007||Viu
NOOP|5.005000|5.003007|p
noperl_die|5.021006||vVniu
NORETURN_FUNCTION_END|5.009003||Viu
NORMAL|5.003007||Viu
NOSTR|5.027010||Viu
NO_TAINT_SUPPORT|5.017006||Viu
not_a_number|5.005000||Viu
NOTE3|5.027001||Viu
NOTHING|5.003007||Viu
NOTHING_t8|5.035004||Viu
NOTHING_t8_p8|5.033003||Viu
NOTHING_t8_pb|5.033003||Viu
NOTHING_tb|5.035004||Viu
NOTHING_tb_p8|5.033003||Viu
NOTHING_tb_pb|5.033003||Viu
nothreadhook|5.008000|5.008000|
notify_parser_that_changed_to_utf8|5.025010||Viu
not_incrementable|5.021002||Viu
NOT_IN_PAD|5.005000||Viu
NOT_REACHED|5.019006|5.003007|poVnu
NPOSIXA|5.017003||Viu
NPOSIXA_t8|5.035004||Viu
NPOSIXA_t8_p8|5.033003||Viu
NPOSIXA_t8_pb|5.033003||Viu
NPOSIXA_tb|5.035004||Viu
NPOSIXA_tb_p8|5.033003||Viu
NPOSIXA_tb_pb|5.033003||Viu
NPOSIXD|5.017003||Viu

ppport.h  view on Meta::CPAN

WHILEM_B_min_tb|5.035004||Viu
WHILEM_B_min_tb_p8|5.033003||Viu
WHILEM_B_min_tb_pb|5.033003||Viu
WHILEM_t8|5.035004||Viu
WHILEM_t8_p8|5.033003||Viu
WHILEM_t8_pb|5.033003||Viu
WHILEM_tb|5.035004||Viu
WHILEM_tb_p8|5.033003||Viu
WHILEM_tb_pb|5.033003||Viu
WIDEST_UTYPE|5.015004|5.003007|poVnu
win32_croak_not_implemented|5.017006||Vniu
WIN32SCK_IS_STDSCK|5.007001||Viu
win32_setlocale|5.027006||Viu
withinCOUNT|5.031004||Viu
withinCOUNT_KNOWN_VALID|5.033005||Viu
WITH_LC_NUMERIC_SET_TO_NEEDED|5.031003|5.031003|
WITH_LC_NUMERIC_SET_TO_NEEDED_IN|5.031003|5.031003|
with_queued_errors|5.013001||Viu
with_tp_UTF8ness|5.033003||Viu
with_t_UTF8ness|5.035004||Viu
wrap_keyword_plugin|5.027006|5.027006|x

ppport.h  view on Meta::CPAN


#if ! defined(PERL_REVISION) && ! defined(PERL_VERSION_MAJOR)
#  if   !   defined(__PATCHLEVEL_H_INCLUDED__)                                  \
     && ! ( defined(PATCHLEVEL) && defined(SUBVERSION))
#    define PERL_PATCHLEVEL_H_IMPLICIT
#    include <patchlevel.h>
#  endif
#  if     ! defined(PERL_VERSION)                                               \
     &&   ! defined(PERL_VERSION_MAJOR)                                         \
     && ( ! defined(SUBVERSION) || ! defined(PATCHLEVEL) )
#    include <could_not_find_Perl_patchlevel.h>
#  endif
#endif

#ifdef PERL_VERSION_MAJOR
#  define D_PPP_MAJOR  PERL_VERSION_MAJOR
#elif defined(PERL_REVISION)
#  define D_PPP_MAJOR  PERL_REVISION
#else
#  define D_PPP_MAJOR  5
#endif



( run in 1.190 second using v1.01-cache-2.11-cpan-cc502c75498 )