Login | Register

Info | Home

BioPHP - Number of matching sequences

Original code submitted by joseba
Code bellow is covered by GNU GPL v2 license.

Description

Last change: 2010/10/18 17:04 | Edit description | Recent Changes | Original description
Will response with number of sequences matching a oligo.

If oligo does not include degenerate nucleotides response will be 1.      
                
      example: oligo is TATA, and response will be 1                      
              

If oligo includes degenerated nucleotides response will be >1             
              .
      example: oligo is WATW, and response will be 4 (recognizes:
AATA,AATT,TATA,TATT

Code

Last change: 2010/10/18 17:04 | Edit Code | Recent Changes | Download | Original code
function number_of_matching_sequences ($oligo){
$Count_YRWSKM=substr_count($oligo,"Y")+
              substr_count($oligo,"R")+
              substr_count($oligo,"W")+
              substr_count($oligo,"S")+
              substr_count($oligo,"K")+
              substr_count($oligo,"M");
$Count_DVHB=substr_count($oligo,"D")+
              substr_count($oligo,"V")+
              substr_count($oligo,"H")+
              substr_count($oligo,"B");

$oligo_len=strlen($oligo);
$options=1;
if ($Count_YRWSKM>0 and $Count_DVHB>0){$options=($Count_YRWSKM*2)*($Count_DVHB*3);};
if ($Count_YRWSKM>0 and $Count_DVHB==0){$options=$Count_YRWSKM*2;};
if ($Count_YRWSKM==0 and $Count_DVHB>0){$options=$Count_DVHB*3;};
return $options;
}