Created
November 29, 2012 17:03
-
-
Save radaniba/4170411 to your computer and use it in GitHub Desktop.
Retrieving a protein by its accession and accessing some of its data
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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