You are here

I don't know what's the problem when load the fragment file

6 posts / 0 new
Last post
I don't know what's the problem when load the fragment file

Hello ~
I'm interested in Pyrosetta
and learning the tutorial
Workshop #4: PyRosetta Folding
page 4
11. Create a new subroutine in your folding code for an alternate random move based upon a “fragment insertion”. A fragment insertion is the replacement of the torsion angles for a set of consecutive residues with new torsion angles pulled at random from a fragment library file. Prior to calling the subroutine, load the set of fragments from the fragment file:
fragset = ConstantLengthFragSet(3)

so I did the same work and it said just error
In [3] : fragset = ConstantLengthFragSet(3)

In [4] :fragset.read_fragment_file("test/data/workshops/aat000_03_05.200_v1_3")
Open failed for file :
←[0m←[1m←[31mERROR: : Exit from:core/fragment/ line: 117
←[0m -----------------------------------------------------------------------------------------------------------------------
RuntimeError Traceback(most recent call last)
<ipython-imput-4-1432af1f1a60> in <module>()
-----> fragset.read_fragment_file("test/data/workshops/aat000_03_05.200_v1_3")
RuntimeError: unidenifiable C++ exception

In [5] :

How can I solve his error?
please tell me what's the wrong.

Post Situation: 
Mon, 2014-09-29 03:45

Are you sure the file exists?

Do you get any output by calling

!tail "test/data/workshops/aat000_03_05.200_v1_3"

in IPython?

Mon, 2014-09-29 04:06

Yes. aat000_03_05.200_v1_3 file exsist in workshop

Mon, 2014-09-29 05:09

One possibility is issues with path. If the path you're running python out of (or more particularly, the one which Rosetta thinks it's running out of) is not the same as the one that's the base of the relative file path you give, then you'll get file missing errors.

Instead of giving a relative path, try giving the full, absolute path. For example, if test/data/workshops/aat000_03_05.200_v1_3 is actually located at /home/john/pyrosetta/workshop/workshop4/test/data/workshops/aat000_03_05.200_v1_3 then use "fragset.read_fragment_file('/home/john/pyrosetta/workshop/workshop4/test/data/workshops/aat000_03_05.200_v1_3')"

Mon, 2014-09-29 15:11

but It doesn't work
I check that the file really exsist by

In [6] : !aat000_03_05.200_v1_3

and find the path by using

In [7] : os.path.abspath("aat000_03_05.200_v1_3")

and Last I put it into ]

In [8] : fragset = ConstantLengthFragSet(3)

In [9] : fragset.read_fragment_file(os.path.abspath("aat000_03_05.200_v1_3")

In [9] : fragset.read_fragment_file(os.path.abspath("aat000_03_05.200_v1_3"))
Open failed for file :
←[0m←[1m←[31mERROR: : Exit from:core/fragment/ line: 117
←[0m -----------------------------------------------------------------------------------------------------------------------
RuntimeError Traceback(most recent call last)
<ipython-imput-4-1432af1f1a60> in <module>()
-----> fragset.read_fragment_file(os.path.abspath("aat000_03_05.200_v1_3"))
RuntimeError: unidenifiable C++ exception

So........Maybe path won't be the problem......
then what might be the problem??

Mon, 2014-09-29 20:22

os.path.abspath() only makes a path according to what Python thinks the path should be according to the path given and the current directory -- it doesn't search for it, and it doesn't actually confirm that there's a file there. You would need to use os.path.exists() to test for existence. I'm highly suspecting that os.path.exists(os.path.abspath("aat000_03_05.200_v1_3")) returns false for you.

That would explain why you're getting the initial error - Python (and possibly PyRosetta) is expecting relative file paths to be based off of the C:\Python27\ directory, rather than where it actually is. The file C:\Python27\test/data/workshops/aat000_03_05.200_v1_3 doesn't actually exist, hence the message that you can't open the file.

What you need to do is *manually* find the complete path to the file in question. Open up a file system explorer window and navigate to the file. Typically there's a path indication in the filesystem browser window. Type this out manually in your Python session. Check that Python thinks that file exists with the os.path.exists(). If it doesn't, check that the path is indeed correct and you haven't mistyped something. (Keep in mind that the backslashes need to be escaped in Python strings, so it's "\\" rather than "\" as a path separator.) Once you get os.path.exists() to return true for that path, then pass that full path to the PyRosetta functions.

Tue, 2014-09-30 13:16