lnnum = subprocess.check_output("wc -l < atom_list.lst", shell=True) lnnum = lnnum.rstrip() lnnum = str(lnnum) lnnum = int(lnnum.strip("b").strip("'")) - 1 if (lnnum == 0): continue updated_pdb_list.append(pdb + "\n") #the proper .atom files selected atom_file_list = [] with open("atom_list.lst", "r") as f: for line in f: atom_file = line.strip() atom_file_name = getName(atom_file) chain = atom_file_name.replace(pdb_name, "") contents = readAtom(atom_file) split_contents = contents2Info(contents) split_contents = addColumn(split_contents, "chain", getChain(line.strip())) #writedf2File("/data/farhan/SoftwareTools/HomopolymerProject/working_scripts/pdb_folder_test/work_dir/atom/6BZEA.txt",df2) write2File(outfolder + "pdb/" + atom_file_name + ".pdb", reassembleLines(split_contents)) atom_file_list.append(outfolder + "pdb/" + atom_file_name + ".pdb") #writedf2File(outfolder+pdb_name+"_chain_"+chain+".pdb",df2) #print(chain) if (len(atom_file_list) == 0): print("#############Zero!!!!!") print(atom_file_list) continue #print ("#############Zero!!!!!") super_list = [] for atm_file in atom_file_list: with open(atm_file, "r") as f: for line in f: if not line.endswith("\n"): line += "\n"
#chain_2=sys.argv[3] #dist=sys.argv[4] fasta_file = sys.argv[2] dist = int(sys.argv[3]) outfile = sys.argv[4] #pdbfilename="/data/farhan/SoftwareTools/HomopolymerProject/data/Actin/monomer/1j6z.pdb" #chain_1="A" #chain_2="A" #dist=8 #outfile="Actin_out/Actin_monomer" chain_dict = readPDB(pdbfilename) split_contents_A = contents2Info(readPDB(pdbfilename)) split_contents_B = contents2Info(readPDB(pdbfilename)) chain_1 = getChain(pdbfilename) chain_2 = getChain(pdbfilename) cb_list = getCB(split_contents_A) #Read fasta from fasta_dictionary.txt fasta = pdb2FastaFromSplitContents(cb_list) #fasta_dict_file="fasta_dictionary.txt" #fasta_dict=readFastaDict(fasta_dict_file) #fasta=getFastaFromDictionary(pdbfilename,fasta_dict) f_fasta = "" with open(fasta_file, "r") as f: for line in f: if line.startswith(">"): continue f_fasta += line.strip() print("PDB Fasta Length=", len(fasta), "\n", fasta,
return fst #pdbfilename="/data/farhan/SoftwareTools/HomopolymerProject/data/pdb/5wvc.pdb" pdbfile_A=sys.argv[1] pdbfile_B=sys.argv[2] #chain_1=sys.argv[2] #chain_2=sys.argv[3] dist=sys.argv[3] outfile=sys.argv[4] #fasta=sys.argv[6] split_contents_A=contents2Info(readPDB(pdbfile_A)) split_contents_B=contents2Info(readPDB(pdbfile_B)) chain_1=getChain(pdbfile_A) chain_2=getChain(pdbfile_B) cb_list_A=getCB(split_contents_A) cb_list_B=getCB(split_contents_B) fasta_A=pdb2FastaFromSplitContents(cb_list_A) L_A=len(fasta_A) fasta_B=pdb2FastaFromSplitContents(cb_list_B) L_B=len(fasta_B) print (fasta_A) if (fasta_A != fasta_B): print ("Fasta sequences of both files are not same...chosing the one with highest length") if (L_A > L_B): fasta=fasta_A else: