0

I have low-Ram laptop but I need to work on whole genome data which is more than 1Gb. For this end, I connect to a supercomputer. In a windows machine, I run the codes in IDLE or Pyscripter and when there is errors, Its easily identifiable because all the variables up to the error point is available and accessible. for example if you have code like this:

genome_dict={}
with open ('genome.fa') as file:
      chromosome= parse(file)
      sequence= parse(file)
      genome_dict[chromosome[z]]=sequence[n][m]

if there is error in parsing chromosome and sequence variable, their values are accessible in IDLE.But in a supercomputer linux machine, when an error occur I could not obtain the variables to find out what is the problem, I can not use print variable because its simply too big to be printable. my question is, is there any way to run a python script in a linux command line in a way that you can obtain the variables generated in the process of running the script after its has been finished processing with or without errors?

Masih
  • 920
  • 2
  • 19
  • 36
  • You can print a variable type (`print type(chromosome)`) to see if it is what it should be; if it is an array, you can print its length (`print len(chromosome)`), or the first record (`print chromosome[0]`)... there are many things you can do. Getting the variables to your Windows machine, not that easy (unless you use [iPython](http://ipython.org/), for example). – Amadan Oct 07 '15 at 07:28
  • Different chromosomes have different properties and sometime they are not produced in the proper format. so when i run my code in the linux machine, it works well for a portion of the data and it suddenly stops with error and it just says:'IndexError: list index out of range'. but i can not figure what is the problem unless i know what is there in the list for that specific chromosome. – Masih Oct 07 '15 at 07:34
  • 1
    Then use try/except to catch the error and print the offending line. (I can't be any more specific without seeing `parse`). – Amadan Oct 07 '15 at 07:37
  • the code itself is a bit long! its a bit difficult to simplify and put it in here – Masih Oct 07 '15 at 08:39

0 Answers0