Skip to content

Instantly share code, notes, and snippets.

@eamonnmag
Created February 7, 2013 15:45
Show Gist options
  • Save eamonnmag/4731752 to your computer and use it in GitHub Desktop.
Save eamonnmag/4731752 to your computer and use it in GitHub Desktop.
Some BII Explanatory code.
MS/SPEC Raw Data > JIC107_GlucoseO2_0.20_External_2_1.txt (meas:metabolite profiling, tech: mass spectrometry)
MS/SPEC Derived Data > PRIDE_Exp_Complete_Ac_8763.xml (meas:protein expression profiling, tech: mass spectrometry)
MS/SPEC Raw Data > spectrum.mzdata (meas:protein expression profiling, tech: mass spectrometry)
MS/SPEC Derived Data > PRIDE_Exp_Complete_Ac_8762.xml (meas:protein expression profiling, tech: mass spectrometry)
MS/SPEC Derived Data > PRIDE_Exp_Complete_Ac_8761.xml (meas:protein expression profiling, tech: mass spectrometry)
MS/SPEC Derived Data > PRIDE_Exp_Complete_Ac_8763.xml (meas:protein expression profiling, tech: mass spectrometry)
MS/SPEC Derived Data > PRIDE_Exp_Complete_Ac_8763.xml (meas:protein expression profiling, tech: mass spectrometry)
MS/SPEC Derived Data > PRIDE_Exp_Complete_Ac_8761.xml (meas:protein expression profiling, tech: mass spectrometry)
MS/SPEC Derived Data > PRIDE_Exp_Complete_Ac_8763.xml (meas:protein expression profiling, tech: mass spectrometry)
MS/SPEC Derived Data > PRIDE_Exp_Complete_Ac_8761.xml (meas:protein expression profiling, tech: mass spectrometry)
MS/SPEC Derived Data > PRIDE_Exp_Complete_Ac_8761.xml (meas:protein expression profiling, tech: mass spectrometry)
MS/SPEC Derived Data > PRIDE_Exp_Complete_Ac_8762.xml (meas:protein expression profiling, tech: mass spectrometry)
MS/SPEC Derived Data > PRIDE_Exp_Complete_Ac_8761.xml (meas:protein expression profiling, tech: mass spectrometry)
.... and so on.
//Given this piece of code
Investigation investigation = validator.getStore().valueOfType(Investigation.class);
for(Study study : investigation.getStudies()) {
for (Assay assay : study.getAssays()) {
Collection<AssayResult> results = ProcessingUtils.findAllDataInAssay(assay);
for(AssayResult assayResult : results) {
out.println(assayResult.getData().getType().getName() + " > " + assayResult.getData().getUrl() + " (meas:" + assay.getMeasurement().getName() + ", tech: " + assay.getTechnologyName() + ")");
}
}
}
// utilising this method in ProcessingUtils
/**
* An helper that finds all the AssayResults related to the assay parameter. It is based on the experimental pipeline
* the assay's material belong in.
*/
public static Collection<AssayResult> findAllDataInAssay ( Assay assay )
{
if ( assay == null )
throw new RuntimeException ( "findAllDataInAssay(): null assay passed to the method" );
Material material = assay.getMaterial ();
if ( material == null )
throw new RuntimeException ( "findAllDataInAssay( " + assay + "): no material associated to the assay" );
final Study study = assay.getStudy ();
if ( study == null )
throw new RuntimeException ( "findAllDataInAssay ( " + assay + " ): no study associated to the assay" );
final Collection<AssayResult> result = new HashSet<AssayResult> ();
ProcessingVisitAction visitor = new ProcessingVisitAction ()
{
public boolean visit ( GraphElement graphElement )
{
if ( ! ( graphElement instanceof DataNode ) ) return true;
Data data = ( (DataNode) graphElement ).getData ();
result.add(new AssayResult(data, study));
return true;
}
};
new ExperimentalPipelineVisitor ( visitor ).visitForward ( material.getMaterialNode () );
return result;
}
// We can get the snippet output attached.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment