Commit 3c4d99a7 authored by VERNETTE Caroline's avatar VERNETTE Caroline
Browse files

nbproject

parents 347ece81 86ddd0b0
......@@ -159,7 +159,8 @@ class OBA_AnalyzeManager extends Command
fclose($file);
$fileout = Controller::tempFilePath($uniqid,"seq_extract",".fa", __METHOD__,0);
//$cmd = config('wimg.binary_paths.cutadapt')."cutadapt -g \"".config('wimg.dbs.barcode.'.$db.'.primer-forward')."...".config('wimg.dbs.barcode.'.$db.'.primer-reverse').";max_error_rate=0.15\" ".$fileSeq ." --discard-untrimmed -o ".$fileout;
$cmd = (["config('wimg.binary_paths.cutadapt')cutadapt","-g","\\","config('wimg.dbs.barcode.'.$db.'.primer-forward')","...","config('wimg.dbs.barcode.'.$db.'.primer-reverse');max_error_rate=0.15\\","$fileSeq","--discard-untrimmed","-o","$fileout"]);
//$cmd = (["config('wimg.binary_paths.cutadapt')cutadapt","-g","\\","config('wimg.dbs.barcode.'.$db.'.primer-forward')","...","config('wimg.dbs.barcode.'.$db.'.primer-reverse');max_error_rate=0.15\\","$fileSeq","--discard-untrimmed","-o","$fileout"]);
$cmd = ([config('wimg.binary_paths.cutadapt')."cutadapt","-g",config('wimg.dbs.barcode.'.$db.'.primer-forward')."...".config('wimg.dbs.barcode.'.$db.'.primer-reverse').";max_error_rate=0.15","$fileSeq","--discard-untrimmed","-o","$fileout"]);
//$cmd = (["config('wimg.binary_paths.cutadapt').cutadapt","-g","\\","config('wimg.dbs.barcode.$db.primer-forward')","...","config('wimg.dbs.barcode.$db.primer-reverse');max_error_rate=0.15\","$fileSeq","--discard-untrimmed","-o","$fileout"])";
try{
$cutadapt = new Process($cmd);
......@@ -167,13 +168,15 @@ class OBA_AnalyzeManager extends Command
if (!$cutadapt->isSuccessful()){
throw new ProcessFailedException($cutadapt);
}
}catch(Exception $ex){
}catch(Exception $ex){
$this->write_html($uniqid, $jobid, $start_time, view('OBA.error', array('error' => "Sorry, there is a problem with cutadapt", 'url' => $this->url)), 1);
log::debug("pb cutadapt OBA_AnaM getSeq_extract ($uniqid)");
}
if(filesize($fileout)==0){
//$cmd = config('wimg.binary_paths.cutadapt')."cutadapt -g \"".config('wimg.dbs.barcode.'.$db.'.primer-forward').";max_error_rate=0.15\" ".$fileSeq ." --discard-untrimmed -o ".$fileout;
$cmd = (["config('wimg.binary_paths.cutadapt')cutadapt","-g","\\","config('wimg.dbs.barcode.'.$db.'.primer-forward');max_error_rate=0.15\\","$fileSeq","--discard-untrimmed","-o","$fileout"]);
//$cmd = (["config('wimg.binary_paths.cutadapt')cutadapt","-g","\\","config('wimg.dbs.barcode.'.$db.'.primer-forward');max_error_rate=0.15\\","$fileSeq","--discard-untrimmed","-o","$fileout"]);
$cmd = ([config('wimg.binary_paths.cutadapt')."cutadapt","-g",config('wimg.dbs.barcode.'.$db.'.primer-forward').";max_error_rate=0.15",$fileSeq,"--discard-untrimmed","-o",$fileout]);
try{
$cutadapt = new Process($cmd);
$cutadapt->run();
......@@ -426,10 +429,10 @@ class OBA_AnalyzeManager extends Command
$i++;
if($i > $nb_result_intermede){break;}
$prod[$id]= "";
log::debug("oba_anaM 429");
log::debug($id);
log::debug($otus);
log::debug($refr);
#log::debug("oba_anaM 429");
#log::debug($id);
#log::debug($otus);
#log::debug($refr);
if($otus[$id]['ref']!=$refr && !empty($otus[$id]['taxon'])){
$refr = $otus[$id]['ref'];
$ref_rcc = explode(".",$otus[$id]['ref']);
......@@ -1030,8 +1033,8 @@ class OBA_AnalyzeManager extends Command
//$alignment_res = new Process([config('wimg.binary_paths.vsearch').'vsearch','--usearch_global',$seq_file_path,'--db',$db_path,'--id',$threshold,config('wimg.more_options.vsearch'),'--blast6out',$aln_outfile]);
//$builder = new ProcessBuilder();
try{
log::debug("OBA_anaM 1033");
log::debug([config('wimg.binary_paths.vsearch').'vsearch','-usearch_global',$seq_file_path,'-db',$db_path,'-id',$threshold,'-blast6out',$aln_outfile,'-maxaccepts','10000']);
//log::debug("OBA_anaM 1033");
//log::debug([config('wimg.binary_paths.vsearch').'vsearch','-usearch_global',$seq_file_path,'-db',$db_path,'-id',$threshold,'-blast6out',$aln_outfile,'-maxaccepts','10000']);
$alignment_res = new Process([config('wimg.binary_paths.vsearch').'vsearch','-usearch_global',$seq_file_path,'-db',$db_path,'-id',$threshold,'-blast6out',$aln_outfile,'-maxaccepts','10000']);
//$alignment_res = new Process([config('wimg.binary_paths.vsearch').'vsearch','-usearch_global',$seq_file_path,'-db',$db_path,'-id',$threshold,'-blast6out',$aln_outfile,config('wimg.more_options.vsearch')]);
//$alignment_res->setOptions([config('wimg.more_options.vsearch')]);
......@@ -1261,8 +1264,8 @@ class OBA_AnalyzeManager extends Command
}
protected function selectOTU($seqref_list, $db){
log::debug("OBA_anaM 1262");
log::debug($seqref_list);
//log::debug("OBA_anaM 1262");
//log::debug($seqref_list);
$conn = DB::connection($db);
$OTUs = array();
......@@ -1317,6 +1320,30 @@ class OBA_AnalyzeManager extends Command
** $equivalence Contains name and unit for each environmental data.
*/
protected function selectEnvironmentData_ondatabase($res_samples,$db){
$conn = DB::connection($db);
$res_selects = $conn->table('sample_metadata')
->join('metadata_definitions', 'metadata_definitions.metadata_id', '=', 'sample_metadata.metadata_id')
->select('*')
#->where('metadata_definitions.type','=','numeric')
->whereIn('sample_metadata.sample_id', $res_samples)
#->whereHas('sample_metadata.sample_id', $res_samples)
#->whereRaw('sample_id',$res_samples)
->get();
#Log::info("sampledata=".print_r($res_selects,true));
$res_selects = json_decode($res_selects, True);
$res_selects2 = $conn->table('sample')
->select('sample_id','sample_original_id','sample_label','station_label','env_feature_tag','lower_fraction','upper_fraction','latitude','longitude')
->whereIn('sample_id', $res_samples)
#->whereHas('sample_id', $res_samples)
#->whereRaw('sample_id',$res_samples)
->get();
$res_selects2 = json_decode($res_selects2, True);
return array($res_selects,$res_selects2);
}
protected function selectEnvironmentData($res_genes_abundance,$db)
{
$res_samples = array();
......@@ -1329,7 +1356,24 @@ class OBA_AnalyzeManager extends Command
$unique_samples = array();
$id_stations = array();
$conn = DB::connection($db);
log::debug("OBA_AnaM 1359");
log::debug(count($res_samples));
if(count($res_samples)<1000){
$res = $this->selectEnvironmentData_ondatabase($res_samples,$db);
$res_selects = $res[0];
$res_selects2 = $res[1];
}else{
$res_selects = array();
$res_selects2 = array();
for($i=0;$i<=count($res_samples);$i+=1000){
$sub_res_samples = array_slice($res_samples,$i,1000);
$res = $this->selectEnvironmentData_ondatabase($sub_res_samples,$db);
$res_selects = array_merge($res_selects,$res[0]);
$res_selects2 = array_merge($res_selects2,$res[1]);
}
}
/*
$res_selects = $conn->table('sample_metadata')
->join('metadata_definitions', 'metadata_definitions.metadata_id', '=', 'sample_metadata.metadata_id')
->select('*')
......@@ -1344,7 +1388,8 @@ class OBA_AnalyzeManager extends Command
->whereIn('sample_id', $res_samples)
->get();
$res_selects2 = json_decode($res_selects2, True);
*/
$res_equivalence_tag_name = $conn->table('metadata_definitions')
#->where('metadata_definitions.type','=','numeric')
->select('*')
......
......@@ -152,7 +152,7 @@ class OBA_TaxonManager extends \Illuminate\Console\Command{
$sampleData = $sample[1];
$matrixR_OTU = $sample[2];
$matrixR_OTU_rar = $sample[3];
$res_select_genes_unique = $this->selectEnvironmentData($res_sample, $db);
$unique_sample = $res_select_genes_unique[0];
......@@ -308,6 +308,7 @@ class OBA_TaxonManager extends \Illuminate\Console\Command{
->join('gene', 'gene_abundance.gene_id', '=', 'gene.gene_id')
->select('gene_abundance.abundance','gene.gene_id','gene.gene_label','gene.tax_classification','gene_abundance.abundance_rarified')
->whereIn('gene.gene_label', $subarray_uniq_match_ID)
#->whereRaw('gene_label',$subarray_uniq_match_ID)
->get();
$genes_abundance = array_merge($genes_abundance,json_decode($genes_abundance_part, True));
}
......@@ -545,6 +546,7 @@ class OBA_TaxonManager extends \Illuminate\Console\Command{
// $richness_station_raw = file_get_contents(config('wimg.db_path.'.$db.'.richness_file'));
// $richness_station = json_decode($richness_station_raw, True);
//}
//log::debug("oba_tAXONm 549");
//log::debug($res_genes_abundance);
//$gene_id = array();
foreach ($res_genes_abundance as $gene){
......@@ -584,9 +586,10 @@ class OBA_TaxonManager extends \Illuminate\Console\Command{
}
$res_samples = array_unique($res_samples);
$res_samples = array_values($res_samples);
//log::debug($tot);
//log::debug($tot_ori);
//log::debug("coucou");
//log::debug("OBA_TaxonM 587");
//log::debug($res_samples);
//log::debug(count($gene_id));
//$gene_id_uniq = array_unique($gene_id);
//log::debug(count($gene_id_uniq));
......@@ -709,11 +712,30 @@ class OBA_TaxonManager extends \Illuminate\Console\Command{
}
//{"sample_label":gene.sample_id, "abundance":gene.abundance,"color":color_SF[sample.SF],"abs_richness":1,"relative_richness":1,"shannon_indice":1};
//log::debug($sampleData[1]);
return array($res_samples,$sampleData,$path_matrix_file,$path_matrix_rar_file);
}
protected function selectEnvironmentData_ondatabase($res_samples,$db){
$conn = DB::connection($db);
$res_selects = $conn->table('sample_metadata')
->join('metadata_definitions', 'metadata_definitions.metadata_id', '=', 'sample_metadata.metadata_id')
->select('*')
#->where('metadata_definitions.type','=','numeric')
->whereIn('sample_metadata.sample_id', $res_samples)
#->whereHas('sample_metadata.sample_id', $res_samples)
#->whereRaw('sample_id',$res_samples)
->get();
#Log::info("sampledata=".print_r($res_selects,true));
$res_selects = json_decode($res_selects, True);
$res_selects2 = $conn->table('sample')
->select('sample_id','sample_original_id','sample_label','station_label','env_feature_tag','lower_fraction','upper_fraction','latitude','longitude')
->whereIn('sample_id', $res_samples)
#->whereHas('sample_id', $res_samples)
#->whereRaw('sample_id',$res_samples)
->get();
$res_selects2 = json_decode($res_selects2, True);
return array($res_selects,$res_selects2);
}
/**
* Select all environmental data for each sample.
......@@ -730,28 +752,25 @@ class OBA_TaxonManager extends \Illuminate\Console\Command{
$unique_samples = array();
$id_stations = array();
$conn = DB::connection($db);
$res_selects = $conn->table('sample_metadata')
->join('metadata_definitions', 'metadata_definitions.metadata_id', '=', 'sample_metadata.metadata_id')
->select('*')
#->where('metadata_definitions.type','=','numeric')
->whereIn('sample_metadata.sample_id', $res_samples)
->get();
#Log::info("sampledata=".print_r($res_selects,true));
$res_selects = json_decode($res_selects, True);
$res_selects2 = $conn->table('sample')
->select('sample_id','sample_original_id','sample_label','station_label','env_feature_tag','lower_fraction','upper_fraction','latitude','longitude')
->whereIn('sample_id', $res_samples)
->get();
$res_selects2 = json_decode($res_selects2, True);
if(count($res_samples)<1000){
$res = $this->selectEnvironmentData_ondatabase($res_samples,$db);
$res_selects = $res[0];
$res_selects2 = $res[1];
}else{
$res_selects = array();
$res_selects2 = array();
for($i=0;$i<=count($res_samples);$i+=1000){
$sub_res_samples = array_slice($res_samples,$i,1000);
$res = $this->selectEnvironmentData_ondatabase($sub_res_samples,$db);
$res_selects = array_merge($res_selects,$res[0]);
$res_selects2 = array_merge($res_selects2,$res[1]);
}
}
$res_equivalence_tag_name = $conn->table('metadata_definitions')
#->where('metadata_definitions.type','=','numeric')
->select('*')
->get();
$res_equivalence_tag_name = json_decode($res_equivalence_tag_name, True);
foreach ($res_selects2 as $res_select)
{
if (!in_array($res_select['station_label'],$id_stations)){$id_stations [] = $res_select['station_label'];}
......
......@@ -111,7 +111,7 @@ class Controller extends BaseController
elseif( $valeur == 'validate_integer') {$regex = '/^\d+$/';}
elseif( $valeur == 'validate_float') {$regex = '/^\d+(\.\d+|)$/';}
elseif( $valeur == 'validate_email') {$regex = '/^([0-9a-z\-\._]+\@[0-9a-z\-\._]+|)$/i';}
elseif( $valeur == 'validate_taxonomy') {$regex = '/^[0-9a-z\-\._ \:\n\t\r\+\(\)]*$/i';}
elseif( $valeur == 'validate_taxonomy') {$regex = '/^[0-9a-z\-\._ \:\n\t\r\+\(\)=]*$/i';}
elseif( preg_match('/^validate_regex_(.+)$/',$valeur,$match) )
{$regex = '/^'.$match[1].'$/';}
//else{$regex = '/./'; $valeur = 'validate_unspecified';}
......
......@@ -429,11 +429,12 @@ class MapController extends Controller
//$mapProcess = new Process($cmd);
//$mapProcess = new Process("nohup php ../artisan analyze:oba_taxon $this->uniqid > $mapErr 2>&1 &");
$mapProcess = new Process(["nohup","php","../artisan","analyze:oba_taxon","$this->uniqid"]);
$mapProcess ->setTimeout(null);
}else{
//$mapProcess = new Process("nohup php ../artisan analyze:oba $this->uniqid > $mapErr 2>&1 &");
$mapProcess = new Process(["nohup","php","../artisan","analyze:oba","$this->uniqid"]);
$mapProcess ->setTimeout(null);
}
$mapProcess->run();
if (!$mapProcess->isSuccessful())
......@@ -472,6 +473,7 @@ class MapController extends Controller
$EF = $request->input('EF_krona');#SRF
$uniqid = $request->input('uniqid');
$genes = $request->input('select_genes_krona');
log::debug($genes);
if ($check_option = Controller::check_options(array(
$uniqid => 'validate_alphanumstrict',
$EF => 'validate_alphanum',
......
......@@ -439,7 +439,7 @@ function update(first_time,id_map, map, param_size_bullet, sampleData, station_E
"longitude": dataItem.longitude+0.5,
"latitude": dataItem.latitude,
//"title": dataItem.station_label+"<br>Abundance: "+abun+"<br>Richness: "+dataItem.richness+"<br>Absolute richness: "+dataItem.abs_richness.toExponential(2)+"<br>Shannon index: "+parseFloat(dataItem.shannon).toFixed(2),
"title": dataItem.original+"<br>"+dataItem.sample_label+"<br>Abundance: "+abun+"<br>Richness: "+dataItem.richness+"<br>Shannon index: "+parseFloat(dataItem.shannon).toFixed(2),
"title": dataItem.station_label+"<br>"+dataItem.original+"<br>"+dataItem.sample_label+"<br>Abundance: "+abun+"<br>Richness: "+dataItem.richness+"<br>Shannon index: "+parseFloat(dataItem.shannon).toFixed(2),
"abundance": dataItem.abundance,
"description": "-",
"EF":dataItem.EF,
......
......@@ -155,6 +155,7 @@ function query(){
* Complete the form with an example.
*/
function example_OMRGC() {
console.log("hello form 158");
$('#job').val("Job-example-prokaryotes");
document.getElementById("info_job").style.display="none";
document.getElementById("info_seq").style.display="none";
......
......@@ -147,7 +147,6 @@ function occurences_param(sampleData){
}
if(SF_second === ''){SF_second = SF_max;}
if(EF_second === ''){EF_second = EF_max;}
//return {"EF_max" : "SRF", "SF_max": SF_max,"SF_second": SF_second,"EF_second" : "DCM"};
return {"EF_max" : EF_max, "SF_max": SF_max,"SF_second": SF_second,"EF_second" : EF_second};
//return {"EF_max" : "SRF","SF_max": "[0.22-1.6µm]", "SF_second": "[0.22-3µm]","EF_second" : "MES"};
......
......@@ -435,7 +435,6 @@
var unique_SF = myJSONData["unique_SF"];
var unique_EF = myJSONData["unique_EF"];
var equivalence_tag_name = myJSONData["equivalence_tag_name"];
//console.log(equivalence_tag_name);
var station_EF_SF = myJSONData["station_EF_SF"];
var color_SF = myJSONData["color_SFs"];
var sampleDataO = myJSONData["sampleData"];
......@@ -446,9 +445,7 @@
for(key in sampleDataO){
sampleData.push(sampleDataO[key]);
}
//console.log(sampleData);
var param_size = param_size_bullet(sampleData);
//console.log(param_size);
var default_SF_EF = occurences_param(sampleData);
var num_equivalence_tag_name=new Object();
var i=0;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment