Commits

Giovanni Marco Dall'Olio  committed 31beac3

MULT: trying implementation of multiple alleles proposed by Ali

  • Participants
  • Parent commits c834715
  • Branches multiple_alleles

Comments (0)

Files changed (2)

File src/binary_to_network.py

 #
                     # TODO: this can be done better using numpy's tools
                     for pos in xrange(len(genotypes)):
-                        if genotypes[pos] not in ("0", "1"):
+                        if genotypes[pos] not in ("01actgACTG"):
                             filteredout_genotypes.update([pos])
 
 #                    all_genotypes.append(''.join(genotypes[upstream:downstream]))
     if skip_gene is True:
         return
     
-    # if step is not a multiple of n_snps, remove some snps from the beginning and the ned
+    # if step is not a multiple of n_snps, remove some snps from the beginning and the end
     if central_window_only is True:
         if options.windows_size == 0:
             windows_size = n_snps   

File src/filteredvcf_to_binary.py

             snp_annotations["ref"].append(snp_fields[3])
 
             snp_ids.append(snp_id)
-            chromosome1          = [snp_fields[i][0] for i in range(9, len(snp_fields))]
-            chromosome2          = [snp_fields[i][2] for i in range(9, len(snp_fields))]
+#            chromosome1          = [snp_fields[i][0] for i in range(9, len(snp_fields))]
+#            chromosome2          = [snp_fields[i][2] for i in range(9, len(snp_fields))]
+            chromosome1 = []
+            for i in range(9, len(snp_fields)):
+                if snp_fields[i][0] == '0':
+                    chromosome1.append(ref)
+                if snp_fields[i][0] == '1':
+                    chromosome1.append(alt)
+
+            chromosome2 = []
+            for i in range(9, len(snp_fields)):
+                if snp_fields[i][2] == '0':
+                    chromosome2.append(ref)
+                if snp_fields[i][2] == '1':
+                    chromosome2.append(alt)
+
             unphased_individuals = [snp_fields[i][1] for i in range(9, len(snp_fields))]
+
             if unphased_individuals.count('/') > 0:
 #                print snp_line
                 raise GenotypeNetworkInitError("""