public function test_index_all_files() { $this->indexer->force_indexation(); $this->indexer->index_all_files(); $index_pathname = $this->indexer->get_main_index_pathname(); $contents_of_index = read_file_into_array($index_pathname); $expected_contents_of_index = array("qugjuq/1n:153:oneRoot.csv\n", "aluk/1nn:312:oneSuffix.csv\n"); $this->assertEquals($expected_contents_of_index, $contents_of_index, "The main index is not correct."); $this->assertEquals(2, $this->indexer->get_nb_indexed_entries(), "The total number of indexed morphemes should have been 2."); $this->assertEquals(2, $this->indexer->get_nb_indexed_files(), "The total number of indexed files should have been 2."); }
// Read the content of base ontology for encoding/decoding Medicine Safety Codes (MSC server). $rule_owl = "\n\n"; $textual_rule = "\nClass: rule\n\tAnnotations:\n\t\trdfs:label \"CDS rule\",\n\t\trdfs:comment \"A rule is a logical description of a drug recommendation based on human genotype.\"\n\nClass: phenotype_rule\n\tAnnotations:\n\t\trdfs:label \"Phenotype rule\",\n\t\trdfs:comment \"A phenotype rule is a logical description of a patient phenotype based on its genotype.\"\n\n"; $report = "-- Report -- \n\n"; // Start with the content of the script report and error log. $valid_polymorphism_variants = array(); // List of valid polymorphism variants from dbSNP (used to find errors and orientation mismatches). $snps_covered_by_23andMe_v2 = read_file_into_array($snpCoveredBy23andMe_v2_file_location); // Read the content of SNPs in 23andMe v2 format. $snps_covered_by_23andMe_v3 = read_file_into_array($snpCoveredBy23andMe_v3_file_location); // Read the content of SNPs in 23andMe v3 format. $snps_covered_by_Affimetrix_DMET_chip = read_file_into_array($snpCoveredByAffimetrix_file_location); // Read the content of SNPs in Affimetrix format. $snps_covered_by_University_of_Florida_and_Standford_chip = read_file_into_array($snpCoveredByUniOfFloridaAndStandford_file_location); // Read the content of the University of Florida and Standford format. $snps_not_in_dbSNP = read_file_into_array($snps_not_in_dbSNP_file_location); //Read the file that contains the SNPs to skip during the processing of dbSNP file. /*************************** ******* Functions ******* ***************************/ //This function indicates if a SNP is part of the genotype of a patient in the ontology. This is needed because a patient's genotype is not only described using haplotypes, such as BRCA1*1, but also with SNPs, such as rs2297595. function rankSNPInGenotype($rsid) { $rank_snps = array("rs9923231", "rs4149056", "rs9934438", "rs6025", "rs12979860", "rs67376798", "rs2297595"); foreach ($rank_snps as $element) { if ($element == $rsid) { return true; } } return false; }
**************************************************/ $owl = file_get_contents($pharmacogenomic_CDS_base_file_location) . "\n\n\n"; // Read the content of base ontology. $msc_owl = file_get_contents($MSC_classes_base_file_location) . "\n\n\n"; // Read the content of base ontology for encoding/decoding Medicine Safety Codes (MSC server). $report = "-- Report -- \n\n"; // Start with the content of the script report and error log. $valid_polymorphism_variants = array(); // List of valid polymorphism variants from dbSNP (used to find errors and orientation mismatches). $snps_covered_by_23andMe_v2 = read_file_into_array($snpCoveredBy23andMe_v2_file_location); // Read the content of SNPs in 23andMe v2 format. $snps_covered_by_23andMe_v3 = read_file_into_array($snpCoveredBy23andMe_v3_file_location); // Read the content of SNPs in 23andMe v3 format. $snps_covered_by_Affimetrix_DMET_chip = read_file_into_array($snpCoveredByAffimetrix_file_location); // Read the content of SNPs in Affimetrix format. $snps_covered_by_University_of_Florida_and_Standford_chip = read_file_into_array($snpCoveredByUniOfFloridaAndStandford_file_location); // Read the content of the University of Florida and Standford format. /*************************** ******* Functions ******* ***************************/ // Read file and transform it into an array of lines. function read_file_into_array($file) { $search = array("\r\n", "\n"); $snp_array = []; $handle = fopen($file, 'r'); if ($handle) { while (!feof($handle)) { $line = fgets($handle); $line = str_replace($search, $replace = '', $line); $snp_array[] = $line;
$pharmacogenomic_CDS_demo_file_location = "..\\ontology\\genomic-cds-demo.owl"; /* * Initializing important variables */ $owl = file_get_contents($pharmacogenomic_CDS_base_file_location) . "\n\n\n"; // Content of main ontology (pharmacogenomic_CDS.owl) will be appended to this variable $msc_owl = file_get_contents($MSC_classes_base_file_location) . "\n\n\n"; // Content of additional classes for encoding/decoding Medicine Safety Codes (MSC_classes.owl) will be appended to this variable $report = "-- Report -- \n\n"; // Content of Report and error log (generate_genomic_CDS.report.txt) will be appended to this variable $valid_polymorphism_variants = array(); // List of valid polymorphism variants from dbSNP (used to find errors and orientation mismatches) $snps_covered_by_23andMe_v2 = read_file_into_array("..\\data\\assay-information\\SNPs covered by 23andMe v2.txt"); $snps_covered_by_23andMe_v3 = read_file_into_array("..\\data\\assay-information\\SNPs covered by 23andMe v3.txt"); $snps_covered_by_Affimetrix_DMET_chip = read_file_into_array("..\\data\\assay-information\\SNPs covered by Affymetrix DMET chip - PMID 20217574.txt"); $snps_covered_by_University_of_Florida_and_Standford_chip = read_file_into_array("..\\data\\assay-information\\SNPs covered by University of Florida and Stanford University chip - PMID 22910441.txt"); /* * Functions */ function read_file_into_array($file) { $search = array("\r\n", "\n"); $snp_array = []; $handle = fopen($file, 'r'); if ($handle) { while (!feof($handle)) { $line = fgets($handle); $line = str_replace($search, $replace = '', $line); $snp_array[] = $line; } fclose($handle);