diff --git a/.gitignore b/.gitignore index bfe05739d4822fa33b071bdd21d39ac3cb90940e..16926746db9b8f735eaac10e5b5fbd44c367313f 100644 --- a/.gitignore +++ b/.gitignore @@ -156,4 +156,7 @@ dmypy.json # Cython debug symbols cython_debug/ +# VSCode +.vscode/ + # End of https://www.toptal.com/developers/gitignore/api/python,git \ No newline at end of file diff --git a/plots/reads_plot_220106_1.svg b/plots/reads_plot_220106_1.svg new file mode 100644 index 0000000000000000000000000000000000000000..96192c54ec6b97e79d4774868b612757ebc10303 --- /dev/null +++ b/plots/reads_plot_220106_1.svg @@ -0,0 +1,866 @@ +<?xml version="1.0" encoding="utf-8" standalone="no"?> +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" + "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> +<!-- Created with matplotlib (https://matplotlib.org/) --> +<svg height="345.6pt" version="1.1" viewBox="0 0 460.8 345.6" width="460.8pt" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> + <metadata> + <rdf:RDF xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> + <cc:Work> + <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/> + <dc:date>2022-01-06T20:59:13.732146</dc:date> + <dc:format>image/svg+xml</dc:format> + <dc:creator> + <cc:Agent> + <dc:title>Matplotlib v3.3.2, https://matplotlib.org/</dc:title> + </cc:Agent> + </dc:creator> + </cc:Work> + </rdf:RDF> + </metadata> + <defs> + <style type="text/css">*{stroke-linecap:butt;stroke-linejoin:round;}</style> + </defs> + <g id="figure_1"> + <g id="patch_1"> + <path d="M 0 345.6 +L 460.8 345.6 +L 460.8 0 +L 0 0 +z +" style="fill:#ffffff;"/> + </g> + <g id="axes_1"> + <g id="patch_2"> + <path d="M 57.6 307.584 +L 414.72 307.584 +L 414.72 41.472 +L 57.6 41.472 +z +" style="fill:#ffffff;"/> + </g> + <g id="patch_3"> + <path clip-path="url(#p07942fdf52)" d="M 73.832727 307.584 +L 112.02738 307.584 +L 112.02738 307.584 +L 73.832727 307.584 +z +" style="fill:#1f77b4;"/> + </g> + <g id="patch_4"> + <path clip-path="url(#p07942fdf52)" d="M 169.319358 307.584 +L 207.514011 307.584 +L 207.514011 72.550257 +L 169.319358 72.550257 +z +" style="fill:#1f77b4;"/> + </g> + <g id="patch_5"> + <path clip-path="url(#p07942fdf52)" d="M 264.805989 307.584 +L 303.000642 307.584 +L 303.000642 281.532067 +L 264.805989 281.532067 +z +" style="fill:#1f77b4;"/> + </g> + <g id="patch_6"> + <path clip-path="url(#p07942fdf52)" d="M 360.29262 307.584 +L 398.487273 307.584 +L 398.487273 130.883933 +L 360.29262 130.883933 +z +" style="fill:#1f77b4;"/> + </g> + <g id="patch_7"> + <path clip-path="url(#p07942fdf52)" d="M 73.832727 307.584 +L 112.02738 307.584 +L 112.02738 307.584 +L 73.832727 307.584 +z +" style="fill:#ff7f0e;"/> + </g> + <g id="patch_8"> + <path clip-path="url(#p07942fdf52)" d="M 169.319358 307.584 +L 207.514011 307.584 +L 207.514011 137.113743 +L 169.319358 137.113743 +z +" style="fill:#ff7f0e;"/> + </g> + <g id="patch_9"> + <path clip-path="url(#p07942fdf52)" d="M 264.805989 307.584 +L 303.000642 307.584 +L 303.000642 303.902749 +L 264.805989 303.902749 +z +" style="fill:#ff7f0e;"/> + </g> + <g id="patch_10"> + <path clip-path="url(#p07942fdf52)" d="M 360.29262 307.584 +L 398.487273 307.584 +L 398.487273 54.144 +L 360.29262 54.144 +z +" style="fill:#ff7f0e;"/> + </g> + <g id="patch_11"> + <path clip-path="url(#p07942fdf52)" d="M 73.832727 307.584 +L 112.02738 307.584 +L 112.02738 307.584 +L 73.832727 307.584 +z +" style="fill:#2ca02c;"/> + </g> + <g id="patch_12"> + <path clip-path="url(#p07942fdf52)" d="M 169.319358 307.584 +L 207.514011 307.584 +L 207.514011 64.338235 +L 169.319358 64.338235 +z +" style="fill:#2ca02c;"/> + </g> + <g id="patch_13"> + <path clip-path="url(#p07942fdf52)" d="M 264.805989 307.584 +L 303.000642 307.584 +L 303.000642 286.912358 +L 264.805989 286.912358 +z +" style="fill:#2ca02c;"/> + </g> + <g id="patch_14"> + <path clip-path="url(#p07942fdf52)" d="M 360.29262 307.584 +L 398.487273 307.584 +L 398.487273 61.22333 +L 360.29262 61.22333 +z +" style="fill:#2ca02c;"/> + </g> + <g id="matplotlib.axis_1"> + <g id="xtick_1"> + <g id="line2d_1"> + <defs> + <path d="M 0 0 +L 0 3.5 +" id="mb3344cd381" style="stroke:#000000;stroke-width:0.8;"/> + </defs> + <g> + <use style="stroke:#000000;stroke-width:0.8;" x="92.930053" xlink:href="#mb3344cd381" y="307.584"/> + </g> + </g> + <g id="text_1"> + <!-- Read 1 --> + <g transform="translate(75.595678 322.182437)scale(0.1 -0.1)"> + <defs> + <path d="M 44.390625 34.1875 +Q 47.5625 33.109375 50.5625 29.59375 +Q 53.5625 26.078125 56.59375 19.921875 +L 66.609375 0 +L 56 0 +L 46.6875 18.703125 +Q 43.0625 26.03125 39.671875 28.421875 +Q 36.28125 30.8125 30.421875 30.8125 +L 19.671875 30.8125 +L 19.671875 0 +L 9.8125 0 +L 9.8125 72.90625 +L 32.078125 72.90625 +Q 44.578125 72.90625 50.734375 67.671875 +Q 56.890625 62.453125 56.890625 51.90625 +Q 56.890625 45.015625 53.6875 40.46875 +Q 50.484375 35.9375 44.390625 34.1875 +z +M 19.671875 64.796875 +L 19.671875 38.921875 +L 32.078125 38.921875 +Q 39.203125 38.921875 42.84375 42.21875 +Q 46.484375 45.515625 46.484375 51.90625 +Q 46.484375 58.296875 42.84375 61.546875 +Q 39.203125 64.796875 32.078125 64.796875 +z +" id="DejaVuSans-82"/> + <path d="M 56.203125 29.59375 +L 56.203125 25.203125 +L 14.890625 25.203125 +Q 15.484375 15.921875 20.484375 11.0625 +Q 25.484375 6.203125 34.421875 6.203125 +Q 39.59375 6.203125 44.453125 7.46875 +Q 49.3125 8.734375 54.109375 11.28125 +L 54.109375 2.78125 +Q 49.265625 0.734375 44.1875 -0.34375 +Q 39.109375 -1.421875 33.890625 -1.421875 +Q 20.796875 -1.421875 13.15625 6.1875 +Q 5.515625 13.8125 5.515625 26.8125 +Q 5.515625 40.234375 12.765625 48.109375 +Q 20.015625 56 32.328125 56 +Q 43.359375 56 49.78125 48.890625 +Q 56.203125 41.796875 56.203125 29.59375 +z +M 47.21875 32.234375 +Q 47.125 39.59375 43.09375 43.984375 +Q 39.0625 48.390625 32.421875 48.390625 +Q 24.90625 48.390625 20.390625 44.140625 +Q 15.875 39.890625 15.1875 32.171875 +z +" id="DejaVuSans-101"/> + <path d="M 34.28125 27.484375 +Q 23.390625 27.484375 19.1875 25 +Q 14.984375 22.515625 14.984375 16.5 +Q 14.984375 11.71875 18.140625 8.90625 +Q 21.296875 6.109375 26.703125 6.109375 +Q 34.1875 6.109375 38.703125 11.40625 +Q 43.21875 16.703125 43.21875 25.484375 +L 43.21875 27.484375 +z +M 52.203125 31.203125 +L 52.203125 0 +L 43.21875 0 +L 43.21875 8.296875 +Q 40.140625 3.328125 35.546875 0.953125 +Q 30.953125 -1.421875 24.3125 -1.421875 +Q 15.921875 -1.421875 10.953125 3.296875 +Q 6 8.015625 6 15.921875 +Q 6 25.140625 12.171875 29.828125 +Q 18.359375 34.515625 30.609375 34.515625 +L 43.21875 34.515625 +L 43.21875 35.40625 +Q 43.21875 41.609375 39.140625 45 +Q 35.0625 48.390625 27.6875 48.390625 +Q 23 48.390625 18.546875 47.265625 +Q 14.109375 46.140625 10.015625 43.890625 +L 10.015625 52.203125 +Q 14.9375 54.109375 19.578125 55.046875 +Q 24.21875 56 28.609375 56 +Q 40.484375 56 46.34375 49.84375 +Q 52.203125 43.703125 52.203125 31.203125 +z +" id="DejaVuSans-97"/> + <path d="M 45.40625 46.390625 +L 45.40625 75.984375 +L 54.390625 75.984375 +L 54.390625 0 +L 45.40625 0 +L 45.40625 8.203125 +Q 42.578125 3.328125 38.25 0.953125 +Q 33.9375 -1.421875 27.875 -1.421875 +Q 17.96875 -1.421875 11.734375 6.484375 +Q 5.515625 14.40625 5.515625 27.296875 +Q 5.515625 40.1875 11.734375 48.09375 +Q 17.96875 56 27.875 56 +Q 33.9375 56 38.25 53.625 +Q 42.578125 51.265625 45.40625 46.390625 +z +M 14.796875 27.296875 +Q 14.796875 17.390625 18.875 11.75 +Q 22.953125 6.109375 30.078125 6.109375 +Q 37.203125 6.109375 41.296875 11.75 +Q 45.40625 17.390625 45.40625 27.296875 +Q 45.40625 37.203125 41.296875 42.84375 +Q 37.203125 48.484375 30.078125 48.484375 +Q 22.953125 48.484375 18.875 42.84375 +Q 14.796875 37.203125 14.796875 27.296875 +z +" id="DejaVuSans-100"/> + <path id="DejaVuSans-32"/> + <path d="M 12.40625 8.296875 +L 28.515625 8.296875 +L 28.515625 63.921875 +L 10.984375 60.40625 +L 10.984375 69.390625 +L 28.421875 72.90625 +L 38.28125 72.90625 +L 38.28125 8.296875 +L 54.390625 8.296875 +L 54.390625 0 +L 12.40625 0 +z +" id="DejaVuSans-49"/> + </defs> + <use xlink:href="#DejaVuSans-82"/> + <use x="64.982422" xlink:href="#DejaVuSans-101"/> + <use x="126.505859" xlink:href="#DejaVuSans-97"/> + <use x="187.785156" xlink:href="#DejaVuSans-100"/> + <use x="251.261719" xlink:href="#DejaVuSans-32"/> + <use x="283.048828" xlink:href="#DejaVuSans-49"/> + </g> + </g> + </g> + <g id="xtick_2"> + <g id="line2d_2"> + <g> + <use style="stroke:#000000;stroke-width:0.8;" x="188.416684" xlink:href="#mb3344cd381" y="307.584"/> + </g> + </g> + <g id="text_2"> + <!-- Read 2 --> + <g transform="translate(171.082309 322.182437)scale(0.1 -0.1)"> + <defs> + <path d="M 19.1875 8.296875 +L 53.609375 8.296875 +L 53.609375 0 +L 7.328125 0 +L 7.328125 8.296875 +Q 12.9375 14.109375 22.625 23.890625 +Q 32.328125 33.6875 34.8125 36.53125 +Q 39.546875 41.84375 41.421875 45.53125 +Q 43.3125 49.21875 43.3125 52.78125 +Q 43.3125 58.59375 39.234375 62.25 +Q 35.15625 65.921875 28.609375 65.921875 +Q 23.96875 65.921875 18.8125 64.3125 +Q 13.671875 62.703125 7.8125 59.421875 +L 7.8125 69.390625 +Q 13.765625 71.78125 18.9375 73 +Q 24.125 74.21875 28.421875 74.21875 +Q 39.75 74.21875 46.484375 68.546875 +Q 53.21875 62.890625 53.21875 53.421875 +Q 53.21875 48.921875 51.53125 44.890625 +Q 49.859375 40.875 45.40625 35.40625 +Q 44.1875 33.984375 37.640625 27.21875 +Q 31.109375 20.453125 19.1875 8.296875 +z +" id="DejaVuSans-50"/> + </defs> + <use xlink:href="#DejaVuSans-82"/> + <use x="64.982422" xlink:href="#DejaVuSans-101"/> + <use x="126.505859" xlink:href="#DejaVuSans-97"/> + <use x="187.785156" xlink:href="#DejaVuSans-100"/> + <use x="251.261719" xlink:href="#DejaVuSans-32"/> + <use x="283.048828" xlink:href="#DejaVuSans-50"/> + </g> + </g> + </g> + <g id="xtick_3"> + <g id="line2d_3"> + <g> + <use style="stroke:#000000;stroke-width:0.8;" x="283.903316" xlink:href="#mb3344cd381" y="307.584"/> + </g> + </g> + <g id="text_3"> + <!-- Read 3 --> + <g transform="translate(266.568941 322.182437)scale(0.1 -0.1)"> + <defs> + <path d="M 40.578125 39.3125 +Q 47.65625 37.796875 51.625 33 +Q 55.609375 28.21875 55.609375 21.1875 +Q 55.609375 10.40625 48.1875 4.484375 +Q 40.765625 -1.421875 27.09375 -1.421875 +Q 22.515625 -1.421875 17.65625 -0.515625 +Q 12.796875 0.390625 7.625 2.203125 +L 7.625 11.71875 +Q 11.71875 9.328125 16.59375 8.109375 +Q 21.484375 6.890625 26.8125 6.890625 +Q 36.078125 6.890625 40.9375 10.546875 +Q 45.796875 14.203125 45.796875 21.1875 +Q 45.796875 27.640625 41.28125 31.265625 +Q 36.765625 34.90625 28.71875 34.90625 +L 20.21875 34.90625 +L 20.21875 43.015625 +L 29.109375 43.015625 +Q 36.375 43.015625 40.234375 45.921875 +Q 44.09375 48.828125 44.09375 54.296875 +Q 44.09375 59.90625 40.109375 62.90625 +Q 36.140625 65.921875 28.71875 65.921875 +Q 24.65625 65.921875 20.015625 65.03125 +Q 15.375 64.15625 9.8125 62.3125 +L 9.8125 71.09375 +Q 15.4375 72.65625 20.34375 73.4375 +Q 25.25 74.21875 29.59375 74.21875 +Q 40.828125 74.21875 47.359375 69.109375 +Q 53.90625 64.015625 53.90625 55.328125 +Q 53.90625 49.265625 50.4375 45.09375 +Q 46.96875 40.921875 40.578125 39.3125 +z +" id="DejaVuSans-51"/> + </defs> + <use xlink:href="#DejaVuSans-82"/> + <use x="64.982422" xlink:href="#DejaVuSans-101"/> + <use x="126.505859" xlink:href="#DejaVuSans-97"/> + <use x="187.785156" xlink:href="#DejaVuSans-100"/> + <use x="251.261719" xlink:href="#DejaVuSans-32"/> + <use x="283.048828" xlink:href="#DejaVuSans-51"/> + </g> + </g> + </g> + <g id="xtick_4"> + <g id="line2d_4"> + <g> + <use style="stroke:#000000;stroke-width:0.8;" x="379.389947" xlink:href="#mb3344cd381" y="307.584"/> + </g> + </g> + <g id="text_4"> + <!-- Read 4 --> + <g transform="translate(362.055572 322.182437)scale(0.1 -0.1)"> + <defs> + <path d="M 37.796875 64.3125 +L 12.890625 25.390625 +L 37.796875 25.390625 +z +M 35.203125 72.90625 +L 47.609375 72.90625 +L 47.609375 25.390625 +L 58.015625 25.390625 +L 58.015625 17.1875 +L 47.609375 17.1875 +L 47.609375 0 +L 37.796875 0 +L 37.796875 17.1875 +L 4.890625 17.1875 +L 4.890625 26.703125 +z +" id="DejaVuSans-52"/> + </defs> + <use xlink:href="#DejaVuSans-82"/> + <use x="64.982422" xlink:href="#DejaVuSans-101"/> + <use x="126.505859" xlink:href="#DejaVuSans-97"/> + <use x="187.785156" xlink:href="#DejaVuSans-100"/> + <use x="251.261719" xlink:href="#DejaVuSans-32"/> + <use x="283.048828" xlink:href="#DejaVuSans-52"/> + </g> + </g> + </g> + </g> + <g id="matplotlib.axis_2"> + <g id="ytick_1"> + <g id="line2d_5"> + <defs> + <path d="M 0 0 +L -3.5 0 +" id="mcadcbacc21" style="stroke:#000000;stroke-width:0.8;"/> + </defs> + <g> + <use style="stroke:#000000;stroke-width:0.8;" x="57.6" xlink:href="#mcadcbacc21" y="307.584"/> + </g> + </g> + <g id="text_5"> + <!-- 0 --> + <g transform="translate(44.2375 311.383219)scale(0.1 -0.1)"> + <defs> + <path d="M 31.78125 66.40625 +Q 24.171875 66.40625 20.328125 58.90625 +Q 16.5 51.421875 16.5 36.375 +Q 16.5 21.390625 20.328125 13.890625 +Q 24.171875 6.390625 31.78125 6.390625 +Q 39.453125 6.390625 43.28125 13.890625 +Q 47.125 21.390625 47.125 36.375 +Q 47.125 51.421875 43.28125 58.90625 +Q 39.453125 66.40625 31.78125 66.40625 +z +M 31.78125 74.21875 +Q 44.046875 74.21875 50.515625 64.515625 +Q 56.984375 54.828125 56.984375 36.375 +Q 56.984375 17.96875 50.515625 8.265625 +Q 44.046875 -1.421875 31.78125 -1.421875 +Q 19.53125 -1.421875 13.0625 8.265625 +Q 6.59375 17.96875 6.59375 36.375 +Q 6.59375 54.828125 13.0625 64.515625 +Q 19.53125 74.21875 31.78125 74.21875 +z +" id="DejaVuSans-48"/> + </defs> + <use xlink:href="#DejaVuSans-48"/> + </g> + </g> + </g> + <g id="ytick_2"> + <g id="line2d_6"> + <g> + <use style="stroke:#000000;stroke-width:0.8;" x="57.6" xlink:href="#mcadcbacc21" y="250.949363"/> + </g> + </g> + <g id="text_6"> + <!-- 200 --> + <g transform="translate(31.5125 254.748582)scale(0.1 -0.1)"> + <use xlink:href="#DejaVuSans-50"/> + <use x="63.623047" xlink:href="#DejaVuSans-48"/> + <use x="127.246094" xlink:href="#DejaVuSans-48"/> + </g> + </g> + </g> + <g id="ytick_3"> + <g id="line2d_7"> + <g> + <use style="stroke:#000000;stroke-width:0.8;" x="57.6" xlink:href="#mcadcbacc21" y="194.314726"/> + </g> + </g> + <g id="text_7"> + <!-- 400 --> + <g transform="translate(31.5125 198.113945)scale(0.1 -0.1)"> + <use xlink:href="#DejaVuSans-52"/> + <use x="63.623047" xlink:href="#DejaVuSans-48"/> + <use x="127.246094" xlink:href="#DejaVuSans-48"/> + </g> + </g> + </g> + <g id="ytick_4"> + <g id="line2d_8"> + <g> + <use style="stroke:#000000;stroke-width:0.8;" x="57.6" xlink:href="#mcadcbacc21" y="137.680089"/> + </g> + </g> + <g id="text_8"> + <!-- 600 --> + <g transform="translate(31.5125 141.479308)scale(0.1 -0.1)"> + <defs> + <path d="M 33.015625 40.375 +Q 26.375 40.375 22.484375 35.828125 +Q 18.609375 31.296875 18.609375 23.390625 +Q 18.609375 15.53125 22.484375 10.953125 +Q 26.375 6.390625 33.015625 6.390625 +Q 39.65625 6.390625 43.53125 10.953125 +Q 47.40625 15.53125 47.40625 23.390625 +Q 47.40625 31.296875 43.53125 35.828125 +Q 39.65625 40.375 33.015625 40.375 +z +M 52.59375 71.296875 +L 52.59375 62.3125 +Q 48.875 64.0625 45.09375 64.984375 +Q 41.3125 65.921875 37.59375 65.921875 +Q 27.828125 65.921875 22.671875 59.328125 +Q 17.53125 52.734375 16.796875 39.40625 +Q 19.671875 43.65625 24.015625 45.921875 +Q 28.375 48.1875 33.59375 48.1875 +Q 44.578125 48.1875 50.953125 41.515625 +Q 57.328125 34.859375 57.328125 23.390625 +Q 57.328125 12.15625 50.6875 5.359375 +Q 44.046875 -1.421875 33.015625 -1.421875 +Q 20.359375 -1.421875 13.671875 8.265625 +Q 6.984375 17.96875 6.984375 36.375 +Q 6.984375 53.65625 15.1875 63.9375 +Q 23.390625 74.21875 37.203125 74.21875 +Q 40.921875 74.21875 44.703125 73.484375 +Q 48.484375 72.75 52.59375 71.296875 +z +" id="DejaVuSans-54"/> + </defs> + <use xlink:href="#DejaVuSans-54"/> + <use x="63.623047" xlink:href="#DejaVuSans-48"/> + <use x="127.246094" xlink:href="#DejaVuSans-48"/> + </g> + </g> + </g> + <g id="ytick_5"> + <g id="line2d_9"> + <g> + <use style="stroke:#000000;stroke-width:0.8;" x="57.6" xlink:href="#mcadcbacc21" y="81.045453"/> + </g> + </g> + <g id="text_9"> + <!-- 800 --> + <g transform="translate(31.5125 84.844671)scale(0.1 -0.1)"> + <defs> + <path d="M 31.78125 34.625 +Q 24.75 34.625 20.71875 30.859375 +Q 16.703125 27.09375 16.703125 20.515625 +Q 16.703125 13.921875 20.71875 10.15625 +Q 24.75 6.390625 31.78125 6.390625 +Q 38.8125 6.390625 42.859375 10.171875 +Q 46.921875 13.96875 46.921875 20.515625 +Q 46.921875 27.09375 42.890625 30.859375 +Q 38.875 34.625 31.78125 34.625 +z +M 21.921875 38.8125 +Q 15.578125 40.375 12.03125 44.71875 +Q 8.5 49.078125 8.5 55.328125 +Q 8.5 64.0625 14.71875 69.140625 +Q 20.953125 74.21875 31.78125 74.21875 +Q 42.671875 74.21875 48.875 69.140625 +Q 55.078125 64.0625 55.078125 55.328125 +Q 55.078125 49.078125 51.53125 44.71875 +Q 48 40.375 41.703125 38.8125 +Q 48.828125 37.15625 52.796875 32.3125 +Q 56.78125 27.484375 56.78125 20.515625 +Q 56.78125 9.90625 50.3125 4.234375 +Q 43.84375 -1.421875 31.78125 -1.421875 +Q 19.734375 -1.421875 13.25 4.234375 +Q 6.78125 9.90625 6.78125 20.515625 +Q 6.78125 27.484375 10.78125 32.3125 +Q 14.796875 37.15625 21.921875 38.8125 +z +M 18.3125 54.390625 +Q 18.3125 48.734375 21.84375 45.5625 +Q 25.390625 42.390625 31.78125 42.390625 +Q 38.140625 42.390625 41.71875 45.5625 +Q 45.3125 48.734375 45.3125 54.390625 +Q 45.3125 60.0625 41.71875 63.234375 +Q 38.140625 66.40625 31.78125 66.40625 +Q 25.390625 66.40625 21.84375 63.234375 +Q 18.3125 60.0625 18.3125 54.390625 +z +" id="DejaVuSans-56"/> + </defs> + <use xlink:href="#DejaVuSans-56"/> + <use x="63.623047" xlink:href="#DejaVuSans-48"/> + <use x="127.246094" xlink:href="#DejaVuSans-48"/> + </g> + </g> + </g> + </g> + <g id="patch_15"> + <path d="M 57.6 307.584 +L 57.6 41.472 +" style="fill:none;stroke:#000000;stroke-linecap:square;stroke-linejoin:miter;stroke-width:0.8;"/> + </g> + <g id="patch_16"> + <path d="M 414.72 307.584 +L 414.72 41.472 +" style="fill:none;stroke:#000000;stroke-linecap:square;stroke-linejoin:miter;stroke-width:0.8;"/> + </g> + <g id="patch_17"> + <path d="M 57.6 307.584 +L 414.72 307.584 +" style="fill:none;stroke:#000000;stroke-linecap:square;stroke-linejoin:miter;stroke-width:0.8;"/> + </g> + <g id="patch_18"> + <path d="M 57.6 41.472 +L 414.72 41.472 +" style="fill:none;stroke:#000000;stroke-linecap:square;stroke-linejoin:miter;stroke-width:0.8;"/> + </g> + <g id="text_10"> + <!-- Counts for GENE3 --> + <g transform="translate(182.614688 35.472)scale(0.12 -0.12)"> + <defs> + <path d="M 64.40625 67.28125 +L 64.40625 56.890625 +Q 59.421875 61.53125 53.78125 63.8125 +Q 48.140625 66.109375 41.796875 66.109375 +Q 29.296875 66.109375 22.65625 58.46875 +Q 16.015625 50.828125 16.015625 36.375 +Q 16.015625 21.96875 22.65625 14.328125 +Q 29.296875 6.6875 41.796875 6.6875 +Q 48.140625 6.6875 53.78125 8.984375 +Q 59.421875 11.28125 64.40625 15.921875 +L 64.40625 5.609375 +Q 59.234375 2.09375 53.4375 0.328125 +Q 47.65625 -1.421875 41.21875 -1.421875 +Q 24.65625 -1.421875 15.125 8.703125 +Q 5.609375 18.84375 5.609375 36.375 +Q 5.609375 53.953125 15.125 64.078125 +Q 24.65625 74.21875 41.21875 74.21875 +Q 47.75 74.21875 53.53125 72.484375 +Q 59.328125 70.75 64.40625 67.28125 +z +" id="DejaVuSans-67"/> + <path d="M 30.609375 48.390625 +Q 23.390625 48.390625 19.1875 42.75 +Q 14.984375 37.109375 14.984375 27.296875 +Q 14.984375 17.484375 19.15625 11.84375 +Q 23.34375 6.203125 30.609375 6.203125 +Q 37.796875 6.203125 41.984375 11.859375 +Q 46.1875 17.53125 46.1875 27.296875 +Q 46.1875 37.015625 41.984375 42.703125 +Q 37.796875 48.390625 30.609375 48.390625 +z +M 30.609375 56 +Q 42.328125 56 49.015625 48.375 +Q 55.71875 40.765625 55.71875 27.296875 +Q 55.71875 13.875 49.015625 6.21875 +Q 42.328125 -1.421875 30.609375 -1.421875 +Q 18.84375 -1.421875 12.171875 6.21875 +Q 5.515625 13.875 5.515625 27.296875 +Q 5.515625 40.765625 12.171875 48.375 +Q 18.84375 56 30.609375 56 +z +" id="DejaVuSans-111"/> + <path d="M 8.5 21.578125 +L 8.5 54.6875 +L 17.484375 54.6875 +L 17.484375 21.921875 +Q 17.484375 14.15625 20.5 10.265625 +Q 23.53125 6.390625 29.59375 6.390625 +Q 36.859375 6.390625 41.078125 11.03125 +Q 45.3125 15.671875 45.3125 23.6875 +L 45.3125 54.6875 +L 54.296875 54.6875 +L 54.296875 0 +L 45.3125 0 +L 45.3125 8.40625 +Q 42.046875 3.421875 37.71875 1 +Q 33.40625 -1.421875 27.6875 -1.421875 +Q 18.265625 -1.421875 13.375 4.4375 +Q 8.5 10.296875 8.5 21.578125 +z +M 31.109375 56 +z +" id="DejaVuSans-117"/> + <path d="M 54.890625 33.015625 +L 54.890625 0 +L 45.90625 0 +L 45.90625 32.71875 +Q 45.90625 40.484375 42.875 44.328125 +Q 39.84375 48.1875 33.796875 48.1875 +Q 26.515625 48.1875 22.3125 43.546875 +Q 18.109375 38.921875 18.109375 30.90625 +L 18.109375 0 +L 9.078125 0 +L 9.078125 54.6875 +L 18.109375 54.6875 +L 18.109375 46.1875 +Q 21.34375 51.125 25.703125 53.5625 +Q 30.078125 56 35.796875 56 +Q 45.21875 56 50.046875 50.171875 +Q 54.890625 44.34375 54.890625 33.015625 +z +" id="DejaVuSans-110"/> + <path d="M 18.3125 70.21875 +L 18.3125 54.6875 +L 36.8125 54.6875 +L 36.8125 47.703125 +L 18.3125 47.703125 +L 18.3125 18.015625 +Q 18.3125 11.328125 20.140625 9.421875 +Q 21.96875 7.515625 27.59375 7.515625 +L 36.8125 7.515625 +L 36.8125 0 +L 27.59375 0 +Q 17.1875 0 13.234375 3.875 +Q 9.28125 7.765625 9.28125 18.015625 +L 9.28125 47.703125 +L 2.6875 47.703125 +L 2.6875 54.6875 +L 9.28125 54.6875 +L 9.28125 70.21875 +z +" id="DejaVuSans-116"/> + <path d="M 44.28125 53.078125 +L 44.28125 44.578125 +Q 40.484375 46.53125 36.375 47.5 +Q 32.28125 48.484375 27.875 48.484375 +Q 21.1875 48.484375 17.84375 46.4375 +Q 14.5 44.390625 14.5 40.28125 +Q 14.5 37.15625 16.890625 35.375 +Q 19.28125 33.59375 26.515625 31.984375 +L 29.59375 31.296875 +Q 39.15625 29.25 43.1875 25.515625 +Q 47.21875 21.78125 47.21875 15.09375 +Q 47.21875 7.46875 41.1875 3.015625 +Q 35.15625 -1.421875 24.609375 -1.421875 +Q 20.21875 -1.421875 15.453125 -0.5625 +Q 10.6875 0.296875 5.421875 2 +L 5.421875 11.28125 +Q 10.40625 8.6875 15.234375 7.390625 +Q 20.0625 6.109375 24.8125 6.109375 +Q 31.15625 6.109375 34.5625 8.28125 +Q 37.984375 10.453125 37.984375 14.40625 +Q 37.984375 18.0625 35.515625 20.015625 +Q 33.0625 21.96875 24.703125 23.78125 +L 21.578125 24.515625 +Q 13.234375 26.265625 9.515625 29.90625 +Q 5.8125 33.546875 5.8125 39.890625 +Q 5.8125 47.609375 11.28125 51.796875 +Q 16.75 56 26.8125 56 +Q 31.78125 56 36.171875 55.265625 +Q 40.578125 54.546875 44.28125 53.078125 +z +" id="DejaVuSans-115"/> + <path d="M 37.109375 75.984375 +L 37.109375 68.5 +L 28.515625 68.5 +Q 23.6875 68.5 21.796875 66.546875 +Q 19.921875 64.59375 19.921875 59.515625 +L 19.921875 54.6875 +L 34.71875 54.6875 +L 34.71875 47.703125 +L 19.921875 47.703125 +L 19.921875 0 +L 10.890625 0 +L 10.890625 47.703125 +L 2.296875 47.703125 +L 2.296875 54.6875 +L 10.890625 54.6875 +L 10.890625 58.5 +Q 10.890625 67.625 15.140625 71.796875 +Q 19.390625 75.984375 28.609375 75.984375 +z +" id="DejaVuSans-102"/> + <path d="M 41.109375 46.296875 +Q 39.59375 47.171875 37.8125 47.578125 +Q 36.03125 48 33.890625 48 +Q 26.265625 48 22.1875 43.046875 +Q 18.109375 38.09375 18.109375 28.8125 +L 18.109375 0 +L 9.078125 0 +L 9.078125 54.6875 +L 18.109375 54.6875 +L 18.109375 46.1875 +Q 20.953125 51.171875 25.484375 53.578125 +Q 30.03125 56 36.53125 56 +Q 37.453125 56 38.578125 55.875 +Q 39.703125 55.765625 41.0625 55.515625 +z +" id="DejaVuSans-114"/> + <path d="M 59.515625 10.40625 +L 59.515625 29.984375 +L 43.40625 29.984375 +L 43.40625 38.09375 +L 69.28125 38.09375 +L 69.28125 6.78125 +Q 63.578125 2.734375 56.6875 0.65625 +Q 49.8125 -1.421875 42 -1.421875 +Q 24.90625 -1.421875 15.25 8.5625 +Q 5.609375 18.5625 5.609375 36.375 +Q 5.609375 54.25 15.25 64.234375 +Q 24.90625 74.21875 42 74.21875 +Q 49.125 74.21875 55.546875 72.453125 +Q 61.96875 70.703125 67.390625 67.28125 +L 67.390625 56.78125 +Q 61.921875 61.421875 55.765625 63.765625 +Q 49.609375 66.109375 42.828125 66.109375 +Q 29.4375 66.109375 22.71875 58.640625 +Q 16.015625 51.171875 16.015625 36.375 +Q 16.015625 21.625 22.71875 14.15625 +Q 29.4375 6.6875 42.828125 6.6875 +Q 48.046875 6.6875 52.140625 7.59375 +Q 56.25 8.5 59.515625 10.40625 +z +" id="DejaVuSans-71"/> + <path d="M 9.8125 72.90625 +L 55.90625 72.90625 +L 55.90625 64.59375 +L 19.671875 64.59375 +L 19.671875 43.015625 +L 54.390625 43.015625 +L 54.390625 34.71875 +L 19.671875 34.71875 +L 19.671875 8.296875 +L 56.78125 8.296875 +L 56.78125 0 +L 9.8125 0 +z +" id="DejaVuSans-69"/> + <path d="M 9.8125 72.90625 +L 23.09375 72.90625 +L 55.421875 11.921875 +L 55.421875 72.90625 +L 64.984375 72.90625 +L 64.984375 0 +L 51.703125 0 +L 19.390625 60.984375 +L 19.390625 0 +L 9.8125 0 +z +" id="DejaVuSans-78"/> + </defs> + <use xlink:href="#DejaVuSans-67"/> + <use x="69.824219" xlink:href="#DejaVuSans-111"/> + <use x="131.005859" xlink:href="#DejaVuSans-117"/> + <use x="194.384766" xlink:href="#DejaVuSans-110"/> + <use x="257.763672" xlink:href="#DejaVuSans-116"/> + <use x="296.972656" xlink:href="#DejaVuSans-115"/> + <use x="349.072266" xlink:href="#DejaVuSans-32"/> + <use x="380.859375" xlink:href="#DejaVuSans-102"/> + <use x="416.064453" xlink:href="#DejaVuSans-111"/> + <use x="477.246094" xlink:href="#DejaVuSans-114"/> + <use x="518.359375" xlink:href="#DejaVuSans-32"/> + <use x="550.146484" xlink:href="#DejaVuSans-71"/> + <use x="627.636719" xlink:href="#DejaVuSans-69"/> + <use x="690.820312" xlink:href="#DejaVuSans-78"/> + <use x="765.625" xlink:href="#DejaVuSans-69"/> + <use x="828.808594" xlink:href="#DejaVuSans-51"/> + </g> + </g> + </g> + </g> + <defs> + <clipPath id="p07942fdf52"> + <rect height="266.112" width="357.12" x="57.6" y="41.472"/> + </clipPath> + </defs> +</svg> diff --git a/requirements.txt b/requirements.txt index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..6ccafc3f904ba0d6ffda0fdc2802e0d6a59a3832 100644 --- a/requirements.txt +++ b/requirements.txt @@ -0,0 +1 @@ +matplotlib diff --git a/requirements_dev.txt b/requirements_dev.txt index 6352bb595442a949b538aad7e88324dede15c7b9..1240dae7dc476182f595151f5ac823a9e2bdddf4 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -3,4 +3,5 @@ flake8 flake8-docstrings mypy pandas -pytest \ No newline at end of file +pytest +matplotlib diff --git a/src/cli_plot_read_counts.py b/src/cli_plot_read_counts.py new file mode 100644 index 0000000000000000000000000000000000000000..915075d191c1790267698d2bc5391567ca10aa70 --- /dev/null +++ b/src/cli_plot_read_counts.py @@ -0,0 +1,35 @@ +"""CLI for plot_read_counts function.""" + +import argparse +import logging + +from plot_read_counts import plot_read_counts + + +def main(): + r"""CLI for plot_read_counts. + + This cli is used to access the functionality of plot_read_counts, + taking in a path of csv files, a gene ID, and an optional save + file name. + + Typical example usage: + + cli_plot_read_counts.py '../tests/resources' GENE1 '../test/PLSe1writeTarget.test' + """ + parser = argparse.ArgumentParser( + description='number of transcripts to sample') + parser.add_argument('file_path', action='store', + type=str, help='path to gene count .csv files') + parser.add_argument('gene_id', action='store', + type=str, help='gene ID of which to plot counts') + argsin = parser.parse_args() + + logging.basicConfig(format='[%(asctime)s: %(levelname)s] "%(module)s" %(message)s', + level=logging.INFO) + + plot_read_counts(argsin.file_path, argsin.gene_id) + + +if __name__ == "__main__": + main() diff --git a/src/plot_read_counts.py b/src/plot_read_counts.py index c32d160f11cf6201741005cf99858577fd766265..31fae3c0f08f6332a56db557441f7cb775245a0b 100644 --- a/src/plot_read_counts.py +++ b/src/plot_read_counts.py @@ -3,19 +3,19 @@ import logging from pathlib import Path from typing import Union +from datetime import datetime + import pandas import matplotlib.pyplot as plt -"""Given a GeneID, construct the histogram of read counts per cell.""" - def plot_read_counts( - dir_path: Union[str, Path] = None, - gene_id: str = None -) -> bool: + dir_path: Union[str, Path], + gene_id: str +) -> str: """Plots histogram of gene ID and read counts from .csv files. - This function reads .csv files from a directory formatted + This function reads .csv files from a directory formatted "GeneID, Counts" and plots a histogram of read counts for a chosen geneID. @@ -23,96 +23,126 @@ def plot_read_counts( dir_path: Path of directory containing .csv files of read counts. gene_id: Name of gene to plot. + Returns: + String representing path to .svg plot file. + Raises: - ValueError: No value is passed for path and/or gene ID. ValueError: Path passed in does not exist. - ValueError: Gene not found in selection of .csv files. TypeError: Gene ID parameter passed is not a String. - AttributeError: No .csv files in chosen directory + FileNotFoundError: File path does not contain any .csv files. + KeyError: A file containing an entry of the chosen gene is missing + a count entry for it. + TypeError: A file containing an entry of the chosen gene has a count + that is not a number. """ + LOGGER = logging.getLogger(__name__) + + dir_path = Path(dir_path) + + if not dir_path.exists(): + raise ValueError("Invalid Path") + + if not isinstance(gene_id, str): + raise TypeError("Invalid gene ID") + + # identify csv files from directory, formatted ['Gene', 'Count'] + # if this is not immediately cast as list, on some python versions + # it sets file_paths to null after a single call + file_paths = list(dir_path.glob("*.csv")) + file_paths.sort() + + if len(file_paths) == 0: + raise FileNotFoundError("No .csv files found in chosen directory") + + gene_count_dict = {} + file_counter = 0 + + LOGGER.info("Running with %s and gene %s" % (dir_path, gene_id)) + + for file_path in file_paths: + # read in csv here via pandas + df_read_counts = pandas.read_csv(str(file_path), + header=None, names=['Gene', 'Count']) + + # confirm that gene entry exists for edge case where count may be deleted + confirm_gene_presence = df_read_counts.loc[df_read_counts.Gene == gene_id, + 'Gene'].tolist() + + # find gene_id within dataframe + gene_count = df_read_counts.loc[df_read_counts.Gene == gene_id, + 'Count'].tolist() + + # # If an entry exists for the gene, but the count is missing, a KeyError is thrown + if confirm_gene_presence and not gene_count: + raise KeyError("%s.csv contains an entry for %s, but is " + "missing a count." % (file_path.stem, gene_id)) + + # If an entry exists for the gene, but the count is not a number, a TypeError is thrown + if confirm_gene_presence: + try: + for i, count in enumerate(gene_count): + gene_count[i] = int(count) + + except ValueError: + raise TypeError("%s.csv contains an entry for %s, but is " + "not a number." % (file_path.stem, gene_id)) + + if not gene_count: + LOGGER.warning(f"File {file_path.stem}.csv does not contain an entry for {gene_id}, " + "this is interpreted as 0") + gene_count = [0] + + if len(gene_count) > 1: + LOGGER.warning( + "%s.csv contains more than one entry for chosen gene - these will be summed" + % (file_path.stem) + ) + + file_counter += 1 + # Uncomment to use file name as label -> does not autoscale pyplot + # gene_count_dict[file_path.stem] = sum(gene_count) + gene_count_dict[f"Read {file_counter}"] = sum(gene_count) + + LOGGER.info('Read complete from %s files' % (file_counter)) + + # read in dictionary from read_counts and plot counts on the same histogram + file_names = list(gene_count_dict.keys()) + counts = list(gene_count_dict.values()) + + # create and show bar plot of read counts for chosen gene + plt.bar(range(len(gene_count_dict)), counts, tick_label=file_names, width=0.4) + plt.title('Counts for %s' % (gene_id)) + plt.autoscale(axis='both') + plot_file_path = Path(f"{Path.cwd()}/plots/{get_file_name()}.svg") + plt.savefig(plot_file_path) + LOGGER.info(f"Plot successfully generated and saved at {plot_file_path}") + + return(plot_file_path) + + +def get_file_name() -> str: + """Helper function to determine output filename.""" + datetime_str = datetime.now().strftime("%y%m%d") + file_name_index = 1 + plot_file_name = f"reads_plot_{datetime_str}_{file_name_index}" + # while(Path.exists(Path(f"{Path.cwd()}/plots/{plot_file_name}"))): + # file_name_index += 1 + # plot_file_name = f"reads_plot_{datetime_str}_{file_name_index}" + return plot_file_name + + +def main(): + """Prompts user in cl to enter path and gene to plot.""" # Initialize logger logging.basicConfig( format='[%(asctime)s: %(levelname)s] "%(module)s" %(message)s', level=logging.INFO) - LOGGER = logging.getLogger(__name__) - try: - dir_path = Path(dir_path) - - if not dir_path.exists(): - LOGGER.critical("Invalid path") - raise ValueError("Invalid Path") - - elif not isinstance(gene_id, str): - LOGGER.critical("Invalid gene ID, please enter as string") - raise TypeError("Invalid gene ID") - - # identify csv files from directory, formatted ['Gene', 'Count'] - # if this is not immediately cast as list, on some python versions - # it sets file_paths to null after a single call which is big sad - file_paths = list(dir_path.glob("*.csv")) - file_paths.sort() - - if file_paths == 0: - LOGGER.warning('No csv files found in current directory, exiting') - raise AttributeError("No .csv files found in chosen directory") - - gene_count_dict = {} - file_counter = 1 - - LOGGER.info("Run with %s and gene %s" % (dir_path, gene_id)) - - for file_path in file_paths: - # read in csv here and transform to pandas dataframe - df_read_counts = pandas.read_csv(str(file_path), - header=None, names=['Gene', 'Count']) - - # find gene_id within dataframe - gene_count = df_read_counts.loc[df_read_counts.Gene == gene_id, - 'Count'].tolist() - - if len(gene_count) > 1: - LOGGER.warning( - "%s.csv contains more than one entry for chosen gene - these will be summed" - % (file_path.stem) - ) - - elif not gene_count: - LOGGER.warning( - "%s.csv does not contain read of chosen gene, this is interpreted as 0" - % (file_path.stem)) - gene_count = [0] - - # in case count entry is missing, interpreted as 0 - if not gene_count: - gene_count = [0] - LOGGER.warning( - "File %s contains an entry for this gene but is missing a count number \ - this is interpreted as 0" % (file_path.stem) - ) - - file_counter += 1 - gene_count_dict[file_path.stem] = sum(gene_count) - - except AttributeError: - LOGGER.fatal("Invalid selection, please verify input") - raise ValueError("Either the path, gene ID, or both were not properly specified") - - if sum(gene_count_dict.values()) == 0: - LOGGER.warning( - "Gene not found -> Please check for correct spelling or ID" - ) - raise ValueError("Gene not found") - - else: - LOGGER.info('Read complete from %s files' % (file_counter-1)) - - # read in dictionary from read_counts and plot counts on the same histogram - file_names = list(gene_count_dict.keys()) - counts = list(gene_count_dict.values()) - - # create and show bar plot of read counts for chosen gene - plt.bar(range(len(gene_count_dict)), counts, tick_label=file_names) - plt.title('Counts for %s' % (gene_id)) - plt.show() - return True + # Prompt user for input + csv_path = input("\nPlease enter a path: ") + gene_of_interest = input("\nPlease enter a gene name to plot: ") + plot_read_counts(csv_path, gene_of_interest) + + +if __name__ == "__main__": + main() diff --git a/tests/resources/Transcript4.csv b/tests/resources/Transcript4.csv deleted file mode 100644 index ff000bdfaa5e13bfc431addf9f8be3a9c1a1fe99..0000000000000000000000000000000000000000 --- a/tests/resources/Transcript4.csv +++ /dev/null @@ -1,19 +0,0 @@ -GENE1,629 -GENE2,803 -GENE3,106 -GENE4,378 -GENE5,728 -GENE6,783 -GENE7,353 -GENE8,747 -GENE9,253 -GENE10,883 -GENE11,552 -GENE12,655 -GENE13,309 -GENE14,133 -GENE15,131 -GENE16,626 -GENE17,669 -GENE18,493 -GENE19,304 diff --git a/tests/resources/Transcript5.csv b/tests/resources/Transcript5.csv deleted file mode 100644 index 34613ca7b1bd45581fc5c22affd989f5034f5cff..0000000000000000000000000000000000000000 --- a/tests/resources/Transcript5.csv +++ /dev/null @@ -1,19 +0,0 @@ -GENE1,830 -GENE2,602 -GENE3,859 -GENE4,174 -GENE5,525 -GENE6,606 -GENE7,851 -GENE8,910 -GENE9,194 -GENE10,415 -GENE11,953 -GENE12,299 -GENE13,127 -GENE14,750 -GENE15,968 -GENE16,282 -GENE17,868 -GENE18,688 -GENE19,650 diff --git a/tests/resources/Transcript6.csv b/tests/resources/Transcript6.csv deleted file mode 100644 index 794d1c1005fe5591f2bedca91087d3cf6f008ec2..0000000000000000000000000000000000000000 --- a/tests/resources/Transcript6.csv +++ /dev/null @@ -1,19 +0,0 @@ -GENE1,676 -GENE2,787 -GENE3,876 -GENE4,368 -GENE5,676 -GENE6,896 -GENE7,865 -GENE8,585 -GENE9,853 -GENE10,447 -GENE11,583 -GENE12,573 -GENE13,895 -GENE14,207 -GENE15,562 -GENE16,411 -GENE17,635 -GENE18,469 -GENE19,128 diff --git a/tests/resources/Transcript7negctrl.csv b/tests/resources/Transcript7negctrl.csv deleted file mode 100644 index 72cb6bffa9a8786e7d0ae0fdcee0eeb9740cc9a1..0000000000000000000000000000000000000000 --- a/tests/resources/Transcript7negctrl.csv +++ /dev/null @@ -1,8 +0,0 @@ -Random,Data,for -This,is,a -negative,control,test -some,numbers, -234,, -,432, -,, -32,, diff --git a/tests/resources/Transcript_read_counts_invalid.csv b/tests/resources/Transcript_read_counts_invalid.csv new file mode 100644 index 0000000000000000000000000000000000000000..6f947976489e7c1d7a381f99a31d091708025843 --- /dev/null +++ b/tests/resources/Transcript_read_counts_invalid.csv @@ -0,0 +1,2 @@ +Improper,Data +GENE6,nan diff --git a/tests/resources/Transcript3.csv b/tests/resources/Transcript_read_counts_missing-gene7.csv similarity index 96% rename from tests/resources/Transcript3.csv rename to tests/resources/Transcript_read_counts_missing-gene7.csv index 2473e6708c09eb374563f0215f2edbbb9ea64785..a6d95f3bb891a4fee14cdfb3ef6446239d82c74c 100644 --- a/tests/resources/Transcript3.csv +++ b/tests/resources/Transcript_read_counts_missing-gene7.csv @@ -4,7 +4,7 @@ GENE3,859 GENE4,174 GENE5,525 GENE6,606 -, +GENE7, GENE8,910 GENE9,194 GENE10,415 diff --git a/tests/resources/Transcript1.csv b/tests/resources/Transcript_read_counts_valid.csv similarity index 91% rename from tests/resources/Transcript1.csv rename to tests/resources/Transcript_read_counts_valid.csv index 4ae4a987b2287f1265121692e0dbd873e9ebc0e5..798fa196c9dd54278cc4d06433c29ae098ec9e3d 100644 --- a/tests/resources/Transcript1.csv +++ b/tests/resources/Transcript_read_counts_valid.csv @@ -1,7 +1,7 @@ -GENE1,92 -GENE2,13 -GENE3,73 -GENE4,83 -GENE5,32 -GENE6,136 +GENE1,92 +GENE2,13 +GENE3,73 +GENE4,83 +GENE5,32 +GENE6,136 GENE7,36 \ No newline at end of file diff --git a/tests/resources/Transcript2.csv b/tests/resources/Transcript_read_counts_valid2.csv similarity index 100% rename from tests/resources/Transcript2.csv rename to tests/resources/Transcript_read_counts_valid2.csv diff --git a/tests/test_plot_read_counts.py b/tests/test_plot_read_counts.py index 293b450183c97f9aa14b9e101674628d03edc6af..8ca0e9de5cf1300dc3d557a600374600fe3d693d 100644 --- a/tests/test_plot_read_counts.py +++ b/tests/test_plot_read_counts.py @@ -12,11 +12,10 @@ class TestPlotReadCounts (): "dir_path, gene_id, expected", [ ('a', 'GENE1', ValueError), - ('Path.home()', 5, TypeError), - (None, None, ValueError), - ('Path.home()', 'GENE1', AttributeError), - (Path(str(Path.parent())+"/tests/resources/"), 'GENE25', ValueError), - + (Path(f"{Path.cwd()}/tests/"), 'GENE1', FileNotFoundError), + (Path(f"{Path.cwd()}/tests/resources/"), 5, TypeError), + (Path(f"{Path.cwd()}/tests/resources/"), 'GENE6', TypeError), + (Path(f"{Path.cwd()}/tests/resources/"), 'GENE7', TypeError), ] ) def test_invalid_input(self, dir_path, gene_id, expected): @@ -25,13 +24,13 @@ class TestPlotReadCounts (): plot_read_counts(dir_path, gene_id) @pytest.mark.parametrize( - "dir_path, gene_id, expected", + "dir_path, gene_id", [ - (Path(str(Path.parent())+"/tests/resources/"), 'GENE1', True), - (Path(str(Path.parent())+"/tests/resources/"), 'GENE1', True), - (Path(str(Path.parent())+"/tests/resources/"), 'GENE7', True), + (Path(f"{Path.cwd()}/tests/resources/"), 'GENE1'), + (Path(f"{Path.cwd()}/tests/resources/"), 'GENE2'), + (Path(f"{Path.cwd()}/tests/resources/"), 'GENE3'), ] ) - def validate_input(self, dir_path, gene_id): + def test_valid_input(self, dir_path, gene_id): """Tests valid input with return value boolean.""" - assert plot_read_counts(dir_path, gene_id) is True + assert Path.exists(plot_read_counts(dir_path, gene_id))