#!/usr/local/bin/perl ############################################################################### # Set up all needed modules and objects ############################################################################### use strict; use Getopt::Long; use FindBin; use lib qw (../../lib/perl); use vars qw ($sbeams $sbeamsMOD $q $current_contact_id $current_username $PROG_NAME $USAGE %OPTIONS $QUIET $VERBOSE $DEBUG $DATABASE $TABLE_NAME $PROGRAM_FILE_NAME $CATEGORY $DB_TABLE_NAME @MENU_OPTIONS); use DBI; use CGI::Carp qw(fatalsToBrowser croak); use POSIX; use SBEAMS::Connection qw($q); use SBEAMS::Connection::Settings; use SBEAMS::Connection::Tables; use SBEAMS::Microarray; use SBEAMS::Microarray::Settings; use SBEAMS::Microarray::Tables; $sbeams = new SBEAMS::Connection; $sbeamsMOD = new SBEAMS::Microarray; $sbeamsMOD->setSBEAMS($sbeams); $sbeams->setSBEAMS_SUBDIR($SBEAMS_SUBDIR); #use CGI; #$q = new CGI; ############################################################################### # Set program name and usage banner for command like use ############################################################################### $PROG_NAME = $FindBin::Script; $USAGE = <Authenticate() and exit if it fails or continue if it works. ############################################################################### sub main { #### Do the SBEAMS authentication and exit if a username is not returned exit unless ($current_username = $sbeams->Authenticate( #connect_read_only=>1, #allow_anonymous_access=>1, #permitted_work_groups_ref=>['Proteomics_user','Proteomics_admin'], )); #### Read in the default input parameters my %parameters; my $n_params_found = $sbeams->parse_input_parameters( q=>$q,parameters_ref=>\%parameters); #$sbeams->printDebuggingInfo($q); #### Process generic "state" parameters before we start $sbeams->processStandardParameters( parameters_ref=>\%parameters); #### Decide what action to take based on information so far if ($parameters{action} eq "???") { # Some action }else { $sbeamsMOD->printPageHeader(); if ($parameters{'UPDATEMIAME'}) { updateMIAMEInfo(parameters_ref=>\%parameters); } print_javascript(); handle_request(ref_parameters=>\%parameters); $sbeamsMOD->printPageFooter(); } } # end main ############################################################################### # print_javascript ############################################################################## sub print_javascript { print qq~ ~; return 1; } ############################################################################### # Handle Request ############################################################################### sub handle_request { my %args = @_; #### Process the arguments list my $ref_parameters = $args{'ref_parameters'} || die "ref_parameters not passed"; my %parameters = %{$ref_parameters}; #### Define some generic varibles my ($i,$element,$key,$value,$line,$result,$sql); my @rows; #### Define variables for Summary Section my $project_id = $sbeams->getCurrent_project_id();; my $category = $parameters{tab}; my $project_name = 'NONE'; my (%array_requests, %array_scans, %quantitation_files); #### Show current user context information #$sbeams->printUserContext(); $sbeams->printUserChooser(); $current_contact_id = $sbeams->getCurrent_contact_id(); $project_name = $sbeams->getCurrent_project_name(); my $page_link = 'ProjectHome.cgi'; #### Print MIAME Status tabs my @miame_tabs = ("Experiment Design","Array Design","Sample Information","Labeling and Hybridization","Measurements"); my $miame_tab_titles_ref = \@miame_tabs; my $miame_page_link = "MIAMEStatus.cgi"; #### Print out some information about this project print qq~
~; #### Summary Section if ($parameters{'tab'} eq "experiment_design"){ $sbeamsMOD->print_tabs(tab_titles_ref=>$miame_tab_titles_ref, page_link=>$miame_page_link, selected_tab=>0); printExperimentDesignSection(parameters=>\%parameters); } elsif($parameters{'tab'} eq "array_design") { $sbeamsMOD->print_tabs(tab_titles_ref=>$miame_tab_titles_ref, page_link=>$miame_page_link, selected_tab=>1); printArrayDesignSection(parameters=>\%parameters); } elsif($parameters{'tab'} eq "sample_information") { $sbeamsMOD->print_tabs(tab_titles_ref=>$miame_tab_titles_ref, page_link=>$miame_page_link, selected_tab=>2); printSampleInformationSection(parameters=>\%parameters); } elsif($parameters{'tab'} eq "labeling_and_hybridization") { $sbeamsMOD->print_tabs(tab_titles_ref=>$miame_tab_titles_ref, page_link=>$miame_page_link, selected_tab=>3); printLabelingAndHybridizationSection(parameters=>\%parameters); } elsif($parameters{'tab'} eq "measurements") { $sbeamsMOD->print_tabs(tab_titles_ref=>$miame_tab_titles_ref, page_link=>$miame_page_link, selected_tab=>4); printMeasurementsSection(parameters=>\%parameters); } else{ $sbeamsMOD->print_tabs(tab_titles_ref=>$miame_tab_titles_ref, page_link=>$miame_page_link, selected_tab=>0); printExperimentDesignSection(parameters=>\%parameters); } print qq~
$LINESEPARATOR
~; return; } # end handle_request ############################################################################### # printExperimentDesignSection # # Mappings (12-23-02): # # Type of Experiment -> comment in project table # Experimental Factors -> comment in project table # Number of Hybridizations -> comment in project table # Reference used for Hyb. -> # Hybridization Design -> # Quality Control Steps -> # URL -> URI in project table # ############################################################################### sub printExperimentDesignSection { my %args = @_; my $SUB_NAME="printExperimentDesignSection"; #### Decode the argument list my $parameters_ref = $args{'parameters'}; my %parameters = %{$parameters_ref}; #### Define standard variables my (@rows,$sql,$mod_date,$uri); my ($additional_information, $module_information); my ($exp_type,$exp_desc,$exp_factors); my ($exp_desc_bool,$exp_type_bool,$exp_factors_bool); my ($num_hyb,$qc_steps,$common_ref,$common_ref_text); my ($num_hyb_bool,$qc_steps_bool,$common_ref_bool); my $project_id = $sbeams->getCurrent_project_id(); #### Experimental Design info is stored in the project table $sql = qq~ SELECT P.additional_information, P.description, P.uri, P.date_modified FROM $TB_PROJECT P WHERE P.project_id=\'$project_id\' AND P.record_status != 'D' ~; @rows = $sbeams->selectSeveralColumns($sql); if (@rows){ ($additional_information, $exp_desc, $uri, $mod_date) = @{$rows[0]}; } ## Extract portion $additional_information =~ /(.*)<\/microarray>/; $module_information = $1; if ($exp_desc){$exp_desc_bool = 'TRUE';} else{$exp_desc_bool = 'FALSE';} if (defined($module_information)) { if ($module_information =~ /(.*)<\/exp_type>/) { $exp_type = $1; $exp_type_bool = 'TRUE'; }else { $exp_type_bool = 'FALSE'; } if ($module_information =~ /(.*)<\/exp_factors>/) { $exp_factors = $1; $exp_factors_bool = 'TRUE'; }else { $exp_factors_bool = 'FALSE'; } if ($module_information =~ /(.*)<\/num_hybs>/) { $num_hyb = $1; $num_hyb_bool = 'TRUE'; }else { $num_hyb_bool = 'FALSE'; } if ($module_information =~ /(.*)<\/qc_steps>/) { $qc_steps = $1; $qc_steps_bool = 'TRUE'; }else { $qc_steps_bool = 'FALSE'; } if ($module_information =~/(.*)<\/common_ref>/) { $common_ref = $1; if ($common_ref eq 'yes'){ $module_information =~/(.*)<\/common_ref_text>/; $common_ref_text = $1; } $common_ref_bool = 'TRUE'; }else { $common_ref_bool = 'FALSE'; } } #### print HTML print qq~ $LINESEPARATOR

Experimental Design - ~; ## Determine MIAME compliance if ($exp_desc_bool eq 'TRUE' && $exp_type_bool eq 'TRUE' && $exp_factors_bool eq 'TRUE' && $num_hyb_bool eq 'TRUE' && $qc_steps_bool eq 'TRUE' && $common_ref_bool eq 'TRUE'){ print qq~MIAME Compliant~; } else{ print qq~NOT MIAME Compliant~; } ## Print "More Info" button my $title = "MIAME Requirements"; my $text = qq~MIAME Requirements for Experiment Design:
  • Type of experiment
    • for example, normal vs. diseased tissue, time course, or gene knock-out
  • Experimental factors
    • parameters or conditions tested such as time, dose, or genetic variation
  • The number of hybridizations performed in the experiment.
  • The type of reference used for the hybridizations, if any.
  • Hybridization design
    • if applicable, a description of the comparisons made in each hybridization
  • Quality control steps taken: for example, replicates or dye swaps.
  • URL of any supplemental websites or database accession numbers
~; print qq~ Help ~; ## Begin printing Experiment Design Section print qq~

last modified on $mod_date

~; my $qcTemplate = qq~ ~; @factors = split ',', $qc_steps; foreach my $factor(@factors) { $qcTemplate =~ s(>$factor<\/TD>)(CHECKED>$factor<\/TD>); if ($factor =~ /^other\((.*)\)/) { my $subst = $1; $qcTemplate =~ s(>Other)(CHECKED>Other); $qcTemplate =~ s(\"otherQCStep1\")(\"otherQCStep1\" VALUE=\"$subst\"); } } print qq~ $qcTemplate
Experiment Description:
Type of Experiment:
Other: ~; my $otherExpTemplate = qq~ ~; if ($exp_type =~/^other\((.*)\)/) { my $subst = $1; $otherExpTemplate =~ s(>)(VALUE=\"$subst\">); } print qq~ $otherExpTemplate
Experimental Factors:
~; #NOTE - this array is duplicated in the updateMIAMEInfo subroutine my @factors = ("age","cell line","cell type", "compound","developmental stage", "disease state", "dose","genetic variation","genotype", "organism part","post-transcriptional gene silencing","protocol", "sex/mating type","species","strain", "temperature","time","tissue type", "other"); my $expFactorsTemplate ="\n"; for (my $i=0;defined($factors[$i]);$i++) { my $val = $i%3; my $factor = $factors[$i]; if ($val == 0) { $expFactorsTemplate .= "\n"; } $expFactorsTemplate .= "\n"; if ($val == 2) { $expFactorsTemplate .= "\n"; } } if ($expFactorsTemplate !~ /<\/TR>$/) { $expFactorsTemplate .= ""; } $expFactorsTemplate .= "
$factor
"; my @factors = split ',',$exp_factors; foreach my $factor(@factors) { $expFactorsTemplate =~ s(>$factor<\/TD>)(CHECKED>$factor<\/TD>); if ($factor =~ /^other\((.*)\)/) { my $subst = $1; $expFactorsTemplate =~ s(>Other)(CHECKED>Other); $expFactorsTemplate =~ s(\"otherExpFact1\")(\"otherExpFact1\" VALUE=\"$subst\"); } } print qq~ $expFactorsTemplate
\# of Hybridizations
Common Reference Used in Hybs? ~; if ($common_ref eq 'yes'){ print qq~ YES ~; }else { print qq~ YES ~; } if ($common_ref eq 'no') { print qq~ NO ~; }else { print qq~ NO ~; } print qq~
If so, describe reference ~; if ($common_ref_text){ print qq~ ~; }else { print qq~ ~; } print qq~
Quality Control Steps:
replicates dye swapping
spike-in controls Other
Supplemental URL
~; my $permission = $sbeams->get_best_permission(); if ($permission <= 10){ print qq~
~; } return; } ############################################################################### # printArrayDesignSection # # Mappings(12-23-02): # # Platform type -> printing_batch protocol # Surface and coating specs -> slide_model comment # Availability of array -> printing_batch protocol # Other general design specs -> printing_batch protocol # Reporter of each feature -> Map file # Reporter type -> Map file # Reporter DB ref -> # Reporter sequence -> Map file (arrayDesign) # Commercial array? # -Manufacturer -> # -Catalog Number -> # -Manufacturer's URL -> # Non-Commercials array? # -source of reporter -> Map file # -method of reporter preparation -> # -spotting protocol -> # -other treatment -> # ############################################################################### sub printArrayDesignSection { my %args = @_; my $SUB_NAME="printArrayDesignSection"; #### Decode the argument list my $parameters_ref = $args{'parameters'}; my %parameters = %{$parameters_ref}; #### Define standard variables my ($sql, @rows); my ($base_url,%url_cols,%hidden_cols); my $miame_compliant = 1; my $project_id = $sbeams->getCurrent_project_id(); #### Get arrays that are used in the project $sql = qq~ SELECT A.array_id,A.array_name,PB.number_of_spots, PR.name AS 'protocol_name', PR.protocol_id, AL.source_filename AS 'key_file', SM.comment FROM $TBMA_ARRAY_REQUEST AR LEFT JOIN $TBMA_ARRAY_REQUEST_SLIDE ARSL ON ( AR.array_request_id = ARSL.array_request_id ) LEFT JOIN $TBMA_ARRAY A ON ( A.array_request_slide_id = ARSL.array_request_slide_id ) LEFT JOIN $TBMA_ARRAY_LAYOUT AL ON ( A.layout_id = AL.layout_id ) LEFT JOIN $TBMA_ARRAY_SCAN ASCAN ON ( A.array_id = ASCAN.array_id ) LEFT JOIN $TBMA_ARRAY_QUANTITATION AQ ON ( ASCAN.array_scan_id = AQ.array_scan_id ) LEFT JOIN $TBMA_PRINTING_BATCH PB ON ( PB.printing_batch_id = A.printing_batch_id) LEFT JOIN $TB_PROTOCOL PR ON (PR.protocol_id = PB.protocol_id) LEFT JOIN $TBMA_SLIDE S ON (S.slide_id = A.slide_id) LEFT JOIN $TBMA_SLIDE_LOT SL ON (SL.slide_lot_id = S.slide_lot_id) LEFT JOIN $TBMA_SLIDE_MODEL SM ON (SM.slide_model_id = SL.slide_model_id) WHERE AR.project_id='$project_id' AND AR.record_status != 'D' AND A.record_status != 'D' AND ASCAN.record_status != 'D' AND AQ.record_status != 'D' AND AQ.data_flag != 'BAD' ORDER BY A.array_name ~; @rows = $sbeams->selectSeveralColumns($sql); ## If we find a 'NULL' in the array, we are not MIAME compliant foreach my $row_ref (@rows) { my @temp_row = @{$row_ref}; foreach my $value (@temp_row) { unless ($value) { $miame_compliant = 0; } } } ## if no records, no miame compliance unless (@rows) { $miame_compliant = 0; } #### print HTML print qq~ $LINESEPARATOR

Array Design - ~; ## Determine MIAME compliance if ($miame_compliant == 1){ print qq~MIAME Compliant~; }else { print qq~NOT MIAME Compliant~; } ## Print "More Info" Button my $title = "MIAME Requirements"; my $text = qq~MIAME Requirements for Array Design:
  • General array design, including:
    • the platform type (whether the array is a spotted glass array, an in situ synthesized array, etc.)
    • surface and coating specifications (when known-- often commercial suppliers do not provide this data)
    • the availability of the array (the name or make of commercially available arrays)
  • For each feature (spot) on the array, its location on the array and the ID of its respective reporter (molecule present on each spot) should be given.
  • For each reporter, its type (e.g., cDNA or oligonucleotide) should be given, along with information that characterizes the reporter molecule unambiguously, in the form of appropriate database reference(s) and sequence (if available).
  • For commercial arrays: a reference to the manufacturer should be provided, including a catalogue number and references to the manufacturers website if available.
  • For non-commercial arrays, the following details should be provided:
    • The source of the reporter molecules: for example, the cDNA or oligo collection used, with references.
    • The method of reporter preparation.
    • The spotting protocols used, including the array substrate, the spotting buffer, and any post-printing processing, including cross-linking.
    • Any additional treatment performed prior to hybridization.
~; print qq~ Help

~; if (@rows){ ## Print of MIAME criteria print qq~ ~; foreach my $row_ref(@rows) { my ($array_id,$array_name,$spot_count,$protocol_name,$protocol_id,$key_file,$comment) = @{$row_ref}; my $map_file = $key_file; $map_file =~ s/key\s*/map/; my $map_location = $map_file; $map_file =~ s(.*/)(); $comment =~ /MIAME surface coating:\s+\"?(.*)\"?/; my $spec = $1; $comment =~ /MIAME physical dimensions:\s+\"?(.*)\"?/; my $dim = $1; print qq~ ~; } print qq~
Array Design Name Platform Type/Availability Surface/Coating Specs Physical Dimensions \# of Features Reporter Information
$array_name $protocol_name $spec $dim $spot_count [Download] [View]

~; }else{ print qq~

No Records for this Project

~; } return; } ############################################################################### # printSampleInformationSection # # Current MIAME satisfaction is ONLY having the organism, until I determine # what else is needed for MIAME. # ############################################################################### sub printSampleInformationSection { my %args = @_; my $SUB_NAME="printSampleInformationSection"; #### Decode the argument list my $parameters_ref = $args{'parameters'}; my %parameters = %{$parameters_ref}; my $project_id = $sbeams->getCurrent_project_id(); #### Define standard variables my ($sql, $html, @rows, $comment, $expType, ); #### print Beginnging HTML print qq~ $LINESEPARATOR

Sample Information - $sql ~; ## Get Sample Information $sql = qq~ SELECT A.array_id,A.array_name, ARSM1.array_request_sample_id,ARSM1.name,ORG1.organism_name, ARSM1.full_name, ARSM2.array_request_sample_id,ARSM2.name,ORG2.organism_name, ARSM2.full_name FROM $TBMA_ARRAY_REQUEST AR LEFT JOIN $TBMA_ARRAY_REQUEST_SLIDE ARSL ON ( AR.array_request_id = ARSL.array_request_id ) LEFT JOIN $TBMA_ARRAY_REQUEST_SAMPLE ARSM1 ON ( ARSL.array_request_slide_id = ARSM1.array_request_slide_id AND ARSM1.sample_index=0) LEFT JOIN $TBMA_ARRAY_REQUEST_SAMPLE ARSM2 ON ( ARSL.array_request_slide_id = ARSM2.array_request_slide_id AND ARSM2.sample_index=1) LEFT JOIN $TBMA_ARRAY A ON ( A.array_request_slide_id = ARSL.array_request_slide_id ) LEFT JOIN $TBMA_SLIDE_TYPE SL ON ( AR.slide_type_id = SL.slide_type_id ) LEFT JOIN $TB_ORGANISM ORG1 ON ( SL.organism_id = ORG1.organism_id ) LEFT JOIN $TB_ORGANISM ORG2 ON ( SL.organism_id = ORG2.organism_id ) WHERE AR.project_id=$project_id AND ARSL.array_request_slide_id IS NOT NULL AND ( AR.record_status != 'D' OR AR.record_status IS NULL ) AND ( A.record_status != 'D' OR A.record_status IS NULL) AND A.array_id IS NOT NULL ORDER BY A.array_name,AR.array_request_id,ARSL.array_request_slide_id ~; @rows = $sbeams->selectSeveralColumns($sql); ## Determine MIAME compliance $html = ""; my $compliant = 1; my $incomplete = "Incomplete
[Update Record]"; foreach my $row_ref(@rows) { my @info_array = @{$row_ref}; foreach my $val (@info_array) { if (!defined ($val)) { $val = $incomplete; } } my ($array_id,$array_name, $smpl_1_id,$smpl_1_name,$smpl_1_org,$smpl_1_full, $smpl_2_id,$smpl_2_name,$smpl_2_org,$smpl_2_full) = @info_array; if ($smpl_1_org eq $incomplete || $smpl_1_full eq $incomplete || $smpl_2_org eq $incomplete || $smpl_2_full eq $incomplete) { $compliant = 0; } $html .= qq~ $array_name $smpl_1_name $smpl_1_full $smpl_1_org $smpl_2_name $smpl_2_full $smpl_2_org ~; } if ($compliant == 1){ print qq~MIAME Compliant~; }else { print qq~NOT MIAME Compliant~; } ## Print "More Info" Button my $title = "MIAME Sample Requirements"; my $text = qq~MIAME Sample Requirements:
  • Organism Name
  • Provider of Sample
  • Developmental Stage
  • Strain
  • Age
  • Gender
  • Disease State
  • Manipulation of Sample
  • Hybridization extract preparation protocol
  • External controls added to bybridization extraction
~; print qq~ Help

~; ## Set up HTML print qq~ $html
Array Sample 1 Name Full Name Organism Sample 2 Name Full Name Organism
~; return; } ############################################################################### # printLabelingAndHybridizationSection ############################################################################### sub printLabelingAndHybridizationSection { my %args = @_; my $SUB_NAME="printLabelingAndHybridizationSection"; #### Decode the argument list my $parameters_ref = $args{'parameters'}; my %parameters = %{$parameters_ref}; #### Define standard variables my ($labeling_hybridization_sql); my (@rows, $comment, $expType); my $miame_compliant = 1; my $project_id = $sbeams->getCurrent_project_id(); #### print HTML print qq~ $LINESEPARATOR

Labeling and Hybridization - ~; ## SQL to extract information $labeling_hybridization_sql = qq~ SELECT A.array_name, A.array_id, LPR.name,LPR.protocol_id,L.labeling_id, HPR.name,HPR.protocol_id,H.hybridization_id, ARSMPL.name,ARSMPL.array_request_sample_id FROM $TBMA_ARRAY_REQUEST AR LEFT JOIN $TBMA_ARRAY_REQUEST_SLIDE ARSL ON (ARSL.array_request_id = AR.array_request_id) LEFT JOIN $TBMA_ARRAY_REQUEST_SAMPLE ARSMPL ON (ARSMPL.array_request_slide_id = ARSL.array_request_slide_id) LEFT JOIN $TBMA_LABELING L ON (L.array_request_sample_id = ARSMPL.array_request_sample_id) LEFT JOIN $TB_PROTOCOL LPR ON (LPR.protocol_id = L.protocol_id) LEFT JOIN $TBMA_ARRAY A ON (A.array_request_slide_id = ARSL.array_request_slide_id) LEFT JOIN $TBMA_HYBRIDIZATION H ON (H.array_id = A.array_id) LEFT JOIN $TB_PROTOCOL HPR ON (HPR.protocol_id = H.protocol_id) WHERE 1=1 AND AR.project_id = '$project_id' AND A.record_status != 'D' AND AR.record_status != 'D' ORDER BY A.array_name ~; @rows = $sbeams->selectSeveralColumns($labeling_hybridization_sql); ## if we have no records, we're not miame compliant unless (@rows) { $miame_compliant = 0; } ## If we find a 'NULL' in the array, we are not MIAME compliant foreach my $row_ref (@rows) { my @temp_row = @{$row_ref}; foreach my $value (@temp_row) { unless ($value) { $miame_compliant = 0; } } } ## Determine MIAME compliance if ($miame_compliant == 1){ print qq~MIAME Compliant~; }else { print qq~NOT MIAME Compliant~; } ##Print "More Info" Button my $title = "MIAME Labeling/Hybridization Requirements"; my $text = qq~Labeling/Hybridization Requirements
  • Labeling protocol(s)
  • The protocol and conditions used during hybridization, blocking and washing
~; print qq~ Help

~; if (@rows){ ## start table print qq~ ~; foreach my $row_ref (@rows) { my ($array_name, $array_id,$lab_prot_name, $lab_prot_id, $lab_id,$hyb_prot_name, $hyb_prot_id,$hyb_id,$arsmpl_name,$arsmpl_id) = @{$row_ref}; print qq~ ~; ## Print Labeling Information if ($lab_prot_name) { print qq~ ~; }else { print qq~ ~; } ## Print Hyb Information if ($hyb_prot_name) { print qq~ ~; }else { print qq~ ~; } ## end row print qq~ ~; } ## end table print qq~
Array Name Array Request Sample Name/ID Labeling Hybridization
$array_name $arsmpl_name ($arsmpl_id)$lab_prot_name
[Protocol] [Record]
No Labeling Record
[Insert Record]
$hyb_prot_name
[Protocol] [Record]
No Hybridization Record
[Insert Record]

~; }else { print qq~

No Records for this Project

~; } return; } ############################################################################### # printMeasurementsSection # # scan protocol -> protocol (protocol_type.name = 'array_scanning' # image analysis -> protocl (protocol_type.name = 'image_analysis' # image analysis output -> array_quantitation page # data processing protocol -> Data Processing Webpage ############################################################################### sub printMeasurementsSection { my %args = @_; my $SUB_NAME="printMeasurementsSection"; #### Decode the argument list my $parameters_ref = $args{'parameters'}; my %parameters = %{$parameters_ref}; #### Define standard variables my ($sql, @rows, $comment, $expType); my $miame_compliant = 1; my $project_id = $sbeams->getCurrent_project_id(); #### print HTML print qq~ $LINESEPARATOR

Measurements - ~; $sql = qq~ SELECT A.array_name,A.array_id,ASPR.name, ASPR.protocol_id,ASCAN.array_scan_id,AQPR.name, AQPR.protocol_id,AQUANT.array_quantitation_id,AQUANT.stage_location FROM $TBMA_ARRAY A LEFT JOIN $TB_PROJECT PR ON (PR.project_id = A.project_id) LEFT JOIN $TBMA_ARRAY_SCAN ASCAN ON (ASCAN.array_id = A.array_id) LEFT JOIN $TB_PROTOCOL ASPR ON (ASPR.protocol_id = ASCAN.protocol_id) LEFT JOIN $TBMA_ARRAY_QUANTITATION AQUANT ON (AQUANT.arraY_scan_id = ASCAN.array_scan_id) LEFT JOIN $TB_PROTOCOL AQPR ON (AQPR.protocol_id = AQUANT.protocol_id) WHERE 1=1 AND PR.project_id = '$project_id' AND A.record_status != 'D' AND ASCAN.record_status != 'D' AND AQUANT.record_status != 'D' ~; @rows = $sbeams->selectSeveralColumns($sql); ## if there are no records, no miame compliance unless (@rows){ $miame_compliant = 0; } ## go through records to make sure something exists foreach my $row_ref (@rows){ my @temp = @{$row_ref}; foreach my $value (@temp){ unless ($value) {$miame_compliant = 0;} } } ## Determine MIAME compliance if ($miame_compliant == 1){ print qq~MIAME Compliant~; }else { print qq~NOT MIAME Compliant~; } ## Print "More Info" Button my $title = "MIAME Measurements/Quantitation Requirements"; my $text = qq~Measurement Data Requirements
  • The quantitations based on the images
  • The set of quantitations from several arrays upon which the authors base their conclusions. While access to images of raw data is not required (although its value is unquestionable), authors should make every effort to provide the following:
    • Type of scanning hardware and software used: this information is appropriate for a materials and methods section
    • Type of image analysis software used: specifications should be stated in the materials and methods
    • A description of the measurements produced by the image-analysis software and a description of which measurements were used in the analysis
    • The complete output of the image analysis before data selection and transformation (spot quantitation matrices)
    • Data selection and transformation procedures
    • Final gene expression data table(s) used by the authors to make their conclusions after data selection and transformation (gene expression data matrices)
~; print qq~ Help

~; if (@rows) { ## start table print qq~ ~; foreach my $row_ref (@rows) { my ($array_name,$array_id,$scan_protocol_name,$scan_protocol_id,$array_scan_id,$quant_protocol_name,$quant_protocol_id,$array_quant_id,$array_quant_location) = @{$row_ref}; print qq~ ~; ## Array Scan Protocol if ($array_scan_id){ print qq~ ~; }else { print qq~ ~; } ## Image Analysis Protocol if ($array_quant_id){ print qq~ ~; }else { print qq~ ~; } print qq~ ~; } ## end table print qq~
Array Name Array Scan Protocol/Record Image Analysis Protocol/Record Data Processing Protocol
$array_name $scan_protocol_name
[View Protocol] [View Record]
No Record
[Insert Record]
$quant_protocol_name
[View Protocol] [View Record]
[Insert Record] Pipeline Documentation

~; }else { print qq~

No Records for this project

~; } return; } ############################################################################### # updateMIAMEInfo ############################################################################### sub updateMIAMEInfo { my %args = @_; #### Process the arguments list my $parameters_ref = $args{'parameters_ref'} || die "parameters_ref not passed"; my %parameters = %{$parameters_ref}; #### Defined standard variables my (@rows, $sql, $category); my ($comment, %rowdata, $rowdata_ref); my $additional_information = ""; $category = $parameters{'tab'}; my $project_id = $sbeams->getCurrent_project_id(); ####################### ## Experiment Design ## ####################### if ($category=~ /experiment_design/ || $category eq "all") { ## Experiment Description if($parameters{'expDesc'} =~ /\w/) { $rowdata{'description'} = $parameters{'expDesc'}; } ## Experiment Type my $exp_type = $parameters{'expTypeChooser'}; if ($exp_type !~ /^nothing$/){ if ($exp_type =~ /^other$/){ my $other = $parameters{'otherExpType'}; $additional_information .= "other\($other\)<\/exp_type>"; }else { $additional_information .= "$exp_type<\/exp_type>"; } } ## Experimental Factors my $exp_factors; my @factors = ('age','cell line','cell type', 'compound','developmental stage', 'disease state', 'dose','genetic variation','genotype', 'organism part','post-transcriptional gene silencing','protocol', 'sex/mating type','species','strain', 'temperature','time','tissue type', 'other'); foreach my $factor (@factors){ if ($parameters{$factor} eq 'on') { if ($factor eq 'other') { $exp_factors .= "$factor($parameters{'otherExpFact1'}),"; }else { $exp_factors .= "$factor,"; } } } #Get rid of the last comma since there is no following term if ($exp_factors){ chop($exp_factors); } if ($exp_factors) { $additional_information .= "".$exp_factors."<\/exp_factors>"; } ## # of Hybridizations if ($parameters{'numHyb'}) { $additional_information .= "".$parameters{'numHyb'}."<\/num_hybs>"; } ## Is a common reference used? if ($parameters{'commonRef'}){ $additional_information .="".$parameters{'commonRef'}."<\/common_ref>"; } ##Description of common ref if ($parameters{'commonRefText'} && $parameters{'commonRef'} eq 'yes') { $additional_information .="".$parameters{'commonRefText'}."<\/common_ref_text>"; } ## Quality Control Steps my $qc_steps; if ($parameters{'reps'} eq 'on') { $qc_steps .= "replicates,"; } if ($parameters{'dyeSwap'} eq 'on') { $qc_steps .= "dye swapping,"; } if ($parameters{'spikeIns'} eq 'on') { $qc_steps .="spike-in controls,"; } if ($parameters{'qc_other1'} eq 'on') { $qc_steps .= "other($parameters{'otherQCStep1'}),"; } if ($qc_steps){ chop($qc_steps); } if ($qc_steps) { $additional_information .= "".$qc_steps."<\/qc_steps>"; } ## Finish with everything that goes in the 'additional_information' field $rowdata{'additional_information'} = update_module(module=>'microarray', content=>$additional_information); ## Project URI if ($parameters{'url'}) { $rowdata{'uri'} = $parameters{'url'}; }else { $rowdata{'uri'} = ""; } $rowdata_ref= \%rowdata; $sbeams->updateOrInsertRow(table_name=>'project', rowdata_ref=>$rowdata_ref, update=>1, PK_name=>'project_id', PK_value=>$project_id, add_audit_parameters=>1 ); ## Clear out hash foreach my $key(keys %rowdata) { delete($rowdata{$key}); } } return; } ############################################################################### # update_module- returns 'additional_information' data ############################################################################### sub update_module { my %args = @_; my $SUB_NAME = "update_module"; ## Process the arguments list my $module = $args{'module'} || die "ERROR[$SUB_NAME]: module not passed"; my $content = $args{'content'}; ## Define standard variables my ($sql, @rows); my (%rowdata, $rowdata_ref); my $current_project_id = $sbeams->getCurrent_project_id; my ($additional_information, $module_information); ## Get 'additional information' column $sql = qq~ SELECT additional_information FROM project WHERE project_id = $current_project_id AND record_status != 'D' ~; @rows = $sbeams->selectOneColumn($sql); ## get '$module' section, then add/switch the content. if (@rows){ $additional_information = $rows[0]; if ($additional_information =~ /<$module>.*<\/$module>/) { $additional_information =~ s(<$module>.*<\/$module>)(<$module>$content<\/$module>); }else { $additional_information .= "<$module>$content<\/$module>"; } }else { $additional_information = "<$module>$content<\/$module>"; } return $additional_information; } ############################################################################### # getUserProfile ############################################################################### sub getUserProfile { my %args = @_; my $SUB_NAME = "getUserProfile"; #### Decode the argument list my $contact_id = $args{'contact_id'} || die "ERROR[$SUB_NAME]:contact_id was not passed"; #### Define standard variables my (%profile); $profile{'username'} = $sbeams->getCurrent_username; $profile{'contact_id'} = $sbeams->getCurrent_contact_id; $profile{'work_group_id'} = $sbeams->getCurrent_work_group_id; $profile{'work_group_name'} = $sbeams->getCurrent_work_group_name; $profile{'project_id'} = $sbeams->getCurrent_project_id; $profile{'project_name'} = $sbeams->getCurrent_project_name; $profile{'user_context_id'} = $sbeams->getCurrent_user_context_id; return %profile; } ############################################################################### # # # UNUSED/DEPRECATED CODE # # # ############################################################################### ############################################################################### # getPermissions- NOT USED! ############################################################################### #sub getPermissions { # my %args = @_; # my $SUB_NAME = "getPermissions"; # # #### Decode the argument list # my $project_id = $args{'project_id'} || -1; # my $contact_id = $args{'contact_id'} || -1; # my $preference = $args{'preference'} || "best"; # # if ( $project_id < 0 || $contact_id < 0 ) { # die "ERROR[$SUB_NAME]: either contact_id or project_id MUST be specified"; # } # # #### Define standard variables # my ($sql, @rows); # # #### If project_id and contact_id are submitted # $sql = qq~ # SELECT UL.username, # MIN(CASE WHEN UWG.contact_id IS NULL THEN NULL ELSE GPP.privilege_id END) AS "best_group_privilege_id", # MIN(UPP.privilege_id) AS "best_user_privilege_id" # FROM project P # JOIN user_login UL ON (P.PI_contact_id = UL.contact_id) # LEFT JOIN user_project_permission UPP ON( P.project_id = UPP.project_id) # LEFT JOIN group_project_permission GPP ON(P.project_id = GPP.project_id) # LEFT JOIN privilege PRIV ON(GPP.privilege_id = PRIV.privilege_id) # LEFT JOIN user_work_group UWG ON (GPP.work_group_id = UWG.work_group_id) # LEFT JOIN work_group WG ON (UWG.work_group_id = WG.work_group_id) # WHERE 1=1 # AND P.record_status != 'D' # AND UL.record_status != 'D' # AND (UPP.record_status != 'D' OR UPP.record_status IS NULL) # AND (GPP.record_status != 'D' OR GPP.record_status IS NULL) # AND (PRIV.record_status != 'D' OR PRIV.record_status IS NULL) # AND (UWG.record_status != 'D' OR UWG.record_status IS NULL) # AND (WG.record_status != 'D' OR WG.record_status IS NULL) # AND P.project_id = '$project_id' # AND UL.contact_id = '$contact_id' # AND ( UPP.privilege_id<=40 OR GPP.privilege_id<=40 ) # AND ( WG.work_group_name IS NOT NULL OR UPP.privilege_id IS NOT NULL ) # GROUP BY P.project_id,P.project_tag,P.name,UL.username # ORDER BY UL.username,P.project_tag # ~; # # @rows = $sbeams->selectSeveralColumns($sql); # my ($group_id, $user_id) = @{$rows[0]}; # # my $return_id; # # if ($preference eq "worst") { # ($group_id < $user_id) ? $return_id = $group_id : $return_id = $user_id; # }elsif ($preference eq "best") { # ($group_id > $user_id) ? $return_id = $group_id : $return_id = $user_id; # }elsif ($preference eq "group") { # $return_id = $group_id; # }else { # $return_id = $user_id; # } # # return $return_id; #} ############################################################################### # getPermissionsTwo- NOT USED! ############################################################################### # #sub getPermissionsTwo { # #### If username is submitted # my $sql = qq~ # SELECT P.project_id,P.project_tag,P.name,UL.username, # MIN(CASE WHEN UWG.contact_id IS NULL THEN NULL ELSE GPP.privilege_id END) AS "best_group_privilege_id", # MIN(UPP.privilege_id) AS "best_user_privilege_id" # FROM project P # JOIN user_login UL ON ( P.PI_contact_id = UL.contact_id ) # LEFT JOIN user_project_permission UPP # ON ( P.project_id = UPP.project_id AND UPP.contact_id='101' ) # LEFT JOIN group_project_permission GPP ON ( P.project_id = GPP.project_id ) # LEFT JOIN privilege PRIV ON ( GPP.privilege_id = PRIV.privilege_id ) # LEFT JOIN user_work_group UWG ON ( GPP.work_group_id = UWG.work_group_id # AND UWG.contact_id='101' ) # LEFT JOIN work_group WG ON ( UWG.work_group_id = WG.work_group_id ) # WHERE 1=1 # AND P.record_status != 'D' # AND UL.record_status != 'D' # AND ( UPP.record_status != 'D' OR UPP.record_status IS NULL ) # AND ( GPP.record_status != 'D' OR GPP.record_status IS NULL ) # AND ( PRIV.record_status != 'D' OR PRIV.record_status IS NULL ) # AND ( UWG.record_status != 'D' OR UWG.record_status IS NULL ) # AND ( WG.record_status != 'D' OR WG.record_status IS NULL ) # AND ( UPP.privilege_id<=40 OR GPP.privilege_id<=40 ) # AND ( WG.work_group_name IS NOT NULL OR UPP.privilege_id IS NOT NULL ) # GROUP BY P.project_id,P.project_tag,P.name,UL.username # ORDER BY UL.username,P.project_tag # ~; # #}