"); } function parse_Fasta ($f) { $sqs = explode(">", $f); $data = []; foreach ($sqs as $s) { if ($s) { $lines = explode("\n",$s,2); list($db,$id,$info) = explode("|",$lines[0]); list ($swp,$info) = explode(" ",$info,2); $data[$id] = ['db'=> $db, 'id'=> $id, 'swpid' => $swp, 'info' => $info, 'sequence' => $lines[1]]; } } return $data; } #start Session to hold input data session_start(); # Check if input comes from an uploaded file if ($_FILES['uploadFile']['name']) { $_REQUEST['fasta'] = file_get_contents($_FILES['uploadFile']['tmp_name']); } if (!$_REQUEST['fasta']) { ?> Error: No request

Error: Received request was empty

") if (!isFasta($_REQUEST['fasta'])) { # Not fasta: take as list of ids # Parsing list $idList = explode("\n", $_REQUEST['fasta']); $fasta = ''; foreach ($idList as $id) { if (!$id) continue; # Clean id spaces and lines $id = preg_replace("/[ \r]/","",$id); # get Uniprot Fasta $thisFasta = file_get_contents("https://rest.uniprot.org/uniprotkb/$id.fasta"); if (!isFasta($thisFasta)) { print "

Error: $id not found

"; } else { $fasta .= $thisFasta; } } } else { $fasta = $_REQUEST['fasta']; } $_SESSION['data'] = parse_Fasta($fasta); } ?>

Processed unique sequence(s)

Id Database SwissProt Id Header