App-SimulateReads

 view release on metacpan or  search on metacpan

lib/App/SimulateReads/DB/Handle/Expression.pm  view on Meta::CPAN

package App::SimulateReads::DB::Handle::Expression;
# ABSTRACT: Class to handle expression-matrix database schemas.

use App::SimulateReads::Base 'class';
use App::SimulateReads::DB;
use IO::Compress::Gzip 'gzip';
use IO::Uncompress::Gunzip 'gunzip';
use Storable qw/nfreeze thaw/;
use Scalar::Util 'looks_like_number';

with 'App::SimulateReads::Role::IO';

our $VERSION = '0.16'; # VERSION

sub insertdb {
	my ($self, $file, $name, $source, $is_user_provided) = @_;
	my $schema = App::SimulateReads::DB->schema;

	log_msg ":: Checking if there is already an expression-matrix '$name' ...";

lib/App/SimulateReads/DB/Handle/Expression.pm  view on Meta::CPAN

		chomp;
		next if /^\s*$/;

		my @fields = split;

		die "Error parsing expression-matrix '$file': Seqid (first column) not found at line $line\n"
			unless defined $fields[0];
		die "Error parsing expression-matrix '$file': Count (second column) not found at line $line\n"
			unless defined $fields[1];
		die "Error parsing expression-matrix '$file': Count (second column) does not look like a number at line $line\n"
			if not looks_like_number($fields[1]);

		# Only throws a warning, because it is common zero values in expression matrix
		if ($fields[1] <= 0) {
			log_msg ":: Parsing expression-matrix '$file': Ignoring seqid '$fields[0]': Count (second column) lesser or equal to zero at line $line\n";
			next;
		}

		$indexed_file{$fields[0]} = $fields[1];
	}

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

package App::SimulateReads::Simulator;
# ABSTRACT: Class responsible to make the simulation

use App::SimulateReads::Base 'class';
use App::SimulateReads::Fastq::SingleEnd;
use App::SimulateReads::Fastq::PairedEnd;
use App::SimulateReads::InterlaceProcesses;
use App::SimulateReads::WeightedRaffle;
use App::SimulateReads::DB::Handle::Expression;
use Scalar::Util 'looks_like_number';
use File::Cat 'cat';
use Parallel::ForkManager;

with qw/App::SimulateReads::Role::IO/;

our $VERSION = '0.16'; # VERSION

has 'seed' => (
	is        => 'ro',
	isa       => 'Int',



( run in 0.619 second using v1.01-cache-2.11-cpan-64827b87656 )