Tripal v1.0 (6.x-1.0)
|
00001 <?php 00002 00007 $defline_tpl = $variables['options']['display']['defline_fields']; 00008 $num_bases_per_line = $variables['options']['display']['num_bases_per_line']; 00009 $use_residues = $variables['options']['display']['use_residues']; 00010 $residues_colname = $variables['options']['display']['residues_colname']; 00011 00012 if(!$num_bases_per_line){ 00013 $num_bases_per_line = 50; 00014 } 00015 00016 // foreach row in the views table 00017 foreach ($themed_rows as $index => $fields) { 00018 $defline = array(); 00019 $residues = ''; 00020 00021 // if we're using the residues as is then we assume the residues are already 00022 // formatted in FASTA format. We just need to print 00023 if ($use_residues) { 00024 print "$fields[$residues_colname]\r\n"; 00025 } 00026 // if we're not using the residues as is then wrap the residues 00027 // and generate a proper FASTA format 00028 else { 00029 00030 foreach ($fields as $key => $value) { 00031 00032 // if the setup indicates, wrap the sequence 00033 if (strcmp($key, $residues_colname) == 0) { 00034 $residues = wordwrap($value, $num_bases_per_line, "\r\n", TRUE); 00035 } 00036 00037 // set the FASTA header 00038 if (strcmp($key, 'defline') == 0) { 00039 $defline = $value; 00040 } 00041 } 00042 00043 // print the FASTA record 00044 print ">$defline\r\n"; 00045 print "$residues\r\n"; 00046 } 00047 } 00048 00049