[Biopython] gff3 file
Peter Cock
p.j.a.cock at googlemail.com
Wed Jun 3 10:26:55 UTC 2015
Hello again,
You are still trying to run Python command directly in the terminal
shell, rather than within Python.
When we write "$" we general mean a command to be typed at the
terminal (Unix or Linux or Mac), e.g.
$ ls -l
that would mean type the letters l, s, space, minus, l, enter. This
would give a directory listing in long mode (one file per line).
In this case I was suggesting you run:
$ python genbank_to_table.py
(having first saved the example Python script as a file named
genbank_to_table.py).
As well as "$" to indicate the terminal prompt, you will often see
people write ">>>" to indicate the Python prompt where you
would type a Python command to be run inside Python.
Do you know anyone in your group who knows a little Python,
or about working at the command line? Some in-person help
would be best. Or an introductory Python text book / tutorial?
Peter
On Wed, Jun 3, 2015 at 10:24 AM, Atteyet-Alla.Yassin
<Atteyet-Alla.Yassin at ukb.uni-bonn.de> wrote:
> Hallo peter I tried it but, unfortunately get the following and the output
> file was blank:
>
> ukb03709 at zr1005436:~/Dokumente/idiograms$ with open("CP008802.txt", "w") as
> output:
> bash: Syntaxfehler beim unerwarteten Wort `('
> ukb03709 at zr1005436:~/Dokumente/idiograms$
> output.write("Seqname\tSource\tfeature\tStart\tEnd\tScore\tStrand\tFrame\tAttributes\n")
> bash: Syntaxfehler beim unerwarteten Wort
> `"Seqname\tSource\tfeature\tStart\tEnd\tScore\tStrand\tFrame\tAttributes\n"'
> ukb03709 at zr1005436:~/Dokumente/idiograms$ for record in
> SeqIO.parse("CP008802.gbk", "genbank"):
> bash: Syntaxfehler beim unerwarteten Wort `('
> ukb03709 at zr1005436:~/Dokumente/idiograms$ print("Converting %s" %
> record.name)
> bash: Syntaxfehler beim unerwarteten Wort `"Converting %s"'
> ukb03709 at zr1005436:~/Dokumente/idiograms$ for f in record.features:
>> if f.type != "gene":
> bash: Syntaxfehler beim unerwarteten Wort `if'
> ukb03709 at zr1005436:~/Dokumente/idiograms$ continue
> bash: continue: nur in einer `for', `while' oder `until' Schleife sinnvoll.
> ukb03709 at zr1005436:~/Dokumente/idiograms$ locus_tag =
> f.qualifiers["locus_tag"][0]
> bash: locus_tag: Kommando nicht gefunden.
> ukb03709 at zr1005436:~/Dokumente/idiograms$ if
> len(f.location.parts) > 1:
> bash: Syntaxfehler beim unerwarteten Wort `f.location.parts'
> ukb03709 at zr1005436:~/Dokumente/idiograms$ print("What should
> we do for %s (compound location)? %s" % (locus_tag, f.location))
> bash: Syntaxfehler beim unerwarteten Wort `"What should we do for %s
> (compound location)? %s"'
> ukb03709 at zr1005436:~/Dokumente/idiograms$ continue
> bash: continue: nur in einer `for', `while' oder `until' Schleife sinnvoll.
> ukb03709 at zr1005436:~/Dokumente/idiograms$
> output.write('%s\tGenBank\t%s\t%i\t%i\t0,000000\t%s\t.\tlocus_tag\t"%s";
> transcript_id "%s"\n'
> bash: Syntaxfehler beim unerwarteten Wort
> `'%s\tGenBank\t%s\t%i\t%i\t0,000000\t%s\t.\tlocus_tag\t"%s"; transcript_id
> "%s"\n''
> ukb03709 at zr1005436:~/Dokumente/idiograms$ %
> (record.name, f.type,
> bash: Syntaxfehler beim unerwarteten Wort `record.name,'
> ukb03709 at zr1005436:~/Dokumente/idiograms$
> f.location.start + 1, f.location.end, f.location.strand,
> bash: f.location.start: Kommando nicht gefunden.
> ukb03709 at zr1005436:~/Dokumente/idiograms$
> locus_tag, locus_tag))
> bash: Syntaxfehler beim unerwarteten Wort `)'
> ukb03709 at zr1005436:~/Dokumente/idiograms$ print("Done")
>
> Am 02.06.2015 um 15:40 schrieb Peter Cock:
>
> On Tue, Jun 2, 2015 at 1:02 PM, Atteyet-Alla.Yassin
> <Atteyet-Alla.Yassin at ukb.uni-bonn.de> wrote:
>> Hallo Peter - Hiier are the messages. May be arised during copy and paste
>> the command you sent? I work with a debian! Therfore please send the
>> command
>> as attached file:
>
> https://gist.github.com/peterjc/bf6796adbc9e7737bff6 is a Python script
> to be run inside Python, not a shell script to run at the terminal prompt.
>
> Download and save it as something like genbank_to_table.py then run
> it like this:
>
> $ python genbank_to_table.py
> Converting CP008802
> What should we do for FB03_00005 (compound location)? join{[0:6](-),
> [2158322:2159306](-)}
> Done
>
> Peter
>
>
>
> _______________________________________________
> Biopython mailing list - Biopython at mailman.open-bio.org
> http://mailman.open-bio.org/mailman/listinfo/biopython
More information about the Biopython
mailing list