# HG changeset patch # User chmaramis # Date 1521371254 14400 # Node ID 5339fb9d8aee47bf0c9a5927b394f875fd13093e # Parent f4edb9437b95a2d75adf46f0dc1fedc198f72fc5 Deleted selected files diff -r f4edb9437b95 -r 5339fb9d8aee cmpb2016/pub_clono_JCDR3.py --- a/cmpb2016/pub_clono_JCDR3.py Sun Mar 18 07:06:56 2018 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,76 +0,0 @@ -# -*- coding: utf-8 -*- -""" -Created on Fri Feb 26 19:08:28 2016 - -@author: chmaramis -""" - -from __future__ import division -import numpy as np -from pandas import * -from numpy import nan as NA -import sys -import time - - - -def publicJGeneClonoFunc(inputs,thres): - - clono=DataFrame() - - for x in range(0,len(inputs),2): - cl = DataFrame() - cl = read_csv(inputs[x] , sep = '\t' , index_col = 0) - #tp = read_csv(inp_name, iterator=True, chunksize=5000,sep='\t', index_col=0 ) - #cl = concat([chunk for chunk in tp]) - - if (thres != 'null'): - cl = cl[cl['Reads'] > int(thres)] - - x1 = inputs[x+1].split('_') - - del cl['Reads'] - cl.columns = [cl.columns[0], cl.columns[1], x1[0]+' '+cl.columns[2], x1[0]+' Relative '+cl.columns[3]] - - if clono.empty: - clono = cl - else: - clono = clono.merge(cl, how='outer', on=['J-GENE','AA JUNCTION']) - - - col = clono.columns - freqs = col.map(lambda x: 'Frequency' in x) - reads = col.map(lambda x: 'Reads/Total' in x) - - clono[col[freqs]] = clono[col[freqs]].fillna(0) - clono[col[reads]] = clono[col[reads]].fillna('0/*') - - clono['Num of Patients']= clono[col[freqs]].apply(lambda x: np.sum(x != 0), axis=1) - - clono = clono[clono['Num of Patients'] > 1] - - clono.index = range(1,len(clono)+1) - - return clono - - -if __name__ == '__main__': - - start=time.time() - - # Parse input arguments - arg = sys.argv[3:] - output = sys.argv[1] - thres = sys.argv[2] - - - # Execute basic function - mer = publicJGeneClonoFunc(arg,thres) - - # Save output to CSV files - if not mer.empty: - mer.to_csv(output , sep = '\t') - - # Print execution time - stop=time.time() - print('Runtime:' + str(stop-start)) diff -r f4edb9437b95 -r 5339fb9d8aee cmpb2016/pub_clono_JCDR3.xml --- a/cmpb2016/pub_clono_JCDR3.xml Sun Mar 18 07:06:56 2018 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ - -Compute Public J+CDR3 Clonotypes - -pub_clono_JCDR3.py "$output1" "$Th.thres" -#for x in $clono_files - "$x.clfile" - "$x.clfile.name" -#end for - - - - - - - - - - - - - - - - - - - - - - - - - - - - - This tool computes the public (J-gene, CDR3) Clonotypes among a number of patients along with their frequencies for each patient. - - diff -r f4edb9437b95 -r 5339fb9d8aee cmpb2016/pub_clono_VCDR3.py --- a/cmpb2016/pub_clono_VCDR3.py Sun Mar 18 07:06:56 2018 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,76 +0,0 @@ -# -*- coding: utf-8 -*- -""" -Created on Fri Feb 26 18:49:15 2016 - -@author: chmaramis -""" - -from __future__ import division -import numpy as np -from pandas import * -from numpy import nan as NA -import sys -import time - - - -def publicVGeneClonoFunc(inputs,thres): - - clono=DataFrame() - - for x in range(0,len(inputs),2): - cl = DataFrame() - cl = read_csv(inputs[x] , sep = '\t' , index_col = 0) - #tp = read_csv(inp_name, iterator=True, chunksize=5000,sep='\t', index_col=0 ) - #cl = concat([chunk for chunk in tp]) - - if (thres != 'null'): - cl = cl[cl['Reads'] > int(thres)] - - x1 = inputs[x+1].split('_') - - del cl['Reads'] - cl.columns = [cl.columns[0], cl.columns[1], x1[0]+' '+cl.columns[2], x1[0]+' Relative '+cl.columns[3]] - - if clono.empty: - clono = cl - else: - clono = clono.merge(cl, how='outer', on=['V-GENE','AA JUNCTION']) - - - col = clono.columns - freqs = col.map(lambda x: 'Frequency' in x) - reads = col.map(lambda x: 'Reads/Total' in x) - - clono[col[freqs]] = clono[col[freqs]].fillna(0) - clono[col[reads]] = clono[col[reads]].fillna('0/*') - - clono['Num of Patients']= clono[col[freqs]].apply(lambda x: np.sum(x != 0), axis=1) - - clono = clono[clono['Num of Patients'] > 1] - - clono.index = range(1,len(clono)+1) - - return clono - - -if __name__ == '__main__': - - start=time.time() - - # Parse input arguments - arg = sys.argv[3:] - output = sys.argv[1] - thres = sys.argv[2] - - - # Execute basic function - mer = publicVGeneClonoFunc(arg,thres) - - # Save output to CSV files - if not mer.empty: - mer.to_csv(output , sep = '\t') - - # Print execution time - stop=time.time() - print('Runtime:' + str(stop-start)) diff -r f4edb9437b95 -r 5339fb9d8aee cmpb2016/pub_clono_VCDR3.xml --- a/cmpb2016/pub_clono_VCDR3.xml Sun Mar 18 07:06:56 2018 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ - -Compute Public V+CDR3 Clonotypes - -pub_clono_VCDR3.py "$output1" "$Th.thres" -#for x in $clono_files - "$x.clfile" - "$x.clfile.name" -#end for - - - - - - - - - - - - - - - - - - - - - - - - - - - - - This tool computes the public (V-gene, CDR3) Clonotypes among a number of patients along with their frequencies for each patient. - -