diff --git a/example_data/COSMICv34_cns.txt b/example_data/COSMICv34_cns.txt new file mode 100644 index 00000000..f41a0a28 --- /dev/null +++ b/example_data/COSMICv34_cns.txt @@ -0,0 +1,20 @@ +"A[C>A]A" "A[C>A]C" "A[C>A]G" "A[C>A]T" "C[C>A]A" "C[C>A]C" "C[C>A]G" "C[C>A]T" "G[C>A]A" "G[C>A]C" "G[C>A]G" "G[C>A]T" "T[C>A]A" "T[C>A]C" "T[C>A]G" "T[C>A]T" "A[C>G]A" "A[C>G]C" "A[C>G]G" "A[C>G]T" "C[C>G]A" "C[C>G]C" "C[C>G]G" "C[C>G]T" "G[C>G]A" "G[C>G]C" "G[C>G]G" "G[C>G]T" "T[C>G]A" "T[C>G]C" "T[C>G]G" "T[C>G]T" "A[C>T]A" "A[C>T]C" "A[C>T]G" "A[C>T]T" "C[C>T]A" "C[C>T]C" "C[C>T]G" "C[C>T]T" "G[C>T]A" "G[C>T]C" "G[C>T]G" "G[C>T]T" "T[C>T]A" "T[C>T]C" "T[C>T]G" "T[C>T]T" "A[T>A]A" "A[T>A]C" "A[T>A]G" "A[T>A]T" "C[T>A]A" "C[T>A]C" "C[T>A]G" "C[T>A]T" "G[T>A]A" "G[T>A]C" "G[T>A]G" "G[T>A]T" "T[T>A]A" "T[T>A]C" "T[T>A]G" "T[T>A]T" "A[T>C]A" "A[T>C]C" "A[T>C]G" "A[T>C]T" "C[T>C]A" "C[T>C]C" "C[T>C]G" "C[T>C]T" "G[T>C]A" "G[T>C]C" "G[T>C]G" "G[T>C]T" "T[T>C]A" "T[T>C]C" "T[T>C]G" "T[T>C]T" "A[T>G]A" "A[T>G]C" "A[T>G]G" "A[T>G]T" "C[T>G]A" "C[T>G]C" "C[T>G]G" "C[T>G]T" "G[T>G]A" "G[T>G]C" "G[T>G]G" "G[T>G]T" "T[T>G]A" "T[T>G]C" "T[T>G]G" "T[T>G]T" +"SBS1" 0.000886157 0.002280405 0.000177031 0.001280227 0.000312055 0.001790318 9.32e-05 2.23e-16 0.00158028 0.00033906 0.000587104 2.23e-16 6.58e-05 0.002530449 2.23e-16 5.88e-06 0.00186033 0.001220217 0.00011502 0.001140202 2.41e-05 7.68e-05 0.000352062 2.23e-16 9.59e-06 0.000164029 0.000166029 2.23e-16 2.23e-16 0.000203036 6.94e-05 0.001560277 0.025004441 0.006321123 0.36506483 0.009581702 0.002000355 0.000270048 0.196034813 0.000196035 0.004440789 9.28e-05 0.218038721 3.84e-05 0.001110197 3.73e-05 0.110019538 2.23e-16 0.000800142 0.002230396 0.001140202 0.000183032 4.3e-05 0.00039307 0.000324057 0.000260046 8.12e-05 0.000129023 0.000246044 0.000258046 0.006721194 2.23e-16 2.8e-05 0.002250399 0.001090193 0.003040539 0.000106019 0.00574102 2.23e-16 0.002500444 0.000360064 4.26e-05 0.001050186 0.001900337 0.001170208 7.13e-05 0.000255045 0.003390603 0.000416074 0.004330769 0.000172031 0.000207037 0.000268048 0.00011202 3.55e-05 0.000212038 0.000128023 0.00017103 2.23e-16 2.23e-16 0.000348062 1.46e-05 2.23e-16 5.51e-05 0.000583103 2.23e-16 +"SBS2" 5.8e-07 0.000148004 5.23e-05 9.78e-05 0.000208006 9.53e-05 2.23e-16 0.000421012 8.62e-05 2.23e-16 1.39e-05 5.12e-05 0.000639018 0.000170005 8.53e-05 0.000440013 2.23e-16 0.000133004 1.52e-05 9.12e-05 2.23e-16 0.00035101 4.87e-05 6.36e-05 6.54e-05 0.000261008 2.23e-16 0.000134004 2.23e-16 9.87e-05 4.12e-05 0.001180034 6.11e-05 0.00138004 3.27e-05 0.001860054 0.004320125 0.000170005 0.00277008 0.001450042 2.23e-16 1.29e-07 2.23e-16 5.04e-05 0.53601551 0.097302815 0.044201279 0.300008682 9.59e-05 0.000878025 2.55e-05 2.23e-16 0.000243007 0.000244007 0.000149004 2.23e-16 2.23e-16 0.000131004 6.38e-05 6.28e-05 0.000422012 0.000192006 5.01e-05 0.000205006 6.17e-05 2.15e-05 1.32e-05 0.000155004 0.000302009 2.85e-05 2.23e-16 0.000186005 2.23e-16 2.74e-05 0.000107003 1.25e-05 2.23e-16 4.35e-05 0.000117003 3.58e-05 0.000238007 7.46e-05 2.05e-06 3.76e-06 0.000153004 0.000155004 0.000121003 0.000203006 0.000209006 0.000133004 3.71e-05 2.23e-16 1.67e-05 7.04e-05 9.54e-05 2.23e-16 +"SBS3" 0.020808323 0.016506603 0.0017507 0.012204882 0.022509004 0.025310124 0.002511004 0.015406162 0.007132853 0.010904362 0.001430572 0.010004002 0.008413365 0.016806723 0.001410564 0.00997399 0.019707883 0.011704682 0.000253101 0.017406963 0.019307723 0.014105642 0.0015006 0.022308924 0.012705082 0.008633453 0.002420968 0.014705882 0.013305322 0.020308123 0.000520208 0.023509404 0.014205682 0.012404962 0.002571028 0.012104842 0.016106443 0.020208083 0.002240896 0.023009204 0.016406563 0.013405362 0.000528211 0.011304522 0.005762305 0.013305322 0.000989396 0.008173269 0.005492197 0.007212885 0.009643858 0.006112445 0.007943177 0.017807123 0.013205282 0.012705082 0.007062825 0.007482993 0.011604642 0.012304922 0.006512605 0.010504202 0.006712685 0.013005202 0.016506603 0.007763105 0.012304922 0.017306923 0.008833533 0.014505802 0.010104042 0.015806323 0.009983994 0.005642257 0.010904362 0.010204082 0.015206082 0.008993597 0.006932773 0.013905562 0.003951581 0.00260104 0.006302521 0.003971589 0.004371749 0.007042817 0.010704282 0.007032813 0.004421769 0.002340936 0.010904362 0.005832333 0.007252901 0.006282513 0.008053221 0.010504202 +"SBS5" 0.0119976 0.009438112 0.00184963 0.006608678 0.007428514 0.006138772 0.003459308 0.006488702 0.01019796 0.00764847 0.002339532 0.006818636 0.007858428 0.009168166 0.00229954 0.012697461 0.01009798 0.00569886 0.001719656 0.01009798 0.006958608 0.009068186 0.002489502 0.009528094 0.004679064 0.005078984 0.001509698 0.006718656 0.007808438 0.00759848 0.001709658 0.0124975 0.032593481 0.017896421 0.006178764 0.021995601 0.019396121 0.018996201 0.017496501 0.023095381 0.019396121 0.021595681 0.01229754 0.018596281 0.020295941 0.022995401 0.015896821 0.020995801 0.007378524 0.006928614 0.009118176 0.00619876 0.003539292 0.005188962 0.005008998 0.00429914 0.003669266 0.002909418 0.004109178 0.003219356 0.006308738 0.004139172 0.004789042 0.00874825 0.046190762 0.013397321 0.038192362 0.038292342 0.013297341 0.01039792 0.020795841 0.014897021 0.014097181 0.007938412 0.014997001 0.013697261 0.017996401 0.009708058 0.012697461 0.018496301 0.003859228 0.00259948 0.007938412 0.004829034 0.002589482 0.004609078 0.006128774 0.00729854 0.002519496 0.001709658 0.00529894 0.00234953 0.005218956 0.006558688 0.006938612 0.013497301 +"SBS7b" 0.002329386 0.000460879 0.000185951 0.000709813 0.0011397 0.001549592 0.000407893 0.001489607 0.000745803 0.000214943 7.29e-05 0.000146961 0.002899236 0.003519073 0.000299921 0.001409629 8.56e-06 0.00018895 0.000504867 0.000284925 0.000457879 0.000959747 0.000790792 0.000889766 5.11e-05 0.000451881 0.000336911 0.000276927 0.000253933 0.001619573 0.000363904 0.000713812 0.001409629 0.038089959 0.000542857 0.010797154 0.106971801 0.181952034 0.022094175 0.125966794 0.000854775 0.026293069 0.000175954 0.00538858 0.006608258 0.210944392 0.057384873 0.101973118 0.002489344 0.000466877 0.001559589 0.008287815 0.001119705 0.000957748 0.000882767 0.00011197 0.000525861 0.000255933 0.000655827 5.59e-05 0.003239146 0.00223941 0.001699552 2.22e-16 0.001019731 0.00045588 0.001499605 0.002149434 0.001529597 0.000839779 0.000729808 0.00572849 0.00026593 2.22e-16 0.000528861 0.006848194 0.005998419 0.001729544 0.003808996 0.002969217 8.44e-05 0.000931754 0.001469613 0.000732807 0.000358905 0.000791791 0.00128966 3.68e-06 0.000322915 0.000320915 0.002409365 0.001829518 0.000954748 0.001549592 0.001349644 0.001769534 +"SBS8" 0.044098218 0.047798069 0.004619813 0.046998101 0.04009838 0.038798433 0.003409862 0.032998667 0.024199022 0.026198942 0.002739889 0.026898913 0.029798796 0.025098986 0.001899923 0.031898711 0.004329825 0.002949881 0.000285988 0.005709769 0.004999798 0.005459779 1.05e-05 0.005489778 0.002579896 0.002389903 0.00048798 0.004859804 0.001469941 0.001339946 7.82e-05 0.00024899 0.006809725 0.002819886 0.00322987 0.012499495 0.002669892 0.004019838 0.00148994 0.014499414 0.000275989 0.00024499 0.001909923 0.004609814 0.005039796 0.00025199 4.17e-05 0.005269787 0.019499212 0.02129914 0.022799079 0.02499899 0.018999232 0.02919882 0.027598885 0.041798311 0.012799483 0.013499455 0.01559937 0.028098865 0.011499535 0.019499212 0.012899479 0.037898469 0.009769605 0.005009798 0.006979718 0.014899398 0.002389903 0.006999717 0.001259949 0.006459739 0.002599895 0.002619894 0.002809886 0.006289746 0.002079916 0.002639893 2.22e-16 0.004569815 0.001639934 0.000667973 0.004769807 0.00073997 0.001219951 0.001949921 0.00469981 0.000573977 0.001309947 0.000655973 0.00396984 0.001289948 2.22e-16 0.001139954 0.003089875 0.00099596 +"SBS10a" 0.00219017 0.001770137 0.000150012 0.017001321 0.003180247 0.000202016 4.64e-05 0.017301344 0.001210094 0.000441034 1.05e-05 0.011100863 0.094007305 0.009970775 0.00116009 0.670052068 2.23e-16 2.43e-05 2.23e-16 2.23e-16 4.57e-05 2.23e-16 2.01e-05 3.01e-05 1.5e-05 8.31e-05 2.23e-16 3.54e-05 5.55e-05 2.23e-16 2.23e-16 5.45e-05 0.001040081 0.000834065 0.005570433 0.002990232 3.68e-05 2.23e-16 2.23e-16 0.000103008 4.22e-05 0.012500972 0.014901158 0.013501049 0.000366028 0.002760214 0.002790217 0.022801772 5.07e-05 0.000194015 2.23e-16 0.006660517 2.23e-16 2.23e-16 2.23e-16 0.000376029 3.31e-06 2.23e-16 7.3e-05 0.000426033 0.002040158 0.000360028 0.000693054 0.005290411 0.000745058 0.003620281 0.002140166 0.003360261 0.000122009 4.12e-05 0.001050082 2.44e-06 0.002200171 0.006280488 2.23e-16 0.005290411 0.000730057 0.005170401 0.000363028 0.003250252 0.001920149 0.001240096 0.000320025 0.009220717 0.000155012 2.23e-16 5.35e-05 0.001300101 0.000204016 0.000833065 2.23e-16 0.002210172 0.002690209 2.23e-16 2.16e-05 0.018901469 +"SBS10b" 0.000181997 0.006539908 5.35e-05 1.63e-05 0.000520993 0.003179955 8.38e-05 0.008329883 0.00073099 0.002549964 8.52e-05 0.002799961 0.000445994 0.003799947 0.000572992 0.081598857 0.000304996 0.000133998 2.22e-16 2.22e-16 2.99e-05 2.22e-16 2.22e-16 2.22e-16 1.72e-05 0.000135998 2.22e-16 0.000112998 2.22e-16 2.22e-16 2.22e-16 4.34e-05 0.000548992 0.005249927 0.000413994 0.007929889 0.000150998 8.44e-05 0.003699948 0.000594992 0.000362995 0.015099789 0.012599824 0.031899553 0.002729962 0.04849932 0.436993876 0.127998206 0.001819975 0.000336995 2.34e-05 0.00284996 7.09e-05 0.000105999 2.22e-16 0.000233997 2.22e-16 0.000122998 2.22e-16 0.000107998 0.003059957 0.000664991 7.06e-05 0.001519979 0.009349869 0.000509993 0.000530993 0.000149998 0.001319982 0.000123998 2.53e-05 0.000814989 0.014699794 0.005329925 0.001379981 0.011499839 0.008859876 8.1e-05 0.000667991 2.51e-05 3.47e-05 5.33e-05 0.000522993 2.22e-16 0.000226997 0.001149984 0.000478993 0.005229927 0.000480993 0.000941987 0.001729976 0.005159928 0.011299842 0.005549922 0.002759961 0.090898726 +"SBS11" 0.000146208 0.000552786 9.42e-05 0.000266379 0.00061888 0.000987404 9.21e-06 0.000150214 0.000165235 0.000405577 1.39e-05 2.22e-16 0.000180256 0.000939336 2.22e-16 4.74e-05 0.000170242 0.000290413 5.97e-05 0.000535762 0.000261372 0.000177252 1.12e-05 9.65e-06 4.68e-05 0.000114162 3.24e-06 0.000186265 1.56e-05 0.000224319 2.22e-16 0.000185263 0.025836745 0.14720936 0.007590796 0.10915524 0.004075797 0.126179452 0.00092131 0.065192716 0.019728057 0.115163785 0.001782535 0.069699125 0.009793929 0.158225026 2.94e-07 0.119169482 0.000417594 0.000441628 3.94e-05 3.4e-06 0.000184262 0.000212302 0.000305434 0.000162231 1.54e-06 0.000375534 0.000119169 0.000164234 0.000186265 0.000202288 0.000201286 0.00067496 0.001141624 0.000939336 0.000320456 0.001191695 0.000328467 0.000714015 0.000131187 8.46e-05 0.000810152 0.000861225 0.000561799 0.000237338 0.000113161 0.000467665 0.000155221 0.000106151 0.00021831 4.68e-05 0.000179255 0.000285406 2.22e-16 2.22e-16 2.22e-16 0.000133189 9.58e-05 2.22e-16 0.000130185 0.000154219 8.52e-05 6.74e-05 0.000101144 5.56e-05 +"SBS15" 0.000944202 0.000497106 4.61e-05 0.001110238 0.041808957 0.005051082 6.62e-05 0.02870615 0.00229049 0.002490533 0.000404087 0.0182039 0.017203685 0.005811245 7.69e-05 0.008051725 0.000113024 0.000269058 3.07e-05 0.00032507 8.36e-05 1.7e-05 5.02e-05 8.45e-05 0.000994213 0.00060813 1.01e-05 0.000451097 0.000214046 6.12e-05 5.84e-05 0.000174037 0.005051082 0.006911481 0.074515965 0.001780381 0.010802315 0.011102379 0.024805315 0.015603343 0.073715794 0.129027643 0.277059358 0.077216543 0.026505679 0.009562048 0.021204543 0.001740373 0.002040437 0.00084118 0.000540116 0.009542044 0.000348075 0.000244052 8.2e-05 0.001050225 0.000511109 0.000589126 0.00018704 0.00084018 0.001090233 0.000157034 0.000149032 0.000475102 0.003890834 0.00196042 0.000240051 0.000929199 0.000750161 0.00215046 0.001390298 0.001750375 0.012902764 0.011602486 0.005951275 0.005861256 0.003420732 0.005921269 0.001320283 0.001350289 0.0004681 0.000415089 0.00018504 0.003630778 0.000206044 0.000157034 0.000272058 0.002490533 0.000203043 0.000580124 0.000347074 0.001390298 0.000231049 0.000294063 0.000148032 0.005991284 +"SBS18" 0.051533859 0.015810387 0.002431598 0.02141407 0.074048652 0.019612886 0.012007889 0.036323866 0.109071663 0.017311374 0.00756497 0.062340959 0.07384852 0.043628665 0.012708349 0.12208021 0.001731137 0.002591703 0.001921262 0.004082682 0.000613403 0.002261486 0.003582354 0.003792492 0.000635417 0.001340881 0.00063942 0.001230809 0.002141407 0.00464305 0.000899591 0.003182091 0.009206048 0.004653057 0.012208021 0.00797524 0.011707692 0.006764444 0.016811045 0.006654372 0.009686364 0.008175371 0.01480973 0.006694398 0.011407495 0.011407495 0.011807758 0.003752465 0.002491637 0.000878577 0.002601709 0.007845154 0.000542356 0.003062012 0.00321211 0.002261486 0.001601052 0.001951282 0.001831203 0.003462275 0.0108071 0.002731795 0.001791177 0.007104668 0.002021328 0.002091374 0.002081367 0.004242788 0.000386254 0.002461617 0.001621065 0.002561683 0.000708465 0.002261486 0.003982617 0.003152071 0.001801183 0.006184063 0.003262143 0.003372216 0.000721474 0.000858564 0.001991308 0.00184121 0.000111073 0.001991308 0.002931926 0.004142722 0.000870572 3.7e-05 0.005833833 0.002141407 0.000696458 0.002101381 0.001450953 0.005163392 +"SBS19" 0.001269382 0.000640688 0.00024588 0.000570722 0.001319358 0.000766627 0.000235885 3.44e-05 0.000813604 0.000271868 0.0002049 0.000272867 0.001379329 0.00112945 0.000284861 0.001379329 0.003188447 0.001789129 0.0006157 0.002138959 0.001769139 0.00180912 4.81e-05 0.003218433 0.001309363 0.001289372 0.00059671 0.000319844 0.001749149 0.003118481 0.000440785 0.001609217 0.027986374 0.014093139 0.001549246 0.036782092 0.118942091 0.09195523 0.01569236 0.257874449 0.060970316 0.03968068 0.003208437 0.108946958 0.043878637 0.024987834 0.004317897 0.062869391 0.000785618 0.000254876 0.000951537 0.000653682 9.6e-05 0.000402804 0.000293857 0.000217894 0.000188908 7.78e-05 0.000485764 0.000282862 0.00049376 0.000474769 0.000372819 0.000672673 0.00258874 0.000593711 0.002308876 0.001739154 0.00045178 8.14e-05 0.000497758 0.00039081 0.000953536 0.00037082 0.000952536 0.002358852 0.001239397 0.000552731 0.001079475 0.001469285 0.002328867 0.001889081 0.001769139 0.001619212 0.000713653 0.002088983 0.001329353 0.00219893 0.000635691 0.000702658 0.000509752 0.000340834 0.001659192 0.002019017 0.002068993 0.004227941 +"SBS23" 0.000835523 0.00039925 9.86e-08 5.61e-18 0.000151095 0.000630395 0.000130081 0.000580363 0.000337211 0.000541339 0.000119075 3.09e-05 0.002131334 0.000664416 9.13e-05 0.00024015 5.74e-18 4.08e-05 2.86e-18 5.61e-18 0.000174109 0.00025516 1.86e-18 0.000227142 4.32e-18 0.00012708 1.83e-18 4.04e-18 0.000211132 0.000266167 2.56e-18 0.000466292 0.022614153 0.080950661 0.00872546 0.035021918 0.06223895 0.189118355 0.014208892 0.156097689 0.053733628 0.154096437 0.012307702 0.107067005 0.015309581 0.043627303 0.002871797 0.02631647 8.29e-18 5.56e-18 0.000354222 0.000161101 0.000462289 4.47e-18 0.000132083 0.000375235 6.26e-18 0.000140088 4.68e-18 5.78e-18 7.77e-18 5.27e-18 0.000185116 7.32e-18 0.000886555 0.000178111 0.000470294 0.000261163 6.86e-18 4.47e-18 0.000389244 4.71e-05 0.000218137 0.000418262 4.68e-18 0.0007995 7.77e-18 0.000190119 0.000302189 7.32e-18 8.29e-18 5.43e-18 5.68e-18 7.43e-18 6.85e-18 0.000148093 6.52e-05 0.000247155 6.26e-18 8.7e-05 0.000157098 5.78e-18 0.000186116 5.27e-18 0.000182114 7.32e-18 +"SBS30" 0.001799681 0.00050591 9.13e-05 0.000555901 0.000767864 0.000387931 0.000406928 0.000296947 0.000942833 0.000493912 2.22e-16 0.000861847 0.000695877 0.000242957 8.26e-05 0.000664882 0.00106981 0.000466917 0.000130977 0.00073087 0.001269775 0.000792859 0.000119979 0.001019819 0.000514909 0.000255955 0.000116979 0.000398929 0.000126977 0.000985825 0.000105981 0.000108981 0.10598119 0.090383958 0.014397445 0.0292948 0.109980479 0.102981722 0.016797019 0.046191802 0.049691181 0.060989176 0.005239071 0.017696859 0.097982609 0.133976221 0.014697392 0.052490683 0.000362936 0.00039293 0.000637887 0.000489913 0.000213962 0.000776862 0.000586896 0.000611891 0.000328942 0.000181968 9.86e-05 0.000190966 0.00028195 0.000240957 0.000189966 0.000700876 0.000610892 0.000457919 0.000276951 0.000544903 0.001269775 0.001379755 0.001269775 0.004099273 0.000934834 0.000554902 0.000500911 0.000444921 0.000543904 0.000285949 0.000202964 0.000444921 3.9e-05 0.00010998 0.000409927 0.000793859 0.000197965 0.000214962 7.85e-05 0.000264953 0.000187967 0.000352937 0.001379755 0.000159972 0.000117979 9.64e-05 0.000812856 0.008888422 +"SBS31" 0.009534985 0.018490274 0.001659127 0.006276698 0.010694375 0.011593902 0.000328827 0.027885332 0.013093113 0.021488697 0.000971489 0.003508155 0.001859022 0.009375069 0.000954498 0.00448764 0.008315626 0.003158339 0.002998423 0.003778013 0.002048922 0.001859022 0.000853551 0.003418202 0.001829038 0.007506052 0.00045676 0.003358234 0.000395792 0.002918465 0.000415781 0.004237771 0.017690695 0.009275121 0.00758601 0.01009469 0.04117834 0.163913781 0.008195689 0.14492377 0.006796425 0.011394007 0.001968964 0.005697003 0.007476068 0.024587067 0.008405579 0.019489748 0.007855868 0.006066809 0.005027356 0.004157813 0.02058917 0.021088907 0.018690169 0.030983703 0.001899001 0.00290847 0.005766967 0.000788585 0.006696478 0.003748029 0.003268281 0.008875332 0.020389275 0.00739611 0.008115731 0.008465547 0.008145715 0.00990479 0.004457655 0.013792745 0.004527618 0.006566546 0.005127303 0.004687534 0.004587587 0.010294585 0.004007892 0.012093639 0.003678065 0.002478696 0.004017887 0.000782588 0.001968964 0.001429248 0.001499211 0.000948501 0.00030384 0.000871542 0.002548659 0.002808523 0.002248817 0.002378749 0.005347187 0.007296162 +"SBS37" 0.003950822 0.001450302 0.001060221 0.001850385 0.00322067 0.000814169 0.000747155 0.001770368 0.002040424 0.000629131 0.000506105 0.001290268 0.002000416 0.001590331 0.001120233 0.002440508 0.034307136 0.01120233 0.005351113 0.018803911 0.000442092 0.000313065 0.000321067 0.000581121 0.001320275 0.000938195 0.00057712 0.001270264 0.001790372 0.001110231 0.000860179 0.002550531 0.006241298 0.003060637 0.006331317 0.005651175 0.003610751 0.002100437 0.00327068 0.006061261 0.002550531 0.002310481 0.004320899 0.002320483 0.004020836 0.00250052 0.003430714 0.005841215 0.002250468 0.001660345 0.002490518 0.002770576 0.001570327 0.001160241 0.001600333 0.002060429 0.001150239 0.000774161 0.001080225 0.00168035 0.00245051 0.001130235 0.001280266 0.001950406 0.07331525 0.038407989 0.016803495 0.048009986 0.050010402 0.021804535 0.00995207 0.050410485 0.030706387 0.018203786 0.009832045 0.040008322 0.047709924 0.045109383 0.01000208 0.061412774 0.021704515 0.010602205 0.016803495 0.024705139 0.002600541 0.002380495 0.003770784 0.004110855 0.011802455 0.006861427 0.009832045 0.017103558 0.018303807 0.019504057 0.030206283 0.029106054 +"SBS39" 0.011701521 0.00715093 0.002670347 0.007400962 0.010101313 0.009061178 0.005740746 0.006030784 0.006880895 0.006950904 0.004530589 0.005890766 0.005980778 0.007861022 0.003010391 0.006550852 0.04730615 0.022502925 0.013601768 0.043405643 0.028803744 0.037704902 0.012301599 0.040205227 0.02400312 0.021302769 0.009861282 0.032404213 0.034704512 0.036704772 0.009621251 0.050706592 0.009601248 0.004040525 0.00600078 0.012801664 0.009111184 0.003860502 0.007570984 0.006990909 0.008031044 0.004500585 0.005480712 0.008611119 0.003880504 0.005280686 0.004860632 0.00423055 0.00531069 0.002880374 0.006940902 0.006120796 0.004940642 0.006440837 0.006800884 0.008271075 0.004960645 0.003520458 0.006670867 0.004090532 0.00669087 0.00369048 0.00546071 0.010701391 0.011201456 0.005640733 0.009641253 0.013601768 0.007340954 0.007911028 0.00777101 0.008591117 0.007470971 0.006890896 0.005740746 0.007510976 0.005940772 0.006440837 0.004980647 0.009481233 0.003880504 0.002970386 0.007660996 0.006420835 0.005300689 0.007390961 0.009831278 0.004940642 0.003330433 0.005800754 0.007721004 0.005940772 0.008391091 0.00508066 0.007280947 0.010901417 +"SBS40a" 0.036395305 0.016772493 0.003747968 0.015434802 0.013755978 0.010841621 0.00161922 0.006711081 0.010147654 0.010996885 0.003537669 0.006335506 0.02752139 0.029381379 0.005438052 0.023830994 0.008213432 0.005620372 0.001496999 0.008359592 0.004024956 0.0043647 0.000929935 0.006367558 0.00266304 0.003081114 0.000644863 0.003122878 0.008219757 0.007893084 0.000941002 0.016393333 0.028638138 0.020511777 0.013165331 0.022509808 0.02480661 0.029165316 0.006542889 0.028898963 0.029806992 0.025369751 0.009274841 0.023174069 0.04223462 0.045911154 0.007070678 0.033591098 0.010007781 0.005501739 0.009324104 0.011182787 0.002458485 0.006639386 0.00573004 0.009494213 0.003134842 0.003716735 0.004515992 0.004943178 0.009514387 0.009126169 0.00563071 0.018227759 0.016890451 0.003120202 0.008145594 0.018468269 0.00610429 0.00492976 0.005142813 0.006773453 0.004829088 0.002912479 0.003370187 0.008249865 0.007356649 0.00306651 0.003704556 0.007912687 0.005393753 0.004653723 0.005253576 0.01159521 0.001527196 0.002641312 0.002146177 0.004305865 0.001051456 0.001026417 0.001748348 0.001953579 0.005562842 0.00642218 0.004188098 0.01492849 +"SBS42" 0.001160252 0.02060448 3.34e-05 0.007971733 0.011602522 0.032807133 0.001880409 0.021104589 0.007711677 0.026805829 0.00106023 0.018103937 0.005101109 0.054011744 0.000904197 0.027305937 0.000406088 0.00050611 1.77e-05 0.000431094 0.004260926 0.00662144 0.000470102 0.006841487 0.002400522 0.001420309 0.000223048 0.002770602 0.000559122 0.001870407 0.000207045 0.000381083 0.022404872 0.039808655 0.000440096 0.035207655 0.018704067 0.04811046 0.001920417 0.032907155 0.033607307 0.152033056 0.004550989 0.086518812 0.004821048 0.032707112 0.000364079 0.015103283 0.013302892 0.004010872 0.005011089 0.00685149 0.01260274 0.001720374 0.01490324 0.007571646 0.012002609 0.0018404 0.00777169 0.003250707 0.008501848 0.002260491 0.005331159 0.003520765 0.011602522 0.003510763 0.008561861 0.002700587 0.00354077 0.003130681 0.003560774 0.003240705 0.005821266 0.00331072 0.003210698 0.00239052 0.006821483 0.003030659 0.003410741 0.002360513 0.001200261 0.000405088 0.000637139 0.000911198 0.000870189 0.000753164 0.005681235 0.003480757 0.001140248 7.05e-05 0.000410089 0.0009202 0.00115025 0.00027406 0.002930637 0.001740378 diff --git a/example_data/small_genome.fa b/example_data/small_genome.fa deleted file mode 100644 index fd6e3755..00000000 --- a/example_data/small_genome.fa +++ /dev/null @@ -1,43 +0,0 @@ ->0 -ctatatgcgggcctatcacgagatcgcctcgcctccctaacgccaatttggttgatcgccgtttatacgggctaaatcct -ggccgccaagaggcactgatctaatttaccagagagtggtactcttacatgcgtatcttatggtcgagagactcaggctc -tgacacctatcatctgtgcgacctcatttacacaaaggcggctctccccgcctaggtcgtgctcatggctatgcccgctt -cgtaacaacccgttacgttgcggacgctagaaagacggtttcggatatcaccgctccaac ->1 -gcttggtatgaaaacccatcattcggccattatctcattccggcgtaaggccccagtacttcaaaaggttcgatggatac -tcggaatttgtgtctgatggcctaagtgtctattctatttagagcaaactagcatatgccctctaccgacctgccatcca -gtcctgcgcattctaggtgcctataattaacctcgacgggttttcggaacaataggcataacatctcgagtcttatgact -gttgaggcctgacaaagagtcgacctgtttttcctaaggtgcgtgaagtaagctgggtgttctgattcgctgttgacggt -tacgctctcgtacgccttgctagctctaaggtccagagatttgttacgcgtcaaaggcccttcaaaaacagtgatgttgg -gcttcgtcggcctgcatgctaacagtcagtccacgtgattaagttagcatcgatagataagcataaacaagggacgcata -cttgccctatgcgaacagatagctaaattaaaaactaatgtaatgaagctccttggacatcggtagctacagggatccgc -tcttggcactgagacaagtttgtccgctatatcctgcacg ->2 -ctagctacagatattagccaggccgtttttttgggccgttgcaagccgatattgtcagatagcttcctggagtcaggttt -agtttttaaggacaatacgtacgggaccagagggtcttattcatgggtctatccagccgttgtgtactgtcttatatttc -cgccacttcccaatagtagccgccggcgatgggcgcgggatggcgcaccactgagttgcgataacgaaggtggacaataa -tgcctgcaatccggcgcaacccgaagcagtacaaaacttgggaaacataacatctgtcataatccataaatcgccaaagg -actggagcccttgcgctgagaaatcagctggttcccaatgtggtcaccttaaggcaaagtggaatggtccggataaccgt -gatgaagggcacggttacgttgttttgaagaggtgtaatgaatgggtacgcttccttccacgcctttgggtccctgtagt -agtaagggagtgggcttcctttagggagcaggatctcggacaccaattcgccttgaaggaacggtatgtcagtgccaggg -cagaaagtccagagggtgacttgttgcgtcttttaatggggctatgctaacggaaatcttgtcgttatgcccggtacccg -ctcacgatcacctcttgagttcaacgtggcttgagataccactccttacaatgttctgctaggcttcaactgagggtcga -gcgtgttacgacgacccaatatggttatccatacccgactaaagctgcgctgatacggttgccagtaactcatagcgtcc -ttacagacgaaagagatcaatcctgctgttgataagcgggggccaagggggcagtgtgtctcagttcccaggctactctt -ttgagcatgatgcttcaaaa ->3 -ggtccgtcgtgcctatttagtatcaaagccgtactcaatgtgtgtaagcctatcctacgtcttccccctggaattaggat -gtgaatcatccgctcacccgatgtgtaatagctttcccgcttagagacggttcgcagtaaaacgccgtcacccctgcaag -cggagagcaccgacagtagtatcaagactctgtcgtgacactaccaactacgagcgactacaagcgcttgctacttttat -gttcgaggtccgaaggctagatcgagctgtgcgctcgtgtaagagagaccatctagggcatacaccttaatggcgataga -atatggcggtcgattttctagtgggttgcttccttgcatacggagggttgcacgtccgctcggaccgaaccatggtctca -cggtggatcccattcaaggggtattgctatgtactatggactagcttctttaaccggagccgataatttgcacatcaaga -tgatggttttgacgtctccgggatttttgcgattccgggttcatcagagctggggagccgcaaatgtacgagtgtaacct -ctagacccggaactaactctgggaggaggcaaagaattctagattcgtcatacttgaacgatcccacttcaccttgtcca -cgggtcgctcgatgggttagcagcgcacgcagtcttttcaatccagaacgcttcgattacgggcgcggtgactaccccgc -gcgcgacgtccccagcatacaacacgtttacgactcaggggttgaatgatgtaccgccgtgcatgtggtgagctctcaat -gaactctcctcttggtcgtcaccgtgggagcgttgcatacctgtgaaacttaccagtcagtcgacgcaaacccaacgtgt -cgagtacgctgcagccctcggccttaagccccgatggtgtgaggctgacgagagacacggccgagctcgagactaggtgg -tgtgagcggtacctcggccctctaatgtaggaacattagttaagctttcatttggtaacttaatgcttaagagctattat -gcccccttcgtacggtacatatttcactcgtggattcacacctaccgtggtcacgtgcgttttacgaaaggctgtcatcg -acatagacttcggagtctcagagaggggcgggaatcgggaccaaactcttgactatccaggttgtataataagtgtggtt diff --git a/example_data/tcga_coad_single.vcf.gz b/example_data/tcga_coad_single.vcf.gz new file mode 100644 index 00000000..f6da6760 Binary files /dev/null and b/example_data/tcga_coad_single.vcf.gz differ diff --git a/requirements_dev.txt b/requirements_dev.txt index 287b9d19..ad7f3a90 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -11,12 +11,13 @@ hypothesis coverage pytest-cov build - numpy scipy pandas bionumpy setuptools - seaborn matplotlib +typing_extensions +requests +scikit-learn diff --git a/setup.py b/setup.py index 074225b8..ea7352a2 100644 --- a/setup.py +++ b/setup.py @@ -17,7 +17,9 @@ 'scikit-learn', 'bionumpy', 'matplotlib', - 'seaborn'] + 'seaborn', + 'typing_extensions', + 'requests'] test_requirements = ['pytest>=3', "hypothesis"] diff --git a/starsigndna/cli.py b/starsigndna/cli.py index 7c8977e9..ecdaaf73 100644 --- a/starsigndna/cli.py +++ b/starsigndna/cli.py @@ -348,17 +348,33 @@ def refit(matrix_file: Annotated[str, typer.Argument(help='Tab separated matrix start_time = time.time() file_name, file_extension = os.path.splitext(matrix_file) - # Handle VCF input - if file_extension == '.vcf': + # Handle VCF input (both .vcf and .vcf.gz) + if file_extension == '.vcf' or (file_extension == '.gz' and os.path.splitext(file_name)[1] == '.vcf'): if not ref_genome and not genome_path: raise ValueError("Either ref_genome or genome_path must be provided.") genome_path = download_reference_genome(ref_genome=ref_genome, genome_path=genome_path) logger.info(f"Reference genome path: {genome_path}") - count_mutation(matrix_file, genome_path, f'{output_folder}/matrix.csv', numeric_chromosomes, genotyped) - matrix_file = f'{output_folder}/matrix.csv' + # Derive output csv path from input sample name + sample_name = Path(matrix_file).name + if sample_name.endswith('.vcf.gz'): + sample_name = sample_name[:-7] + elif sample_name.endswith('.vcf'): + sample_name = sample_name[:-4] + out_csv = f"{output_folder}/{sample_name}.csv" + os.makedirs(output_folder, exist_ok=True) + count_mutation(matrix_file, genome_path, out_csv, numeric_chromosomes, genotyped) + matrix_file = out_csv # Read input data M = read_counts(matrix_file) + + # Remove rows with all zeros (can occur with genotyped VCFs) + row_sums = M.sum(axis=1) + if (row_sums == 0).any(): + n_zero_rows = (row_sums == 0).sum() + logger.warning(f"Removing {n_zero_rows} empty row(s) with zero mutation counts from the matrix") + M = M[row_sums > 0] + index_matrix = M.index.values.tolist() S = read_signature(signature_file) @@ -376,7 +392,23 @@ def refit(matrix_file: Annotated[str, typer.Argument(help='Tab separated matrix S = signatures if signature_names is not None: - S = filter_signatures(S, signature_names.split(',')) + requested_sigs = signature_names.split(',') + # Only keep signatures that are both requested and available after filtering + available_requested = [sig for sig in requested_sigs if sig in S.index] + + if len(available_requested) < 5: + missing_sigs = [sig for sig in requested_sigs if sig not in S.index] + logger.warning(f"Only {len(available_requested)} of the requested signatures are available after correlation filtering.") + logger.warning(f"Missing signatures: {', '.join(missing_sigs)}") + logger.warning(f"Available signatures: {', '.join(S.index.tolist())}") + raise ValueError(f"Only {len(available_requested)} requested signatures are available after filtering. At least 5 are required. Missing: {missing_sigs}") + + if len(available_requested) < len(requested_sigs): + missing_sigs = [sig for sig in requested_sigs if sig not in S.index] + logger.warning(f"Some requested signatures were filtered out due to low correlation with the sample: {', '.join(missing_sigs)}") + logger.info(f"Using {len(available_requested)} available signatures: {', '.join(available_requested)}") + + S = filter_signatures(S, available_requested) # Prepare data for analysis index_signature = S.index.values.tolist() @@ -496,7 +528,7 @@ def get_lambda(data_type: DataType) -> float: Returns: float: Lambda value for regularization """ - return 100 if data_type == DataType.genome else 0.7 + return 1000 if data_type == DataType.genome else 0.7 def read_opportunity(M: np.ndarray, opportunity_file: Optional[str] = None) -> np.ndarray: @@ -614,17 +646,33 @@ def denovo(matrix_file: Annotated[str, typer.Argument(help='Tab separated matrix logger.info(f'Starting de novo analysis for {run_name}') start_time = time.time() - # Handle VCF input - if matrix_file.endswith('.vcf'): + # Handle VCF input (both .vcf and .vcf.gz) + if matrix_file.endswith('.vcf') or matrix_file.endswith('.vcf.gz'): if not ref_genome and not genome_path: raise ValueError("Either ref_genome or genome_path must be provided.") genome_path = download_reference_genome(ref_genome=ref_genome, genome_path=genome_path) logger.info(f"Reference genome path: {genome_path}") - count_mutation(matrix_file, genome_path, f'{output_folder}/matrix.csv', numeric_chromosomes, genotyped) - matrix_file = f'{output_folder}/matrix.csv' + # Derive output csv path from input sample name + sample_name = Path(matrix_file).name + if sample_name.endswith('.vcf.gz'): + sample_name = sample_name[:-7] + elif sample_name.endswith('.vcf'): + sample_name = sample_name[:-4] + out_csv = f"{output_folder}/{sample_name}.csv" + os.makedirs(output_folder, exist_ok=True) + count_mutation(matrix_file, genome_path, out_csv, numeric_chromosomes, genotyped) + matrix_file = out_csv # Read and prepare data M = read_counts(matrix_file) + + # Remove rows with all zeros (can occur with genotyped VCFs) + row_sums = M.sum(axis=1) + if (row_sums == 0).any(): + n_zero_rows = (row_sums == 0).sum() + logger.warning(f"Removing {n_zero_rows} empty row(s) with zero mutation counts from the matrix") + M = M[row_sums > 0] + index_matrix = M.index.values.tolist() desired_order = M.columns O = read_opportunity(M, opportunity_file)