
import psyco_full

import bx.align.maf
import copy
import sys

from itertools import *

def main():

    species = sys.argv[1].split( ',' )

    maf_reader = bx.align.maf.Reader( sys.stdin )
    maf_writer = bx.align.maf.Writer( sys.stdout )

    for m in maf_reader:        
        new_components = []    
        for comp in m.components:
            if comp.src.split( '.' )[0] in species:
                new_components.append( comp )
        m.components = new_components
        if len( m.components ) > 1:
            maf_writer.write( m )
        
    maf_reader.close()
    maf_writer.close()

if __name__ == "__main__": 
    main()


import psyco_full

import bx.align.maf
import copy
import sys

from itertools import *

def main():

    species = sys.argv[1].split( ',' )

    maf_reader = bx.align.maf.Reader( sys.stdin )
    maf_writer = bx.align.maf.Writer( sys.stdout )

    for m in maf_reader:        
        new_components = []    
        for comp in m.components:
            if comp.src.split( '.' )[0] in species:
                new_components.append( comp )
        m.components = new_components
        m.remove_all_gap_columns()
        if len( m.components ) > 1:
            maf_writer.write( m )
        
    maf_reader.close()
    maf_writer.close()

if __name__ == "__main__": 
    main()

Remove all-gap columns after removing rows of the alignment
Remove all-gap columns after removing rows of the alignment

  
  import psyco_full
  
  import bx.align.maf
  import copy
  import sys
  
  from itertools import *
  
  def main():
  
      species = sys.argv[1].split( ',' )
  
      maf_reader = bx.align.maf.Reader( sys.stdin )
      maf_writer = bx.align.maf.Writer( sys.stdout )
  
      for m in maf_reader:        
          new_components = []    
          for comp in m.components:
              if comp.src.split( '.' )[0] in species:
                  new_components.append( comp )
          m.components = new_components
+         m.remove_all_gap_columns()
          if len( m.components ) > 1:
              maf_writer.write( m )
          
      maf_reader.close()
      maf_writer.close()
  
  if __name__ == "__main__": 
      main()
  
Remove all-gap columns after removing rows of the alignment
## Code Before:

import psyco_full

import bx.align.maf
import copy
import sys

from itertools import *

def main():

    species = sys.argv[1].split( ',' )

    maf_reader = bx.align.maf.Reader( sys.stdin )
    maf_writer = bx.align.maf.Writer( sys.stdout )

    for m in maf_reader:        
        new_components = []    
        for comp in m.components:
            if comp.src.split( '.' )[0] in species:
                new_components.append( comp )
        m.components = new_components
        if len( m.components ) > 1:
            maf_writer.write( m )
        
    maf_reader.close()
    maf_writer.close()

if __name__ == "__main__": 
    main()

## Instruction:
Remove all-gap columns after removing rows of the alignment
## Code After:

import psyco_full

import bx.align.maf
import copy
import sys

from itertools import *

def main():

    species = sys.argv[1].split( ',' )

    maf_reader = bx.align.maf.Reader( sys.stdin )
    maf_writer = bx.align.maf.Writer( sys.stdout )

    for m in maf_reader:        
        new_components = []    
        for comp in m.components:
            if comp.src.split( '.' )[0] in species:
                new_components.append( comp )
        m.components = new_components
        m.remove_all_gap_columns()
        if len( m.components ) > 1:
            maf_writer.write( m )
        
    maf_reader.close()
    maf_writer.close()

if __name__ == "__main__": 
    main()
