create an all against all fasta file
0
0
Entering edit mode
14 months ago
Chu • 0

I have a fasta file of 50 sequences that looks like

ID1
> sequence1 : receptor sequence1
ID2
> sequence2 : receptor sequence2

...and so on, 50 entries total.

I want to create a fasta file that plots all 50 sequences to all 50 receptors, ending up with 2500 entries in a fasta file with the appropriate ID names:

ID1_ID1
> sequence1: receptor sequence1
ID1_ID2
> sequence1: receptor sequence2
ID1_ID3
> sequence1: receptor sequence3
ID1_ID4
> sequence1: receptor sequence4

... and so on for 2500 entries total

Thank you!

python fasta • 958 views
ADD COMMENT
0
Entering edit mode

What do you mean by

that plots all 50 sequences to all 50 receptors

you want to paste the sequences together?

ADD REPLY
0
Entering edit mode

I want to make all against all pairs of sequences and receptors.

sequence 1 would pair with all 50 receptors, sequence 2 would do the same, and so on.

Hope that makes sense

ADD REPLY
0
Entering edit mode
  1. read both files in to biopython.
  2. Iterate each list
  3. use Pairwise2 to compute alignments between each
  4. Profit

There are almost certainly faster ways to achieve this eg. with parallel, but this would be quite straightforward

ADD REPLY
0
Entering edit mode

I don't think OP wants to align. This is most definitely an XY problem.

ADD REPLY
0
Entering edit mode

Chu : While trying to reformat your post I see that your examples now looks like

> sequence1 : receptor sequence1

Not sure if they need to look like the following (with two sequences following each other to make a multi-fasta file).

> sequence1 : receptor 
> sequence2

Make changes as necessary (not sure what the word receptor is doing in that line) and keep using 101010 button to format as code.

ADD REPLY
0
Entering edit mode

I think "receptor sequence X" is a single entity as is "sequence X". We're supposed to read it as:

ID1
> sequence1 : receptor_sequence1
ID2
> sequence2 : receptor_sequence2

OP is likely on an XY quest, it's not worth investing time in IMO.

ADD REPLY
0
Entering edit mode

Chu,

This looks like an XY problem. Please explain to us why you need this solved - in all probability, the task that needs this approach can be tackled in a completely different and probably more efficient manner altogether.

ADD REPLY

Login before adding your answer.

Traffic: 2143 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6