<commit_before>package org.biojava.bio.structure.domain;

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.Writer;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.SortedSet;
import java.util.TreeSet;

import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;

import org.biojava.bio.structure.align.util.HTTPConnectionTools;
import org.xml.sax.Attributes;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;


/**
 * Class to fetch domains through the RCSB's REST API.
 * 
 * @author <NAME>
 *
 */
public class PDBDomainProvider implements DomainProvider{

	private String base = "http://www.rcsb.org/pdb/rest/";
	private int cutoff = 40; // default %id cutoff for clusters

	/**
	 * Gets a list of domain representatives for a given PDB ID.<commit_msg>Added PDBDomainParser constructor to allow alternate source URLs<commit_after>package org.biojava.bio.structure.domain;

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.Writer;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.SortedSet;
import java.util.TreeSet;

import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;

import org.biojava.bio.structure.align.util.HTTPConnectionTools;
import org.xml.sax.Attributes;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;


/**
 * Class to fetch domains through the RCSB's REST API.
 * 
 * @author <NAME>
 *
 */
public class PDBDomainProvider implements DomainProvider{
	public static final String DEFAULT_PDB_HOST = "http://www.rcsb.org";
	public static final String DEFAULT_PDB_API_URL = DEFAULT_PDB_HOST + "/pdb/rest/";

	private String base;
	private int cutoff;
	
	/**
	 */
	public PDBDomainProvider() {
		this(DEFAULT_PDB_API_URL,40);
	}
	/**
	 * @param base
	 * @param cutoff
	 */
	public PDBDomainProvider(String base, int cutoff) {
		this.base = base;
		this.cutoff = cutoff;
	}
	
	
	/**
	 * Gets a list of domain representatives for a given PDB ID.
{'fraction_non_alphanumeric': 0.1078020134228188, 'fraction_numerical': 0.0016778523489932886, 'mean_word_length': 4.719424460431655, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 14}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7154989', 'n_tokens_mistral': 793, 'n_tokens_neox': 762, 'n_words': 184}