Entering edit mode
11.2 years ago
priyankapillai13
•
0
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.