Skip to content

Commit

Permalink
reorganized json path and added new examples
Browse files Browse the repository at this point in the history
  • Loading branch information
Noe Fernandez Pozo authored and Noe Fernandez Pozo committed Dec 11, 2024
1 parent 4b9162e commit bf4868d
Show file tree
Hide file tree
Showing 37 changed files with 259 additions and 254 deletions.
4 changes: 2 additions & 2 deletions annot_desc.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
// load annotation links in hash
$annot_hash;

if ( file_exists("$annotation_links_path/annotation_links.json") ) {
if ( file_exists("$json_files_path/tools/annotation_links.json") ) {

$annot_json_file = file_get_contents("$annotation_links_path/annotation_links.json");
$annot_json_file = file_get_contents("$json_files_path/tools/annotation_links.json");
// var_dump($annot_json_file);
$annot_hash = json_decode($annot_json_file, true);
// var_dump($annot_hash);
Expand Down
4 changes: 2 additions & 2 deletions annot_desc_file.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

<!-- COMMANDS -->
<?php
if (file_exists("$annotation_links_path/annotation_links.json")) {
$annot_json_file = file_get_contents("$annotation_links_path/annotation_links.json");
if (file_exists("$json_files_path/tools/annotation_links.json")) {
$annot_json_file = file_get_contents("$json_files_path/tools/annotation_links.json");
$annot_hash = json_decode($annot_json_file, true);
}

Expand Down
13 changes: 7 additions & 6 deletions footer.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,21 @@
include_once realpath("$custom_text_path/custom_footer.php");
}
else {
$logos_path = $root_path."".$images_path."/logos";
// $logos_path = $root_path."".$images_path."/logos";

$logos_json = file_get_contents($logos_path."/logos.json");
// var_dump($labs_json);
// $logos_json = file_get_contents($logos_path."/logos.json");
$logos_json = file_get_contents($json_files_path."/customization/logos.json");


//var_dump($logos_json);
$jlogo = json_decode($logos_json, true);

foreach($jlogo["logos"] as $logo) {
echo "<a href='".$logo["link"]."' target='_blank'><img class='m-2' height='".$logo["height"]."' src='".$images_path."/logos/".$logo["image"]."'></a>";
}

echo '<br>';
}
?>

<br>
<p style="display:inline">
<a href="/easy_gdb/cookies.php">Cookie policy</a>.
This site is based on <a href="https://github.com/noefp/easy_gdb" target="_blank">easyGDB</a> software.
Expand Down
4 changes: 2 additions & 2 deletions gene.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
$annot_file = $annotations_path."/".trim($_GET["annot"]);
// list($gene_name, $annot_file) = explode("@", trim($_GET["name"]));

if (file_exists("$annotation_links_path/annotation_links.json")) {
$annot_json_file = file_get_contents("$annotation_links_path/annotation_links.json");
if (file_exists("$json_files_path/tools/annotation_links.json")) {
$annot_json_file = file_get_contents("$json_files_path/tools/annotation_links.json");
$annotation_hash = json_decode($annot_json_file, true);
}

Expand Down
94 changes: 46 additions & 48 deletions groups.php
Original file line number Diff line number Diff line change
@@ -1,60 +1,58 @@
<br>
<h1>People</h1>
<br>

<?php
if ($dh = opendir($lab_path)){
// echo "<ul>";
while (($file_name = readdir($dh)) !== false){ //iterate all files in dir
<?php
$labs_json_file = $json_files_path."/customization/labs.json";

if ( file_exists($labs_json_file) ){
$labs_json = file_get_contents($labs_json_file);
// var_dump($labs_json);
$lab_hash = json_decode($labs_json, true);

foreach($lab_hash as $key => $value) {

echo '<h2>'.$lab_hash[$key]["group_name"].'</h2>';
echo '<div class="row">';
echo '<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">';

foreach($lab_hash[$key]["people"] as $person) {

if (!preg_match('/^\./', $file_name)) { //discard hidden files
if (!is_dir($lab_path."/".$file_name) && preg_match('/\.json/', $file_name) ){

$labs_json = file_get_contents($lab_path."/".$file_name);
// var_dump($labs_json);
$lab = json_decode($labs_json, true);
// var_dump($lab);
echo '<h2>'.$lab["group_name"].'</h2><br>';
echo '<div class="row">';
echo '<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">';

foreach($lab["people"] as $person) {
if ($person["link"]) {
if (preg_match('/www|http/', $person["link"])) { //external link

echo '<a href="'.$person["link"].'" target="blank" class="float-left card egdb_person_card" style="color:#333">';
} else {
echo '<a href="person_view.php?person_file='.$person["link"].'" class="float-left card egdb_person_card" style="color:#333">';
}
} else {
echo '<a href="" class="float-left card egdb_person_card" style="color:#333">';
}
echo '<img class="card-img-top egdb_person_img" src="'.$images_path.'/people/'.$person["picture"].'" alt="Lab member">';
echo '<div class="card-body" style="white-space: nowrap; padding: 5px;">';
echo '<h4 style="margin-bottom: 5px">'.$person["person_name"].'</h4>';
echo '<p class="person-card-text">'.$person["position"].'</p>';
if ($person["more_info"]) {
foreach($person["more_info"] as $person_item) {
echo '<p class="person-card-text">'.$person_item.'</p>';
}
}
echo '</div>';
echo '</a>';

}

echo '</div></div><br>';

if ($person["link"]) {
if (preg_match('/www|http/', $person["link"])) { //external link

echo '<a href="'.$person["link"].'" target="blank" class="float-left card egdb_person_card" style="color:#333">';
} else {
echo '<a href="person_view.php?person_file='.$person["link"].'" class="float-left card egdb_person_card" style="color:#333">';
}
} else {
echo '<a href="" class="float-left card egdb_person_card" style="color:#333">';
}
echo '<img class="card-img-top egdb_person_img" src="'.$images_path.'/people/'.$person["picture"].'" alt="Lab member">';
echo '<div class="card-body" style="white-space: nowrap; padding: 5px;">';
echo '<h4 style="margin-bottom: 5px">'.$person["person_name"].'</h4>';
echo '<p class="person-card-text">'.$person["position"].'</p>';
if ($person["more_info"]) {
foreach($person["more_info"] as $person_item) {
echo '<p class="person-card-text">'.$person_item.'</p>';
}
}
echo '</div>';
echo '</a>';

}
}
?>
}//close foreach person

echo '</div></div><br>'; //close row

} //close foreach lab
} //close if json file exists


?>

</div>
</div>
<!-- </div>
</div> -->

<br>
<style>
.egdb_person_card {
min-height:150px;
Expand Down
8 changes: 6 additions & 2 deletions species.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,13 @@
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">

<?php
if ( file_exists("$species_path/species_list.json") ) {
// if ( file_exists("$species_path/species_list.json") ) {
//$logos_json = file_get_contents($json_files_path."/customization/logos.json");

if ( file_exists($json_files_path."/customization/species_list.json") ) {

$sps_json_file = file_get_contents("$species_path/species_list.json");
// $sps_json_file = file_get_contents("$species_path/species_list.json");
$sps_json_file = file_get_contents("$json_files_path/customization/species_list.json");
// var_dump($sps_json_file);
$species_hash = json_decode($sps_json_file, true);
// var_dump($$species_hash);
Expand Down
6 changes: 4 additions & 2 deletions species_view.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@
<div class="row" style="margin-bottom: 10px;">
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
<?php
if ( file_exists("$species_path/species_list.json") ) {
if ( file_exists("$json_files_path/customization/species_list.json") ) {

$sps_json_file = file_get_contents("$species_path/species_list.json");
// $sps_json_file = file_get_contents("$species_path/species_list.json");

$sps_json_file = file_get_contents("$json_files_path/customization/species_list.json");
// var_dump($sps_json_file);
$species_hash = json_decode($sps_json_file, true);
// var_dump($species_hash);
Expand Down
8 changes: 4 additions & 4 deletions templates/egdb_files/egdb_conf/easyGDB_conf.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@
$images_path = "/$egdb_files_folder/egdb_images";
$custom_text_path = "$root_path/$egdb_files_folder/egdb_custom_text";
$downloads_path = "downloads";
$annotations_path = "$root_path/annotations";
$blast_dbs_path = "$root_path/blast_dbs";
$lookup_path = "$root_path/lookup"; //from root
$species_path = "$root_path/$egdb_files_folder/egdb_species";
$lab_path = "$root_path/$egdb_files_folder/egdb_labs";
$json_files_path = "$root_path/$egdb_files_folder/json_files";

//Expression
$expression_path = "$root_path/expression_data";
$private_expression_path = "$root_path/private_expression_data";
$comparator_lookup = 0;

//Annotations
$annotation_links_path = "$root_path/$egdb_files_folder/annotations";
$annotations_path = "$root_path/annotations";

//Passport
$passport_path = "$root_path/passport";
Expand All @@ -40,7 +40,7 @@

$tb_about = 1;
$tb_downloads = 1;
$tb_species = 0;
$tb_species = 1;
$tb_search_box = 0;

$tb_tools = 1;
Expand Down
24 changes: 0 additions & 24 deletions templates/egdb_files/egdb_labs/01_the_wall_lab.json

This file was deleted.

24 changes: 0 additions & 24 deletions templates/egdb_files/egdb_labs/02_mordor_lab.json

This file was deleted.

52 changes: 52 additions & 0 deletions templates/egdb_files/json_files/customization/labs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"Lab1":
{
"group_name":"The Wall Lab",
"people":
[
{"person_name":"Daenerys Targaryen","position":"Principal Investigator","picture":"placeholder1.png","link":"person.php",
"more_info":[
"phone: 555-123456",
"email: [email protected]"
]
},
{"person_name":"John Snow","position":"Research Assistant","picture":"placeholder2.png","link":"person.php",
"more_info":[
"phone: 555-123456",
"email: [email protected]"
]
},
{"person_name":"White Walker","position":"PhD Student","picture":"placeholder1.png","link":"person.php",
"more_info":[
"phone: 555-123456",
"email: [email protected]"
]
}
]
},
"Lab2":
{
"group_name":"Mordor Lab",
"people":
[
{"person_name":"Sauron","position":"Principal Investigator","picture":"placeholder2.png","link":"person.php",
"more_info":[
"phone: 555-123456",
"email: [email protected]"
]
},
{"person_name":"Uruk hai","position":"Research Assistant","picture":"placeholder1.png","link":"person.php",
"more_info":[
"phone: 555-123456",
"email: [email protected]"
]
},
{"person_name":"Orc","position":"PhD Student","picture":"placeholder2.png","link":"person.php",
"more_info":[
"phone: 555-123456",
"email: [email protected]"
]
}
]
}
}
File renamed without changes.
1 change: 1 addition & 0 deletions templates/egdb_files/json_files/tools/comparator_link.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"link":"https://peatmoss.plantcode.cup.uni-freiburg.de/ppatens_db/pp_annot.php?name=query_id"}
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"Example1 - Plant_gene_expression (RPKM).txt":
"Example1 - Plant_gene_expression_RPKM.txt":
{"link":"",
"annotation_file":"example/gene_annotations.txt",
"description":"example1_description.php",
Expand All @@ -17,7 +17,7 @@
"Cold":"cold.jpeg"
}
},
"Example2 - Organism dataset name (Units).txt":
"Example2 - Organism dataset name.txt":
{"link":"#",
"description":"example2_description.php"
},
Expand Down
17 changes: 17 additions & 0 deletions templates/egdb_files/json_files/tools/vcf.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"gene_names_file":"gene_names.txt",
"gff_file":"gene_models.gff.gz",
"jb_data_folder":"easy_gdb_sample",
"passport_folder":"passport_folder",
"chr_files":
{
"chr1":"chr1.ann.vcf.gz",
"chr2":"chr2.ann.vcf.gz",
"chr3":"chr3.ann.vcf.gz",
"chr4":"chr4.ann.vcf.gz",
"chr5":"chr5.ann.vcf.gz",
"chr6":"chr6.ann.vcf.gz",
"chr7":"chr7.ann.vcf.gz",
"chr8":"chr8.ann.vcf.gz"
}
}
4 changes: 2 additions & 2 deletions tools/annot_output_db.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
// load annotation links in hash
$annot_hash;

if ( file_exists("$annotation_links_path/annotation_links.json") ) {
$annot_json_file = file_get_contents("$annotation_links_path/annotation_links.json");
if ( file_exists("$json_files_path/tools/annotation_links.json") ) {
$annot_json_file = file_get_contents("$json_files_path/tools/annotation_links.json");
$annot_hash = json_decode($annot_json_file, true);
}

Expand Down
4 changes: 2 additions & 2 deletions tools/annot_output_file.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@ function print_annot_table($desc_input, $annot_file, $annot_hash, $dataset_name,
}

// create HASH with ANNOTATION links
if (file_exists("$annotation_links_path/annotation_links.json")) {
$annot_json_file = file_get_contents("$annotation_links_path/annotation_links.json");
if (file_exists("$json_files_path/tools/annotation_links.json")) {
$annot_json_file = file_get_contents("$json_files_path/tools/annotation_links.json");
$annotation_hash = json_decode($annot_json_file, true);
}

Expand Down
Loading

0 comments on commit bf4868d

Please sign in to comment.