MCPcopy Create free account
hub / github.com/Moduland/csv2vcf / csv_reader

Function csv_reader

csv2vcf/VCF.py:192–221  ·  view source on GitHub ↗

This function read input csv file and parse it :param file_name: file name or address of file :type file_name:tr :return: vcf_counter as integer

(file_name)

Source from the content-addressed store, hash-verified

190 VCF_creator(foldername, temp[0], temp[1], temp[2], temp[3], temp[4], temp[5], temp[6], temp[7], temp[8],
191 temp[9], temp[10])
192def csv_reader(file_name):
193 '''
194 This function read input csv file and parse it
195 :param file_name: file name or address of file
196 :type file_name:tr
197 :return: vcf_counter as integer
198 '''
199 try:
200 file=open(file_name,"r")
201
202 vcf_counter=0
203
204 foldername=VCF_Folder(file_name)
205 for index,line in enumerate(file):
206 if index>0:
207 stripped_line=line.strip()
208 temp=stripped_line.split(",")
209 if len(temp)>11:
210 print("[Warning] CSV File Line "+str(index)+" Bad Format")
211 continue
212 else:
213 VCF_write(temp,name_dict,foldername)
214 vcf_counter+=1
215 return vcf_counter
216
217 except FileNotFoundError:
218 print("[Warning] Please Open CSV File")
219 except Exception:
220 messagebox.showinfo("CSV2VCF", "Error In Reading Input File")
221 print("[Error] In Reading Input File")
222

Callers 1

openfileFunction · 0.85

Calls 2

VCF_FolderFunction · 0.85
VCF_writeFunction · 0.85

Tested by

no test coverage detected