Skip to content

Instantly share code, notes, and snippets.

@radaniba
Created November 29, 2012 17:03
Show Gist options
  • Select an option

  • Save radaniba/4170411 to your computer and use it in GitHub Desktop.

Select an option

Save radaniba/4170411 to your computer and use it in GitHub Desktop.
Retrieving a protein by its accession and accessing some of its data
public static void main(String[] args) {
if (args.length != 1) {
System.out.println("The program expects one parameter: \n"
+ "1. Protein accesion\n");
} else {
String inputSt = args[0];
Bio4jManager manager = null;
try {
//--creating manager and node retriever----
manager = new Bio4jManager(CommonData.DATABASE_FOLDER);
NodeRetriever nodeRetriever = new NodeRetriever(manager);
//--------------------------------------------------------------
//-----retrieving protein node by its Uniprot accession---------
ProteinNode protein = nodeRetriever.getProteinNodeByAccession(inputSt);
//checking there's a protein with the accession provided...
if (protein == null) {
System.out.println("There's no protein with the accession " + inputSt);
} else {
System.out.println("Protein data: \n" + protein);
}
//--------------------------------------------------------------
} catch (Exception e) {
//deal somehow with the exception
} finally {
//---closing the manager----
manager.shutDown();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment