Bio-Chaos

 view release on metacpan or  search on metacpan

bin/cx-enscore2chaos.pl  view on Meta::CPAN

				      type=>'produced_by',
				     ]));
	
	my @exC = ();
	my $mrnaseq = '';
	my $cdsseq = '';
	my $in_cds = 0;
	foreach my $exon (@exons) {
	    my ($min, $max, $strand, $contig_id) = 
	      $exon->getl(qw(contig_start contig_end contig_strand contig_id));
	    my $ctgid = $exon->sget_contig_id."-ct";
	    my ($nb, $ne) = bcmm2ibv($min, $max, $strand);
	    my $contig = $contigh{$contig_id};
	    my $dna = $contig->sget("dna/sequence");
	    my $exonseq = cutseq($dna, $nb, $ne);
	    $mrnaseq .= $exonseq;

	    # cds
	    if ($exon->sget_exon_id eq
		$translation->sget_start_exon_id) {
		$in_cds = 1;
		# start of CDS
		my $tnrelpos = $translation->sget_seq_start -1;
		$cdsseq =
		  cutseq($exonseq, 
			 $tnrelpos,
			 length($exonseq),
			 1);
		$tnfloc->set_nbeg($nb + $tnrelpos * $strand);
		$tnfloc->set_srcfeature_id($ctgid);
		if ($exon->sget_exon_id eq
		    $translation->sget_end_exon_id) {

		    $tnfloc->set_nend($nb + 
				      $translation->sget_seq_end * $strand);
		}
	    }
	    elsif ($exon->sget_exon_id eq
		   $translation->sget_end_exon_id) {
		$in_cds = 0;
		# end of CDS
		my $tnrelpos = $translation->sget_seq_end;
		$cdsseq .=
		  cutseq($exonseq, 
			 0,
			 $tnrelpos,
			 1);
		$tnfloc->set_nend($nb + $tnrelpos * $strand);
		if ($ctgid ne $tnfloc->sget_srcfeature_id) {
		    $tnC->add_featureprop(N(featureprop=>[type=>"problem",
							  value=>"CDS range split across contigs; also on $ctgid"]));
		}
	    }
	    else {
		# continuation of CDS
		$cdsseq .= $exonseq if $in_cds;
	    }
	    

#	    if ($strand == 1) {
#		if ($exon->sget_exon_id eq

bin/cx-enscore2chaos.pl  view on Meta::CPAN

	    my $fid = $exon->sget_exon_id."-ex";
	    my $f =
	      N(feature=>[
			  feature_id=>$fid,
			  uniquename=>$fid,
			  type=>'exon',
			  featureloc=>[
				       nbeg=>$nb,
				       nend=>$ne,
				       strand=>$strand,
				       srcfeature_id=>$ctgid,
				      ]
			  ]);
	    push(@exC, $f);
	    push(@F, $f);
	    push(@F, 
		 N(feature_relationship=>[subject_id=>$fid,
					  object_id=>$tfid,
					  type=>'part_of',
					 ]));
	}



( run in 1.844 second using v1.01-cache-2.11-cpan-5735350b133 )