[melbourne-pug] help with importing fasta files nito command window (python)

Jessica Rose jessicarose74 at yahoo.ca
Tue Mar 7 04:15:30 EST 2017


Hi guys. I am all good. Still trying to get the bigger picture but have successfully imported a number of files for translation from RNA to protein. Yay me and you. 
Next in line... Jessica Rose, PhD PDF Department of MicrobiologyFaculty of MedicineTechnion, Haifa+972-52-378-1674 

    On Tuesday, March 7, 2017 10:03 AM, Mike Dewhirst <miked at dewhirst.com.au> wrote:
 

 On 6/03/2017 10:44 PM, Jessica Rose via melbourne-pug wrote:
> yeah that pip command gives me trouble too! i really am a newbie at 
> all this so sorry for seeming slow.
>
> when i have my command window open (idle) what do i type in to import 
> fasta from biopython?

I know nothing about fasta nor biopython but there is a pattern you need 
to adopt to import stuff in Python. Python 2.7 and 3.x are slightly 
different but you can make them behave more or less the same by 
inserting the following incantation at the top of your Python 2.7 
script/program ... (not necessary if you are using Python 3)

from __future__ import absolute_import, unicode_literals, division

That imports some Python 3 features into Python 2.

I personally would avoid Idle and go straight to Notepad++ (as suggested 
earlier) to write your scripts.

So to your question ... I would try

from biopython import fasta

At that point you have imported the entire fasta suite (aka namespace) 
of functions, classes, constants and so on. You call them like this ...

x = fasta.method_one()

Next write your first script in Notepad++ and save it to say 
C:\Users\Jessica\beginnings\first.py

Then, in Windows Explorer navigate to that directory and open an 
ordinary command prompt. You should see C:\Users\Jessica\beginnings>

Enter "python first.py" and your script should run. If it doesn't you 
should see the traceback and be able to fix it.

Check this out ...

https://www.blog.pythonlibrary.org/2016/03/01/python-101-all-about-imports/

Good luck

Mike



> Jessica Rose, PhD
> PDF Department of Microbiology
> Faculty of Medicine
> Technion, Haifa
> +972-52-378-1674
>
>
> On Monday, March 6, 2017 1:36 PM, Tim Richardson 
> <tim at growthpath.com.au> wrote:
>
>
> The module is not installed. Read pyfasta installation instructions.
> Usually it will be
> pip install pyfasta
>
>
> On Mon, 6 Mar. 2017, 21:57 Rory Hart, <hartror at gmail.com 
> <mailto:hartror at gmail.com>> wrote:
>
>    Oh dear you've asked programmers about what text editor they
>    prefer, let the religious wars begin!
>
>    I would suggest sublime 3 personally. It is straightforward to use
>    out of the box and later you can install a bunch of plugins once
>    you get a bit more advanced that can help your coding.
>
>    I assume by your name you are a lady (or identify as such), are
>    you aware of the PyLadies Meetup?
>
>    > On 6 Mar. 2017, at 8:43 pm, William ML Leslie
>    <william.leslie.ttg at gmail.com
>    <mailto:william.leslie.ttg at gmail.com>> wrote:
>    >
>    > On 3 March 2017 at 18:57, Jessica Rose via melbourne-pug
>    > <melbourne-pug at python.org <mailto:melbourne-pug at python.org>> wrote:
>    >> Hi there, I am having trouble with importing or reading text
>    files (fasta
>    >> files) when writing code with python. I am very new to this and
>    have been
>    >> practicing python code writing from the command window with
>    great success.
>    >> but the time has come for me to apply what i have learned to
>    real files. I
>    >> am a protein biologist and am starting to get more into
>    bioinformatics.
>    >> python is definitely the way for me to go.
>    >>
>    >> i have looked at every online site and tried just about everything
>    >> suggested. Do you think there is an easy solution to my
>    problem? I am
>    >> working primarily on a windows operating system.
>    >>
>    >
>    > Hello! It is great that you are getting to saving your programs
>    to a file.
>    >
>    > What are you trying so far?  Are you using notepad.exe?  Note that
>    > wordpad and MS Word will not work!  Some people also like notepad++
>    > when on Windows.
>    >
>    > When you save your file, make sure the 'save as type' select list
>    > shows 'all files *.*' if it doesn't have anything for python.  then
>    > you can add a .py extension on your file.
>    >
>    > Have you ever used the printscreen feature to get an image of the
>    > problem you are seeing?
>    >
>    > --
>    > William Leslie
>    >
>    > Notice:
>    > Likely much of this email is, by the nature of copyright, covered
>    > under copyright law.  You absolutely MAY reproduce any part of it in
>    > accordance with the copyright law of the nation you are reading this
>    > in.  Any attempt to DENY YOU THOSE RIGHTS would be illegal without
>    > prior contractual agreement.
>    > _______________________________________________
>    > melbourne-pug mailing list
>    > melbourne-pug at python.org <mailto:melbourne-pug at python.org>
>    > https://mail.python.org/mailman/listinfo/melbourne-pug
>
>    _______________________________________________
>    melbourne-pug mailing list
>    melbourne-pug at python.org <mailto:melbourne-pug at python.org>
>    https://mail.python.org/mailman/listinfo/melbourne-pug
>
> -- 
> Tim Richardson, Director
> GrowthPath - Profit Engineers
>
>
>
>
> _______________________________________________
> melbourne-pug mailing list
> melbourne-pug at python.org
> https://mail.python.org/mailman/listinfo/melbourne-pug



   
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/melbourne-pug/attachments/20170307/4b841a17/attachment-0001.html>


More information about the melbourne-pug mailing list