Question: Executing Script.Py For Modeller Software Through Java Code
0
gravatar for priyankapillai13
6.8 years ago by
priyankapillai130 wrote:

Script.py file

Homology modeling by the automodel class
from modeller import *              # Load standard Modeller classes
from modeller.automodel import *    # Load the automodel class

log.verbose()    # request verbose output
env = environ()  # create a new MODELLER environment to build this model in

 directories for input atom files
env.io.atom_files_directory = './:../atom_files'

a = automodel(env,
alnfile  = 'align.ali',     # alignment filename
knowns   = '1GJZ',              # codes of the templates
sequence = 'target')              # code of the target

a.starting_model= 1       
a.ending_model= 10           # index of the first model
(determines how many models to calculate)
a.make()                            # do the actual homology modeling

Code`

import java.io.*;

public class Demo 
{
        public static void main(String args[])
        {
        try 
        {
Runtime r = Runtime.getRuntime();
Process p = r.exec("cmd /c \"C:/model2/script.py\"");
BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()));
String line = "";
while ((line = br.readLine()) != null) {
    System.out.println(line);
}
} 
catch (Exception e) 
{
e.printStackTrace();
}
        }
    }

This code is accessing the modeller program as we can see in the output part, once it starts getting executed it gives an error align.ali not found as we can see in the error part. It runs as a stand alone script.py file.

Output

                     MODELLER 9.10, 2011/09/28, r8346

 PROTEIN STRUCTURE MODELLING BY SATISFACTION OF SPATIAL RESTRAINTS


                 Copyright(c) 1989-2011 Andrej Sali
                        All Rights Reserved

                         Written by A. Sali
                           with help from
       B. Webb, M.S. Madhusudhan, M-Y. Shen, M.A. Marti-Renom,
            N. Eswar, F. Alber, M. Topf, B. Oliva, A. Fiser,
                R. Sanchez, B. Yerkovich, A. Badretdinov,
                  F. Melo, J.P. Overington, E. Feyfant
             University of California, San Francisco, USA
                Rockefeller University, New York, USA
                  Harvard University, Cambridge, USA
               Imperial Cancer Research Fund, London, UK
          Birkbeck College, University of London, London, UK

Error

io_data____W> Setting io.atom_files_directory to a colon-delimited string is
              deprecated, as it is not robust on Windows systems. Set it to
              a list of directories instead. For example:
              env.io.atom_files_directory = ['./', '../atom_files']
openf______E> Cannot open file align.ali: No such file or directory
ADD COMMENTlink modified 6.8 years ago by samsara600 • written 6.8 years ago by priyankapillai130
0
gravatar for samsara
6.8 years ago by
samsara600
The Earth
samsara600 wrote:

In my opinion you are running java code in one directory and your input files are in different directory.

In the error there is colon-delimited string is deprecated , that means you should not use colon delimited string in this line env.io.atom_files_directory = './:../atom_files'

ADD COMMENTlink written 6.8 years ago by samsara600

Thank you so much for the help :) It is working now :)

ADD REPLYlink written 6.8 years ago by priyankapillai130
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1620 users visited in the last hour