Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $s=file_get_contents("actin-human.fasta");
- $righe=explode("\n",$s);
- $string1="gaattg";
- $gi_regexp="/^>gi\|(\d{5,12})\|/";
- $pdb_regexp="/\|pdb\|(\w+)\|/";
- $array_gi=array();
- $array_pdb=array();
- $i=0;
- $j=0;
- foreach($righe as $riga){
- $riga=trim($riga);
- if(preg_match($gi_regexp,$riga,$matches)){
- array_push($array_gi,$matches[1]);
- $i++;
- }
- if(preg_match($pdb_regexp,$riga,$matches)){
- array_push($array_pdb,$matches[1]);
- $j++;
- }
- }
- echo "<p>trovati $i gi</p><p>";
- echo "trovati $j pdb</p><p>";
- echo "i gi trovati sono:</p><p>";
- foreach($array_gi as $gi){
- echo $gi."<br>";
- }
- echo "i pdb trovati sono:</p><p>";
- foreach($array_pdb as $pdb){
- echo $pdb."<br>";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement