Re: [Tutor] FASTA FILE SUB-SEQUENCE EXTRACTION

2016-03-08 Thread Danny Yoo
You should probably look into Biopython:

   http://biopython.org/wiki/Main_Page

Your question should involve fairly straightforward use of the Seq methods
of Biopython. You should not try to write your own FASTA parser: Biopython
comes with a good one already.

Note that the tutor mailing list is not entirely general: the questions
here are expected to be beginner-level.  Bioinformatics questions are a bit
out of scope for tutor @python.org, since they involve a specialized domain
that our participants here won't probably be very familiar with.

The last times I participated, the Biopython forums were very active.  You
should check them out:

http://biopython.org/wiki/Mailing_lists

Good luck!
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] FASTA FILE SUB-SEQUENCE EXTRACTION

2016-03-08 Thread Alan Gauld
On 08/03/16 12:19, syed zaidi wrote:

One thing. This is a plain text mailing list and because Python is space
dependant you need to post in plain text not HTML/RTF or the layout gets
lost in the mail system. (as you see below).

The main things you need to tell us are what libraries you are
using to read the FASTA data, which OS, and which Python version.


> Well, fasta is a file format used by biologists to store 
> biological sequencesthe format is as under

> sequence information (sequence name, sequence length etc)genomic sequence> 
> sequence information (sequence name, sequence length etc)genomic sequenceI 
> want to match the name of sequence with another list of sequence names and 
> splice the sequence by the provided list of start and end sites for each 
> sequenceso the pseudo code could beif line starts with '>':match the 
> header name with sequence name:if sequence name found:
> splice from the given start and end positions of that sequencethe 
> code I have devised so far is:import oswith open('E:/scaftig.sample - 
> Copy.scaftig','r') as f:header = f.readline()header = 
> header.rstrip(os.linesep)sequence = ''  
>for line in f:line = line.rstrip('\n')if line[0] == '>':   
>  header = header[:]print headerif 
> line[0] != '>':sequence+= line 
> print sequence, len(sequence)I would appreciate if you can 
> helpThanksBest RegardsAli


-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] how to receive messages form a server?

2016-03-08 Thread Alan Gauld
On 08/03/16 11:56, Paul Z wrote:

> There is AP with UDP-Server(sending UDP messages).
> My computer has connected the AP. 

How did you do that? Via a socket? From Python?

> I know how to receive messages form a client via socket.

Your terminology confuses me. You send messages from
a client to a server. So are you saying you know how
to write a server?

> But, Now, how to receive messages from a server?

Servers don't generally send messages, they send
responses to requests from clients.  I'm not sure
what exactly you are trying to do? Is this a
multi-tier application with your code in the middle
interacting with clients and servers? Or are you
a client accessing a server? Or is it a peer to
peer set up?

Do you have any code you can share with us?
That might clarify things.

Also it will definitely help if you tell us which
OS and Python version you are using.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


[Tutor] how to receive messages form a server?

2016-03-08 Thread Paul Z
Hi,

There is AP with UDP-Server(sending UDP messages).
My computer has connected the AP. I know how to receive messages form a client 
via socket.
But, Now, how to receive messages from a server?

Thanks!
  
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] FASTA FILE SUB-SEQUENCE EXTRACTION

2016-03-08 Thread syed zaidi
Well, fasta is a file format used by biologists to store biological 
sequencesthe format is as under> sequence information (sequence name, sequence 
length etc)genomic sequence> sequence information (sequence name, sequence 
length etc)genomic sequenceI want to match the name of sequence with another 
list of sequence names and splice the sequence by the provided list of start 
and end sites for each sequenceso the pseudo code could beif line starts with 
'>':match the header name with sequence name:if sequence name 
found:splice from the given start and end positions of that 
sequencethe code I have devised so far is:import oswith 
open('E:/scaftig.sample - Copy.scaftig','r') as f:header = f.readline()
header = header.rstrip(os.linesep)sequence = ''for line in f:
line = line.rstrip('\n')if line[0] == '>':header = 
header[:]print headerif line[0] != '>': 
   sequence+= line 
print sequence, len(sequence)I would appreciate if you can 
helpThanksBest RegardsAli
> Date: Tue, 8 Mar 2016 03:11:42 -0500
> Subject: Re: [Tutor] FASTA FILE SUB-SEQUENCE EXTRACTION
> From: wolfrage8...@gmail.com
> To: syedzaid...@hotmail.co.uk
> 
> What is FASTA? This seems very specific. Do you have any code thus far
> that is failing?
> 
> On Tue, Mar 8, 2016 at 2:33 AM, syed zaidi  wrote:
> > Hello all,
> > I am stuck in a problem, I hope someone can help me out. I have a FASTA 
> > file with multiple sequences and another file with the gene coordinates. 
> > SAMPLEFASTA FILE:
> >>EBM_revised_C2034_1  
> >>length=611GCAGCAGTAATATTGCACAATGGGCGCAAGCCTGATGCAGCCATGCCGCGTGTATGAAGAAGGCCTTCGGGTTGTAAAGTACTTTCAGCAGGAAGGGAGTAAAGTTAATACCTTTGCTCATTGACGTTACCCGCAGAAGAAGCACCGGCTAACTCCGTGCCAGCAGCCGCGGTAATACGGAGGGTGCAAGCGTTAATCGGAATTACTGGGCGTAAAGCGCACGCAGGCGGTTTGTTAAGTCAGATGTGAAATGGGCTCAACCTGGGAACTGCATCTGATACTGGCAAGCTTGAGTCTCGTAGAGGTAGAATTCCAGGTGTAGCGGTGAAATGCGTAGAGATCTGGAGGAATACCGGTGGCGAAGGCGGCTGGACGAAGACTGACGCTCAGGTGCGAAAGCGTAGCAAACAGGATTAGATACCCTGGTAGTCCACGCCGTAAACGATGTCGACTTGGAGGTTGTGCCCTTGAGGCGTGGCTTCCGGAGCTAACGCGTTAAGTCGACCGCCTAGTACGGCCGCAAGGTTCTCAAATGAATTGACGCCCGCACAAGCGGTGGAGCATGTGGTTTAATT>EBM_revised_C2104_1
> >>  
> >>length=923TCCGAGGGCGGTGGGATGTTGGTGCTGCAGCGGCTTTCGGATGCGCGGCGGTTGGGTCATCCGGTGTTGGCGGTGGTGGTCGGGTCGGCGGTTAATCAGGATCGTCGAATGGGTTGACCGCGCCTAATGGTCCTTCGCAGCAGCGGGTGGTGCGGGCGGCGTTGGCCAATGCCGGGTTGAGCGCGGCCGAGGTGGATGTGGTGGACATGGGACCGGGACCACGTTGATCCGATTGAGGCTCAGGCGTTGTTGGCCACTTATGGGCAAGATCGGAGCCGGGAGAACCTTTGTGGTTTCGGT
 GAA
> >  
> > GTCGAATATGGGTCATACGCAGGCCGCGGCGTGGCCTGATCAAGATGGTGTTGGCGATGCGCCATGAGCTGTTGCCGGCGACGTTGCACGTGGATGTGCCTAGCCCGCATGTGGATTGGTCGGCGCGGTGGAGTTGTTGACCGCGCCGCGGGTGTGGCCTGCTGGTGCTCGGACGCGTCGTGCGTGTCGTCGTTTGGGATTAGTGGCACTAATGCGCATGTGATTATCGAGGCGGTGCCGGTGGTGCCGCGGCGGGAGGCTGGTTGGGCCCGGTGGTGCCGTGGGTGGTGTCGGCGAAGTCGGAGTCGGCGTTGCGCAGGCGGCTCGGTTGGCCGCGTACGTGCGTGGCGATGATGGCCTCGATGTTGCCGATGTTGGTCGTTGGCGGGTCGTTCGGTGAGCATCGGGCGGTGGTGGTTGGCACCGTGATCGGTTGTTGGCCGGGCTCGATGAGCTGGCGGGTGACCAGTTGGGCGGCTCGGTTGTTCCACGGCGACTGCGGCGGGTAAGACGGTGTTCGTCTTGGCCAAGGCTCCCAATGGCTGGGCATGGGAAT
> > GENE COORD FILEScaf_nameGene_name   DS_St   
> > DS_EnEBM_revised_C2034_1gene1_1 33  99EBM_revised_C2034_1   
> > gene1_1 55  100EBM_revised_C2034_1  gene1_1 111 
> > 150EBM_revised_C2104_1  gene1_1 44  70
> > I want to perform the following steps:compare the scaf_name with the header 
> > of fasta sequenceif header matches then process the sequence and extract 
> > the sequence by the provided start and end positions.
> >
> > I would appreciate if someone can help
> > Thanks
> > Best Regards
> >
> > Ali
> >
> >> ___
> >> Tutor maillist  -  Tutor@python.org
> >> To unsubscribe or change subscription options:
> >> https://mail.python.org/mailman/listinfo/tutor
> >
> > ___
> > Tutor maillist  -  Tutor@python.org
> > To unsubscribe or change subscription options:
> > https://mail.python.org/mailman/listinfo/tutor
  
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] simulating key presses

2016-03-08 Thread Alan Gauld
On 08/03/16 10:00, Benjamin Fishbein wrote:
> Despite scouring stack overflow and other places, I can’t figure out how to 
> simulate key presses.
> I’m using Mac 10.10.5.
> Most answers to this involve sending keys to an element, but my problem is 
> that I have no element to send to; I’m trying to automate key presses for 
> choosing (browsing) a file in the Finder window.
> Any help is much appreciated.

This is specific to your GUI toolkit, in your case Cocoa.
You will need to look in the Apple documentation for Cocoa
on the Apple develop site then see if the required
functionality is made available in the Python Cocoa
bindings available from the MacPython community.

From my ObjectiveC Cocoa books it looks like you need
to create a Key event using the

+(NSEvent*)keyEventWithType: (NSEventType) type

method.

Another approach would be to use AppleScript via osascript
as a subprocess. You can certainly automate the finder
via that route. It might be easier than going in
via Cocoa. I think there's a Python wrapper for
osascript too.

Not much direct help but maybe a pointer in the
right direction...


HTH

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


[Tutor] Fasta Identy

2016-03-08 Thread Sydney Shall

Dear Ali,

I suggest your best way is to use the resource at the EMBL or the 
National Library of Congress, NIH, resources.


There you can compare your FASTA sequences with authentic databases. The 
programs know about FASTA and will recognise the format. It will 
identify the gene for you. And it will give you a link to all the 
available data on that gene.

--
Sydney
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


[Tutor] simulating key presses

2016-03-08 Thread Benjamin Fishbein
Despite scouring stack overflow and other places, I can’t figure out how to 
simulate key presses.
I’m using Mac 10.10.5.
Most answers to this involve sending keys to an element, but my problem is that 
I have no element to send to; I’m trying to automate key presses for choosing 
(browsing) a file in the Finder window.
Any help is much appreciated.


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] FASTA FILE SUB-SEQUENCE EXTRACTION

2016-03-08 Thread Alan Gauld
On 08/03/16 07:33, syed zaidi wrote:
> Hello all,

Hello,
For future reference, please do not hijack an old thread
for a new topic -
a) it messes up0 the archives for searching
b) it means those using threaded readers will probably
   not see your message

> I am stuck in a problem, I hope someone can help me out. I have a FASTA file

There are specialist libraries for reading processing fasta data.
Are you using one of those, if so which? Thee are also general
purpose Bio science libraries within the SciPy and SciKit bundles
that may help you. Their support forums are also much more likely
to have the specialist knowledge on how to use these tools. This
forum is concerned with core Python language issues.

It will also  help if you tell us which OS and Python
version you are using.

> 
> I want to perform the following steps:

> compare the scaf_name with the header of fasta sequence
> if header matches then process the sequence
> and extract the sequence by the provided start and end positions.

OK, There are three clear steps there. Have you written any code for any
of them? If so show us, along with any error messages.
Do you have a specific issue where you need help?

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


[Tutor] FASTA FILE SUB-SEQUENCE EXTRACTION

2016-03-08 Thread syed zaidi
Hello all,
I am stuck in a problem, I hope someone can help me out. I have a FASTA file 
with multiple sequences and another file with the gene coordinates. SAMPLEFASTA 
FILE:
>EBM_revised_C2034_1  
>length=611GCAGCAGTAATATTGCACAATGGGCGCAAGCCTGATGCAGCCATGCCGCGTGTATGAAGAAGGCCTTCGGGTTGTAAAGTACTTTCAGCAGGAAGGGAGTAAAGTTAATACCTTTGCTCATTGACGTTACCCGCAGAAGAAGCACCGGCTAACTCCGTGCCAGCAGCCGCGGTAATACGGAGGGTGCAAGCGTTAATCGGAATTACTGGGCGTAAAGCGCACGCAGGCGGTTTGTTAAG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GGCTCGATGAGCTGGCGGGTGACCAGTTGGGCGGCTCGGTTGTTCCACGGCGACTGCGGCGGGTAAGACGGTGTTCGTCTTGGCCAAGGCTCCCAATGGCTGGGCATGGGAAT
GENE COORD FILEScaf_nameGene_name   DS_St   
DS_EnEBM_revised_C2034_1gene1_1 33  99EBM_revised_C2034_1   gene1_1 
55  100EBM_revised_C2034_1  gene1_1 111 150EBM_revised_C2104_1  gene1_1 
44  70
I want to perform the following steps:compare the scaf_name with the header of 
fasta sequenceif header matches then process the sequence and extract the 
sequence by the provided start and end positions.

I would appreciate if someone can help
Thanks
Best Regards

Ali

> ___
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
  
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor