Skip to content

Commit

Permalink
Added more backend servers for USI.
Browse files Browse the repository at this point in the history
  • Loading branch information
wenbostar committed May 17, 2024
1 parent 169ab81 commit 3c6f546
Showing 1 changed file with 27 additions and 17 deletions.
44 changes: 27 additions & 17 deletions src/main/java/PDVGUI/gui/SinglePeptideDisplay.java
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,8 @@ private void initComponents(){

setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
setTitle("PDV - One PSM");
setBackground(new java.awt.Color(255, 255, 255));
setMinimumSize(new java.awt.Dimension(760, 600));
setBackground(new Color(255, 255, 255));
setMinimumSize(new Dimension(760, 600));
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent evt) {
formWindowClosing(evt);
Expand All @@ -195,10 +195,10 @@ public void windowClosing(WindowEvent evt) {

setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("/icons/SeaGullMass.png")));

mainJPanel.setBackground(new java.awt.Color(255, 255, 255));
mainJPanel.setPreferredSize(new java.awt.Dimension(1260, 800));
mainJPanel.setBackground(new Color(255, 255, 255));
mainJPanel.setPreferredSize(new Dimension(1260, 800));

menuBar.setBackground(new java.awt.Color(255, 255, 255));
menuBar.setBackground(new Color(255, 255, 255));

fileJMenu.setMnemonic('F');
fileJMenu.setText("File");
Expand Down Expand Up @@ -262,7 +262,7 @@ public void windowClosing(WindowEvent evt) {

peptideSequenceJText.setEditable(true);
peptideSequenceJText.setHorizontalAlignment(SwingConstants.CENTER);
peptideSequenceJText.addKeyListener(new java.awt.event.KeyAdapter() {
peptideSequenceJText.addKeyListener(new KeyAdapter() {
public void keyReleased(KeyEvent evt) {
peptideSequenceJTextKeyReleased(evt);
}
Expand Down Expand Up @@ -363,7 +363,7 @@ public void keyReleased(KeyEvent evt) {

);

allJToolBar.setBackground(new java.awt.Color(255, 255, 255));
allJToolBar.setBackground(new Color(255, 255, 255));
allJToolBar.setBorder(null);
allJToolBar.setFloatable(false);
allJToolBar.setRollover(true);
Expand Down Expand Up @@ -516,19 +516,29 @@ private void getUSIJButtonActionPerformed(ActionEvent evt){
@Override
public void run() {
try {
String url = "https://proteomecentral.proteomexchange.org/api/proxi/v0.1/spectra?resultType=compact&usi=" + usiID+"&format=json";
URL obj = new URL(url);

ArrayList<String> usi_server_list = new ArrayList<>();
usi_server_list.add("https://proteomecentral.proteomexchange.org/api/proxi/v0.1/spectra?resultType=compact&usi=");
usi_server_list.add("https://www.ebi.ac.uk/pride/proxi/archive/v0.1/spectra?resultType=full&usi=");
String url = "";
int responseCode = -1;
HttpURLConnection con = null;
int charge = 2;
double precursorMZ = 0.0;

HttpURLConnection con = (HttpURLConnection) obj.openConnection();
// optional default is GET
con.setRequestMethod("GET");
//add request header
con.setRequestProperty("User-Agent", "Mozilla/5.0");
int responseCode = con.getResponseCode();

for(String base_url: usi_server_list) {
url = base_url + usiID + "&format=json";
System.out.println(url);
URL obj = new URL(url);
con = (HttpURLConnection) obj.openConnection();
// optional default is GET
con.setRequestMethod("GET");
//add request header
con.setRequestProperty("User-Agent", "Mozilla/5.0");
responseCode = con.getResponseCode();
if (responseCode == 200){
break;
}
}
if (responseCode == 200){
System.out.println("\nSending 'GET' request to URL : " + url);
System.out.println("Response Code : " + responseCode);
Expand Down

0 comments on commit 3c6f546

Please sign in to comment.