From 5c956fdb13c8e1b5b2aa2201d665ca5b9dc73cbc Mon Sep 17 00:00:00 2001 From: Felix Simkovic Date: Mon, 30 Jan 2017 21:55:26 +0000 Subject: [PATCH] Files renamed --- docs/examples/contact_map.rst | 27 -------------- docs/examples/io.rst | 68 ----------------------------------- 2 files changed, 95 deletions(-) delete mode 100644 docs/examples/contact_map.rst delete mode 100644 docs/examples/io.rst diff --git a/docs/examples/contact_map.rst b/docs/examples/contact_map.rst deleted file mode 100644 index 4f0c5822..00000000 --- a/docs/examples/contact_map.rst +++ /dev/null @@ -1,27 +0,0 @@ -.. _example_plotting_a_map: - -Contact Map plotting -==================== - -To plot contacts in form of a contact map using ConKit, you need a contact prediction file. - -To start, you need to read the file into its hierarchy. - -.. code-block:: python - - >>> import conkit - >>> contact_h = conkit.io.read('pathto/contact.file', 'contact_format') - -With the code above, we created a :obj:`conkit.core.ContactFile` hierarchy. This allows you to store contact maps in a single hierarchy. Here, we are only interested in the first, and thus we can remove the rest. - -.. code-block:: python - - >>> contact_map = contact_h.top_map - -Finally, to plot the contact map, all we need to do is invoke the relevant function. - -.. code-block:: python - - >>> contact_map.plot_map() - -This will create a contact map plot that will be saved to your disk. diff --git a/docs/examples/io.rst b/docs/examples/io.rst deleted file mode 100644 index 70b6ca34..00000000 --- a/docs/examples/io.rst +++ /dev/null @@ -1,68 +0,0 @@ -.. _example_file_conversion: - -File Conversions -================ - -In order to convert files in ConKit, we need to use the ConKit I/O framework. - -.. note:: - ConKit I/O framework consists of three main functions that handle the relevant parsers: :func:`conkit.io.read`, :func:`conkit.io.write` and :func:`conkit.io.convert`. The latter effectively uses the former but handles everything in one step. - -.. note:: - ConKit provides a script that allows you to convert files from the command line. The script is called ``conkit.convert`` and installed automatically. - --------------------------------------------------------- - -Contact Prediction Files ------------------------- - -File reading -^^^^^^^^^^^^ - -Let's say you are designing a new pipeline and you want to manipulate your contact file. Thus, you need to have a way of reading the file into memory before you can manipulate it. - -ConKit provides the following simple syntax to do exactly that. - -.. code-block:: python - - >>> import conkit - >>> with open('query.pconsc3.txt', 'r') as f_in: - ... contact_hierarchy = conkit.io.read(f_in, 'pconsc3') - -File writing -^^^^^^^^^^^^ - -Now, you've manipulated the file from the previous example and you now want to write it back out. Look no further, this is what you need to do. - -.. code-block:: python - - >>> import conkit - >>> with open('query.pconsc3.new.txt', 'w') as f_out: - ... conkit.io.write(f_out, contact_hierarchy, 'pconsc3') - -File conversion -^^^^^^^^^^^^^^^ - -Imagine the following scenario: you have just used an online server, let's say `PconsC3`_, and you have received a contact prediction file. Now, the file in text format is little use to you and although you have a contact map, there are many cool tools that use predictions to visualise them in a protein structure. These tools rely on the official Casp format and you really don't want to convert every line manually or write a script to do it. Look no further, ConKit does this in a heartbeat. - -Assuming our PconsC3 contact file is called ``query.pconsc3.txt`` and you want to write it to a file called ``query.rr.txt``, you can convert it using the following code: - -.. code-block:: python - - >>> import conkit - >>> with open('query.pconsc3.txt', 'r') as f_in, open('query.casp.rr', 'w') as f_out: - ... conkit.io.convert(f_in, 'pconsc3', f_out, 'casprr') - -This is it, you now have converted your contact file from PconsC3 format to Casp format. - --------------------------------------------------------- - -(Multiple) Sequence Files -------------------------- - -The functions used to convert sequence files are identical to those used for contact prediction files. The only difference is the format parsed to those functions. - - -.. _PconsC3: http://pconsc3.bioinfo.se/ - -