<s> from nose . tools import ok_ , eq_ , raises , assert_list_equal <EOL> import simtk . openmm . app as app <EOL> import pdbfixer <EOL> import tempfile <EOL> import time <EOL> try : <EOL> from urllib . request import urlopen <EOL> from io import StringIO <EOL> except : <EOL> from urllib2 import urlopen <EOL> from cStringIO import StringIO <EOL> file_content = urlopen ( '<STR_LIT>' ) . read ( ) . decode ( '<STR_LIT:utf-8>' ) <EOL> def remove_chain_ids_and_verify ( chain_ids_to_remove , expected_chain_ids_remaining ) : <EOL> fixer = pdbfixer . PDBFixer ( pdbfile = StringIO ( file_content ) ) <EOL> fixer . removeChains ( chainIds = chain_ids_to_remove ) <EOL> chain_ids_remaining = [ c . id for c in fixer . topology . chains ( ) ] <EOL> assert_list_equal ( chain_ids_remaining , expected_chain_ids_remaining ) <EOL> def test_removechain_ids ( ) : <EOL> remove_chain_ids_and_verify ( [ ] , [ '<STR_LIT:B>' , '<STR_LIT:D>' , '<STR_LIT:A>' , '<STR_LIT:C>' , '<STR_LIT:B>' , '<STR_LIT:A>' ] ) <EOL> remove_chain_ids_and_verify ( [ '<STR_LIT:B>' , '<STR_LIT:D>' ] , [ '<STR_LIT:A>' , '<STR_LIT:C>' , '<STR_LIT:A>' ] ) <EOL> remove_chain_ids_and_verify ( [ '<STR_LIT:A>' , '<STR_LIT:C>' ] , [ '<STR_LIT:B>' , '<STR_LIT:D>' , '<STR_LIT:B>' ] ) <EOL> remove_chain_ids_and_verify ( [ '<STR_LIT:B>' , '<STR_LIT:A>' ] , [ '<STR_LIT:D>' , '<STR_LIT:C>' ] ) <EOL> remove_chain_ids_and_verify ( [ '<STR_LIT:B>' , '<STR_LIT:D>' , '<STR_LIT:A>' , '<STR_LIT:C>' ] , [ ] ) <EOL> def remove_chain_indices_and_verify ( chain_indices_to_remove , expected_chain_ids_remaining ) : <EOL> fixer = pdbfixer . PDBFixer ( pdbfile = StringIO ( file_content ) ) <EOL> fixer . removeChains ( chainIndices = chain_indices_to_remove ) <EOL> chain_ids_remaining = [ c . id for c in fixer . topology . chains ( ) ] <EOL> assert_list_equal ( chain_ids_remaining , expected_chain_ids_remaining ) <EOL> def test_removechain_indices ( ) : <EOL> remove_chain_indices_and_verify ( [ ] , [ '<STR_LIT:B>' , '<STR_LIT:D>' , '<STR_LIT:A>' , '<STR_LIT:C>' , '<STR_LIT:B>' , '<STR_LIT:A>' ] ) <EOL> remove_chain_indices_and_verify ( [ <NUM_LIT:0> , <NUM_LIT:1> ] , [ '<STR_LIT:A>' , '<STR_LIT:C>' , '<STR_LIT:B>' , '<STR_LIT:A>' ] ) <EOL> remove_chain_indices_and_verify ( [ <NUM_LIT:2> , <NUM_LIT:3> ] , [ '<STR_LIT:B>' , '<STR_LIT:D>' , '<STR_LIT:B>' , '<STR_LIT:A>' ] ) <EOL> remove_chain_indices_and_verify ( [ <NUM_LIT:0> , <NUM_LIT:2> ] , [ '<STR_LIT:D>' , '<STR_LIT:C>' , '<STR_LIT:B>' , '<STR_LIT:A>' ] ) <EOL> remove_chain_indices_and_verify ( [ <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:4> , <NUM_LIT:5> ] , [ ] ) </s>
