old_contents: ## parse the output of this to make a collectors curve of reads
  ## this only works with >=1.10 metrichor output
  
  #a=read.table("/tmp/times.txt", header=T, sep="\t")
  #b=cbind(a, "start" = a$timestamp - min(a$timestamp))
  #c=cut(b$start, seq(3600, 259200, by=3600)
  #cumfreq0=c(0, cumsum(f))
  #breaks = seq(3600, 259200, by=3600)
  #plot(breaks/3600, cumfreq0)
  #lines(breaks/3600, cumfreq0)
  import Fast5File
  from time import strftime, localtime
  import sys
  
  #logging
  import logging
  logger = logging.getLogger('poretools')
  
  def run(parser, args):
  	print '\t'.join(['filename', 'read_length', 'exp_starttime', 'unix_timestamp', 'iso_timestamp', 'day', 'hour', 'minute'])
  	
  	for fast5 in Fast5File.Fast5FileSet(args.files):
  		if fast5.is_open:
  			
  			fq = fast5.get_fastq()
  			
  			start_time = fast5.get_start_time()
  			if start_time is None:
  				logger.warning("No start time for %s!" % (fast5.filename))
  				fast5.close()
  				continue
  
  			if fq is not None:
  				read_length = len(fq.seq)
  			else:
  				read_length = 0
  
  			lt = localtime(start_time)
  			print "\t".join([fast5.filename, 
  				str(read_length),
  				fast5.get_exp_start_time(),
  				str(start_time), \
  				strftime('%Y-%m-%dT%H:%M:%S%z', lt),
  				strftime('%d', lt),
  				strftime('%H', lt),
  				strftime('%M', lt)])
  			fast5.close()
  
  #	plot_collectors(args.saveas, start_times, read_lengths)
  
  
new_contents: ## parse the output of this to make a collectors curve of reads
  ## this only works with >=1.10 metrichor output
  
  #a=read.table("/tmp/times.txt", header=T, sep="\t")
  #b=cbind(a, "start" = a$timestamp - min(a$timestamp))
  #c=cut(b$start, seq(3600, 259200, by=3600)
  #cumfreq0=c(0, cumsum(f))
  #breaks = seq(3600, 259200, by=3600)
  #plot(breaks/3600, cumfreq0)
  #lines(breaks/3600, cumfreq0)
  import Fast5File
  from time import strftime, localtime
  import sys
  
  #logging
  import logging
  logger = logging.getLogger('poretools')
  
  def run(parser, args):
  	print '\t'.join(['filename', 'read_length', 'exp_starttime', 'unix_timestamp', 'duration', 'unix_timestamp_end', 'iso_timestamp', 'day', 'hour', 'minute'])
  	
  	for fast5 in Fast5File.Fast5FileSet(args.files):
  		if fast5.is_open:
  			
  			fq = fast5.get_fastq()
  			
  			start_time = fast5.get_start_time()
  			if start_time is None:
  				logger.warning("No start time for %s!" % (fast5.filename))
  				fast5.close()
  				continue
  
  			if fq is not None:
  				read_length = len(fq.seq)
  			else:
  				read_length = 0
  
  			lt = localtime(start_time)
  			print "\t".join([fast5.filename, 
  				str(read_length),
  				fast5.get_exp_start_time(),
  				str(start_time), \
  				str(fast5.get_duration()),
  				str(fast5.get_end_time()),
  				strftime('%Y-%m-%dT%H:%M:%S%z', lt),
  				strftime('%d', lt),
  				strftime('%H', lt),
  				strftime('%M', lt)])
  			fast5.close()
  
  #	plot_collectors(args.saveas, start_times, read_lengths)
  
  
subject: add end time to times