comparison cpt_psm_prep/lib/CPT/Bio/Lipo.pm @ 0:e4de0a0e90c8 draft

Uploaded
author cpt
date Tue, 05 Jul 2022 05:38:34 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:e4de0a0e90c8
1 package CPT::Bio::Lipo;
2 use Moose;
3 use strict;
4 use warnings;
5 use Data::Dumper;
6 use autodie;
7
8 # ABSTRACT: Lipo finding functionality in a library.
9
10 sub run_hash {
11 my ( $self, $hash_ref ) = @_;
12 my %hash = %{$hash_ref};
13 my @return_keys;
14 foreach ( sort { $a <=> $b } keys %hash ) {
15 if ( $hash{$_}[4] !~ qr/^.{10,39}C/ ) {
16 next;
17 }
18 else {
19 $hash{$_}[5] = $self->run_seq( $hash{$_}[4] );
20 }
21 }
22 return \%hash;
23 }
24
25 sub run_seq {
26 my ( $self, $seq ) = @_;
27 my @C; #A list of each C in the string, in str(10,40)
28 for ( my $j = 10 ; $j < length($seq) && $j < 40 ; $j++ ) {
29 if ( substr( $seq, $j, 1 ) =~ /[c]/i ) {
30 push( @C, $j );
31 }
32 }
33 my @results;
34 for ( my $z = 0 ; $z < scalar(@C) ; $z++ ) {
35 my $upC10 = "";
36
37 #Make sure it's not ALL DEKRs 10 residues upstream. (Does that happen O.o)
38 if ( substr( $seq, $C[$z] - 10, 10 ) !~ /[DEKR]/ ) {
39 push(
40 @results,
41 [
42 substr( $seq, 0, $C[$z] - 10 ),
43 substr( $seq, $C[$z] - 10, 10 ),
44 substr( $seq, $C[$z], 1 ),
45 substr( $seq, $C[$z] + 1 ),
46 ]
47 );
48 }
49 }
50 if ( scalar @results ) {
51 return \@results;
52 }
53 return undef;
54 }
55
56 no Moose;
57 1;
58
59 __END__
60
61 =pod
62
63 =encoding UTF-8
64
65 =head1 NAME
66
67 CPT::Bio::Lipo - Lipo finding functionality in a library.
68
69 =head1 VERSION
70
71 version 1.99.4
72
73 =head1 AUTHOR
74
75 Eric Rasche <rasche.eric@yandex.ru>
76
77 =head1 COPYRIGHT AND LICENSE
78
79 This software is Copyright (c) 2014 by Eric Rasche.
80
81 This is free software, licensed under:
82
83 The GNU General Public License, Version 3, June 2007
84
85 =cut