views-data-export-fasta-body.tpl.php 687 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. /**
  3. * @file
  4. * Renders the body portion of a FASTA views data export
  5. */
  6. //print_r($themed_rows);
  7. // print the first FASTA record header
  8. // this is needed due to the order of the fields
  9. print $defline;
  10. // foreach row in the views table
  11. foreach ($themed_rows as $index => $fields) {
  12. $defline = array();
  13. $residues = '';
  14. foreach ($fields as $key => $value) {
  15. // wrap the sequence
  16. if (strcmp($key, 'residues') == 0) {
  17. $residues = wordwrap($value, 60, "\r\n", TRUE);
  18. }
  19. // set the FASTA header
  20. if (strcmp($key, 'defline') == 0) {
  21. $defline = $value;
  22. }
  23. }
  24. // print the FASTA record
  25. print ">$defline\r\n";
  26. print "$residues\r\n";
  27. }