
import sys
import argparse

def main():
    parser = argparse.ArgumentParser(description='Convert .csv to .map')
    parser.add_argument('csv', help="""CSV file to convert. Fields are : Index,Illumina_SNP_Name,Alternative_SNP_Name,Chromosome,Build36_Position,Build37_Position,new_rsname,Strand,TopAlleles,ForwardAlleles,DesignAlleles
    """)
    parser.add_argument('map', help='MAP file to create')
    args = parser.parse_args()
    
    # read the csv file and convert it into a MAP file
    with open(args.csv, 'r') as fdr:
        with open(args.map, 'w') as fdw:
            for line in fdr:
                line_split = line.split(',')
                fdw.write("%s\n" % "\n".join(["%s %s 0 %s" % (line_split[3], line_split[2], line_split[5])]))
            fdw.close()
        fdr.close()

if __name__ == "__main__":
    main()


import sys
import argparse

def main():
    parser = argparse.ArgumentParser(description='Convert .csv to .map')
    parser.add_argument('csv', help="""CSV file to convert. Fields are : Index,Illumina_SNP_Name,Alternative_SNP_Name,Chromosome,Build36_Position,Build37_Position,new_rsname,Strand,TopAlleles,ForwardAlleles,DesignAlleles
    """)
    parser.add_argument('map', help='MAP file to create. Fields will be : num chromosome (1-22, X, Y or 0 if unplaced), snp identifier, Genetic distance (morgans) = 0, Base-pair position (bp units)')
    args = parser.parse_args()
    
    # read the csv file and convert it into a MAP file
    with open(args.csv, 'r') as fdr:
        with open(args.map, 'w') as fdw:
            for line in fdr:
                line_split = line.split(',')
                fdw.write("%s\n" % "\n".join(["%s %s 0 %s" % (line_split[3], line_split[2], line_split[5])]))
            fdw.close()
        fdr.close()

if __name__ == "__main__":
    main()

Add infos about MAP file
Add infos about MAP file

  
  import sys
  import argparse
  
  def main():
      parser = argparse.ArgumentParser(description='Convert .csv to .map')
      parser.add_argument('csv', help="""CSV file to convert. Fields are : Index,Illumina_SNP_Name,Alternative_SNP_Name,Chromosome,Build36_Position,Build37_Position,new_rsname,Strand,TopAlleles,ForwardAlleles,DesignAlleles
      """)
-     parser.add_argument('map', help='MAP file to create')
+     parser.add_argument('map', help='MAP file to create. Fields will be : num chromosome (1-22, X, Y or 0 if unplaced), snp identifier, Genetic distance (morgans) = 0, Base-pair position (bp units)')
      args = parser.parse_args()
      
      # read the csv file and convert it into a MAP file
      with open(args.csv, 'r') as fdr:
          with open(args.map, 'w') as fdw:
              for line in fdr:
                  line_split = line.split(',')
                  fdw.write("%s\n" % "\n".join(["%s %s 0 %s" % (line_split[3], line_split[2], line_split[5])]))
              fdw.close()
          fdr.close()
  
  if __name__ == "__main__":
      main()
  
Add infos about MAP file
## Code Before:

import sys
import argparse

def main():
    parser = argparse.ArgumentParser(description='Convert .csv to .map')
    parser.add_argument('csv', help="""CSV file to convert. Fields are : Index,Illumina_SNP_Name,Alternative_SNP_Name,Chromosome,Build36_Position,Build37_Position,new_rsname,Strand,TopAlleles,ForwardAlleles,DesignAlleles
    """)
    parser.add_argument('map', help='MAP file to create')
    args = parser.parse_args()
    
    # read the csv file and convert it into a MAP file
    with open(args.csv, 'r') as fdr:
        with open(args.map, 'w') as fdw:
            for line in fdr:
                line_split = line.split(',')
                fdw.write("%s\n" % "\n".join(["%s %s 0 %s" % (line_split[3], line_split[2], line_split[5])]))
            fdw.close()
        fdr.close()

if __name__ == "__main__":
    main()

## Instruction:
Add infos about MAP file
## Code After:

import sys
import argparse

def main():
    parser = argparse.ArgumentParser(description='Convert .csv to .map')
    parser.add_argument('csv', help="""CSV file to convert. Fields are : Index,Illumina_SNP_Name,Alternative_SNP_Name,Chromosome,Build36_Position,Build37_Position,new_rsname,Strand,TopAlleles,ForwardAlleles,DesignAlleles
    """)
    parser.add_argument('map', help='MAP file to create. Fields will be : num chromosome (1-22, X, Y or 0 if unplaced), snp identifier, Genetic distance (morgans) = 0, Base-pair position (bp units)')
    args = parser.parse_args()
    
    # read the csv file and convert it into a MAP file
    with open(args.csv, 'r') as fdr:
        with open(args.map, 'w') as fdw:
            for line in fdr:
                line_split = line.split(',')
                fdw.write("%s\n" % "\n".join(["%s %s 0 %s" % (line_split[3], line_split[2], line_split[5])]))
            fdw.close()
        fdr.close()

if __name__ == "__main__":
    main()
