Welcome to MirrorTree Server

The Mirrortree Server allows to graphically and interactively studying the co-evolution of two protein families, and asses their interactions in an taxonomic context. The server accepts single sequences as input, although expert users can provide their own multiple sequence alignments or trees. Select below the point from which you want to start (single sequences, alignments or trees). See the "Help" page above for more information. (Adobe Flash Player 10 is required for the interactive manipulation of the results)

The interactive interface for assessing the tree similarity is not available as Adobe Flash Player got discontinued. While we recruit the resources for re-doing that part using another technology, only a static graphical representation of the two mirroring trees is shown, together with the tree similarity score (correlation value).

Due to technical problems, only the "(B) From multiple alignments" and "(C) From trees" sections of the input form work right now. Do NOT use the "(A) From sequences" entry point.

Your job has been submitted!

The results will be sent to {$_POST["email"]}

Please take note of your JobID: $uniqid

You will find the results in: http://csbg.cnb.csic.es/mtserver/TMP/$uniqid

It may take a while...

"; exec_perl($inputfiles[0],$inputfiles[1],$_POST['email'],$_POST['jobname'],$uniqid,$_POST['hident'],$_POST['hvalue'],$_POST['hcoverage'],$_POST['oident'],$_POST['ogap']); } } else{ show_form(); } // ################### // PHP FUNCTIONS // ################### function show_form($errors='') { print<<<_HTML_

From sequences

Provide the sequence of a member of each one of the two families (in FASTA format (example)). The system will look for orthologs in different species and generate the multiple sequence alignments and phylogenetic trees. The protocol implemented in the server is not intended to work with protein domains. You have to use whole-length sequences as input for the server. More info...

From multiple alignments - Advanced Users

Provide multiple sequence alignmets of ORTHOLOGS for the two families in "multiple fasta" format (example)). IDs should be in a swissprot-like format ">XXX_YYY". If XXX and/or YYY are not valid Uniprot and NCBI TaxID identifiers the system will work but some features will be disabled. More info...

From trees - Advanced Users

Provide phylogenetic trees of ORTHOLOGS for the two families in "newick" format. Bootstrap values (or "0.0" if not available) should be between squared brackets "[]" (example). IDs should be in a swissprot-like format "XXX_YYY". If XXX and/or YYY are not valid Uniprot and NCBI TaxID identifiers the system will work but some features will be disabled. More info...

_HTML_; if($errors){ print '
Please check this errors:
'; } print<<<_HTML_

Protein 1

Protein 2

Protein 1

Protein 2

Protein 1

Protein 2

Job Submission

(optional)

Advanced options

Homologs Selection

% Identity ≥% (20-100%)
E-value ≤ 1e-(≤1e-4)
% Coverage ≥% (1-100%)

Orthologs Selection

% Identity ≥% (20-100%)
% Gap ≤% (1-100%)
_HTML_; } function validate_form(){ $waittime="300"; $errors = array(); $utime=`perl ./scripts/uservalidation.pl {$_SERVER['REMOTE_ADDR']} $waittime`; if($utime){ $errors[]="To avoid server overload, each user (IP) can only send a job every 10 minutes. You have to wait $utime minutes before submiting a new job. If you require a more intensive use of the server, please contact us"; } else{ if(strlen(trim($_POST['email']))==0){ $errors[]='Please insert your email'; } elseif(! preg_match ('/^[^@\s]+@([-a-z0-9]+\.)+[a-z]{2,}$/i',$_POST['email'])){ $errors[]='Please enter a valid e-mail address'; } if($_POST['submit_check']=='Send Sequences'){ if((($_POST['seqarea1'])&&(($_FILES['seqfile1']['type'])))||((($_POST['seqarea2']))&&(($_FILES['seqfile2']['type'])))){ $errors[]='Please insert a sequence or a file (NOT BOTH)'; } if((($_FILES['seqfile1']['error']== UPLOAD_ERR_INI_SIZE) || ($_FILES['seqfile1']['error']==UPLOAD_ERR_FORM_SIZE))||(($_FILES['seqfile2']['error']== UPLOAD_ERR_INI_SIZE) || ($_FILES['seqfile2']['error']==UPLOAD_ERR_FORM_SIZE))){ $errors[]='Uploaded file is too big'; } elseif(($_FILES['seqfile1']['error'] == UPLOAD_ERR_PARTIAL)||($_FILES['seqfile2']['error'] == UPLOAD_ERR_PARTIAL)){ $errors[]='File upload was interrupted'; } elseif(((strlen(trim($_POST['seqarea1']))==0)&&($_FILES['seqfile1']['error']==UPLOAD_ERR_NO_FILE))||((strlen(trim($_POST['seqarea2']))==0)&&($_FILES['seqfile2']['error']==UPLOAD_ERR_NO_FILE))){ $errors[]='Please insert 2 protein sequences'; } if(((strlen(trim($_POST['seqarea1']))!=0)&&(preg_match('/^>.+/i',$_POST['seqarea1'])==0))||((strlen(trim($_POST['seqarea2']))!=0)&&(preg_match('/^>.+/i',$_POST['seqarea2'])==0))){ $errors[]='The sequences must be in FASTA format'; } if((strlen(trim($_POST['hident']))==0)||(strlen(trim($_POST['hvalue']))==0)||(strlen(trim($_POST['hcoverage']))==0)||(strlen(trim($_POST['oident']))==0)||(strlen(trim($_POST['ogap']))==0)){ $errors[]="The advanced options must be filled"; }else{ if((trim($_POST['hident'])<20)||(trim($_POST['hident'])>100)){ $errors[]="% identity in homologs selection (".$_POST['hident']."%) is out of range"; } if(trim($_POST['hvalue'])<4){ $errors[]="E-value in homologs selection (1e-".$_POST['hvalue'].") is out of range"; } if((trim($_POST['hcoverage'])<1)||(trim($_POST['hcoverage'])>100)){ $errors[]="% Coverage in homologs selection (".$_POST['hcoverage']."%) is out of range"; } if((trim($_POST['oident'])<20)||(trim($_POST['oident'])>100)){ $errors[]="% identity in orthologs selection (".$_POST['oident']."%) is out of range"; } if((trim($_POST['ogap'])<1)||(trim($_POST['ogap'])>100)){ $errors[]="% gaps in orthologs selection (".$_POST['ogap']."%) is out of range"; } } } elseif($_POST['submit_check']=='Send Alignments'){ if((($_POST['alnarea1'])&&(($_FILES['alnfile1']['type'])))||((($_POST['alnarea2']))&&(($_FILES['alnfile2']['type'])))){ $errors[]='Please insert an alignment or a file (NOT BOTH)'; } if((($_FILES['alnfile1']['error']== UPLOAD_ERR_INI_SIZE) || ($_FILES['alnfile1']['error']==UPLOAD_ERR_FORM_SIZE))||(($_FILES['alnfile2']['error']== UPLOAD_ERR_INI_SIZE) || ($_FILES['alnfile2']['error']==UPLOAD_ERR_FORM_SIZE))){ $errors[]='Uploaded file is too big'; } elseif(($_FILES['alnfile1']['error'] == UPLOAD_ERR_PARTIAL)||($_FILES['alnfile2']['error'] == UPLOAD_ERR_PARTIAL)){ $errors[]='File upload was interrupted'; } elseif(((strlen(trim($_POST['alnarea1']))==0)&&($_FILES['alnfile1']['error']==UPLOAD_ERR_NO_FILE))||((strlen(trim($_POST['alnarea2']))==0)&&($_FILES['alnfile2']['error']==UPLOAD_ERR_NO_FILE))){ $errors[]='Please insert 2 multiple alignments'; } if(((strlen(trim($_POST['alnarea1']))!=0)&&(preg_match('/^>.+/i',$_POST['alnarea1'])==0))||((strlen(trim($_POST['alnarea2']))!=0)&&(preg_match('/^>.+/i',$_POST['alnarea2'])==0))){ $errors[]='The alignments must be in FASTA format'; } } elseif($_POST['submit_check']=='Send Trees'){ if((($_POST['treearea1'])&&(($_FILES['treefile1']['type'])))||((($_POST['treearea2']))&&(($_FILES['treefile2']['type'])))){ $errors[]='Please insert a tree or a file (NOT BOTH)'; } if((($_FILES['treefile1']['error']== UPLOAD_ERR_INI_SIZE) || ($_FILES['treefile1']['error']==UPLOAD_ERR_FORM_SIZE))||(($_FILES['treefile2']['error']== UPLOAD_ERR_INI_SIZE) || ($_FILES['treefile2']['error']==UPLOAD_ERR_FORM_SIZE))){ $errors[]='Uploaded file is too big'; } elseif(($_FILES['treefile1']['error'] == UPLOAD_ERR_PARTIAL)||($_FILES['treefile2']['error'] == UPLOAD_ERR_PARTIAL)){ $errors[]='File upload was interrupted'; } elseif(((strlen(trim($_POST['treearea1']))==0)&&($_FILES['treefile1']['error']==UPLOAD_ERR_NO_FILE))||((strlen(trim($_POST['treearea2']))==0)&&($_FILES['treefile2']['error']==UPLOAD_ERR_NO_FILE))){ $errors[]='Please insert 2 trees'; } } if(count($errors)==0){ `perl ./scripts/userregistry.pl {$_SERVER['REMOTE_ADDR']} {$_POST['email']}`; } } return $errors; } function process_form(){ if(trim($_POST['jobname'])){ $_POST['jobname']=preg_replace('/ /','',$_POST['jobname']); } else{ $_POST['jobname']='unknown'; } $uploads_dir='./uploads'; if($_POST['submit_check']=='Send Sequences'){ if($_FILES['seqfile1']['name']){ $safe_filename1=str_replace('/','',$_FILES['seqfile1']['name']); $safe_filename1=str_replace(' ','_',$safe_filename1); $safe_filename1=str_replace('..','',$safe_filename1); $prefix = substr(md5(uniqid(rand())),0,6); $destination_file1=$uploads_dir."/".$prefix."_".$safe_filename1; move_uploaded_file($_FILES['seqfile1']['tmp_name'],$destination_file1); } else{ $prefix = substr(md5(uniqid(rand())),0,6); $destination_file1=$uploads_dir."/".$prefix."_file1.fasta"; file_put_contents($destination_file1,$_POST['seqarea1']); } if($_FILES['seqfile2']['name']){ $safe_filename2=str_replace('/','',$_FILES['seqfile2']['name']); $safe_filename2=str_replace('..','',$safe_filename2); $safe_filename2=str_replace(' ','_',$safe_filename2); $prefix = substr(md5(uniqid(rand())),0,6); $destination_file2=$uploads_dir."/".$prefix."_".$safe_filename2; move_uploaded_file($_FILES['seqfile2']['tmp_name'],$destination_file2); } else{ $prefix = substr(md5(uniqid(rand())),0,6); $destination_file2=$uploads_dir."/".$prefix."_file2.fasta"; file_put_contents($destination_file2,$_POST['seqarea2']); } } elseif($_POST['submit_check']=='Send Alignments'){ if($_FILES['alnfile1']['name']){ $safe_filename1=str_replace('/','',$_FILES['alnfile1']['name']); $safe_filename1=str_replace('..','',$safe_filename1); $safe_filename1=str_replace(' ','_',$safe_filename1); $prefix = substr(md5(uniqid(rand())),0,6); $destination_file1=$uploads_dir."/".$prefix."_".$safe_filename1; move_uploaded_file($_FILES['alnfile1']['tmp_name'],$destination_file1); } else{ $prefix = substr(md5(uniqid(rand())),0,6); $destination_file1=$uploads_dir."/".$prefix."_file1.fasta"; file_put_contents($destination_file1,$_POST['alnarea1']); } if($_FILES['alnfile2']['name']){ $safe_filename2=str_replace('/','',$_FILES['alnfile2']['name']); $safe_filename2=str_replace('..','',$safe_filename2); $safe_filename2=str_replace(' ','_',$safe_filename2); $prefix = substr(md5(uniqid(rand())),0,6); $destination_file2=$uploads_dir."/".$prefix."_".$safe_filename2; move_uploaded_file($_FILES['alnfile2']['tmp_name'],$destination_file2); } else{ $prefix = substr(md5(uniqid(rand())),0,6); $destination_file2=$uploads_dir."/".$prefix."_file2.fasta"; file_put_contents($destination_file2,$_POST['alnarea2']); } } elseif($_POST['submit_check']=='Send Trees'){ if($_FILES['treefile1']['name']){ $safe_filename1=str_replace('/','',$_FILES['treefile1']['name']); $safe_filename1=str_replace('..','',$safe_filename1); $safe_filename1=str_replace(' ','_',$safe_filename1); $prefix = substr(md5(uniqid(rand())),0,6); $destination_file1=$uploads_dir."/".$prefix."_".$safe_filename1; move_uploaded_file($_FILES['treefile1']['tmp_name'],$destination_file1); } else{ $prefix = substr(md5(uniqid(rand())),0,6); $destination_file1=$uploads_dir."/".$prefix."_file1.fasta"; file_put_contents($destination_file1,$_POST['treearea1']); } if($_FILES['treefile2']['name']){ $safe_filename2=str_replace('/','',$_FILES['treefile2']['name']); $safe_filename2=str_replace('..','',$safe_filename2); $safe_filename2=str_replace(' ','_',$safe_filename2); $prefix = substr(md5(uniqid(rand())),0,6); $destination_file2=$uploads_dir."/".$prefix."_".$safe_filename2; move_uploaded_file($_FILES['treefile2']['tmp_name'],$destination_file2); } else{ $prefix = substr(md5(uniqid(rand())),0,6); $destination_file2=$uploads_dir."/".$prefix."_file2.fasta"; file_put_contents($destination_file2,$_POST['treearea2']); } } $inputfiles=array($destination_file1,$destination_file2); return($inputfiles); } function exec_perl($file1, $file2, $email, $job, $uniqid, $hident, $hvalue, $hcoverage, $oident, $ogap) { if($_POST['submit_check']=='Send Sequences'){ system("perl ./scripts/workflow.pl '1' $file1 $file2 $email $job $uniqid $hident $hvalue $hcoverage $oident $ogap > out.txt 2>/dev/null &"); } elseif($_POST['submit_check']=='Send Alignments'){ system("perl ./scripts/workflow.pl '2' $file1 $file2 $email $job $uniqid $hident $hvalue $hcoverage $oident $ogap > out.txt 2>/dev/null &"); } elseif($_POST['submit_check']=='Send Trees'){ system("perl ./scripts/workflow.pl '3' $file1 $file2 $email $job $uniqid $hident $hvalue $hcoverage $oident $ogap > out.txt 2>/dev/null &"); } } ?>