Question: (Closed) To Parse A Fasta File And Retrieve Only The Raw Sequence Of A Specific Chain
0
gravatar for priyankapillai13
6.7 years ago by
priyankapillai130 wrote:
import java.net.*;
import java.io.*;


public class Fasta {

    public static void main(String[] args) throws IOException 
    {
       URL url = new URL("http://www.rcsb.org/pdb/download/downloadFile.do?fileFormat=FASTA&compression=NO&structureId=1GJZ");
       URLConnection con = url.openConnection();
       InputStream is =con.getInputStream();
       BufferedReader br = new BufferedReader(new InputStreamReader(is));
       String line = null;
       while ((line = br.readLine()) != null) 
        {
         writeToFile(line);
        }
    } 
    public static void writeToFile(String text)
    {
        try 
        {
            BufferedWriter bw = new BufferedWriter(new FileWriter(new File("1GJZ.fasta.txt"), true));
            bw.write(text);
            bw.newLine();
            bw.close();
        }
        catch (Exception e) {}
    }
}

This is my code that will download the Fasta File of the id mentioned. I need to retrieve the raw sequence of only the A chain.

>1GJZ:A|PDBID|CHAIN|SEQUENCE
GSMQIFVKTLTGKTITLEVEPSDTIENVKAKIQDKEGIPPDQQRLIFAGKQLE
>1GJZ:B|PDBID|CHAIN|SEQUENCE
GSMQIFVKTLTGKTITLEVEPSDTIENVKAKIQDKEGIPPDQQRLIFAGKQLE

Please help me I am badly stuck here....

ADD COMMENTlink written 6.7 years ago by priyankapillai130
1

If your sequences are spread only on one line, this could be easier approach: awk '/1GJZ:A/ { getline; print $0 }' input.fasta

ADD REPLYlink written 6.7 years ago by Biomonika (Noolean)3.1k

I recommend you edit your post or title to indicate that you're interested in getting this information out of a PDB/3S structural file - would help make it clearer what kind of "chain" you're referring to

ADD REPLYlink written 6.7 years ago by aidan-budd1.9k

do your homework yourself!

ADD REPLYlink written 6.7 years ago by Michael Dondrup46k
Please log in to add an answer.
The thread is closed. No new answers may be added.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 2151 users visited in the last hour