From e8a57b2a879c665ab305b87fb43d55d178643b46 Mon Sep 17 00:00:00 2001 From: chris etienne Date: Mon, 22 Jul 2024 19:52:02 +0000 Subject: [PATCH 1/5] updated Gattaca.py script --- Gattaca.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Gattaca.py b/Gattaca.py index 51cdd77..461f74e 100644 --- a/Gattaca.py +++ b/Gattaca.py @@ -39,8 +39,11 @@ def Parser(): Options = parser.parse_args() # main user args - if Options.output[len(Options.output)-1]!="/": - Options.output+="/" + # if Options.output[len(Options.output)-1]!="/": + # Options.output+="/" + + if Options.outputLoc[-1] != "/": + Options.outputLoc += "/" try: Options.mutRate = float(Options.mutRate) @@ -104,4 +107,4 @@ def ConfigSectionMap(section, Config): ''' Last Step: ''' - JavaCode([gene for gene in geneLocs.data], contexts.context, mutRates.geneMuts, contexts.triNucsProb, contexts.triNucsGenePos, Options.outputLoc) \ No newline at end of file + JavaCode([gene for gene in geneLocs.data], contexts.context, mutRates.geneMuts, contexts.triNucsProb, contexts.triNucsGenePos, Options.outputLoc) From 52dbd4a4b7606b9abe017aa070e10903182e6346 Mon Sep 17 00:00:00 2001 From: chris etienne Date: Mon, 22 Jul 2024 22:35:11 +0000 Subject: [PATCH 2/5] updated "gattaca_classes.py" script --- gattaca_classes.py | 5 +++-- usr_paths.ini | 4 ---- 2 files changed, 3 insertions(+), 6 deletions(-) delete mode 100644 usr_paths.ini diff --git a/gattaca_classes.py b/gattaca_classes.py index 399003c..dc65425 100644 --- a/gattaca_classes.py +++ b/gattaca_classes.py @@ -47,8 +47,9 @@ def _getBedFileOfGenes(self, Options, snpeff): print("Getting genomic positions for genes...") - cmd = ["java","-jar", snpeff['snpeff'], "genes2bed", "-t", Options.genome, ' '.join(genes)] - # print(' '.join(cmd)) + # cmd = ["java","-jar", snpeff['snpeff'], "genes2bed", "-t", Options.genome, ' '.join(genes)] + cmd = ["java","-jar", snpeff['snpeff'], "genes2bed", Options.genome, ' '.join(genes)] + # print(' '.join(cmd)) locInfo = os.popen(' '.join(cmd)).read() geneInfo = self._getBedDict(locInfo) diff --git a/usr_paths.ini b/usr_paths.ini deleted file mode 100644 index e673fd2..0000000 --- a/usr_paths.ini +++ /dev/null @@ -1,4 +0,0 @@ -[snpeff] -snpeff = /Users/rschenck/Desktop/BioinformaticsTools/snpEff/snpEff.jar -[reference] -ref = /Users/rschenck/Desktop/BioinformaticsTools/References/GRCh37.75/Homo_sapiens.GRCh37.75.dna.primary_assembly.fa.gz \ No newline at end of file From 172dc21b550e5ff5fbdb008fc844d3dd6c75cec4 Mon Sep 17 00:00:00 2001 From: chris etienne Date: Mon, 28 Oct 2024 16:19:37 +0000 Subject: [PATCH 3/5] merging branches --- GattacaExample/Gattaca.java | 8 ++++---- gattaca_muts.py | 3 ++- usr_paths.ini | 4 ++++ usr_paths_copy.ini | 6 ++++++ 4 files changed, 16 insertions(+), 5 deletions(-) create mode 100644 usr_paths.ini create mode 100644 usr_paths_copy.ini diff --git a/GattacaExample/Gattaca.java b/GattacaExample/Gattaca.java index d25a4da..6a7f0aa 100644 --- a/GattacaExample/Gattaca.java +++ b/GattacaExample/Gattaca.java @@ -17,12 +17,12 @@ public class Gattaca extends Genome { - private static final int genomeComponents=3; - private static final String[] geneNames=new String[]{"PIK3CA","KRAS","TP53"}; - private static double[] expectedMuts=new double[]{0.00036969310843373496,0.0001583488,5.536848192771085e-05}; + private static final int genomeComponents=90; + private static final String[] geneNames=new String[]{"MTOR","SPEN","ARID1A","NRAS","FAM46C","NOTCH2","ELF3","DNMT3A","BIRC6","LRP1B","NFE2L2","SF3B1","CASP8","IDH1","VHL","MYD88","CTNNB1","SETD2","BAP1","PIK3CA","FGFR3","KIT","FAT4","FBXW7","FAT1","CDH10","MAP3K1","PIK3R1","APC","NSD1","HLA-A","PIM1","ESR1","EGFR","BRAF","KMT2C","PREX2","FAM135B","PTPRD","PTCH1","NOTCH1","GATA3","PTEN","TCF7L2","FGFR2","HRAS","FAT3","ATM","KRAS","ARID2","KMT2D","ERBB3","PTPRB","PTPN11","TBX3","BRCA2","NBEA","RB1","FOXA1","AKT1","MAP2K1","AXIN1","CREBBP","CTCF","CDH1","ZFHX3","TP53","MAP2K4","NCOR1","NF1","CDK12","SPOP","RNF43","SMAD4","BCL2","STK11","KEAP1","SMARCA4","CIC","PPP2R1A","MYH9","EP300","ATRX","RBM10","BCOR","DDX3X","KDM6A","AMER1","AR","STAG2"}; + private static double[] expectedMuts=new double[]{np.float64(0.00032393625845542317),np.float64(0.00019633977850906667),np.float64(0.00015817045649846182),np.float64(3.594096676125766e-05),np.float64(5.416680777287287e-05),np.float64(0.0006273434227039533),np.float64(2.3018243929991588e-05),np.float64(0.00022408077940161503),np.float64(0.0006036706155261128),np.float64(0.014650092712063297),np.float64(0.00044163841310641567),np.float64(0.00012562956071820693),np.float64(0.00012215153628563962),np.float64(0.00010970052480635022),np.float64(2.7677346337455764e-05),np.float64(9.637075643095435e-06),np.float64(0.00018946766362253813),np.float64(0.00025829112299497544),np.float64(1.6246156076653443e-05),np.float64(0.0004170673851353698),np.float64(4.0114569983493146e-05),np.float64(0.00031420768074859285),np.float64(0.0009194765214475896),np.float64(0.0004765738031772305),np.float64(0.0005831648888694237),np.float64(0.0023004136410384973),np.float64(0.0001936381460970265),np.float64(0.00023874274823340366),np.float64(0.0003620728506725827),np.float64(0.0005017631306548828),np.float64(1.5647450951371972e-05),np.float64(1.295134237158102e-05),np.float64(0.002056992489605814),np.float64(0.0010360186604525567),np.float64(0.000705902353699847),np.float64(1.04763523617796e-06),np.float64(0.0019331859240140814),np.float64(0.003601586470718826),np.float64(0.014470904715403934),np.float64(0.0001755991911186153),np.float64(0.00015263813190082595),np.float64(0.00010238031621281614),np.float64(0.00022008500443253706),np.float64(0.0004373870956536973),np.float64(0.0002925891302410787),np.float64(1.6295979303751873e-05),np.float64(0.0027287359104974864),np.float64(0.00039697793578182553),np.float64(0.00017864038698238612),np.float64(0.00048296152799445443),np.float64(1.4196683827960172e-07),np.float64(6.711661695479416e-05),np.float64(0.00048123558051133507),np.float64(0.00024392868070479605),np.float64(7.215285139749513e-05),np.float64(0.00022704646839306558),np.float64(0.003313395876758856),np.float64(0.00047676822467450684),np.float64(3.63064095845497e-05),np.float64(7.80906339811734e-05),np.float64(0.00022942606573444948),np.float64(0.0002454295646448156),np.float64(0.00029284388981936087),np.float64(0.00013274098367587958),np.float64(0.00019137682183315236),np.float64(0.0008608566784817315),np.float64(6.246366905333995e-05),np.float64(0.00047750157864770616),np.float64(0.0005960781515942787),np.float64(0.0006901418381663342),np.float64(0.00025634187350581216),np.float64(0.00020621823909724245),np.float64(0.0001642173565164336),np.float64(0.00039313651277884585),np.float64(0.0005306596019929049),np.float64(0.00011499175804841508),np.float64(4.177230683728284e-05),np.float64(0.00024537976316508825),np.float64(7.88497259680223e-05),np.float64(0.00014638764386867606),np.float64(0.0002785498973795928),np.float64(0.00021697343407601612),np.float64(0.0008107088827439141),np.float64(0.00011448028162845523),np.float64(0.0003230680164132242),np.float64(7.366215157011487e-05),np.float64(0.0005589570746161362),np.float64(7.177676323606922e-08),np.float64(0.0010112364437611474),np.float64(0.001759998973040811)}; private static final String[] triNucs=new String[]{"aca","acc","acg","act","ata","atc","atg","att","cca","ccc","ccg","cct","cta","ctc","ctg","ctt","gca","gcc","gcg","gct","gta","gtc","gtg","gtt","tca","tcc","tcg","tct","tta","ttc","ttg","ttt"}; private static final double[] triNucProbs=new double[]{0.0209303274009191,0.033557599861572876,0.107302079398366,0.02651118778570226,0.038192694284793736,0.00567481172225612,0.013666986802849355,0.01912594074717787,0.02110999360892538,0.01782595926053107,0.06105193293527706,0.017014238588760208,0.0077541000759324494,0.011900540850508678,0.01380158840616718,0.01567323350041558,0.01353409731499741,0.04834403973688821,0.10864636613895277,0.02029160649891354,0.03453495875709209,0.005725065352770743,0.02436827964140632,0.027756541352567873,0.04379543141661486,0.05025955142286499,0.11449695582541337,0.04084707012907112,0.015020886337026971,0.0050083076272755,0.003957482948775858,0.012320144269213486}; - private static final String[] chrom=new String[]{"3","12","17"}; + private static final String[] chrom=new String[]{"1","1","1","1","1","1","1","2","2","2","2","2","2","2","3","3","3","3","3","3","4","4","4","4","4","5","5","5","5","5","HSCHR6_MHC_SSTO","6","6","7","7","7","8","8","9","9","9","10","10","10","10","11","11","11","12","12","12","12","12","12","12","13","13","13","14","14","15","16","16","16","16","16","17","17","17","17","17","17","17","18","18","19","19","19","19","19","22","22","X","X","X","X","X","X","X","X"}; private static final String[] mutTypes=new String[]{"A[C>A]A","A[C>G]A","A[C>T]A","A[C>A]C","A[C>G]C","A[C>T]C","A[C>A]G","A[C>G]G","A[C>T]G","A[C>A]T","A[C>G]T","A[C>T]T","A[T>A]A","A[T>C]A","A[T>G]A","A[T>A]C","A[T>C]C","A[T>G]C","A[T>A]G","A[T>C]G","A[T>G]G","A[T>A]T","A[T>C]T","A[T>G]T","C[C>A]A","C[C>G]A","C[C>T]A","C[C>A]C","C[C>G]C","C[C>T]C","C[C>A]G","C[C>G]G","C[C>T]G","C[C>A]T","C[C>G]T","C[C>T]T","C[T>A]A","C[T>C]A","C[T>G]A","C[T>A]C","C[T>C]C","C[T>G]C","C[T>A]G","C[T>C]G","C[T>G]G","C[T>A]T","C[T>C]T","C[T>G]T","G[C>A]A","G[C>G]A","G[C>T]A","G[C>A]C","G[C>G]C","G[C>T]C","G[C>A]G","G[C>G]G","G[C>T]G","G[C>A]T","G[C>G]T","G[C>T]T","G[T>A]A","G[T>C]A","G[T>G]A","G[T>A]C","G[T>C]C","G[T>G]C","G[T>A]G","G[T>C]G","G[T>G]G","G[T>A]T","G[T>C]T","G[T>G]T","T[C>A]A","T[C>G]A","T[C>T]A","T[C>A]C","T[C>G]C","T[C>T]C","T[C>A]G","T[C>G]G","T[C>T]G","T[C>A]T","T[C>G]T","T[C>T]T","T[T>A]A","T[T>C]A","T[T>G]A","T[T>A]C","T[T>C]C","T[T>G]C","T[T>A]G","T[T>C]G","T[T>G]G","T[T>A]T","T[T>C]T","T[T>G]T"}; private static final double[] mutTypeProb=new double[]{0.00488140223956781,0.000804488969084387,0.0152444361922669,0.00802416561805448,0.0181805665776302,0.0073528676658882,0.0133644382724535,0.0114450107078053,0.0824926304181072,0.00956939639731738,0.00474780104243128,0.0121939903459536,0.0102587510850119,0.0252160659511617,0.00271787724862014,0.00110455083837638,0.00457026088387974,0.0,0.0103016667830403,0.00252918215757991,0.000836137862229144,0.00968707322373083,0.00790256735010489,0.00153630017334215,0.010403970413985,0.0018959383088408,0.00881008488609958,0.0123886197963046,0.00205190449619982,0.00338543496802665,0.00308683612332815,0.00377738408789601,0.0541877127240529,0.00183215089781896,0.00244991081553465,0.0127321768754066,0.0,0.00411791571968485,0.0036361843562476,0.00034046654054141,0.00661217252976477,0.0049479017802025,0.00179953602192932,0.00656216208423937,0.00543989029999849,0.00213623486690682,0.00827274854035444,0.00526425009315432,0.00568534628997891,0.00192009324350455,0.00592865778151395,0.00283731160759142,0.00224094228546769,0.0432657858438291,0.010598098950561,0.00182259862606548,0.0962256685623263,0.00109877643596122,0.00679720084580522,0.0123956292171471,0.0145200481728849,0.0107594463752022,0.00925546420900499,0.000560791143230503,0.00516427420954024,0.0,0.00770518639753221,0.0122238575519231,0.00443923569195101,0.00114796903591997,0.0199230273354852,0.0066855449811627,0.0113538051643074,0.00959209784421696,0.0228495284080905,0.00468555342226589,0.02632097722303,0.0192530207775691,0.0122617523579577,0.00129719766875367,0.100938005798702,0.00274229991293782,0.0170005081133654,0.0211042621027679,0.00400406965851523,0.0073075867557355,0.00370922992277624,0.0,0.00288669036059096,0.00212161726668454,0.00130389531129614,0.000441769793851428,0.00221181784362829,0.000923547914709982,0.00439671903461965,0.00699987731988341}; diff --git a/gattaca_muts.py b/gattaca_muts.py index 6fc7f05..09cc888 100644 --- a/gattaca_muts.py +++ b/gattaca_muts.py @@ -13,7 +13,8 @@ def _getGenes(self, geneData): return([gene for gene in geneData]) def _getLawrenceRates(self): - with open("./data/Lawrence_et_al_2013.txt", "r") as inFile: + # with open("./data/Lawrence_et_al_2013.txt", "r") as inFile: + with open("/mnt/disks/maindisk1/home/cetienne/nsclc_rapidautopsy_gattaca/Gattaca/data/Lawrence_et_al_2013.txt", "r") as inFile: vals = inFile.readlines() out = dict() for line in vals: diff --git a/usr_paths.ini b/usr_paths.ini new file mode 100644 index 0000000..53b685b --- /dev/null +++ b/usr_paths.ini @@ -0,0 +1,4 @@ +[snpeff] +snpeff = /mnt/disks/maindisk1/home/cetienne/GattacaBioinformaticsTools/snpEff/snpEff.jar +[reference] +ref = /mnt/disks/maindisk1/home/cetienne/GattacaBioinformaticsTools/References/GRCh37.75/Homo_sapiens.GRCh37.dna.primary_assembly.fa.gz diff --git a/usr_paths_copy.ini b/usr_paths_copy.ini new file mode 100644 index 0000000..61bf6d9 --- /dev/null +++ b/usr_paths_copy.ini @@ -0,0 +1,6 @@ +[snpeff] +#snpeff = /Users/rschenck/Desktop/BioinformaticsTools/snpEff/snpEff.jar +snpeff = /mnt/disks/maindisk1/home/cetienne/GattacaBioinformaticsTools/snpEff/snpEff.jar +[reference] +#ref = /Users/rschenck/Desktop/BioinformaticsTools/References/GRCh37.75/Homo_sapiens.GRCh37.75.dna.primary_assembly.fa.gz +ref = /mnt/disks/maindisk1/home/cetienne/GattacaBioinformaticsTools/References/GRCh37/Homo_sapiens.GRCh37.dna.primary_assembly.fa.gz From dac5e3b6de65abf01dc2dba5ba895efed69556df Mon Sep 17 00:00:00 2001 From: chris etienne Date: Mon, 28 Oct 2024 17:44:31 +0000 Subject: [PATCH 4/5] updated two of the main gattaca scripts --- Gattaca.py | 3 ++- JavaCodeGen.py | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Gattaca.py b/Gattaca.py index 461f74e..6dcd295 100644 --- a/Gattaca.py +++ b/Gattaca.py @@ -39,10 +39,11 @@ def Parser(): Options = parser.parse_args() # main user args + # Updated script due to variable naming issues # if Options.output[len(Options.output)-1]!="/": # Options.output+="/" - if Options.outputLoc[-1] != "/": + if Options.outputLoc[len(Options.outputLoc)-1] != "/": Options.outputLoc += "/" try: diff --git a/JavaCodeGen.py b/JavaCodeGen.py index f649f33..aa190dc 100644 --- a/JavaCodeGen.py +++ b/JavaCodeGen.py @@ -27,7 +27,10 @@ def getJavaCode(self, geneList, contextProbs, expectedMuts, triNucsProb, triNucs part4 = "\tprivate static final String[] mutTypes=new String[]{%s};"%(','.join([repr(item) for item in self.orderedVals[0]])) part4b = "\tprivate static final double[] mutTypeProb=new double[]{%s};"%(','.join([repr(item) for item in self.orderedVals[1]])) part4 = part4.replace("'",'"') - part5 = "\tprivate static double[] expectedMuts=new double[]{%s};"%(','.join([repr(expectedMuts[item]) for item in geneList])) + #part5 = "\tprivate static double[] expectedMuts=new double[]{%s};"%(','.join([repr(expectedMuts[item]) for item in geneList])) + ## this part seems to be causing issue by adding the 'np.float64' in front of the values in the "Gattaca.java" output file. + ## so i decided to specifically convert the 'expectedMuts' values to plain floats before formatting them for the Java code" + part5 = "\tprivate static double[] expectedMuts=new double[]{%s};" % (','.join([repr(float(expectedMuts[item])) for item in geneList])) vars = "\n\tprivate static final String BaseIndexFile= System.getProperty(\"user.dir\") + \"/src/triNucsPos.csv\";\n\tprivate static final long[][][] basePositions=ParseTriNucFile();\n\tprivate Poisson[] PoissonDists;\n\tprivate RandomEngine RNEngine;\n\tprivate Rand RN;\n\tprivate MultinomialCalc picker;\n\n\tString PrivateGenome;\n\tdouble h;\n\tdouble s;\n\tdouble v;\n\tint[] triNucMuts;\n\tstatic double[] theMutOptions=new double[3];\n\tstatic double[] mutOptionsProbs=new double[3];\n\tint[] mutTypeHit;\n\tint mutIdx;\n\tString mutChosen;\n\tString mutChrom;\n\tString mutGene;\n\tlong mutPos;\n\tint mutations;" From a96cbca774ce65c6a8ccb184ec3a1ffb37f3e695 Mon Sep 17 00:00:00 2001 From: chris etienne Date: Mon, 28 Oct 2024 17:52:38 +0000 Subject: [PATCH 5/5] removed large triNucsPos files